/* * pie_hidden.h -- every symbol in the amd64 image is the image's own. * * Force-included (-include) ahead of every amd64 kernel and loader source by * kernel/Makefile's ARCH_CFLAGS, together with -fpie. The image is one PE file, * linked by ld -m i386pep, loaded by the firmware wherever it chooses: a PC's * firmware puts it above 2 GiB (the Beelink SER5 did), where the 32-bit absolute * addresses of -fno-pic code are sign-extended into unmapped memory and the * loader page-faults before its first checkpoint (FABRIC-3.md XLIV). -fpie * addresses every global relative to RIP, which is right at any load address. * * -fpie alone is not enough: GCC treats an extern declaration of default * visibility as possibly defined in another module and reaches it through the * GOT. This image has no dynamic linker and ld -m i386pep builds no GOT, so * such a read returns zero -- the 2026-08-06 bug (FABRIC-0.md). -fvisibility= * hidden covers definitions only; this pragma covers declarations too, so GCC * never uses the GOT. (EDK2's GCC X64 ProcessorBind.h does the same.) * * The Makefile checks the result: the link fails if any object still carries * a GOT or 32-bit absolute relocation. */ #ifndef STARKERNEL_PIE_HIDDEN_H #define STARKERNEL_PIE_HIDDEN_H #pragma GCC visibility push(hidden) #endif /* STARKERNEL_PIE_HIDDEN_H */