[PATCH] D57332: [RISCV] Allow parsing of bare symbols with offsets
James Clarke via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 18 22:13:29 PDT 2019
jrtc27 added a comment.
In D57332#1549661 <https://reviews.llvm.org/D57332#1549661>, @asb wrote:
> Is this being used in the wild and does it work sensibly with binutils? I'm seeing that binutils seems to be associating the addend with both the emitted R_RISCV_PCREL_HI20 relocation and R_RISCV_RELAX relocation. Maybe this is just a binutils bug and the addend is ignored by the linker but this does seem surprising...
>
> $ cat t.s
> lla a5, a_symbol + (0xFF << 3)
> $ ./riscv32-unknown-elf-as t.s
> $ ./riscv32-unknown-elf-readelf -r a.out
>
> Relocation section '.rela.text' at offset 0xec contains 4 entries:
> Offset Info Type Sym.Value Sym. Name + Addend
> 00000000 00000617 R_RISCV_PCREL_HI2 00000000 a_symbol + 7f8
> 00000000 00000033 R_RISCV_RELAX 7f8
> 00000004 00000418 R_RISCV_PCREL_LO1 00000000 .L0 + 0
> 00000004 00000033 R_RISCV_RELAX 0
>
Yes, FreeRTOS at least uses it, and we've had to manually patch the source to refer to just the bare symbol and follow it with an `addi` in order to support LLVM. The RELAX addend is probably a bug but I don't think it actually ever gets read.
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57332/new/
https://reviews.llvm.org/D57332
More information about the llvm-commits
mailing list