HomeFreeBSD

rtld-elf: support either byte-order of hints file

Description

rtld-elf: support either byte-order of hints file

Accept either little-endian or big-endian representation of the ELF
hints magic number in the header of a hints file and convert the
parameters to the native byte-order of the repsective system.

This is a pre-requisite for a planned change to always write the byte
order in little-endian format on all architectures. The only relvant
architecture that uses big-endian data is powerpc64, and it is not
likely that new architectures will choose that representation of data
in memory.

When all supported architectures use little-endian data in the hints
file, the byte swap logic can be enabled for big-endian CPUs at
compile time. Up to that point, there is a very small run-time penalty
that is paid on all systems to check the byte-order of the hints file
and to provide the option to byte-swap the parameters read from the
hints file header.

This commit contains the changes from review D44080 (which had been
split off from this patch for easier review),

Reviewed by: kib
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D44053

Details

Provenance
seAuthored on Feb 26 2024, 10:18 PM
Reviewer
kib
Differential Revision
D44053: Architecture independent ld-elf.so.hints file
Parents
rG975d7730828a: kern: fix panic with disabled ttys
Branches
Unknown
Tags
Unknown