[PATCH] D57332: [RISCV] Allow parsing of bare symbols with offsets

Alex Bradbury via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 18 21:28:18 PDT 2019


asb added a comment.
Herald added subscribers: Jim, benna, psnobl.
Herald added a project: LLVM.

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


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