Files
LithosAnanke/kernel/include/starkernel/pie_hidden.h
T
Claude 3bd81097e1 chore(license): an SPDX header on every source file that had none (LicenseRef-Starship-1.0) [skip ci]
The header scan (Captain Bob, 2026-11-10): 788 source files -- 351 with the
SL-1.0 header, 12 with the old name (docs/working/experiments, kept by
ruling), 31 under someone else's licence (tools/kconfig, Linux's, GPL-2.0:
kept), and 394 with none. Ruled: the SPDX form; capsules (.4th, .f18) and
proofs (.thy) left for a ruling of their own (mkcapsule's 64x16 block format,
content-addressed capsules).

253 files now begin
    SPDX-License-Identifier: LicenseRef-Starship-1.0
    Copyright (c) 2023-2026 Robert A. James
as a /* */ block (C, headers, assembly, linker scripts) or # lines (scripts,
Makefiles, Kconfig; below a shebang or a coding line); tools/mkcapsule.c,
which had the copyright line, gets the SPDX line only.

Not touched: docs/working/ (archive and old campaign material, as the
ruling kept the experiments); v4/system/post_cases.c (generated by
v4/tools/mkpost.py, "do not edit" -- the generator has the header).

Comments only: the kernel builds on amd64, aarch64, riscv64; make -C v4
test-32: 39 programs, 0 failures; every changed script parses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
2026-11-10 04:12:49 +00:00

31 lines
1.4 KiB
C

/* SPDX-License-Identifier: LicenseRef-Starship-1.0
* Copyright (c) 2023-2026 Robert A. James
*/
/*
* 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 */