This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 3/5] RISC-V/GAS: Correct branch relaxation for weak symbols


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]