[PATCH v2] bfd: Fix Solaris/x86 ELF_MAXPAGESIZE
Jan Beulich
jbeulich@suse.com
Tue Aug 19 07:38:24 GMT 2025
On 19.08.2025 09:23, Rainer Orth wrote:
> 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
>
> To fix this, on i386 it's sufficient to redefine ELF_MAXPAGESIZE. On
> x86_64, unlike i386, ELF_COMMONPAGESIZE is hardcoded as 0x1000, the
> default, so setting ELF_MAXPAGESIZE has no effect on ELF_P_ALIGN.
> Setting ELF_COMMONPAGESIZE to ELF_MAXPAGESIZE, too, fixes that and
> brings both target in sync.
>
> Tested on {i386,amd64}-pc-solaris2.11, {i686,x86_64}-pc-linux-gnu, and
> amd64-pc-freebsd14.0.
>
> Ok for trunk?
Okay with one further cosmetic adjustment: In the last hunk, please either
move your addition past ELF_MACHINE_CODE handling, or simply take the
opportunity and purge that (which was necessary at some point, but isn't
anymore, with L1OM and K1OM support removed).
Jan
More information about the Binutils
mailing list