MIPS/LD: Include n64 `.interp' with INITIAL_READONLY_SECTIONS
authorYunQiang Su <yunqiang.su@cipunited.com>
Fri, 28 Jul 2023 05:00:36 +0000 (06:00 +0100)
committerMaciej W. Rozycki <macro@orcam.me.uk>
Fri, 28 Jul 2023 05:00:36 +0000 (06:00 +0100)
commitf625926792da741ab196ef71c16e481331965b6f
tree8c5b9a95257b6a668f8ef54787c448a553f572b3
parentcc66ad2d2a63cec2eaafd7bbc6a9204490816c0b
MIPS/LD: Include n64 `.interp' with INITIAL_READONLY_SECTIONS

In ld/emulparams/elf64bmip-defs.sh there is no explicit handling of the
`.interp' section, which causes it to be positioned in output at an odd
place.

Let's include it with INITIAL_READONLY_SECTIONS, just like o32/n32 do,
fixing a regression from commit 5a8e7be242f3 ("INITIAL_READONLY_SECTIONS
in elf.sc"), where the handling of n64 was missed due to an unfortunate
sequence of events where ld/emulparams/elf64bmip-defs.sh was only added
with commit 94bb04b3c611 ("Use .reginfo rather than .MIPS.options in n32
linker scripts") the day before.

Add test cases covering section ordering across the three ABIs.  This
change also fixes ld/pr23658-2:

FAIL: Build pr23658-2

Co-Authored-By: Maciej W. Rozycki <macro@orcam.me.uk>
ld/ChangeLog:
* emulparams/elf64bmip-defs.sh: Include `.interp' with
INITIAL_READONLY_SECTIONS.
* testsuite/ld-mips-elf/pie-n64.d: Adjust addresses.
* testsuite/ld-mips-elf/sections-1-o32.rd: New test.
* testsuite/ld-mips-elf/sections-1-o32t.rd: New test.
* testsuite/ld-mips-elf/sections-1-n32.rd: New test.
* testsuite/ld-mips-elf/sections-1-n32t.rd: New test.
* testsuite/ld-mips-elf/sections-1-n32p.rd: New test.
* testsuite/ld-mips-elf/sections-1-n64.rd: New test.
* testsuite/ld-mips-elf/sections-1-n64t.rd: New test.
* testsuite/ld-mips-elf/sections-2-o32.rd: New test.
* testsuite/ld-mips-elf/sections-2-o32t.rd: New test.
* testsuite/ld-mips-elf/sections-2-n32.rd: New test.
* testsuite/ld-mips-elf/sections-2-n32t.rd: New test.
* testsuite/ld-mips-elf/sections-2-n32p.rd: New test.
* testsuite/ld-mips-elf/sections-2-n64.rd: New test.
* testsuite/ld-mips-elf/sections-2-n64t.rd: New test.
* testsuite/ld-mips-elf/sections.s: New test source.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
18 files changed:
ld/emulparams/elf64bmip-defs.sh
ld/testsuite/ld-mips-elf/mips-elf.exp
ld/testsuite/ld-mips-elf/pie-n64.d
ld/testsuite/ld-mips-elf/sections-1-n32.rd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/sections-1-n32p.rd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/sections-1-n32t.rd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/sections-1-n64.rd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/sections-1-n64t.rd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/sections-1-o32.rd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/sections-1-o32t.rd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/sections-2-n32.rd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/sections-2-n32p.rd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/sections-2-n32t.rd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/sections-2-n64.rd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/sections-2-n64t.rd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/sections-2-o32.rd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/sections-2-o32t.rd [new file with mode: 0644]
ld/testsuite/ld-mips-elf/sections.s [new file with mode: 0644]