summaryrefslogtreecommitdiff
path: root/lib/MC/MCAssembler.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2011-11-28 23:39:00 +0000
committerJim Grosbach <grosbach@apple.com>2011-11-28 23:39:00 +0000
commit958da85b937a26f47eb2412e6e05656b93c07066 (patch)
tree553d0d7ff0ff7b86fbf236510863ee977375fbaa /lib/MC/MCAssembler.cpp
parent54b92113e227db1d982172df18c4ad5058aae4e9 (diff)
downloadllvm-958da85b937a26f47eb2412e6e05656b93c07066.tar.gz
llvm-958da85b937a26f47eb2412e6e05656b93c07066.tar.bz2
llvm-958da85b937a26f47eb2412e6e05656b93c07066.tar.xz
Thumb2 only force the fixup thumb bit for data relocations.
rdar://10493453 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145318 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCAssembler.cpp')
-rw-r--r--lib/MC/MCAssembler.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp
index 29adbcbc7f..802bb8e74b 100644
--- a/lib/MC/MCAssembler.cpp
+++ b/lib/MC/MCAssembler.cpp
@@ -273,13 +273,17 @@ bool MCAssembler::EvaluateFixup(const MCAsmLayout &Layout,
Value = Target.getConstant();
- bool IsThumb = false;
+ bool SetThumbBit = false;
if (const MCSymbolRefExpr *A = Target.getSymA()) {
const MCSymbol &Sym = A->getSymbol().AliasedSymbol();
if (Sym.isDefined())
Value += Layout.getSymbolOffset(&getSymbolData(Sym));
- if (isThumbFunc(&Sym))
- IsThumb = true;
+ // ARM data fixups based from a thumb function address need to have the low
+ // bit set. The actual value is always at least 16-bit aligned, so the
+ // low bit is normally clear and available for use as an ISA flag for
+ // interworking.
+ if (Fixup.getKind() == FK_Data_4 && isThumbFunc(&Sym))
+ SetThumbBit = true;
}
if (const MCSymbolRefExpr *B = Target.getSymB()) {
const MCSymbol &Sym = B->getSymbol().AliasedSymbol();
@@ -302,11 +306,7 @@ bool MCAssembler::EvaluateFixup(const MCAsmLayout &Layout,
Value -= Offset;
}
- // ARM fixups based from a thumb function address need to have the low
- // bit set. The actual value is always at least 16-bit aligned, so the
- // low bit is normally clear and available for use as an ISA flag for
- // interworking.
- if (IsThumb)
+ if (SetThumbBit)
Value |= 1;
return IsResolved;