[PATCH] D127549: RISCV: handle 64-bit PCREL data relocations

Saleem Abdulrasool via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 10 16:00:14 PDT 2022


compnerd created this revision.
compnerd added reviewers: craig.topper, luismarques.
compnerd added a project: LLVM.
Herald added subscribers: sunshaoce, VincentWu, luke957, StephenFan, vkmr, frasercrmck, evandro, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, arichardson.
Herald added a project: All.
compnerd requested review of this revision.
Herald added subscribers: pcwang-thead, eopXD, MaskRay.

We would previously fail to handle 64-bit PC-relative relocations on
RISCV.  This was exposed by trying to build with
`-fprofile-instr-generate`.  The original changes restricted the
relocation handling to the text segment as the paired relocations to be
relaxed by the linker were undesirable in the debug and eh_frame
sections.  We now make this explicit to handle the general case for the
data relocations as well.  There is a small optimization here that is
missing: when building in the compact code model, we should relax this
pair-wise relocation to a R_RISCV_<SIZEOF_VOID_P>_PCREL type relocation.

Fixes: #55971


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127549

Files:
  llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp
  llvm/test/MC/RISCV/instr-profile.s

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127549.436068.patch
Type: text/x-patch
Size: 5013 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220610/efcdeeac/attachment.bin>


More information about the llvm-commits mailing list