diff options
Diffstat (limited to 'bfd/elf32-s390.c')
-rw-r--r-- | bfd/elf32-s390.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/bfd/elf32-s390.c b/bfd/elf32-s390.c index 470335c..0d04663 100644 --- a/bfd/elf32-s390.c +++ b/bfd/elf32-s390.c @@ -1793,7 +1793,7 @@ elf_s390_late_size_sections (bfd *output_bfd ATTRIBUTE_UNUSED, /* Set the contents of the .interp section to the interpreter. */ if (bfd_link_executable (info) && !info->nointerp) { - s = bfd_get_linker_section (dynobj, ".interp"); + s = htab->elf.interp; if (s == NULL) abort (); s->size = sizeof ELF_DYNAMIC_INTERPRETER; @@ -2059,6 +2059,7 @@ elf_s390_relocate_section (bfd *output_bfd, int tls_type; asection *base_got = htab->elf.sgot; bool resolved_to_zero; + bool relax; r_type = ELF32_R_TYPE (rel->r_info); if (r_type == (int) R_390_GNU_VTINHERIT @@ -2145,7 +2146,8 @@ elf_s390_relocate_section (bfd *output_bfd, if (sec != NULL && discarded_section (sec)) RELOC_AGAINST_DISCARDED_SECTION (info, input_bfd, input_section, - rel, 1, relend, howto, 0, contents); + rel, 1, relend, R_390_NONE, + howto, 0, contents); if (bfd_link_relocatable (info)) continue; @@ -2153,6 +2155,11 @@ elf_s390_relocate_section (bfd *output_bfd, resolved_to_zero = (h != NULL && UNDEFWEAK_NO_DYNAMIC_RELOC (info, h)); + /* Rewrite instructions and related relocations if (1) relaxation + disabled by default, (2) enabled by target, or (3) enabled by + user. Suppress rewriting if linker option --no-relax is used. */ + relax = info->disable_target_specific_optimizations <= 1; + switch (r_type) { case R_390_GOTPLT12: @@ -2260,8 +2267,9 @@ elf_s390_relocate_section (bfd *output_bfd, h->got.offset |= 1; } - if ((h->def_regular - && SYMBOL_REFERENCES_LOCAL (info, h)) + if (relax + && h->def_regular + && SYMBOL_REFERENCES_LOCAL (info, h) /* lrl rx,sym@GOTENT -> larl rx, sym */ && ((r_type == R_390_GOTENT && (bfd_get_16 (input_bfd, @@ -2281,6 +2289,7 @@ elf_s390_relocate_section (bfd *output_bfd, bfd_put_16 (output_bfd, new_insn, contents + rel->r_offset - 2); r_type = R_390_PC32DBL; + rel->r_info = ELF32_R_INFO (r_symndx, r_type); rel->r_addend = 2; howto = elf_howto_table + r_type; relocation = h->root.u.def.value |