[PATCH v5] elf: Set image base address to the maximum page size

Alan Modra amodra@gmail.com
Mon Jun 29 23:39:34 GMT 2026


On Mon, Jun 29, 2026 at 11:40:53AM +0800, H.J. Lu wrote:
> 	PR ld/34184
> 	* ldexp.c (fold_binary): Set the default image base address to
> 	the maximum page size for ELF PDE output if it is lower than
> 	the maximum page size set on command-line and issue an warning
> 	if the image base address set on command-line is lower than the
> 	maximum page size.
> 	* testsuite/ld-elf/elf.exp: Add ld/34184 tests for PDE, PIE
> 	static PDE and static PIE.
> 	* testsuite/ld-elf/pr34184.c: New file.
> 	* testsuite/ld-elf/textaddr3.d: Change -Ttext-segment address
> 	to 0x200100 so that it > the maximum page size.
> 	* testsuite/ld-elf/textaddr5.d: Likewise.
> 	* testsuite/ld-elf/textaddr8.d: New test.
> 	* testsuite/ld-elf/textaddr9.d: Likewise.
> 	* testsuite/ld-elf/textaddr10.d: Likewise.

The testcases still introduce new failures.
alpha-linux-gnu  +FAIL: ld-elf/textaddr10
h8300-linux-gnu  +FAIL: ld-elf/textaddr8
microblaze-linux-gnu  +FAIL: ld-elf/textaddr10
microblaze-linux-gnu  +FAIL: ld-elf/textaddr9

alpha because the testsuite adds -Ttext-segment.  h8300 with a RWE
segment starting at 0x800000, combining .text and .data.  microblaze
also mashes .text and .data together.  None of these are your problem,
so the patch is OK.

-- 
Alan Modra


More information about the Binutils mailing list