]> granicus.if.org Git - llvm/commit
[RISCV] Don't evaluatePCRelLo if a relocation will be forced (e.g. due to linker...
authorAlex Bradbury <asb@lowrisc.org>
Mon, 1 Apr 2019 02:38:27 +0000 (02:38 +0000)
committerAlex Bradbury <asb@lowrisc.org>
Mon, 1 Apr 2019 02:38:27 +0000 (02:38 +0000)
commitdef747f20c2a57ce93ac4aa32d663a4c9df8302c
tree3908f04952039816229d2457d427461e274f64ac
parenta11754154dd7127effc5c68f3808755e5b29e46b
[RISCV] Don't evaluatePCRelLo if a relocation will be forced (e.g. due to linker relaxation)

A pcrel_lo will point to the associated pcrel_hi fixup which in turn points to
the real target. RISCVMCExpr::evaluatePCRelLo will work around this
indirection in order to allow the fixup to be evaluate properly. However, if
relocations are forced (e.g. due to linker relaxation is enabled) then its
evaluation is undesired and will result in a relocation with the wrong target.

This patch modifies evaluatePCRelLo so it will not try to evaluate if the
fixup will be forced as a relocation. A new helper method is added to
RISCVAsmBackend to query this.

Differential Revision: https://reviews.llvm.org/D59686

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@357374 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.h
lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.cpp
test/MC/RISCV/linker-relaxation.s
test/MC/RISCV/option-relax.s