This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: gcc and -fPIC
Daniel Jacobowitz <drow@false.org> writes:
> On Sat, Oct 16, 2004 at 02:09:24PM +0200, Andreas Schwab wrote:
>> Gerhard Wiesinger <lists@wiesinger.com> writes:
>>
>> > BTW: Is it possible to see the dynamic symbols in the disassembly? I don't
>> > see the call to operator delete[](void*) at location 8048592.
>>
>> Difficult, because the PLT entries have no symbols attached to them.
>> There is no information about which PLT entry belongs to which function.
>
> There's some code in HEAD to do this, written by Jakub.
Didn't work on m68k.
Tested on ppc-linux with target=m68k-linux, enable-targets=all and
enable-64-bit-bfd, no new warnings, no regressions.
Andreas.
2004-10-18 Andreas Schwab <schwab@suse.de>
* elf-bfd.h (struct elf_backend_data): Change plt_sym_val to take
pointer to bfd as additional first parameter.
* elf.c (_bfd_elf_get_synthetic_symtab): Pass abfd to plt_sym_val.
* elf32-i386.c (elf_i386_plt_sym_val): Update argument list.
* elf32-ppc.c (ppc_elf_plt_sym_val): Likewise.
* elf32-s390.c (elf_s390_plt_sym_val): Likewise.
* elf32-sh.c (sh_elf_plt_sym_val): Likewise.
* elf32-sparc.c (elf32_sparc_plt_sym_val): Likewise.
* elf64-s390.c (elf_s390_plt_sym_val): Likewise.
* elf64-sparc.c (sparc64_elf_plt_sym_val): Likewise.
* elf64-x86-64.c (elf64_x86_64_plt_sym_val): Likewise.
* elf32-m68k.c (elf_m68k_plt_sym_val): New function.
(elf_backend_plt_sym_val): Define.
Index: bfd/elf-bfd.h
===================================================================
RCS file: /cvs/src/src/bfd/elf-bfd.h,v
retrieving revision 1.162
diff -u -p -a -r1.162 elf-bfd.h
--- bfd/elf-bfd.h 14 Oct 2004 23:38:08 -0000 1.162
+++ bfd/elf-bfd.h 18 Oct 2004 19:59:30 -0000
@@ -943,7 +943,8 @@ struct elf_backend_data
/* This function is used by `_bfd_elf_get_synthetic_symtab';
see elf.c. */
- bfd_vma (*plt_sym_val) (bfd_vma, const asection *, const arelent *);
+ bfd_vma (*plt_sym_val) (bfd *abfd, bfd_vma, const asection *,
+ const arelent *);
/* Used to handle bad SHF_LINK_ORDER input. */
bfd_error_handler_type link_order_error_handler;
Index: bfd/elf.c
===================================================================
RCS file: /cvs/src/src/bfd/elf.c,v
retrieving revision 1.251
diff -u -p -a -r1.251 elf.c
--- bfd/elf.c 14 Oct 2004 23:38:08 -0000 1.251
+++ bfd/elf.c 18 Oct 2004 19:59:30 -0000
@@ -7851,7 +7851,7 @@ _bfd_elf_get_synthetic_symtab (bfd *abfd
size_t len;
bfd_vma addr;
- addr = bed->plt_sym_val (i, plt, p);
+ addr = bed->plt_sym_val (abfd, i, plt, p);
if (addr == (bfd_vma) -1)
continue;
Index: bfd/elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.129
diff -u -p -a -r1.129 elf32-i386.c
--- bfd/elf32-i386.c 17 Sep 2004 07:14:26 -0000 1.129
+++ bfd/elf32-i386.c 18 Oct 2004 19:59:30 -0000
@@ -3279,7 +3279,8 @@ elf_i386_finish_dynamic_sections (bfd *o
or (bfd_vma) -1 if it should not be included. */
static bfd_vma
-elf_i386_plt_sym_val (bfd_vma i, const asection *plt,
+elf_i386_plt_sym_val (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_vma i, const asection *plt,
const arelent *rel ATTRIBUTE_UNUSED)
{
return plt->vma + (i + 1) * PLT_ENTRY_SIZE;
Index: bfd/elf32-m68k.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68k.c,v
retrieving revision 1.68
diff -u -p -a -r1.68 elf32-m68k.c
--- bfd/elf32-m68k.c 17 Sep 2004 07:14:27 -0000 1.68
+++ bfd/elf32-m68k.c 18 Oct 2004 19:59:30 -0000
@@ -2207,6 +2207,18 @@ elf32_m68k_reloc_type_class (rela)
}
}
+/* Return address for Ith PLT stub in section PLT, for relocation REL
+ or (bfd_vma) -1 if it should not be included. */
+
+static bfd_vma
+elf_m68k_plt_sym_val (bfd *abfd, bfd_vma i, const asection *plt,
+ const arelent *rel ATTRIBUTE_UNUSED)
+{
+ if (CPU32_FLAG (abfd))
+ return plt->vma + (i + 1) * PLT_CPU32_ENTRY_SIZE;
+ return plt->vma + (i + 1) * PLT_ENTRY_SIZE;
+}
+
#define TARGET_BIG_SYM bfd_elf32_m68k_vec
#define TARGET_BIG_NAME "elf32-m68k"
#define ELF_MACHINE_CODE EM_68K
@@ -2236,6 +2248,7 @@ elf32_m68k_reloc_type_class (rela)
#define bfd_elf32_bfd_print_private_bfd_data \
elf32_m68k_print_private_bfd_data
#define elf_backend_reloc_type_class elf32_m68k_reloc_type_class
+#define elf_backend_plt_sym_val elf_m68k_plt_sym_val
#define elf_backend_can_gc_sections 1
#define elf_backend_can_refcount 1
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.128
diff -u -p -a -r1.128 elf32-ppc.c
--- bfd/elf32-ppc.c 10 Oct 2004 13:58:05 -0000 1.128
+++ bfd/elf32-ppc.c 18 Oct 2004 19:59:31 -0000
@@ -6138,7 +6138,8 @@ ppc_elf_final_write_processing (bfd *abf
or (bfd_vma) -1 if it should not be included. */
static bfd_vma
-ppc_elf_plt_sym_val (bfd_vma i ATTRIBUTE_UNUSED,
+ppc_elf_plt_sym_val (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_vma i ATTRIBUTE_UNUSED,
const asection *plt ATTRIBUTE_UNUSED,
const arelent *rel)
{
Index: bfd/elf32-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-s390.c,v
retrieving revision 1.66
diff -u -p -a -r1.66 elf32-s390.c
--- bfd/elf32-s390.c 17 Sep 2004 07:14:28 -0000 1.66
+++ bfd/elf32-s390.c 18 Oct 2004 19:59:31 -0000
@@ -3450,7 +3450,8 @@ elf_s390_grok_prstatus (abfd, note)
or (bfd_vma) -1 if it should not be included. */
static bfd_vma
-elf_s390_plt_sym_val (bfd_vma i, const asection *plt,
+elf_s390_plt_sym_val (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_vma i, const asection *plt,
const arelent *rel ATTRIBUTE_UNUSED)
{
return plt->vma + PLT_FIRST_ENTRY_SIZE + i * PLT_ENTRY_SIZE;
Index: bfd/elf32-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh.c,v
retrieving revision 1.115
diff -u -p -a -r1.115 elf32-sh.c
--- bfd/elf32-sh.c 17 Sep 2004 07:14:28 -0000 1.115
+++ bfd/elf32-sh.c 18 Oct 2004 19:59:31 -0000
@@ -7454,7 +7454,8 @@ elf32_shlin_grok_psinfo (bfd *abfd, Elf_
or (bfd_vma) -1 if it should not be included. */
static bfd_vma
-sh_elf_plt_sym_val (bfd_vma i, const asection *plt,
+sh_elf_plt_sym_val (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_vma i, const asection *plt,
const arelent *rel ATTRIBUTE_UNUSED)
{
return plt->vma + (i + 1) * PLT_ENTRY_SIZE;
Index: bfd/elf32-sparc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sparc.c,v
retrieving revision 1.75
diff -u -p -a -r1.75 elf32-sparc.c
--- bfd/elf32-sparc.c 23 Sep 2004 00:51:33 -0000 1.75
+++ bfd/elf32-sparc.c 18 Oct 2004 19:59:31 -0000
@@ -3420,7 +3420,8 @@ elf32_sparc_reloc_type_class (rela)
or (bfd_vma) -1 if it should not be included. */
static bfd_vma
-elf32_sparc_plt_sym_val (bfd_vma i ATTRIBUTE_UNUSED,
+elf32_sparc_plt_sym_val (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_vma i ATTRIBUTE_UNUSED,
const asection *plt ATTRIBUTE_UNUSED,
const arelent *rel)
{
Index: bfd/elf64-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-s390.c,v
retrieving revision 1.66
diff -u -p -a -r1.66 elf64-s390.c
--- bfd/elf64-s390.c 17 Sep 2004 07:14:29 -0000 1.66
+++ bfd/elf64-s390.c 18 Oct 2004 19:59:31 -0000
@@ -3360,7 +3360,8 @@ elf_s390_finish_dynamic_sections (output
or (bfd_vma) -1 if it should not be included. */
static bfd_vma
-elf_s390_plt_sym_val (bfd_vma i, const asection *plt,
+elf_s390_plt_sym_val (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_vma i, const asection *plt,
const arelent *rel ATTRIBUTE_UNUSED)
{
return plt->vma + PLT_FIRST_ENTRY_SIZE + i * PLT_ENTRY_SIZE;
Index: bfd/elf64-sparc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-sparc.c,v
retrieving revision 1.96
diff -u -p -a -r1.96 elf64-sparc.c
--- bfd/elf64-sparc.c 17 Sep 2004 07:14:30 -0000 1.96
+++ bfd/elf64-sparc.c 18 Oct 2004 19:59:31 -0000
@@ -3096,7 +3096,8 @@ sparc64_elf_object_p (abfd)
or (bfd_vma) -1 if it should not be included. */
static bfd_vma
-sparc64_elf_plt_sym_val (bfd_vma i, const asection *plt,
+sparc64_elf_plt_sym_val (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_vma i, const asection *plt,
const arelent *rel ATTRIBUTE_UNUSED)
{
bfd_vma j;
Index: bfd/elf64-x86-64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-x86-64.c,v
retrieving revision 1.86
diff -u -p -a -r1.86 elf64-x86-64.c
--- bfd/elf64-x86-64.c 8 Oct 2004 13:54:57 -0000 1.86
+++ bfd/elf64-x86-64.c 18 Oct 2004 19:59:31 -0000
@@ -2776,7 +2776,8 @@ elf64_x86_64_finish_dynamic_sections (bf
or (bfd_vma) -1 if it should not be included. */
static bfd_vma
-elf64_x86_64_plt_sym_val (bfd_vma i, const asection *plt,
+elf64_x86_64_plt_sym_val (bfd *abfd ATTRIBUTE_UNUSED,
+ bfd_vma i, const asection *plt,
const arelent *rel ATTRIBUTE_UNUSED)
{
return plt->vma + (i + 1) * PLT_ENTRY_SIZE;
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."