llvm-project
290279b6 - [ARM] Use .reloc for weak symbols in PIC mode instead of GOT indirection (#208372)

Commit
3 days ago
[ARM] Use .reloc for weak symbols in PIC mode instead of GOT indirection (#208372) In ARM ELF PIC mode, weak symbols referenced via the constant pool use a PC-relative expression like `.long sym-(.LPC+8)`. The assembler eagerly resolves this when both the symbol and reference are in the same section, which prevents the linker from overriding a weak definition with a strong one from another object file. The previous approach (#198577) forced weak symbols to go through GOT indirection to avoid this, but that adds an extra load. This patch instead emits a `.reloc` directive alongside the local PC-relative expression, forcing the assembler to emit a proper `R_ARM_REL32` relocation. This lets the linker perform the override without the runtime cost of a GOT load.
Parents
Loading