diff options
-rw-r--r-- | bfd/ChangeLog | 8 | ||||
-rw-r--r-- | bfd/elfxx-mips.c | 4 | ||||
-rw-r--r-- | ld/ChangeLog | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/reloc-discard.d | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/reloc-discard.ld | 6 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/reloc-discard.s | 2 |
6 files changed, 35 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c5960e6..9b7048c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,11 @@ +2018-07-20 Maciej W. Rozycki <macro@mips.com> + + * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Do not + create DT_REL, DT_RELSZ or DT_RELENT dynamic entries if the + dynamic relocation section will be discarded from output. + (_bfd_mips_elf_finish_dynamic_sections) <DT_RELSZ>: Assert that + the dynamic relocation section will be retained in output. + 2018-07-18 Maciej W. Rozycki <macro@mips.com> * xcofflink.c (xcoff_write_global_symbol): Fix symbol type diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index d919423..cc767ea 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -9890,7 +9890,8 @@ _bfd_mips_elf_size_dynamic_sections (bfd *output_bfd, } else { - if (sreldyn && sreldyn->size > 0) + if (sreldyn && sreldyn->size > 0 + && !bfd_is_abs_section (sreldyn->output_section)) { if (! MIPS_ELF_ADD_DYNAMIC_ENTRY (info, DT_REL, 0)) return FALSE; @@ -11798,6 +11799,7 @@ _bfd_mips_elf_finish_dynamic_sections (bfd *output_bfd, : sizeof (Elf32_External_Rel))); /* Adjust the section size too. Tools like the prelinker can reasonably expect the values to the same. */ + BFD_ASSERT (!bfd_is_abs_section (s->output_section)); elf_section_data (s->output_section)->this_hdr.sh_size = dyn.d_un.d_val; break; diff --git a/ld/ChangeLog b/ld/ChangeLog index c2f6b28..8c7d2df 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,9 @@ +2018-07-20 Maciej W. Rozycki <macro@mips.com> + + * testsuite/ld-elf/reloc-discard.d: New test. + * testsuite/ld-elf/reloc-discard.ld: New test linker script. + * testsuite/ld-elf/reloc-discard.s: New test source. + 2018-07-18 Nick Clifton <nickc@redhat.com> * po/fr.po: Updated French translation. diff --git a/ld/testsuite/ld-elf/reloc-discard.d b/ld/testsuite/ld-elf/reloc-discard.d new file mode 100644 index 0000000..b8aad88 --- /dev/null +++ b/ld/testsuite/ld-elf/reloc-discard.d @@ -0,0 +1,10 @@ +#name: Discarded dynamic relocation section +#ld: -shared -T reloc-discard.ld +#readelf: -r --use-dynamic +#target: [check_shared_lib_support] +#source: reloc-discard.s +#xfail: nds32*-*-* tic6x-*-* +# Need to figure out how to pass `-fpic' for NDS32 or `-mpic -mpid=near' +# for TI C6X targets to GAS for this test. + +There are no dynamic relocations in this file\. diff --git a/ld/testsuite/ld-elf/reloc-discard.ld b/ld/testsuite/ld-elf/reloc-discard.ld new file mode 100644 index 0000000..b16b80a --- /dev/null +++ b/ld/testsuite/ld-elf/reloc-discard.ld @@ -0,0 +1,6 @@ +SECTIONS +{ + /* .dynamic needs to go first with MIPS IRIX-style emulations. */ + .dynamic : { *(.dynamic) } + /DISCARD/ : { *(.rel.dyn) *(.rela.dyn) } +} diff --git a/ld/testsuite/ld-elf/reloc-discard.s b/ld/testsuite/ld-elf/reloc-discard.s new file mode 100644 index 0000000..23f187a --- /dev/null +++ b/ld/testsuite/ld-elf/reloc-discard.s @@ -0,0 +1,2 @@ + .data + .dc.a foo |