This is the mail archive of the
binutils-cvs@sourceware.org
mailing list for the binutils project.
[binutils-gdb] RISC-V: Don't enable relaxation in relocatable link
- From: Andreas Schwab <schwab at sourceware dot org>
- To: bfd-cvs at sourceware dot org
- Date: 15 Mar 2018 08:55:43 -0000
- Subject: [binutils-gdb] RISC-V: Don't enable relaxation in relocatable link
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=202d116e5714a0c21d0c38b7dd45b5d4ee494880
commit 202d116e5714a0c21d0c38b7dd45b5d4ee494880
Author: Andreas Schwab <schwab@suse.de>
Date: Sun Mar 11 14:25:30 2018 +0100
RISC-V: Don't enable relaxation in relocatable link
PR ld/22949
* emultempl/riscvelf.em (riscv_elf_before_allocation): Don't
enable relaxation in relocatable link.
Diff:
---
ld/ChangeLog | 6 ++++++
ld/emultempl/riscvelf.em | 13 ++++++++-----
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/ld/ChangeLog b/ld/ChangeLog
index ab27208..522d0078 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,9 @@
+2018-03-15 Andreas Schwab <schwab@suse.de>
+
+ PR ld/22949
+ * emultempl/riscvelf.em (riscv_elf_before_allocation): Don't
+ enable relaxation in relocatable link.
+
2018-03-15 Kuan-Lin Chen <kuanlinchentw@gmail.com>
* emultempl/nds32elf.em (nds32_elf_after_allocation): Remove
diff --git a/ld/emultempl/riscvelf.em b/ld/emultempl/riscvelf.em
index eaaf4c5..409dd50 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;
}