git: 173953182af0 - main - rtld-elf: add some debug print statements
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 21 Mar 2024 15:34:18 UTC
The branch main has been updated by se: URL: https://cgit.FreeBSD.org/src/commit/?id=173953182af060dcab43990e179ee91e9f2d1e54 commit 173953182af060dcab43990e179ee91e9f2d1e54 Author: Stefan Eßer <se@FreeBSD.org> AuthorDate: 2024-03-21 15:31:49 +0000 Commit: Stefan Eßer <se@FreeBSD.org> CommitDate: 2024-03-21 15:31:49 +0000 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.. --- libexec/rtld-elf/rtld.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c index 4b6d19104343..fbf5b3e20a1f 100644 --- a/libexec/rtld-elf/rtld.c +++ b/libexec/rtld-elf/rtld.c @@ -2109,6 +2109,11 @@ cleanup1: return (NULL); } is_le = /*le32toh(1) == 1 || */ hdr.magic == ELFHINTS_MAGIC; + dbg("host byte-order: %s-endian", le32toh(1) == 1 ? "little" : "big"); + dbg("hints file byte-order: %s-endian", is_le ? "little" : "big"); + dbg("verify swap macros: le32toh(0x12345678) == %#010x, " + "be32toh(0x12345678) == %#010x", + le32toh(0x12345678), be32toh(0x12345678)); magic = COND_SWAP(hdr.magic); version = COND_SWAP(hdr.version); strtab = COND_SWAP(hdr.strtab);