The ld-elf.so.hints file contains binary data in the endianness of the respective architecture.
This is relevant for example when a file system image for an emulated CPU with a different byte order is prepared.
FreeBSD used to support several big-endian architectures, but only powerpc64 is of some relevance today.
The patch in this review changes the definition of the hints file to use little-endian values on all architectures.
It provides both a run-time linker rtld and a ldconfig command that support both endiannesses on all architectures, as a step towards using only little endian data.
The ldconfig command will create little-endian hints files unless invoked with the new -B option, which will enforce big-endian mode (and will check it when reading or merging).
This allows for example to create a powerpc64 file system image for stable releases that lack the run-time linker with support for both byte order schemes.
The support for big-endian hints files on little-endian architectures exists solely for testing purposes. There is a commented-out test in rtld that evaluates to a constant "true" value on little endian architectures and when activated will remove the support for big-endian hints files on little-endian systems, which results in all byte-swap macros to be eliminated (i.e., no code size or run-time overhead remains).
This patch is an intermediary step - when all supported releases support the new rtld, support for big-endian hint files can be removed.
This would involve the logical substitution of the force_be variable in all expression by a constant false value (i.e., the simplification of expressions and parameter lists).
The commented out test in the calculation of is_be in rtld should be activated as soon as sufficient testing has been performed and testing of the byte swap macro on amd64 is no longer considered necessary (i.e., when this review has been tested and is approved).