https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116642
--- Comment #28 from Xi Ruoyao <xry111 at gcc dot gnu.org> --- (In reply to Xi Ruoyao from comment #27) > Build your program as a static PIE and use assembly (or a very limited C > subset) to relocate itself on startup. In a static PIE there are only > relative relocs, and it's fairly easy to handle relative relocs even in > assembly. All other implementations (Glibc, Musl, and Linux kernel with KASLR enabled on modern architectures like RISC-V) do this, instead of urging the compiler to add some feature to disable all relocs. And sorry, your implementation is not more important than them so it's a no-go to add burdens to the compiler just for your case.