This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Adding hplt to elf_link_hash_table
Alan Modra <amodra@bigpond.net.au> writes:
> On Fri, Feb 24, 2006 at 05:34:45PM +0000, Richard Sandiford wrote:
>> I'm soon going to submit equivalent user-mode VxWorks support for ARM,
>> and there are other targets to come, so would it be OK to have "hplt"
>> in the common elf_link_hash_table, alongside "hgot"?
>>
>> This patch does that, and removes the now-redundant "hgot" field
>> from elf_i386_link_hash_table. Tested individually on i586-vxworks
>> and on i686-linux-gnu with --enable-targets=all --enable-64-bit-bfd.
>> OK to install?
>
> Yes, this is OK.
Thanks. Installed after fixing the partly-orphaned comments that
Dan noticed.
>> BTW, I notice that elf32-ppc.c uses:
>>
>> if (strcmp (h->root.root.string, "_DYNAMIC") == 0
>> || (!htab->is_vxworks
>> && (h == htab->elf.hgot
>> || strcmp (h->root.root.string,
>> "_PROCEDURE_LINKAGE_TABLE_") == 0)))
>> ...
>>
>> whereas most targets use string comparisons. Would you prefer
>> all targets to use hash entry comparisons, and do it for both
>> _GLOBAL_OFFSET_TABLE_ and _PROCEDURE_LINKAGE_TABLE_?
>> If so, I'll submit a follow-up patch.
>
> That would be nice too.
OK, here's the patch. Some targets check for these symbols in other
places too, but it wasn't immediately obvious whether they could be
changed, so I just stuck to finish_dynamic_symbols here.
Tested with --enable-targets=all --enable-64-bit-bfd on
i686-pc-linux-gnu. OK to install?
Richard
bfd/
* elf-m10300.c (_bfd_mn10300_elf_finish_dynamic_symbol): Use the
cached hgot entry to check for _GLOBAL_OFFSET_TABLE_.
* elf32-arm.c (elf32_arm_finish_dynamic_symbol): Likewise.
* elf32-bfin.c (bfin_finish_dynamic_symbol): Likewise.
* elf32-cris.c (elf_cris_finish_dynamic_symbol): Likewise.
* elf32-hppa.c (elf32_hppa_finish_dynamic_symbol): Likewise.
* elf32-i386.c (elf_i386_finish_dynamic_symbol): Likewise.
* elf32-m32r.c (m32r_elf_finish_dynamic_symbol): Likewise.
* elf32-m68k.c (elf_m68k_finish_dynamic_symbol): Likewise.
* elf32-sh.c (sh_elf_finish_dynamic_symbol): Likewise.
* elf32-vax.c (elf_vax_finish_dynamic_symbol): Likewise.
* elf32-xtensa.c (elf_xtensa_finish_dynamic_symbol): Likewise.
* elf64-sh64.c (sh64_elf64_finish_dynamic_symbol): Likewise.
* elf64-x86-64.c (elf64_x86_64_finish_dynamic_symbol): Likewise.
* elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Likewise.
* elf32-s390.c (elf_s390_finish_dynamic_symbol): Likewise. Also use
the cached hplt entry to check for _PROCEDURE_LINKAGE_TABLE_.
* elf64-alpha.c (elf64_alpha_finish_dynamic_symbol): Likewise.
* elf64-s390.c (elf_s390_finish_dynamic_symbol): Likewise.
* elfxx-ia64.c (elfNN_ia64_finish_dynamic_symbol): Likewise.
* elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Likewise.
Index: bfd/elf-m10300.c
===================================================================
RCS file: /cvs/src/src/bfd/elf-m10300.c,v
retrieving revision 1.71
diff -u -p -r1.71 elf-m10300.c
--- bfd/elf-m10300.c 25 Feb 2006 09:23:30 -0000 1.71
+++ bfd/elf-m10300.c 25 Feb 2006 09:50:32 -0000
@@ -4502,7 +4502,7 @@ _bfd_mn10300_elf_finish_dynamic_symbol (
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ || h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
return TRUE;
Index: bfd/elf32-arm.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-arm.c,v
retrieving revision 1.64
diff -u -p -r1.64 elf32-arm.c
--- bfd/elf32-arm.c 21 Feb 2006 01:51:58 -0000 1.64
+++ bfd/elf32-arm.c 25 Feb 2006 09:50:33 -0000
@@ -6866,7 +6866,7 @@ elf32_arm_finish_dynamic_symbol (bfd * o
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ || h == htab->root.hgot)
sym->st_shndx = SHN_ABS;
return TRUE;
Index: bfd/elf32-bfin.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-bfin.c,v
retrieving revision 1.3
diff -u -p -r1.3 elf32-bfin.c
--- bfd/elf32-bfin.c 24 Oct 2005 16:31:20 -0000 1.3
+++ bfd/elf32-bfin.c 25 Feb 2006 09:50:34 -0000
@@ -2337,7 +2337,7 @@ fprintf(stderr, "*** check this relocati
}
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ || h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
return TRUE;
Index: bfd/elf32-cris.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-cris.c,v
retrieving revision 1.71
diff -u -p -r1.71 elf32-cris.c
--- bfd/elf32-cris.c 28 Oct 2005 00:29:44 -0000 1.71
+++ bfd/elf32-cris.c 25 Feb 2006 09:50:35 -0000
@@ -1769,7 +1769,7 @@ elf_cris_finish_dynamic_symbol (output_b
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ || h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
return TRUE;
Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.142
diff -u -p -r1.142 elf32-hppa.c
--- bfd/elf32-hppa.c 21 Feb 2006 01:51:58 -0000 1.142
+++ bfd/elf32-hppa.c 25 Feb 2006 09:50:36 -0000
@@ -4057,7 +4057,7 @@ elf32_hppa_finish_dynamic_symbol (bfd *o
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
if (eh->root.root.string[0] == '_'
&& (strcmp (eh->root.root.string, "_DYNAMIC") == 0
- || strcmp (eh->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0))
+ || eh == htab->etab.hgot))
{
sym->st_shndx = SHN_ABS;
}
Index: bfd/elf32-i386.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-i386.c,v
retrieving revision 1.153
diff -u -p -r1.153 elf32-i386.c
--- bfd/elf32-i386.c 25 Feb 2006 09:23:30 -0000 1.153
+++ bfd/elf32-i386.c 25 Feb 2006 09:50:37 -0000
@@ -3638,8 +3638,7 @@ elf_i386_finish_dynamic_symbol (bfd *out
On VxWorks, the _GLOBAL_OFFSET_TABLE_ symbol is not absolute: it
is relative to the ".got" section. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || (strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- && !htab->is_vxworks))
+ || (!htab->is_vxworks && h == htab->elf.hgot))
sym->st_shndx = SHN_ABS;
return TRUE;
Index: bfd/elf32-m32r.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m32r.c,v
retrieving revision 1.78
diff -u -p -r1.78 elf32-m32r.c
--- bfd/elf32-m32r.c 25 Feb 2006 09:23:30 -0000 1.78
+++ bfd/elf32-m32r.c 25 Feb 2006 09:50:39 -0000
@@ -3358,7 +3358,7 @@ m32r_elf_finish_dynamic_symbol (bfd *out
/* Mark some specially defined symbols as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ || h == htab->root.hgot)
sym->st_shndx = SHN_ABS;
return TRUE;
Index: bfd/elf32-m68k.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-m68k.c,v
retrieving revision 1.85
diff -u -p -r1.85 elf32-m68k.c
--- bfd/elf32-m68k.c 7 Feb 2006 19:01:09 -0000 1.85
+++ bfd/elf32-m68k.c 25 Feb 2006 09:50:39 -0000
@@ -2140,7 +2140,7 @@ elf_m68k_finish_dynamic_symbol (output_b
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ || h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
return TRUE;
Index: bfd/elf32-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-s390.c,v
retrieving revision 1.80
diff -u -p -r1.80 elf32-s390.c
--- bfd/elf32-s390.c 21 Feb 2006 01:51:58 -0000 1.80
+++ bfd/elf32-s390.c 25 Feb 2006 09:50:41 -0000
@@ -3309,8 +3309,8 @@ elf_s390_finish_dynamic_symbol (output_b
/* Mark some specially defined symbols as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
+ || h == htab->elf.hgot
+ || h == htab->elf.hplt)
sym->st_shndx = SHN_ABS;
return TRUE;
Index: bfd/elf32-sh.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-sh.c,v
retrieving revision 1.134
diff -u -p -r1.134 elf32-sh.c
--- bfd/elf32-sh.c 25 Feb 2006 09:23:30 -0000 1.134
+++ bfd/elf32-sh.c 25 Feb 2006 09:50:42 -0000
@@ -7036,7 +7036,7 @@ sh_elf_finish_dynamic_symbol (bfd *outpu
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ || h == htab->root.hgot)
sym->st_shndx = SHN_ABS;
return TRUE;
Index: bfd/elf32-vax.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-vax.c,v
retrieving revision 1.34
diff -u -p -r1.34 elf32-vax.c
--- bfd/elf32-vax.c 18 Aug 2005 01:28:24 -0000 1.34
+++ bfd/elf32-vax.c 25 Feb 2006 09:50:43 -0000
@@ -1954,7 +1954,7 @@ elf_vax_finish_dynamic_symbol (bfd *outp
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ || h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
return TRUE;
Index: bfd/elf32-xtensa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xtensa.c,v
retrieving revision 1.61
diff -u -p -r1.61 elf32-xtensa.c
--- bfd/elf32-xtensa.c 20 Dec 2005 01:30:11 -0000 1.61
+++ bfd/elf32-xtensa.c 25 Feb 2006 09:50:45 -0000
@@ -2384,7 +2384,7 @@ elf_xtensa_finish_dynamic_symbol (bfd *o
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ || h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
return TRUE;
Index: bfd/elf64-alpha.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-alpha.c,v
retrieving revision 1.148
diff -u -p -r1.148 elf64-alpha.c
--- bfd/elf64-alpha.c 25 Feb 2006 09:23:30 -0000 1.148
+++ bfd/elf64-alpha.c 25 Feb 2006 09:50:46 -0000
@@ -4717,8 +4717,8 @@ elf64_alpha_finish_dynamic_symbol (bfd *
/* Mark some specially defined symbols as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
+ || h == elf_hash_table (info)->hgot
+ || h == elf_hash_table (info)->hplt)
sym->st_shndx = SHN_ABS;
return TRUE;
Index: bfd/elf64-s390.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-s390.c,v
retrieving revision 1.80
diff -u -p -r1.80 elf64-s390.c
--- bfd/elf64-s390.c 21 Feb 2006 01:51:58 -0000 1.80
+++ bfd/elf64-s390.c 25 Feb 2006 09:50:47 -0000
@@ -3252,8 +3252,8 @@ elf_s390_finish_dynamic_symbol (output_b
/* Mark some specially defined symbols as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
+ || h == htab->elf.hgot
+ || h == htab->elf.hplt)
sym->st_shndx = SHN_ABS;
return TRUE;
Index: bfd/elf64-sh64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-sh64.c,v
retrieving revision 1.65
diff -u -p -r1.65 elf64-sh64.c
--- bfd/elf64-sh64.c 25 Feb 2006 09:23:30 -0000 1.65
+++ bfd/elf64-sh64.c 25 Feb 2006 09:50:48 -0000
@@ -3889,7 +3889,7 @@ sh64_elf64_finish_dynamic_symbol (bfd *o
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ || h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
return TRUE;
Index: bfd/elf64-x86-64.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-x86-64.c,v
retrieving revision 1.110
diff -u -p -r1.110 elf64-x86-64.c
--- bfd/elf64-x86-64.c 21 Feb 2006 01:51:59 -0000 1.110
+++ bfd/elf64-x86-64.c 25 Feb 2006 09:50:48 -0000
@@ -3131,7 +3131,7 @@ elf64_x86_64_finish_dynamic_symbol (bfd
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
+ || h == htab->elf.hgot)
sym->st_shndx = SHN_ABS;
return TRUE;
Index: bfd/elfxx-ia64.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-ia64.c,v
retrieving revision 1.177
diff -u -p -r1.177 elfxx-ia64.c
--- bfd/elfxx-ia64.c 24 Feb 2006 15:47:24 -0000 1.177
+++ bfd/elfxx-ia64.c 25 Feb 2006 09:50:49 -0000
@@ -4835,8 +4835,8 @@ elfNN_ia64_finish_dynamic_symbol (output
/* Mark some specially defined symbols as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
+ || h == ia64_info->root.hgot
+ || h == ia64_info->root.hplt)
sym->st_shndx = SHN_ABS;
return TRUE;
Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.158
diff -u -p -r1.158 elfxx-mips.c
--- bfd/elfxx-mips.c 4 Feb 2006 08:29:58 -0000 1.158
+++ bfd/elfxx-mips.c 25 Feb 2006 09:50:52 -0000
@@ -7492,7 +7492,7 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd
/* Mark _DYNAMIC and _GLOBAL_OFFSET_TABLE_ as absolute. */
name = h->root.root.string;
if (strcmp (name, "_DYNAMIC") == 0
- || strcmp (name, "_GLOBAL_OFFSET_TABLE_") == 0)
+ || h == elf_hash_table (info)->hgot)
sym->st_shndx = SHN_ABS;
else if (strcmp (name, "_DYNAMIC_LINK") == 0
|| strcmp (name, "_DYNAMIC_LINKING") == 0)
Index: bfd/elfxx-sparc.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-sparc.c,v
retrieving revision 1.18
diff -u -p -r1.18 elfxx-sparc.c
--- bfd/elfxx-sparc.c 21 Feb 2006 01:51:59 -0000 1.18
+++ bfd/elfxx-sparc.c 25 Feb 2006 09:50:53 -0000
@@ -3578,8 +3578,8 @@ _bfd_sparc_elf_finish_dynamic_symbol (bf
/* Mark some specially defined symbols as absolute. */
if (strcmp (h->root.root.string, "_DYNAMIC") == 0
- || strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0
- || strcmp (h->root.root.string, "_PROCEDURE_LINKAGE_TABLE_") == 0)
+ || h == htab->elf.hgot
+ || h == htab->elf.hplt)
sym->st_shndx = SHN_ABS;
return TRUE;