Mysterious `d4d4` Instructions in LLD: Not a Trap, But a Conditional Branch
2025-08-21
A programmer discovered numerous `d4d4` instructions in disassembled ARM code, always unreachable and identified by LLVM's objdump as a relative branch to -0x58. Experiments and analysis revealed these weren't added by the LLVM compiler, but by the LLD linker during object file boundary alignment. LLD uses `d4d4` as padding, intending it as a trap instruction. However, it's actually a conditional branch, acting as a relative jump in the Thumb instruction set. This seems like an LLD bug; it's not a true trap, potentially causing unpredictable jumps. The GNU linker uses zeros for padding, avoiding this issue.
Development