[llvm] [LoongArch] Support R_LARCH_{ADD, SUB}_ULEB128 for .uleb128 and force relocs when sym is not in section (PR #76433)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 1 06:43:12 PST 2024
================
@@ -226,21 +259,28 @@ bool LoongArchAsmBackend::handleAddSubRelocations(const MCAsmLayout &Layout,
uint64_t &FixedValue) const {
std::pair<MCFixupKind, MCFixupKind> FK;
uint64_t FixedValueA, FixedValueB;
- const MCSection &SecA = Target.getSymA()->getSymbol().getSection();
- const MCSection &SecB = Target.getSymB()->getSymbol().getSection();
-
- // We need record relocation if SecA != SecB. Usually SecB is same as the
- // section of Fixup, which will be record the relocation as PCRel. If SecB
- // is not same as the section of Fixup, it will report error. Just return
- // false and then this work can be finished by handleFixup.
- if (&SecA != &SecB)
- return false;
+ const MCSymbol &SA = Target.getSymA()->getSymbol();
+ const MCSymbol &SB = Target.getSymB()->getSymbol();
- // In SecA == SecB case. If the linker relaxation is enabled, we need record
- // the ADD, SUB relocations. Otherwise the FixedValue has already been
- // calculated out in evaluateFixup, return true and avoid record relocations.
- if (!STI.hasFeature(LoongArch::FeatureRelax))
- return true;
+ bool force = !SA.isInSection() || !SB.isInSection();
+
----------------
MaskRay wrote:
delete blank line
https://github.com/llvm/llvm-project/pull/76433
More information about the llvm-commits
mailing list