This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[RFA:] elflink.c: Hide _GLOBAL_OFFSET_TABLE_
- From: Hans-Peter Nilsson <hans-peter dot nilsson at axis dot com>
- To: binutils at sources dot redhat dot com
- Date: Fri, 29 Oct 2004 06:37:12 +0200
- Subject: [RFA:] elflink.c: Hide _GLOBAL_OFFSET_TABLE_
A long time ago, in
<URL:http://sources.redhat.com/ml/binutils/2003-04/msg00117.html>,
I suggested a patch to make the visibility of
_GLOBAL_OFFSET_TABLE_ target-selectable through a bfd hook, with
the intent on making it hidden, but keeping it visible to avoid
breaking something obscure somewhere. Alan Modra thought it'd
be just as good to make it *always* hidden. Here's the patch
for that and the testsuite adjustments for i686-pc-linux-gnu
(built and tested there). If that's still ok, I'll adjust the
rest of the testsuite.
Ok to commit?
bfd:
* elflink.c (_bfd_elf_create_got_section): Hide _GLOBAL_OFFSET_SYMBOL.
ld/testsuite:
* ld-i386/tlsbin.rd: Adjust for hidden _GLOBAL_OFFSET_TABLE_.
* ld-i386/tlsnopic.rd, ld-i386/tlspic.rd: Ditto.
Index: elflink.c
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.115
diff -u -p -r1.115 elflink.c
--- elflink.c 26 Oct 2004 13:46:00 -0000 1.115
+++ elflink.c 29 Oct 2004 04:11:33 -0000
@@ -88,6 +88,7 @@ _bfd_elf_create_got_section (bfd *abfd,
h = (struct elf_link_hash_entry *) bh;
h->def_regular = 1;
h->type = STT_OBJECT;
+ h->other = STV_HIDDEN;
if (! info->executable
&& ! bfd_elf_link_record_dynamic_symbol (info, h))
cvs diff: Diffing .
Index: tlsbin.rd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-i386/tlsbin.rd,v
retrieving revision 1.3
diff -u -p -r1.3 tlsbin.rd
--- tlsbin.rd 22 Sep 2004 07:24:13 -0000 1.3
+++ tlsbin.rd 29 Oct 2004 04:07:51 -0000
@@ -66,13 +66,13 @@ Relocation section '.rel.dyn' at offset
0+804a114 0000060e R_386_TLS_TPOFF +0+ +sG4
0+804a118 00000825 R_386_TLS_TPOFF32 0+ +sG6
0+804a11c 00000925 R_386_TLS_TPOFF32 0+ +sG1
-0+804a120 00000d0e R_386_TLS_TPOFF +0+ +sG8
+0+804a120 00000c0e R_386_TLS_TPOFF +0+ +sG8
-Relocation section '.rel.plt' at offset 0x30c contains 1 entries:
+Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 1 entries:
Offset +Info +Type +Sym.Value Sym. Name
-0+804a130 00000e07 R_386_JUMP_SLOT +[0-9a-f]+ +___tls_get_addr
+0+804a130 00000d07 R_386_JUMP_SLOT +[0-9a-f]+ +___tls_get_addr
-Symbol table '.dynsym' contains 15 entries:
+Symbol table '.dynsym' contains 14 entries:
+Num: +Value Size Type +Bind +Vis +Ndx Name
+[0-9]+: 0+ +0 NOTYPE LOCAL DEFAULT UND *
+[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT UND sG3
@@ -85,7 +85,6 @@ Symbol table '.dynsym' contains 15 entri
+[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT UND sG6
+[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT UND sG1
+[0-9]+: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _edata
- +[0-9]+: [0-9a-f]+ +0 OBJECT GLOBAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
+[0-9]+: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _end
+[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT UND sG8
+[0-9]+: [0-9a-f]+ +0 FUNC +GLOBAL DEFAULT UND ___tls_get_addr
@@ -158,7 +157,7 @@ Symbol table '.symtab' contains 75 entri
+[0-9]+: 00000014 +0 TLS +GLOBAL DEFAULT +9 sg6
+[0-9]+: 00000018 +0 TLS +GLOBAL DEFAULT +9 sg7
+[0-9]+: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _edata
- +[0-9]+: [0-9a-f]+ +0 OBJECT GLOBAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
+ +[0-9]+: [0-9a-f]+ +0 OBJECT GLOBAL HIDDEN 13 _GLOBAL_OFFSET_TABLE_
+[0-9]+: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _end
+[0-9]+: 00000044 +0 TLS +GLOBAL HIDDEN +9 sh2
+[0-9]+: 00000054 +0 TLS +GLOBAL HIDDEN +9 sh6
Index: tlsnopic.rd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-i386/tlsnopic.rd,v
retrieving revision 1.4
diff -u -p -r1.4 tlsnopic.rd
--- tlsnopic.rd 22 Sep 2004 07:24:13 -0000 1.4
+++ tlsnopic.rd 29 Oct 2004 04:07:52 -0000
@@ -72,7 +72,7 @@ Relocation section '.rel.dyn' at offset
0+208c 0+d0e R_386_TLS_TPOFF 0+ sg2
-Symbol table '.dynsym' contains 17 entries:
+Symbol table '.dynsym' contains 16 entries:
+Num: +Value Size Type +Bind +Vis +Ndx Name
+[0-9]+: 0+ +0 NOTYPE LOCAL DEFAULT UND *
+[0-9]+: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +5 *
@@ -89,7 +89,6 @@ Symbol table '.dynsym' contains 17 entri
+[0-9]+: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS __bss_start
+[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT UND sg2
+[0-9]+: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _edata
- +[0-9]+: 0+2098 +0 OBJECT GLOBAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
+[0-9]+: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _end
Symbol table '.symtab' contains 36 entries:
@@ -118,6 +117,7 @@ Symbol table '.symtab' contains 36 entri
+[0-9]+: 0+1c +0 TLS +LOCAL HIDDEN +6 sh3
+[0-9]+: 0+20 +0 TLS +LOCAL HIDDEN +6 sh4
+[0-9]+: 0+14 +0 TLS +LOCAL HIDDEN +6 sh1
+ +[0-9]+: 0+2098 +0 OBJECT LOCAL HIDDEN ABS _GLOBAL_OFFSET_TABLE_
+[0-9]+: 0+18 +0 TLS +LOCAL HIDDEN +6 sh2
+[0-9]+: [0-9a-f]+ +0 OBJECT GLOBAL DEFAULT ABS _DYNAMIC
+[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT UND sg3
@@ -128,5 +128,4 @@ Symbol table '.symtab' contains 36 entri
+[0-9]+: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS __bss_start
+[0-9]+: 0+ +0 TLS +GLOBAL DEFAULT UND sg2
+[0-9]+: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _edata
- +[0-9]+: 0+2098 +0 OBJECT GLOBAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
+[0-9]+: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _end
Index: tlspic.rd
===================================================================
RCS file: /cvs/src/src/ld/testsuite/ld-i386/tlspic.rd,v
retrieving revision 1.3
diff -u -p -r1.3 tlspic.rd
--- tlspic.rd 22 Sep 2004 07:24:13 -0000 1.3
+++ tlspic.rd 29 Oct 2004 04:07:52 -0000
@@ -81,9 +81,9 @@ Relocation section '.rel.dyn' at offset
Relocation section '.rel.plt' at offset 0x[0-9a-f]+ contains 1 entries:
Offset Info Type Sym.Value Sym. Name
-[0-9a-f]+ 0+1407 R_386_JUMP_SLOT 0+ ___tls_get_addr
+[0-9a-f]+ 0+1307 R_386_JUMP_SLOT 0+ ___tls_get_addr
-Symbol table '.dynsym' contains 21 entries:
+Symbol table '.dynsym' contains 20 entries:
+Num: + Value Size Type + Bind +Vis +Ndx Name
+[0-9]+: 0+ +0 NOTYPE LOCAL DEFAULT UND *
+[0-9]+: [0-9a-f]+ +0 SECTION LOCAL DEFAULT +7 *
@@ -103,7 +103,6 @@ Symbol table '.dynsym' contains 21 entri
+[0-9]+: 0+14 +0 TLS +GLOBAL DEFAULT +8 sg6
+[0-9]+: 0+18 +0 TLS +GLOBAL DEFAULT +8 sg7
+[0-9]+: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _edata
- +[0-9]+: [0-9a-f]+ +0 OBJECT GLOBAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
+[0-9]+: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _end
+[0-9]+: 0+ +0 NOTYPE GLOBAL DEFAULT UND ___tls_get_addr
@@ -149,6 +148,7 @@ Symbol table '.symtab' contains 57 entri
+[0-9]+: 0+74 +0 TLS +LOCAL HIDDEN +9 sH6
+[0-9]+: 0+7c +0 TLS +LOCAL HIDDEN +9 sH8
+[0-9]+: 0+40 +0 TLS +LOCAL HIDDEN +8 sh1
+ +[0-9]+: [0-9a-f]+ +0 OBJECT LOCAL HIDDEN ABS _GLOBAL_OFFSET_TABLE_
+[0-9]+: 0+44 +0 TLS +LOCAL HIDDEN +8 sh2
+[0-9]+: 0+54 +0 TLS +LOCAL HIDDEN +8 sh6
+[0-9]+: 0+1c +0 TLS +GLOBAL DEFAULT +8 sg8
@@ -163,6 +163,5 @@ Symbol table '.symtab' contains 57 entri
+[0-9]+: 0+14 +0 TLS +GLOBAL DEFAULT +8 sg6
+[0-9]+: 0+18 +0 TLS +GLOBAL DEFAULT +8 sg7
+[0-9]+: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _edata
- +[0-9]+: [0-9a-f]+ +0 OBJECT GLOBAL DEFAULT ABS _GLOBAL_OFFSET_TABLE_
+[0-9]+: [0-9a-f]+ +0 NOTYPE GLOBAL DEFAULT ABS _end
+[0-9]+: 0+ +0 NOTYPE GLOBAL DEFAULT UND ___tls_get_addr
brgds, H-P