This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Fix ld/778: Hiding _GLOBAL_OFFSET_TABLE_ breaks function pointer canonicalization
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Cc: John David Anglin <danglin at gcc dot gnu dot org>
- Date: Mon, 7 Mar 2005 16:30:25 +1030
- Subject: Fix ld/778: Hiding _GLOBAL_OFFSET_TABLE_ breaks function pointer canonicalization
This undoes the 2004-11-02 elflink.c change for hppa32. In fact, it
goes a little further and makes _GLOBAL_OFFSET_TABLE_ dynamic even for
executables. I believe this is necessary for the case where the main
app does no function pointer comparisons, but shared libraries do.
PR ld/778
* elf32-hppa.c (elf32_hppa_create_dynamic_sections): Reinstate
_GLOBAL_OFFSET_TABLE_ as a normal dynamic symbol.
Index: bfd/elf32-hppa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-hppa.c,v
retrieving revision 1.126
diff -u -p -r1.126 elf32-hppa.c
--- bfd/elf32-hppa.c 31 Jan 2005 23:13:20 -0000 1.126
+++ bfd/elf32-hppa.c 7 Mar 2005 05:49:30 -0000
@@ -937,6 +937,7 @@ static bfd_boolean
elf32_hppa_create_dynamic_sections (bfd *abfd, struct bfd_link_info *info)
{
struct elf32_hppa_link_hash_table *htab;
+ struct elf_link_hash_entry *h;
/* Don't try to create the .plt and .got twice. */
htab = hppa_link_hash_table (info);
@@ -966,7 +967,12 @@ elf32_hppa_create_dynamic_sections (bfd
htab->sdynbss = bfd_get_section_by_name (abfd, ".dynbss");
htab->srelbss = bfd_get_section_by_name (abfd, ".rela.bss");
- return TRUE;
+ /* hppa-linux needs _GLOBAL_OFFSET_TABLE_ to be visible from the main
+ application, because __canonicalize_funcptr_for_compare needs it. */
+ h = elf_hash_table (info)->hgot;
+ h->forced_local = 0;
+ h->other = STV_DEFAULT;
+ return bfd_elf_link_record_dynamic_symbol (info, h);
}
/* Copy the extra info we tack onto an elf_link_hash_entry. */
@@ -1836,7 +1842,7 @@ allocate_plt_static (struct elf_link_has
info = inf;
htab = hppa_link_hash_table (info);
if (htab->elf.dynamic_sections_created
- && h->plt.refcount > 0)
+ && h->plt.refcount > 0)
{
/* Make sure this symbol is output as a dynamic symbol.
Undefined weak syms won't yet be marked as dynamic. */
--
Alan Modra
IBM OzLabs - Linux Technology Centre