[llvm] 65a8448 - Revert "[MC] Remove isThumbFunc special case"

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 13 08:43:36 PDT 2023


Author: Fangrui Song
Date: 2023-08-13T08:43:31-07:00
New Revision: 65a8448fbf4a8ca3c214f8e514ba86a953d42fb7

URL: https://github.com/llvm/llvm-project/commit/65a8448fbf4a8ca3c214f8e514ba86a953d42fb7
DIFF: https://github.com/llvm/llvm-project/commit/65a8448fbf4a8ca3c214f8e514ba86a953d42fb7.diff

LOG: 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.

Added: 
    

Modified: 
    llvm/lib/MC/MCExpr.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index 9d08fba378fb0e..a7b980553af055 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))


        


More information about the llvm-commits mailing list