summaryrefslogtreecommitdiff
path: root/bfd/linker.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2022-04-25 10:51:39 -0700
committerH.J. Lu <hjl.tools@gmail.com>2022-05-04 16:26:51 -0700
commitda422fa49d508e33b8f1b2bd9b8f719b831b199b (patch)
tree197586145f0c372bad5abda8d2032fd9eaf6db63 /bfd/linker.c
parent40ae4abe44fa4e0a53d1681bc48adf445df25822 (diff)
downloadbinutils-gdb-da422fa49d508e33b8f1b2bd9b8f719b831b199b.tar.gz
LTO: Handle __real_SYM reference in IR
When an IR symbol SYM is referenced in IR via __real_SYM, its resolution should be LDPR_PREVAILING_DEF, not PREVAILING_DEF_IRONLY, since LTO doesn't know that __real_SYM should be resolved by SYM. bfd/ PR ld/29086 * linker.c (bfd_wrapped_link_hash_lookup): Mark SYM is referenced via __real_SYM. include/ PR ld/29086 * bfdlink.h (bfd_link_hash_entry): Add ref_real. ld/ PR ld/29086 * plugin.c (get_symbols): Resolve SYM definition to LDPR_PREVAILING_DEF for __real_SYM reference. * testsuite/ld-plugin/lto.exp: Run PR ld/29086 test. * testsuite/ld-plugin/pr29086.c: New file.
Diffstat (limited to 'bfd/linker.c')
-rw-r--r--bfd/linker.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/bfd/linker.c b/bfd/linker.c
index 088c1d06f3d..e9ebdbad040 100644
--- a/bfd/linker.c
+++ b/bfd/linker.c
@@ -599,6 +599,7 @@ bfd_wrapped_link_hash_lookup (bfd *abfd,
n[1] = '\0';
strcat (n, l + sizeof REAL - 1);
h = bfd_link_hash_lookup (info->hash, n, create, true, follow);
+ h->ref_real = 1;
free (n);
return h;
}