From: Alan Modra <amodra@gmail.com>
To: Tom Tromey <tromey@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] MIPS: Compressed PLT/stubs support
Date: Fri, 22 Feb 2013 06:06:00 -0000 [thread overview]
Message-ID: <20130222060640.GL3080@bubble.grove.modra.org> (raw)
In-Reply-To: <20130222005833.GJ3080@bubble.grove.modra.org>
On Fri, Feb 22, 2013 at 11:28:33AM +1030, Alan Modra wrote:
> Hmm, perhaps a cleaner change would be implement make_msymbol_special
> for ppc64 and move the udata.p special case out of elf_symtab_read?
Like so.
* elfread.c (elf_symtab_read): Do not use udata.p here to find
symbol size.
* ppc64-tdep.c (ppc64_elf_make_msymbol_special): New function.
* ppc64-tdep.h (ppc64_elf_make_msymbol_special): Declare.
* ppc-linux-tdep.c (ppc_linux_init_abi): Set up to use the above.
* ppcfbsd-tdep.c (ppcfbsd_init_abi): Likewise.
Index: gdb/elfread.c
===================================================================
RCS file: /cvs/src/src/gdb/elfread.c,v
retrieving revision 1.145
diff -u -p -r1.145 elfread.c
--- gdb/elfread.c 21 Feb 2013 04:35:21 -0000 1.145
+++ gdb/elfread.c 22 Feb 2013 05:42:53 -0000
@@ -556,21 +556,14 @@ elf_symtab_read (struct objfile *objfile
if (msym)
{
- /* Pass symbol size field in via BFD. FIXME!!! */
- elf_symbol_type *elf_sym;
-
/* NOTE: uweigand-20071112: A synthetic symbol does not have an
- ELF-private part. However, in some cases (e.g. synthetic
- 'dot' symbols on ppc64) the udata.p entry is set to point back
- to the original ELF symbol it was derived from. Get the size
- from that symbol. */
+ ELF-private part. */
if (type != ST_SYNTHETIC)
- elf_sym = (elf_symbol_type *) sym;
- else
- elf_sym = (elf_symbol_type *) sym->udata.p;
-
- if (elf_sym)
- SET_MSYMBOL_SIZE (msym, elf_sym->internal_elf_sym.st_size);
+ {
+ /* Pass symbol size field in via BFD. FIXME!!! */
+ elf_symbol_type *elf_sym = (elf_symbol_type *) sym;
+ SET_MSYMBOL_SIZE (msym, elf_sym->internal_elf_sym.st_size);
+ }
msym->filename = filesymname;
gdbarch_elf_make_msymbol_special (gdbarch, sym, msym);
Index: gdb/ppc-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc-linux-tdep.c,v
retrieving revision 1.143
diff -u -p -r1.143 ppc-linux-tdep.c
--- gdb/ppc-linux-tdep.c 4 Feb 2013 18:40:41 -0000 1.143
+++ gdb/ppc-linux-tdep.c 22 Feb 2013 05:42:53 -0000
@@ -1336,6 +1336,9 @@ ppc_linux_init_abi (struct gdbarch_info
set_gdbarch_convert_from_func_ptr_addr
(gdbarch, ppc64_convert_from_func_ptr_addr);
+ set_gdbarch_elf_make_msymbol_special (gdbarch,
+ ppc64_elf_make_msymbol_special);
+
/* Shared library handling. */
set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code);
set_solib_svr4_fetch_link_map_offsets
Index: gdb/ppc64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppc64-tdep.c,v
retrieving revision 1.1
diff -u -p -r1.1 ppc64-tdep.c
--- gdb/ppc64-tdep.c 1 Feb 2013 20:59:08 -0000 1.1
+++ gdb/ppc64-tdep.c 22 Feb 2013 05:42:53 -0000
@@ -22,6 +22,7 @@
#include "gdbcore.h"
#include "ppc-tdep.h"
#include "ppc64-tdep.h"
+#include "elf-bfd.h"
/* Macros for matching instructions. Note that, since all the
operands are masked off before they're or-ed into the instruction,
@@ -361,3 +362,17 @@ ppc64_convert_from_func_ptr_addr (struct
return addr;
}
+
+/* A synthetic 'dot' symbols on ppc64 has the udata.p entry pointing
+ back to the original ELF symbol it was derived from. Get the size
+ from that symbol. */
+
+void
+ppc64_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
+{
+ if ((sym->flags & BSF_SYNTHETIC) != 0 && sym->udata.p != NULL)
+ {
+ elf_symbol_type *elf_sym = (elf_symbol_type *) sym->udata.p;
+ SET_MSYMBOL_SIZE (msym, elf_sym->internal_elf_sym.st_size);
+ }
+}
Index: gdb/ppc64-tdep.h
===================================================================
RCS file: /cvs/src/src/gdb/ppc64-tdep.h,v
retrieving revision 1.1
diff -u -p -r1.1 ppc64-tdep.h
--- gdb/ppc64-tdep.h 1 Feb 2013 20:59:08 -0000 1.1
+++ gdb/ppc64-tdep.h 22 Feb 2013 05:42:53 -0000
@@ -31,4 +31,6 @@ extern CORE_ADDR ppc64_convert_from_func
CORE_ADDR addr,
struct target_ops *targ);
+extern void ppc64_elf_make_msymbol_special (asymbol *,
+ struct minimal_symbol *);
#endif /* PPC64_TDEP_H */
Index: gdb/ppcfbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppcfbsd-tdep.c,v
retrieving revision 1.1
diff -u -p -r1.1 ppcfbsd-tdep.c
--- gdb/ppcfbsd-tdep.c 4 Feb 2013 20:48:53 -0000 1.1
+++ gdb/ppcfbsd-tdep.c 22 Feb 2013 05:42:53 -0000
@@ -325,6 +325,9 @@ ppcfbsd_init_abi (struct gdbarch_info in
{
set_gdbarch_convert_from_func_ptr_addr
(gdbarch, ppc64_convert_from_func_ptr_addr);
+ set_gdbarch_elf_make_msymbol_special (gdbarch,
+ ppc64_elf_make_msymbol_special);
+
set_gdbarch_skip_trampoline_code (gdbarch, ppc64_skip_trampoline_code);
set_solib_svr4_fetch_link_map_offsets (gdbarch,
svr4_lp64_fetch_link_map_offsets);
--
Alan Modra
Australia Development Lab, IBM
next prev parent reply other threads:[~2013-02-22 6:06 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-19 20:44 Maciej W. Rozycki
2013-02-19 20:45 ` [PATCH 2/2] MIPS: Compressed PLT/stubs support test cases Maciej W. Rozycki
2013-02-20 21:53 ` [PATCH 1/2] MIPS: Compressed PLT/stubs support Richard Sandiford
2013-03-09 4:04 ` Maciej W. Rozycki
2013-03-09 9:58 ` Richard Sandiford
2013-06-08 0:22 ` Maciej W. Rozycki
2013-06-08 16:04 ` Richard Sandiford
2013-06-10 17:13 ` Maciej W. Rozycki
2013-06-10 18:08 ` Richard Sandiford
2013-06-10 19:34 ` Maciej W. Rozycki
2013-06-25 0:40 ` Maciej W. Rozycki
2013-03-11 13:53 ` Joel Brobecker
2013-06-26 15:02 ` Maciej W. Rozycki
2013-02-21 21:06 ` Tom Tromey
2013-02-22 0:58 ` Alan Modra
2013-02-22 6:06 ` Alan Modra [this message]
2013-02-22 20:09 ` Tom Tromey
2013-03-09 4:06 ` Maciej W. Rozycki
2013-06-20 16:20 ` [PING^2][PATCH] in_plt_section: support alternate stub section names (was: [PATCH 1/2] MIPS: Compressed PLT/stubs support) Maciej W. Rozycki
2013-06-20 16:50 ` [PING^2][PATCH] in_plt_section: support alternate stub section names Pedro Alves
2013-06-21 11:43 ` Maciej W. Rozycki
2013-06-21 15:34 ` Pedro Alves
2013-06-22 2:24 ` Maciej W. Rozycki
2013-06-24 12:40 ` Pedro Alves
2013-06-24 23:34 ` Maciej W. Rozycki
2013-06-25 9:57 ` Pedro Alves
2013-06-07 13:25 ` [PATCH] in_plt_section: support alternate stub section names (was: [PATCH 1/2] MIPS: Compressed PLT/stubs support) Maciej W. Rozycki
2013-06-13 12:43 ` [PING][PATCH] " Maciej W. Rozycki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20130222060640.GL3080@bubble.grove.modra.org \
--to=amodra@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox