From 36b8fda5d614cb5aaf701a92befa9919bd0b195a Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 29 Jan 2018 21:45:09 +1030 Subject: Make __start/__stop symbols dynamic and add testcase bfd/ * elflink.c (bfd_elf_define_start_stop): Make __start and __stop symbols dynamic. ld/ * testsuite/ld-elf/pr21964-3a.c: New file. * testsuite/ld-elf/pr21964-3c.c: New file. * testsuite/ld-elf/shared.exp: Run new __start/__stop testcase. --- bfd/elflink.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'bfd/elflink.c') diff --git a/bfd/elflink.c b/bfd/elflink.c index e81f6c6..f1ec880 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -14354,8 +14354,13 @@ bfd_elf_define_start_stop (struct bfd_link_info *info, bed = get_elf_backend_data (info->output_bfd); (*bed->elf_backend_hide_symbol) (info, h, TRUE); } - else if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) - h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_PROTECTED; + else + { + if (ELF_ST_VISIBILITY (h->other) == STV_DEFAULT) + h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_PROTECTED; + if (h->ref_dynamic || h->def_dynamic) + bfd_elf_link_record_dynamic_symbol (info, h); + } return &h->root; } return NULL; -- cgit v1.1