[PATCH 3/5] RISC-V/GAS: Correct branch relaxation for weak symbols
Palmer Dabbelt
palmer@dabbelt.com
Mon Jan 2 02:26:00 GMT 2017
From: Andrew Waterman <andrew@sifive.com>
Do not shorten branches to weak symbols, since they can be preempted at
link time.
gas/ChangeLog
2016-12-21 Andrew Waterman <andrew@sifive.com>
* config/tc-riscv.c (relaxed_branch_length): Use the long
sequence when the target is a weak symbol.
---
gas/config/tc-riscv.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 38dcd04..03db275 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -360,6 +360,7 @@ relaxed_branch_length (fragS *fragp, asection *sec, int update)
if (fragp->fr_symbol != NULL
&& S_IS_DEFINED (fragp->fr_symbol)
+ && !S_IS_WEAK (fragp->fr_symbol)
&& sec == S_GET_SEGMENT (fragp->fr_symbol))
{
offsetT val = S_GET_VALUE (fragp->fr_symbol) + fragp->fr_offset;
--
2.10.2
More information about the Binutils
mailing list