aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-01-29 21:45:09 +1030
committerAlan Modra <amodra@gmail.com>2018-01-30 10:09:07 +1030
commit36b8fda5d614cb5aaf701a92befa9919bd0b195a (patch)
treecee28f1d88d72357f4a39c2999ec99467b0f763a /bfd
parent185cdb8cc7c0102140d41fb6272a5ee99994d72d (diff)
downloadgdb-36b8fda5d614cb5aaf701a92befa9919bd0b195a.zip
gdb-36b8fda5d614cb5aaf701a92befa9919bd0b195a.tar.gz
gdb-36b8fda5d614cb5aaf701a92befa9919bd0b195a.tar.bz2
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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/elflink.c9
2 files changed, 12 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 9566198..4a45b55 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2018-01-30 Alan Modra <amodra@gmail.com>
+
+ * elflink.c (bfd_elf_define_start_stop): Make __start and __stop
+ symbols dynamic.
+
2018-01-29 Alan Modra <amodra@gmail.com>
PR 22741
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;