RISC-V: Don't enable relaxation in relocatable link
authorAndreas Schwab <schwab@suse.de>
Sun, 11 Mar 2018 13:25:30 +0000 (14:25 +0100)
committerAndreas Schwab <schwab@suse.de>
Thu, 15 Mar 2018 08:54:51 +0000 (09:54 +0100)
PR ld/22949
* emultempl/riscvelf.em (riscv_elf_before_allocation): Don't
enable relaxation in relocatable link.

ld/ChangeLog
ld/emultempl/riscvelf.em

index ab27208715d63eb0f60c8216322e32457b3b624d..522d0078a74807d193ca094798f75b8c5c0b9c23 100644 (file)
@@ -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
index eaaf4c58b54ce61e50e53f002ca30ed15812e089..409dd5000ac85e5c3ec0ba7ff8288a77f4b6e89b 100644 (file)
@@ -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;
 }
This page took 0.02604 seconds and 4 git commands to generate.