[PATCH] D102712: BPF: Add more relocation kinds
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 21 14:59:55 PDT 2021
MaskRay added inline comments.
================
Comment at: llvm/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp:45
llvm_unreachable("invalid fixup kind!");
- case FK_SecRel_8:
+ case FK_SecRel_4:
+ // LD_imm64 instruction.
----------------
yonghong-song wrote:
> yonghong-song wrote:
> > MaskRay wrote:
> > > FK_SecRel_4 is used by PE-COFF to represent SECREL relocation types.
> > >
> > > "The 32-bit offset of the target from the beginning of its section. This is used to support debugging information and static thread local storage."
> > >
> > > Why does it map to a regular looking R_BPF_64_64?
> > In AMDGPU/MCTargetDesc/R600MCCodeEmitter.cpp, I see
> > ```
> > Fixups.push_back(MCFixup::create(offset, MO.getExpr(), FK_SecRel_4, MI.getLoc()));
> > ```
> > It looks like backend can choose create a MCFixup with FK_SecRel_4. Do we have restrictions that we have to use a different one? Use FK_SecRel_4 seems a good fit here as only 4 bytes are permitted to write anyway.
> I can certainly go back with FK_SecRel_8, but want to understand why I cannot use FK_SecRel_4.
My concern here is that `FK_SecRel_*` is no overloaded for entirely different semantics. Other targets use different variant kinds for such cases.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102712/new/
https://reviews.llvm.org/D102712
More information about the llvm-commits
mailing list