aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@imgtec.com>2016-04-09 11:59:36 +0100
committerMaciej W. Rozycki <macro@imgtec.com>2016-04-13 13:38:50 +0100
commit991f40a9fa668eb65159ee9884bf89c8cbc09f02 (patch)
treee5fd317846540cfafc8d7d702169cb17609c0466 /gas/config
parentc1f61bd2b0644fc710dcfbb378a63f0b34be8903 (diff)
downloadgdb-991f40a9fa668eb65159ee9884bf89c8cbc09f02.zip
gdb-991f40a9fa668eb65159ee9884bf89c8cbc09f02.tar.gz
gdb-991f40a9fa668eb65159ee9884bf89c8cbc09f02.tar.bz2
MIPS/GAS: Correct branch relaxation for weak symbols
Weak symbols can be preempted at link time so always choose the longer sequence in branch relaxation, according to the relaxation level chosen, so that any symbol finally used as the branch target is reachable. 2016-04-13 Maciej W. Rozycki <macro@imgtec.com> Andrew Bennett <andrew.bennett@imgtec.com> gas/ * config/tc-mips.c (relaxed_branch_length): Use the long sequence where the target is a weak symbol. (relaxed_micromips_32bit_branch_length): Likewise. (relaxed_micromips_16bit_branch_length): Likewise. * testsuite/gas/mips/branch-weak-1.d: New test. * testsuite/gas/mips/branch-weak-2.d: New test. * testsuite/gas/mips/branch-weak-3.d: New test. * testsuite/gas/mips/branch-weak-4.d: New test. * testsuite/gas/mips/branch-weak-5.d: New test. * testsuite/gas/mips/branch-weak.l: New stderr output. * testsuite/gas/mips/branch-weak.s: New test source. * testsuite/gas/mips/mips.exp: Run the new tests.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/tc-mips.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index dba147a..118b91d 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -16798,6 +16798,7 @@ relaxed_branch_length (fragS *fragp, asection *sec, int update)
if (fragp
&& S_IS_DEFINED (fragp->fr_symbol)
+ && !S_IS_WEAK (fragp->fr_symbol)
&& sec == S_GET_SEGMENT (fragp->fr_symbol))
{
addressT addr;
@@ -16861,6 +16862,7 @@ relaxed_micromips_32bit_branch_length (fragS *fragp, asection *sec, int update)
if (fragp
&& S_IS_DEFINED (fragp->fr_symbol)
+ && !S_IS_WEAK (fragp->fr_symbol)
&& sec == S_GET_SEGMENT (fragp->fr_symbol))
{
addressT addr;
@@ -16952,6 +16954,7 @@ relaxed_micromips_16bit_branch_length (fragS *fragp, asection *sec, int update)
if (fragp
&& S_IS_DEFINED (fragp->fr_symbol)
+ && !S_IS_WEAK (fragp->fr_symbol)
&& sec == S_GET_SEGMENT (fragp->fr_symbol))
{
addressT addr;