[PATCH] D45181: [RISCV] Add diff relocation support for RISC-V

Hsiangkai Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 09:07:14 PDT 2019


HsiangKai added a comment.

In D45181#1470189 <https://reviews.llvm.org/D45181#1470189>, @jrtc27 wrote:

> The problem is that `Length` is the length of the CIE, i.e. the data structure itself; this means it isn't subject to relaxations and so the difference expression can be folded. I don't see much merit in teaching all the tools out there to check relocations for `Length` when we can instead just emit the "right" thing. I think the fix is to make sure we only return true from `requiresDiffExpressionRelocations` if a target is in a code section? `MCSection::UseCodeAlign` will tell you this (or you can use `MCSectionELF::getFlags() & ELF::SHF_EXECINSTR` to be less general), though perhaps it should be renamed to `isCodeSection` to match `isVirtualSection`.


Use SHF_EXECINSTR flag may be not enough. Several debug information sections also need relocations. For example, although it has no need to generate relocations for `Length` in FDE, it needs relocations for `Address Range` in FDE. These two attributes are located in the same section and the section has no SHF_EXECINSTR flag.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D45181/new/

https://reviews.llvm.org/D45181





More information about the llvm-commits mailing list