From: Andreas Schwab Date: Sun, 11 Mar 2018 13:25:30 +0000 (+0100) Subject: RISC-V: Don't enable relaxation in relocatable link X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=202d116e5714a0c21d0c38b7dd45b5d4ee494880;p=binutils-gdb.git 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 --git a/ld/ChangeLog b/ld/ChangeLog index ab27208715d..522d0078a74 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2018-03-15 Andreas Schwab + + PR ld/22949 + * emultempl/riscvelf.em (riscv_elf_before_allocation): Don't + enable relaxation in relocatable link. + 2018-03-15 Kuan-Lin Chen * emultempl/nds32elf.em (nds32_elf_after_allocation): Remove diff --git a/ld/emultempl/riscvelf.em b/ld/emultempl/riscvelf.em index eaaf4c58b54..409dd5000ac 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; }