On Mon Jan 22 17:10:07 2024 +0000, Gabriel Ivăncescu wrote:
FWIW I believe the only three modules that have issues with this are:
- kernel32 (ExitProcess and for i386 the Interlocked* funcs)
- ntoskrnl (this MR)
- winecrt0 (setjmp.c but that can be compiled without LTO as a
workaround, though I'm not sure how hacky that would be) Since I've been able to get a successful build with some hacks for them. Of course some functions in other modules (ntdll) may need to be marked with `__attribute__((used))` because they're called only from asm funcs, but that's completely safe and a no-op normally so it's not a concern. From what I see those 3 modules are all PE, right? Just curious what exactly do you mean by "handle import libraries correctly", can you please elaborate a bit?
Import libraries are not regular static libs, they don't contain real code, so it wouldn't make sense to have them participate in LTO.