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

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 22 00:45:53 PST 2023


smithp35 wrote:

Apologies I'm going to be away from a work computer for the next couple of weeks due to holiday, can only leave a few comments for now. 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. Either the assembler is not writing out the object file correctly, or the linker is not resolving the relocation correctly. Are you able to help with a reproducer either for the assembler or the linker? I think Free BSD uses lld as the linker?

I agree that it would be good to have the relocation resolved at assembly time if in the same section. From memory this wasn't easy to do for just these relocations in https://github.com/llvm/llvm-project/blob/main/llvm/lib/MC/MCAssembler.cpp#L248.  Looking at the history of this problem, there is an epic thread in https://reviews.llvm.org/D72892 which looks like it involved these same BSD source files.

While I think doing the extra work to either emit an error message or do the fixup (for just these relocations when the fixup is in the same section) is possible. Given that the assembler/linker combination should work, I'd prefer to get to the bottom of why this case is failing first.

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


More information about the llvm-commits mailing list