When linking massive binaries that include Intel's prebuilt MKL static archive, relocation overflows occur because MKL's object files use LEA instructions with large negative addends that exceed the ±2 GiB limit of 32-bit PC-relative relocations. Since MKL can't be recompiled, a technique called 'linker pessimization' is introduced: the reverse of linker relaxation. Instead of shrinking instructions, a single opcode byte is changed (0x8D → 0x8B) to convert a LEA into a MOV, replacing a direct arithmetic computation with an indirect memory load through a nearby pointer slot. The pointer slot uses a 64-bit absolute R_X86_64_64 relocation that can address the full 64-bit address space without overflow. The fix requires three surgical changes to the object file: patching the opcode, creating a new .data.fixup section with the 64-bit pointer, and retargeting the original relocation. The trade-off is an extra memory load where pure arithmetic existed before.
Table of contents
The Problematic LEAThe Idea: Replace LEA with MOVVisualizing the ChangeImplementation DetailsSort: