weakdef list handling
Alan Modra
amodra@gmail.com
Sun Nov 12 08:07:00 GMT 2017
The existing code allowed common and indirect symbols to pass an
assert, but then read root.u.def which is not valid for anything
besides defined and weakdef symbols. The garbage root.u.def.section
pointer read can't possibly match pointers stored at the same location
for indirect and common symbols, so we would always have left
u.weakdef NULL.
* elflink.c (elf_link_add_object_symbols): Ignore anything but
defined and defweak symbols when setting up weakdefs.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 122549c..72886d5 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -5145,10 +5145,10 @@ error_free_dyn:
weaks = hlook->u.weakdef;
hlook->u.weakdef = NULL;
- BFD_ASSERT (hlook->root.type == bfd_link_hash_defined
- || hlook->root.type == bfd_link_hash_defweak
- || hlook->root.type == bfd_link_hash_common
- || hlook->root.type == bfd_link_hash_indirect);
+ if (hlook->root.type != bfd_link_hash_defined
+ && hlook->root.type != bfd_link_hash_defweak)
+ continue;
+
slook = hlook->root.u.def.section;
vlook = hlook->root.u.def.value;
--
Alan Modra
Australia Development Lab, IBM
More information about the Binutils
mailing list