When your hft app gets way bigger than 2,147,483,647.
Vladimir Sakharuk • • 1 min read
Tried building a -no-pie binary with debug symbols and slammed into this gem:
Root cause: gcc’s 32-bit-sized start of constructors meeting a codebase that’s… not 32-bit-sized anymore.
Fix that worked:
Recompile GCC’s crtbegin.o and crtend.o with the large code model:
Overlay the toolchain in the app and dial the app back to medium:
Yes, I rebuilt parts of GCC. Yes, it actually helped to create 28 GB binary. Compiling toolchains by hand is an… immense kind of fun.
Takeaways
- Turning off PIE can surface gnarly relocation limits.
- Know your x86-64 code models: small/medium/large isn’t just trivia.
- Sometimes the only way out is through the CRT.