[llvm] [llvm][MC][ARM][Assembly] Emit relocations for ADRs and big-endian targets (PR #73834)

via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 22 04:49:08 PST 2023


bd1976bris wrote:

> In theory the assembler fixup and the linker relocation are semantically identical, the linker is expected to convert the add into a sub and vice-versa regardless of what the object file uses (https://github.com/llvm/llvm-project/blob/main/lld/ELF/Arch/ARM.cpp#L467C25). If there is an out of range error then something else may have gone wrong. 

Actually, I want to clarify that the error I saw reported was:

```
error: relocation R_ARM_ALU_PC_G0 cannot be used against symbol 'cachebailout'; recompile with -fPIC
>>> defined in cpu_asm-v6.S.obj
>>> referenced by cpu_asm-v6.S:(cpu_asm-v6.S)
>>>               cpu_asm-v6.S.obj:(dcache_wb_pou_checked)
```

Given that, as you pointed out, the relocation patching in LLD should be equivalent to the assembler resolving the reference this could be caused by user error on my part.

https://github.com/llvm/llvm-project/pull/73834


More information about the llvm-commits mailing list