aboutsummaryrefslogtreecommitdiff
path: root/ld/ldexp.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-06-24 03:56:05 -0700
committerH.J. Lu <hjl.tools@gmail.com>2020-06-24 03:56:16 -0700
commit5376d47f66d0e4e07b3d42cb62ad07327cad4292 (patch)
treea2f4ab98b98a0cf98f62d014e7b6e7d6060fa4b6 /ld/ldexp.c
parenta5aae5087ca50f14e361cffe155ad3886afb56cb (diff)
downloadgdb-5376d47f66d0e4e07b3d42cb62ad07327cad4292.zip
gdb-5376d47f66d0e4e07b3d42cb62ad07327cad4292.tar.gz
gdb-5376d47f66d0e4e07b3d42cb62ad07327cad4292.tar.bz2
ld: Set non_ir_ref_regular on source for assignment
We need to set non_ir_ref_regular on the source for assignment to get the correct LTO resolution: 190 a27be7f4ad90c5ce PREVAILING_DEF real_g instead of 190 30c3b2d8f967f5ea PREVAILING_DEF_IRONLY real_g PR ld/26163 * ldexp.c (exp_fold_tree_1): Set non_ir_ref_regular on the source for assignment. * testsuite/ld-plugin/lto.exp: Run ld/26163 test. * testsuite/ld-plugin/pr26163a.c: New file. * testsuite/ld-plugin/pr26163b.c: Likewise.
Diffstat (limited to 'ld/ldexp.c')
-rw-r--r--ld/ldexp.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/ld/ldexp.c b/ld/ldexp.c
index 3ffabb8..b4e7c41 100644
--- a/ld/ldexp.c
+++ b/ld/ldexp.c
@@ -1217,15 +1217,19 @@ exp_fold_tree_1 (etree_type *tree)
bfd_link_hide_symbol (link_info.output_bfd,
&link_info, h);
- /* Copy the symbol type if this is an expression only
+ /* Copy the symbol type and set non_ir_ref_regular
+ on the source if this is an expression only
referencing a single symbol. (If the expression
contains ternary conditions, ignoring symbols on
false branches.) */
if (expld.assign_src != NULL
&& (expld.assign_src
!= (struct bfd_link_hash_entry *) -1))
- bfd_copy_link_hash_symbol_type (link_info.output_bfd,
- h, expld.assign_src);
+ {
+ bfd_copy_link_hash_symbol_type (link_info.output_bfd,
+ h, expld.assign_src);
+ expld.assign_src->non_ir_ref_regular = TRUE;
+ }
}
}
}