aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/MC/MCExpr.cpp
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2023-08-13 08:43:31 -0700
committerFangrui Song <i@maskray.me>2023-08-13 08:43:31 -0700
commit65a8448fbf4a8ca3c214f8e514ba86a953d42fb7 (patch)
treecd2e6fb418c92acfb8537ea7cf3686733b69ec4d /llvm/lib/MC/MCExpr.cpp
parent91157a0b260b1844914387a135ea4997c21eae00 (diff)
downloadllvm-65a8448fbf4a8ca3c214f8e514ba86a953d42fb7.zip
llvm-65a8448fbf4a8ca3c214f8e514ba86a953d42fb7.tar.gz
llvm-65a8448fbf4a8ca3c214f8e514ba86a953d42fb7.tar.bz2
Revert "[MC] Remove isThumbFunc special case"
This reverts commit 8ee6c0ea0bf30f1f1da6b49ee720b933f9676a30. The untested special case is used as a workaround that we don't force emitting R_ARM_REL32 relocations like GNU assembler's arm port: `TC_FORCE_RELOCATION_SUB_SAME`. We shall investigate how to emit R_ARM_REL32.
Diffstat (limited to 'llvm/lib/MC/MCExpr.cpp')
-rw-r--r--llvm/lib/MC/MCExpr.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index 9d08fba..a7b9805 100644
--- a/llvm/lib/MC/MCExpr.cpp
+++ b/llvm/lib/MC/MCExpr.cpp
@@ -606,6 +606,11 @@ static void AttemptToFoldSymbolOffsetDifference(
return;
auto FinalizeFolding = [&]() {
+ // Pointers to Thumb symbols need to have their low-bit set to allow
+ // for interworking.
+ if (Asm->isThumbFunc(&SA))
+ Addend |= 1;
+
// If symbol is labeled as micromips, we set low-bit to ensure
// correct offset in .gcc_except_table
if (Asm->getBackend().isMicroMips(&SA))