aboutsummaryrefslogtreecommitdiff
path: root/bfd/elflink.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2017-11-12 14:12:41 +1030
committerAlan Modra <amodra@gmail.com>2017-11-12 17:45:24 +1030
commite3e53eed9c2f1ab82ae4a7683f474b4f6eb162c7 (patch)
tree712e20f801d16dd5ff14e765783a1b6e0469769a /bfd/elflink.c
parent529fe20eeb0030ea5d653d0ebec433f9e3145874 (diff)
downloadgdb-e3e53eed9c2f1ab82ae4a7683f474b4f6eb162c7.zip
gdb-e3e53eed9c2f1ab82ae4a7683f474b4f6eb162c7.tar.gz
gdb-e3e53eed9c2f1ab82ae4a7683f474b4f6eb162c7.tar.bz2
weakdef list handling
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.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r--bfd/elflink.c8
1 files changed, 4 insertions, 4 deletions
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;