]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
rtld-elf: support either byte-order of hints file
authorStefan Eßer <se@FreeBSD.org>
Mon, 26 Feb 2024 22:18:12 +0000 (23:18 +0100)
committerStefan Eßer <se@FreeBSD.org>
Mon, 26 Feb 2024 22:18:12 +0000 (23:18 +0100)
commit7b77d37a561b47db093a2528b8032dbfe5791698
tree44ce006cd79986dfe795e6857660db609a811fe2
parent975d7730828a8bde28c2a0092b6e95c4c4e22f34
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
libexec/rtld-elf/rtld.c