aboutsummaryrefslogtreecommitdiff
path: root/ld
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2018-03-11 14:25:30 +0100
committerAndreas Schwab <schwab@suse.de>2018-03-15 09:54:51 +0100
commit202d116e5714a0c21d0c38b7dd45b5d4ee494880 (patch)
treee9ba1906c8b2010e64d324edf53baa43257ff386 /ld
parentf9671640954362a918c669700bcc9a57be25782d (diff)
downloadgdb-202d116e5714a0c21d0c38b7dd45b5d4ee494880.zip
gdb-202d116e5714a0c21d0c38b7dd45b5d4ee494880.tar.gz
gdb-202d116e5714a0c21d0c38b7dd45b5d4ee494880.tar.bz2
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.
Diffstat (limited to 'ld')
-rw-r--r--ld/ChangeLog6
-rw-r--r--ld/emultempl/riscvelf.em13
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;
}