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