The ldconfig command has traditionally only supported the hosts endianness.
This patch allows to specify the endianness of the hints file to be created, for example in order to update the hints for a non-native architecture in a qemu jail.
The options added to control the endianness of a new hints file are -64b and -64l (for big vs. little endian 64 bit architectures) respectively -32b and -32l for 32 bit.
This feature may be useful for the installation of packages in a non-native jail with the pkg command (which will have to pass the correct endianness option).
Details
Verify that there are no regressions executing the previously supported use cases.
Create a hints file using the options "-64b" and "-64l" on a big-endian and a little-endian CPU and check hex dumps for correctness of the created files. (-32b and -32l differ only with regard to the default hints file name, but that should be specified with -f for these tests, anyway.)
Updating a little-endian hints file with -64b and a big-endian hints file with -64l is expected to fail with an error message.
The -r option will ignore the forced endianness and will detect the endianness of the hints file.
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Update the patch to use a COND_SWAP macro to conditionally reverse the byte order of the passed 32 bit integer value.
No functional change relative to the previous patch - but IMHO much easier to review and maintain in case of further changes.
Small fix: if there was no hints file in the "merge" case ("-R" or "-m" option used), the requested endianness could be ignored.
Also a clarification with regard to the "-R" option: it is only implied if there are no file or directory arguments.
The "-m" and "-R" options give completely identical results, BTW. This is not made obvious in the man-page.
"-R" could be described as just an alias of "-m" (merging with no additional files/directories results in a rescan).
A version based on these patches (but with slightly different command line options) has been discussed and accepted in review D44093.