powerpc64-elf weak syms
Alan Modra
amodra@bigpond.net.au
Tue Jan 29 20:57:00 GMT 2002
Jakub's recent patch to gas killed powerpc64-linux glibc, where we
emitted undefined weak function descriptor syms in relocatable
objects as a hack around linker problems. The trouble is that
these syms are not referenced in a relocatable object, so are
garbage collected by Jakub's code. When the linker realized a
function descriptor sym was missing, it unfortunately made an
undefined sym rather than undef weak, leading to errors later on.
This patch cures the problem (we can do without the glibc hack),
and fixes another bug where we were creating unwanted func desc
syms.
bfd/ChangeLog
* elf64-ppc.c (func_desc_adjust): Only provide missing function
descriptor symbols for undefined function code syms. Clear
ELF_LINK_NON_ELF so that they can stay weak.
--
Alan Modra
IBM OzLabs - Linux Technology Centre
Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.23
diff -u -p -r1.23 elf64-ppc.c
--- elf64-ppc.c 2002/01/29 14:52:12 1.23
+++ elf64-ppc.c 2002/01/30 03:27:05
@@ -2500,20 +2500,15 @@ func_desc_adjust (h, inf)
fdh = elf_link_hash_lookup (&htab->elf, h->root.root.string + 1,
false, false, true);
- if (fdh == NULL && info->shared)
+ if (fdh == NULL
+ && info->shared
+ && (h->root.type == bfd_link_hash_undefined
+ || h->root.type == bfd_link_hash_undefweak))
{
bfd *abfd;
asymbol *newsym;
- /* Create it as undefined. */
- if (h->root.type == bfd_link_hash_undefined
- || h->root.type == bfd_link_hash_undefweak)
- abfd = h->root.u.undef.abfd;
- else if (h->root.type == bfd_link_hash_defined
- || h->root.type == bfd_link_hash_defweak)
- abfd = h->root.u.def.section->owner;
- else
- abort ();
+ abfd = h->root.u.undef.abfd;
newsym = bfd_make_empty_symbol (abfd);
newsym->name = h->root.root.string + 1;
newsym->section = bfd_und_section_ptr;
@@ -2529,6 +2524,7 @@ func_desc_adjust (h, inf)
{
return false;
}
+ fdh->elf_link_hash_flags &= ~ELF_LINK_NON_ELF;
}
if (fdh != NULL
More information about the Binutils
mailing list