diff options
author | Jinyang He <hejinyang@loongson.cn> | 2023-12-20 10:54:51 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-20 10:54:51 +0800 |
commit | a8081ed8ff0fd11fb8d5f4c83df49da909e49612 (patch) | |
tree | e48280252b9702cdee02ca66765ba7dd17895fa4 /llvm/lib/MC/MCExpr.cpp | |
parent | e6a7175c6d72e8c50534cb5494d2d2542e011fe5 (diff) | |
download | llvm-a8081ed8ff0fd11fb8d5f4c83df49da909e49612.zip llvm-a8081ed8ff0fd11fb8d5f4c83df49da909e49612.tar.gz llvm-a8081ed8ff0fd11fb8d5f4c83df49da909e49612.tar.bz2 |
[LoongArch] Allow delayed decision for ADD/SUB relocations (#72960)
Refer to RISCV [1], LoongArch also need delayed decision for ADD/SUB
relocations. In handleAddSubRelocations, just return directly if SecA !=
SecB, handleFixup usually will finish the the rest of creating PCRel
relocations works. Otherwise we emit relocs depends on whether
relaxation is enabled. If not, we return true and avoid record ADD/SUB
relocations.
Now the two symbols separated by alignment directive will return without
folding symbol offset in AttemptToFoldSymbolOffsetDifference, which has
the same effect when relaxation is enabled.
[1] https://reviews.llvm.org/D155357
Diffstat (limited to 'llvm/lib/MC/MCExpr.cpp')
-rw-r--r-- | llvm/lib/MC/MCExpr.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp index 73e6569..061f2ad 100644 --- a/llvm/lib/MC/MCExpr.cpp +++ b/llvm/lib/MC/MCExpr.cpp @@ -632,7 +632,8 @@ static void AttemptToFoldSymbolOffsetDifference( // instructions and InSet is false (not expressions in directive like // .size/.fill), disable the fast path. if (Layout && (InSet || !SecA.hasInstructions() || - !Asm->getContext().getTargetTriple().isRISCV())) { + !(Asm->getContext().getTargetTriple().isRISCV() || + Asm->getContext().getTargetTriple().isLoongArch()))) { // If both symbols are in the same fragment, return the difference of their // offsets. canGetFragmentOffset(FA) may be false. if (FA == FB && !SA.isVariable() && !SB.isVariable()) { |