This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH] RISC-V: Don't enable relaxation in relocatable link
- From: Andreas Schwab <schwab at suse dot de>
- To: binutils at sourceware dot org
- Date: Mon, 12 Mar 2018 10:56:07 +0100
- Subject: [PATCH] RISC-V: Don't enable relaxation in relocatable link
- Authentication-results: sourceware.org; auth=none
PR ld/22949
* emultempl/riscvelf.em (riscv_elf_before_allocation): Don't
enable relaxation in relocatable link.
---
ld/emultempl/riscvelf.em | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/ld/emultempl/riscvelf.em b/ld/emultempl/riscvelf.em
index eaaf4c58b5..409dd5000a 100644
--- a/ld/emultempl/riscvelf.em
+++ b/ld/emultempl/riscvelf.em
@@ -33,11 +33,14 @@ riscv_elf_before_allocation (void)
if (link_info.discard == discard_sec_merge)
link_info.discard = discard_l;
- /* We always need at least some relaxation to handle code alignment. */
- if (RELAXATION_DISABLED_BY_USER)
- TARGET_ENABLE_RELAXATION;
- else
- ENABLE_RELAXATION;
+ if (!bfd_link_relocatable (&link_info))
+ {
+ /* We always need at least some relaxation to handle code alignment. */
+ if (RELAXATION_DISABLED_BY_USER)
+ TARGET_ENABLE_RELAXATION;
+ else
+ ENABLE_RELAXATION;
+ }
link_info.relax_pass = 3;
}
--
2.16.2
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."