aboutsummaryrefslogtreecommitdiff
path: root/ld/ChangeLog
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@mips.com>2018-02-19 18:38:41 +0000
committerMaciej W. Rozycki <macro@mips.com>2018-02-19 18:38:41 +0000
commit6798f8bfa617c72240036571cb12313fef353090 (patch)
treeae568e9cf41034c27a3d9ae13b0ad2017a25130e /ld/ChangeLog
parent8772de117d8366988bc60c9f9c571e262ef75932 (diff)
downloadgdb-6798f8bfa617c72240036571cb12313fef353090.zip
gdb-6798f8bfa617c72240036571cb12313fef353090.tar.gz
gdb-6798f8bfa617c72240036571cb12313fef353090.tar.bz2
MIPS/BFD: Fix the size of `.reginfo' and `.MIPS.abiflags' sections
Use the SEC_FIXED_SIZE flag to actually fix the size of `.reginfo' and `.MIPS.abiflags' sections in `_bfd_mips_elf_always_size_sections', as originally intended, removing link failures such as: ld: final link failed: Section has no contents or: ld: final link failed: Bad value or: ld: foo: .reginfo section size should be 24 bytes, actual size is 32 and assertion failures like: ld: BFD (GNU Binutils) 2.30.51.20180131 assertion fail .../bfd/elfxx-mips.c:14322 in link scenarios involving a linker script that either creates an output `.reginfo' or `.MIPS.abiflags' section from scratch or produces either section from different sections. If such an output section's size turns out to be incorrect according to the psABI, then the section is either truncated or padded out to the correct size, as relevant. This allows people to handle these sections in a link in an unusual way, while still addressing the issue covered by commit 58807c48a5a3 ("_bfd_mips_elf_final_link: Notify user about wrong .reginfo size"). The original arrangement, coming from an unindentified change made to what was called `mips_elf_always_size_sections' back then, between commit 02650bd0a97e ("This adds ABI flags to MIPS/ELF object files.") and commit 252b5132c753 ("19990502 sourceware import"), also missing from BFD ChangeLog files, assumed that the output section size is not going to change after return from `bfd_elf_size_dynamic_sections', the caller of that function, called in turn from `ldemul_before_allocation' via `gld${EMULATION_NAME}_before_allocation' in ld/emultempl/elf32.em, and ultimately from `lang_process'. This is because later on in `lang_process' processing `lang_size_sections' is called , happily recalculating the section size, and it has actually already been the case at the time of commit 252b5132c753 ("19990502 sourceware import"), so the assumption was clearly incorrect right from the beginning. bfd/ * elfxx-mips.c (_bfd_mips_elf_always_size_sections): Set SEC_FIXED_SIZE and SEC_HAS_CONTENTS flags for `.reginfo' and `.MIPS.abiflags' sections. (_bfd_mips_elf_final_link): Avoid reading beyond `.reginfo' section's end. ld/ * testsuite/ld-mips-elf/reginfo-0.d: New test. * testsuite/ld-mips-elf/reginfo-0r.d: New test. * testsuite/ld-mips-elf/reginfo-1.d: New test. * testsuite/ld-mips-elf/reginfo-1r.d: New test. * testsuite/ld-mips-elf/reginfo-2.d: New test. * testsuite/ld-mips-elf/reginfo-2r.d: New test. * testsuite/ld-mips-elf/mips-abiflags-0.d: New test. * testsuite/ld-mips-elf/mips-abiflags-0r.d: New test. * testsuite/ld-mips-elf/mips-abiflags-1.d: New test. * testsuite/ld-mips-elf/mips-abiflags-1r.d: New test. * testsuite/ld-mips-elf/mips-abiflags-2.d: New test. * testsuite/ld-mips-elf/mips-abiflags-2r.d: New test. * testsuite/ld-mips-elf/reginfo-0.ld: New test linker script. * testsuite/ld-mips-elf/reginfo-1.ld: New test linker script. * testsuite/ld-mips-elf/mips-abiflags-0.ld: New test linker script. * testsuite/ld-mips-elf/mips-abiflags-1.ld: New test linker script. * testsuite/ld-mips-elf/reginfo-1.s: New test source. * testsuite/ld-mips-elf/reginfo-2.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
Diffstat (limited to 'ld/ChangeLog')
-rw-r--r--ld/ChangeLog24
1 files changed, 24 insertions, 0 deletions
diff --git a/ld/ChangeLog b/ld/ChangeLog
index 4f5cd5f..f2cc005 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,29 @@
2018-02-19 Maciej W. Rozycki <macro@mips.com>
+ * testsuite/ld-mips-elf/reginfo-0.d: New test.
+ * testsuite/ld-mips-elf/reginfo-0r.d: New test.
+ * testsuite/ld-mips-elf/reginfo-1.d: New test.
+ * testsuite/ld-mips-elf/reginfo-1r.d: New test.
+ * testsuite/ld-mips-elf/reginfo-2.d: New test.
+ * testsuite/ld-mips-elf/reginfo-2r.d: New test.
+ * testsuite/ld-mips-elf/mips-abiflags-0.d: New test.
+ * testsuite/ld-mips-elf/mips-abiflags-0r.d: New test.
+ * testsuite/ld-mips-elf/mips-abiflags-1.d: New test.
+ * testsuite/ld-mips-elf/mips-abiflags-1r.d: New test.
+ * testsuite/ld-mips-elf/mips-abiflags-2.d: New test.
+ * testsuite/ld-mips-elf/mips-abiflags-2r.d: New test.
+ * testsuite/ld-mips-elf/reginfo-0.ld: New test linker script.
+ * testsuite/ld-mips-elf/reginfo-1.ld: New test linker script.
+ * testsuite/ld-mips-elf/mips-abiflags-0.ld: New test linker
+ script.
+ * testsuite/ld-mips-elf/mips-abiflags-1.ld: New test linker
+ script.
+ * testsuite/ld-mips-elf/reginfo-1.s: New test source.
+ * testsuite/ld-mips-elf/reginfo-2.s: New test source.
+ * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
+
+2018-02-19 Maciej W. Rozycki <macro@mips.com>
+
* ldlang.c (insert_pad): Do not change output section's size if
SEC_FIXED_SIZE is set in the flags.
(size_input_section): Likewise.