[PATCH] bfd: Fix Solaris/x86 ELF_MAXPAGESIZE

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Fri Aug 15 12:45:55 GMT 2025
I noticed that the alignment of the .text and .data sections on
Solaris/x86 doesn't match what /bin/ld does: gld uses the original i386
psABI default of 0x1000, while Solaris has moved to larger values as can
be seen both in the Oracle Solaris 11.4 Linkers and Libraries Guide,
ch. 15, Program Loading and Dynamic Linking, p. 15-6 and the system
headers (<sys/elf_{i386,amd64}.h>) that have

#define	ELF_386_MAXPGSZ		0x10000
#define	ELF_AMD64_MAXPGSZ	0x100000	/* maximum page size */

while the Solaris/SPARC values are already correct.

#define	ELF_SPARC_MAXPGSZ	0x10000		/* maximum page size */
#define	ELF_SPARCV9_MAXPGSZ	0x100000

This patch fixes that.  While on i386 it's sufficient to redefine
ELF_MAXPAGESIZE, x86_64 uses ELF_P_ALIGN instead.

Tested on {i386,amd64}-pc-solaris2.11 and {i686,x86_64}-pc-linux-gnu.

Ok for trunk?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2025-07-29  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	bfd:
	* elf32-i386.c <elf32-i386-sol2> (ELF_MAXPAGESIZE): Redefine.
	<elf32-iamcu> (ELF_MAXPAGESIZE): Restore previous value.
	* elf64-x86-64.c <elf64-x86-64-sol2> (ELF_MAXPAGESIZE): Likewise.
	(ELF_P_ALIGN): Redefine as ELF_MAXPAGESIZE.
	<elf32-x86-64> (ELF_MAXPAGESIZE): Restore previous value.
	(ELF_P_ALIGN): Undef.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: solx86-bfd-elf_maxpagesize.patch
Type: text/x-patch
Size: 1536 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20250815/6095ed7d/attachment-0001.bin>


More information about the Binutils mailing list