This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
those pesky absolute symbols
- From: Alan Modra <amodra at gmail dot com>
- To: binutils at sourceware dot org
- Date: Thu, 17 May 2012 12:14:50 +0930
- Subject: those pesky absolute symbols
This makes _DYNAMIC, _GLOBAL_OFFSET_TABLE_ and _PROCEDURE_LINKAGE_TABLE_
section relative for PowerPC. There is no ABI requirement that these
symbols be absolute as far as I can see, and as discussed previously,
no symbols corresponding to a program image virtual address ought to
be absolute. (_etext and suchlike should be fixed too, but I'm not
going to rush into that change.)
bfd/
* elf32-ppc.c (ppc_elf_finish_dynamic_symbol): Don't make _DYNAMIC,
_GLOBAL_OFFSET_TABLE_ or _PROCEDURE_LINKAGE_TABLE_ absolute.
* elf64-ppc.c (ppc64_elf_finish_dynamic_symbol): Don't make _DYNAMIC
absolute.
ld/testsuite/
* ld-powerpc/tlsso.r: Update for dynamic sym changes.
* ld-powerpc/tlsso32.d: Likewise.
* ld-powerpc/tlsso32.r: Likewise.
* ld-powerpc/tlstocso.r: Likewise.
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.313
diff -u -p -r1.313 elf32-ppc.c
--- bfd/elf32-ppc.c 17 May 2012 02:24:49 -0000 1.313
+++ bfd/elf32-ppc.c 17 May 2012 02:33:44 -0000
@@ -9139,14 +9139,6 @@ ppc_elf_finish_dynamic_symbol (bfd *outp
fprintf (stderr, "\n");
#endif
- /* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || (!htab->is_vxworks
- && (h == htab->elf.hgot
- || strcmp (h->root.root.string,
- "_PROCEDURE_LINKAGE_TABLE_") == 0)))
- sym->st_shndx = SHN_ABS;
-
return TRUE;
}
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.381
diff -u -p -r1.381 elf64-ppc.c
--- bfd/elf64-ppc.c 7 May 2012 03:27:51 -0000 1.381
+++ bfd/elf64-ppc.c 7 May 2012 09:36:47 -0000
@@ -13869,7 +13869,7 @@ static bfd_boolean
ppc64_elf_finish_dynamic_symbol (bfd *output_bfd,
struct bfd_link_info *info,
struct elf_link_hash_entry *h,
- Elf_Internal_Sym *sym)
+ Elf_Internal_Sym *sym ATTRIBUTE_UNUSED)
{
struct ppc_link_hash_table *htab;
struct plt_entry *ent;
@@ -13938,10 +13938,6 @@ ppc64_elf_finish_dynamic_symbol (bfd *ou
bfd_elf64_swap_reloca_out (output_bfd, &rela, loc);
}
- /* Mark some specially defined symbols as absolute. */
- if (strcmp (h->root.root.string, "_DYNAMIC") == 0)
- sym->st_shndx = SHN_ABS;
-
return TRUE;
}
Index: ld/testsuite/ld-powerpc/tlsso.r
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-powerpc/tlsso.r,v
retrieving revision 1.29
diff -u -p -r1.29 tlsso.r
--- ld/testsuite/ld-powerpc/tlsso.r 10 Oct 2011 09:05:41 -0000 1.29
+++ ld/testsuite/ld-powerpc/tlsso.r 6 May 2012 07:16:19 -0000
@@ -107,7 +107,7 @@ Symbol table '\.symtab' contains [0-9]+
.* TLS +LOCAL +DEFAULT +7 ie4
.* TLS +LOCAL +DEFAULT +7 le4
.* TLS +LOCAL +DEFAULT +7 le5
-.* OBJECT +LOCAL +DEFAULT +ABS _DYNAMIC
+.* OBJECT +LOCAL +DEFAULT +9 _DYNAMIC
.* NOTYPE +LOCAL +DEFAULT +6 00000010\.plt_call\.__tls_get_addr\+0
.* NOTYPE +LOCAL +DEFAULT +6 __glink_PLTresolve
.* NOTYPE +LOCAL +DEFAULT +UND \.__tls_get_addr
Index: ld/testsuite/ld-powerpc/tlsso32.d
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-powerpc/tlsso32.d,v
retrieving revision 1.15
diff -u -p -r1.15 tlsso32.d
--- ld/testsuite/ld-powerpc/tlsso32.d 6 Nov 2007 03:59:16 -0000 1.15
+++ ld/testsuite/ld-powerpc/tlsso32.d 6 May 2012 07:16:19 -0000
@@ -39,8 +39,9 @@ Disassembly of section \.text:
.*: a9 49 00 00 lha r10,0\(r9\)
Disassembly of section \.got:
-.* <\.got>:
- \.\.\.
+.* <_GLOBAL_OFFSET_TABLE_-0x28>:
+#...
.*: 4e 80 00 21 blrl
-.*: 00 01 03 ec .*
- \.\.\.
+.* <_GLOBAL_OFFSET_TABLE_>:
+.*: 00 01 03 ec .*
+#pass
Index: ld/testsuite/ld-powerpc/tlsso32.r
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-powerpc/tlsso32.r,v
retrieving revision 1.21
diff -u -p -r1.21 tlsso32.r
--- ld/testsuite/ld-powerpc/tlsso32.r 24 Sep 2009 15:56:51 -0000 1.21
+++ ld/testsuite/ld-powerpc/tlsso32.r 6 May 2012 07:16:19 -0000
@@ -110,8 +110,8 @@ Symbol table '\.symtab' contains [0-9]+
.* TLS +LOCAL +DEFAULT +7 ie4
.* TLS +LOCAL +DEFAULT +7 le4
.* TLS +LOCAL +DEFAULT +7 le5
-.* OBJECT +LOCAL +DEFAULT +ABS _DYNAMIC
-.* OBJECT +LOCAL +DEFAULT +ABS _GLOBAL_OFFSET_TABLE_
+.* OBJECT +LOCAL +DEFAULT +9 _DYNAMIC
+.* OBJECT +LOCAL +DEFAULT +10 _GLOBAL_OFFSET_TABLE_
.* TLS +GLOBAL +DEFAULT +UND gd
.* TLS +GLOBAL +DEFAULT +8 le0
.* NOTYPE +GLOBAL +DEFAULT +UND __tls_get_addr
Index: ld/testsuite/ld-powerpc/tlstocso.r
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-powerpc/tlstocso.r,v
retrieving revision 1.26
diff -u -p -r1.26 tlstocso.r
--- ld/testsuite/ld-powerpc/tlstocso.r 5 Aug 2011 06:22:22 -0000 1.26
+++ ld/testsuite/ld-powerpc/tlstocso.r 6 May 2012 07:16:19 -0000
@@ -103,7 +103,7 @@ Symbol table '\.symtab' contains [0-9]+
.* TLS +LOCAL +DEFAULT +7 le4
.* TLS +LOCAL +DEFAULT +7 le5
.* NOTYPE +LOCAL +DEFAULT +10 \.Lie0
-.* OBJECT +LOCAL +DEFAULT +ABS _DYNAMIC
+.* OBJECT +LOCAL +DEFAULT +9 _DYNAMIC
.* NOTYPE +LOCAL +DEFAULT +6 00000010\.plt_call\.__tls_get_addr\+0
.* NOTYPE +LOCAL +DEFAULT +6 __glink_PLTresolve
.* NOTYPE +LOCAL +DEFAULT +UND \.__tls_get_addr
--
Alan Modra
Australia Development Lab, IBM