Linker thunks (trampolines) offer a solution for building huge static binaries beyond 2GiB on x86_64 without switching to the large code model. While architectures like AArch64 already use thunks due to instruction size limitations, x86_64 lacks this support despite its potential benefits. Thunks allow most code to remain in the efficient small code model by inserting intermediate jumps only where needed, similar to how PLT works for dynamic linking. This approach could enable massive static binaries while avoiding the instruction bloat and performance penalties of large code models, though it requires extending LLVM's linker to support thunks for x86_64 CALL instructions and GOT access patterns.

5m read timeFrom fzakaria.com
Post cover image

Sort: