Issue: sys-boot/lilo-24.2 fails to compile.
Discovered on: amd64 (internal ref: tinderbox)
This machine uses a clang/LLVM toolchain.
If you think that this issue is strictly related to clang/LLVM please block bug 408963. If you think that this issue is strictly related to the LLD linker, please block bug 731004.
This machine uses also GLIBC-2.32. If you think that this issue is strictly related to GLIBC please block bug 736174.
Created attachment 659817 [details]
build log and emerge --info
Created attachment 713217 [details, diff]
Patch to move the pointer calculation to runtime
I am not convinced that the attached patch fully resolves the issue. The patch makes the runtime calculation only happen in function `bmp_file_open', but the 'lh' pointer is also accessed in `bmp_file_close' and `main'.
Some quick research suggests two possible solutions:
- Remove the 'static' initializer from the 'lh' definition, per this StackOverflow answer: https://stackoverflow.com/a/34450315/ and this commit in someone's personal repo: https://git.sr.ht/~kqz/repo/commit/b8808d8
- Change the assignment to the following code, sourced from a Reddit comment on making lilo build with clang and musl:
(void*)((char*)&tm + (offsetof(MENUTABLE, row) - offsetof(BITMAPLILOHEADER, row)))
I don't have a working clang compiler installation, so I cannot reliably test either of these solutions (gcc-11 seems content with either of them).