diff options
author | Michael Matz <matz@suse.de> | 2018-01-31 14:26:46 +0100 |
---|---|---|
committer | Michael Matz <matz@suse.de> | 2018-01-31 14:37:32 +0100 |
commit | bf3077a6c3c9ff21c072a6f42c91bffefd35bc15 (patch) | |
tree | 5d3837a7783fd87738654b411674c9bbd78efc0e /bfd/elflink.c | |
parent | 823143c6ca8ef4267e67ba03771991e08d09fabd (diff) | |
download | fsf-binutils-gdb-bf3077a6c3c9ff21c072a6f42c91bffefd35bc15.zip fsf-binutils-gdb-bf3077a6c3c9ff21c072a6f42c91bffefd35bc15.tar.gz fsf-binutils-gdb-bf3077a6c3c9ff21c072a6f42c91bffefd35bc15.tar.bz2 |
bfd_elf_define_start_stop: Fix check
We really need to check for a dynamic def, not only a ref.
See added testcase.
bfd/
* elflink.c (bfd_elf_define_start_stop): Fix check of
def_dynamic.
ld/
* testsuite/ld-elf/pr21964-5.c: New test.
* testsuite/ld-elf/shared.exp: Run it.
Diffstat (limited to 'bfd/elflink.c')
-rw-r--r-- | bfd/elflink.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c index 3787c85..3fe4555 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -14338,8 +14338,9 @@ bfd_elf_define_start_stop (struct bfd_link_info *info, if (h != NULL && (h->root.type == bfd_link_hash_undefined || h->root.type == bfd_link_hash_undefweak - || ((h->ref_regular || h->ref_dynamic) && !h->def_regular))) + || ((h->ref_regular || h->def_dynamic) && !h->def_regular))) { + bfd_boolean was_dynamic = h->ref_dynamic || h->def_dynamic; h->root.type = bfd_link_hash_defined; h->root.u.def.section = sec; h->root.u.def.value = 0; @@ -14358,7 +14359,7 @@ bfd_elf_define_start_stop (struct bfd_link_info *info, { if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_PROTECTED; - if (h->ref_dynamic) + if (was_dynamic) bfd_elf_link_record_dynamic_symbol (info, h); } return &h->root; |