freebsd-src/libexec
Stefan Eßer f61d786c29 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

(cherry picked from commit 7b77d37a56)

rtld-elf: add some debug print statements

The byte-order independent code has been reported to fail on powerpc64.
Add some more debug statements to help identify the parametrs used and
to verify the correct operation of the byte-swap macros used..

(cherry picked from commit 173953182a)

rtld: fix check for endianess of elf hints file

Don't check if the elf hints file is in host byte order, but check
if it is in little endian by looking at the magic number.
This fixes rtld on big endian platforms.

Reviewed by:	se, kib (prior version of the patch)
Fixes:		7b77d37a56 ("rtld-elf: support either byte-order of hints")
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D44472

(cherry picked from commit da2d6e2815)

rtld: reduce debug messages after fix on big-endian hosts

Remove a debug message that had been added to support the debugging
of a mis-detection of the hint files endianness on powerpc64.

MFC after:	3 days

(cherry picked from commit c44bf7d2e9)
2024-03-29 07:43:52 +01:00
..
atf Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
atrun Purge more stray embedded $FreeBSD$ strings 2023-10-24 11:13:18 -07:00
blacklistd-helper Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
bootpd bootpd(8): Fix a typo in a source code comment 2024-01-25 07:50:46 +01:00
comsat Purge more stray embedded $FreeBSD$ strings 2023-10-24 11:13:18 -07:00
dma Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
fingerd Purge more stray embedded $FreeBSD$ strings 2023-10-24 11:13:18 -07:00
flua Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
ftpd ftpd: add deprecation notice 2023-09-14 10:48:24 +01:00
getty Purge more stray embedded $FreeBSD$ strings 2023-10-24 11:13:18 -07:00
hyperv Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
mail.local Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
makewhatis.local Remove $FreeBSD$: two-line nroff pattern 2023-08-23 11:43:31 -06:00
mknetid Purge more stray embedded $FreeBSD$ strings 2023-10-24 11:13:18 -07:00
phttpget Remove $FreeBSD$: two-line nroff pattern 2023-08-23 11:43:31 -06:00
pppoed Remove $FreeBSD$: two-line nroff pattern 2023-08-23 11:43:31 -06:00
rbootd Purge more stray embedded $FreeBSD$ strings 2023-10-24 11:13:18 -07:00
rc leapseconds: Update to the canonical place. 2024-02-07 22:15:47 -07:00
revnetgroup Purge more stray embedded $FreeBSD$ strings 2023-10-24 11:13:18 -07:00
rpc.rquotad Remove $FreeBSD$: two-line nroff pattern 2023-08-23 11:43:31 -06:00
rpc.rstatd Purge more stray embedded $FreeBSD$ strings 2023-10-24 11:13:18 -07:00
rpc.rusersd Purge more stray embedded $FreeBSD$ strings 2023-10-24 11:13:18 -07:00
rpc.rwalld Remove $FreeBSD$: two-line nroff pattern 2023-08-23 11:43:31 -06:00
rpc.sprayd Purge more stray embedded $FreeBSD$ strings 2023-10-24 11:13:18 -07:00
rtld-elf rtld-elf: support either byte-order of hints file 2024-03-29 07:43:52 +01:00
rtld-elf32 Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
save-entropy Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
smrsh Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
talkd Purge more stray embedded $FreeBSD$ strings 2023-10-24 11:13:18 -07:00
tcpd Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
telnetd Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
tests Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
tftp-proxy Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
tftpd Remove $FreeBSD$: one-line nroff pattern 2023-08-23 11:43:32 -06:00
ulog-helper Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
ypxfr Remove $FreeBSD$: two-line nroff pattern 2023-08-23 11:43:31 -06:00
Makefile Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
Makefile.amd64 Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
Makefile.i386 Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
Makefile.inc Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00