This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 3/5] RISC-V/GAS: Correct branch relaxation for weak symbols
- From: Palmer Dabbelt <palmer at dabbelt dot com>
- To: binutils at sourceware dot org
- Cc: Andrew Waterman <andrew at sifive dot com>
- Cc: amorda at gmail dot com
- Date: Sun, 1 Jan 2017 18:24:51 -0800
- Subject: [PATCH 3/5] RISC-V/GAS: Correct branch relaxation for weak symbols
- Authentication-results: sourceware.org; auth=none
- References: <20170102022453.25556-1-palmer@dabbelt.com>
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