aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-08-26 07:43:23 -0700
committerH.J. Lu <hjl.tools@gmail.com>2021-08-27 19:44:57 -0700
commit7de7786bb7db5159fc8a7bfa3df72381ff16a38c (patch)
treebeb6bd50c6bfa1019914afdc61f49baab9ed3e11 /bfd
parentb05929a20efa7caa40415d2f069e44f7e76615e4 (diff)
downloadgdb-7de7786bb7db5159fc8a7bfa3df72381ff16a38c.zip
gdb-7de7786bb7db5159fc8a7bfa3df72381ff16a38c.tar.gz
gdb-7de7786bb7db5159fc8a7bfa3df72381ff16a38c.tar.bz2
ld: Change indirect symbol from IR to undefined
bfd/ PR ld/28264 * elflink.c (_bfd_elf_merge_symbol): Change indirect symbol from IR to undefined. ld/ PR ld/28264 * testsuite/ld-plugin/lto.exp: Run PR ld/28264 test. * testsuite/ld-plugin/pr28264-1.d: New file. * testsuite/ld-plugin/pr28264-2.d: Likewise. * testsuite/ld-plugin/pr28264-3.d: Likewise. * testsuite/ld-plugin/pr28264-4.d: Likewise. * testsuite/ld-plugin/pr28264.c: Likewise. * testsuite/ld-plugin/pr28264.ver: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/elflink.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/bfd/elflink.c b/bfd/elflink.c
index c9d5da2..6fe9041 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -1272,14 +1272,25 @@ _bfd_elf_merge_symbol (bfd *abfd,
olddyn = (oldsec->symbol->flags & BSF_DYNAMIC) != 0;
}
- /* Handle a case where plugin_notice won't be called and thus won't
- set the non_ir_ref flags on the first pass over symbols. */
if (oldbfd != NULL
- && (oldbfd->flags & BFD_PLUGIN) != (abfd->flags & BFD_PLUGIN)
- && newdyn != olddyn)
+ && (oldbfd->flags & BFD_PLUGIN) != (abfd->flags & BFD_PLUGIN))
{
- h->root.non_ir_ref_dynamic = true;
- hi->root.non_ir_ref_dynamic = true;
+ if (newdyn != olddyn)
+ {
+ /* Handle a case where plugin_notice won't be called and thus
+ won't set the non_ir_ref flags on the first pass over
+ symbols. */
+ h->root.non_ir_ref_dynamic = true;
+ hi->root.non_ir_ref_dynamic = true;
+ }
+
+ if ((oldbfd->flags & BFD_PLUGIN) != 0
+ && hi->root.type == bfd_link_hash_indirect)
+ {
+ /* Change indirect symbol from IR to undefined. */
+ hi->root.type = bfd_link_hash_undefined;
+ hi->root.u.undef.abfd = oldbfd;
+ }
}
/* NEWDEF and OLDDEF indicate whether the new or old symbol,