aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2018-01-31 05:10:40 -0800
committerH.J. Lu <hjl.tools@gmail.com>2018-01-31 05:10:53 -0800
commit823143c6ca8ef4267e67ba03771991e08d09fabd (patch)
treedb64563589a5f1577c0dfeaab5ffdef9a7a0ee83 /bfd
parentbea298f9547372e6cb7854fabc2c0646e1d3d9be (diff)
downloadgdb-823143c6ca8ef4267e67ba03771991e08d09fabd.zip
gdb-823143c6ca8ef4267e67ba03771991e08d09fabd.tar.gz
gdb-823143c6ca8ef4267e67ba03771991e08d09fabd.tar.bz2
Check if __start/__stop symbols are referenced by shared objects
Define __start/__stop symbols if they are referenced by shared objects, not if they are also defined in shared objects. bfd/ PR ld/21964 * elflink.c (bfd_elf_define_start_stop): Check if __start and __stop symbols are referenced by shared objects. ld/ PR ld/21964 * testsuite/ld-elf/pr21964-4.c: New file. * testsuite/ld-elf/shared.exp: Run pr21964-4 test on Linux.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elflink.c4
2 files changed, 8 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index fb93985..2a0330c 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2018-01-31 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR ld/21964
+ * elflink.c (bfd_elf_define_start_stop): Check if __start and
+ __stop symbols are referenced by shared objects.
+
2018-01-30 Alan Modra <amodra@gmail.com>
PR 22758
diff --git a/bfd/elflink.c b/bfd/elflink.c
index f1ec880..3787c85 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -14338,7 +14338,7 @@ 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->def_dynamic) && !h->def_regular)))
+ || ((h->ref_regular || h->ref_dynamic) && !h->def_regular)))
{
h->root.type = bfd_link_hash_defined;
h->root.u.def.section = sec;
@@ -14358,7 +14358,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 || h->def_dynamic)
+ if (h->ref_dynamic)
bfd_elf_link_record_dynamic_symbol (info, h);
}
return &h->root;