SHA256
1
0
forked from pool/binutils
binutils/riscv-relax-relocatable.patch
2018-03-27 15:01:40 +00:00

31 lines
954 B
Diff

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.
Index: binutils-2.30/ld/emultempl/riscvelf.em
===================================================================
--- binutils-2.30.orig/ld/emultempl/riscvelf.em
+++ binutils-2.30/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;
}