[llvm-dev] llvm-mc assembler, GNU as, and pc-relative branches for Arm/AArch64/Mips
Rafael Avila de Espindola via llvm-dev
llvm-dev at lists.llvm.org
Wed Jan 10 09:45:08 PST 2018
Alex Bradbury via llvm-dev <llvm-dev at lists.llvm.org> writes:
> # Summary
>
> As a consequence of comparing the RISC-V LLVM MC assembler to the RISC-V GNU
> assembler I've noticed that a number of targets have quite different handling
> for pc-relative jumps/branches with immediate integer operands in llvm-mc vs
> GNU as. I'll admit that this isn't likely to occur in hand-written code (as
> you'd almost always prefer to use a label), but thought it was worth slightly
> wider discussion. See below for full details, but really it boils down to
> whether you treat an immediate offset to a pc-relative branch as an absolute
> target or a pc-relative offset to be directly encoded in the instruction.
It sounds like a bug. Note that for X86_64 we produce relocations like
gas:
jmp 0x123
produces
000000000001 000000000002 R_X86_64_PC32 11f
Cheers,
Rafael
More information about the llvm-dev
mailing list