summaryrefslogtreecommitdiff
path: root/lib/MC/MCAssembler.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2010-12-14 18:46:57 +0000
committerJim Grosbach <grosbach@apple.com>2010-12-14 18:46:57 +0000
commit475002078848d102b6577fe7283464c039b38af6 (patch)
tree91badba54354d556dee83f21897d00ab10db48af /lib/MC/MCAssembler.cpp
parentd84de8cf62991597c15e948ecb121ad0233ba4ec (diff)
downloadllvm-475002078848d102b6577fe7283464c039b38af6.tar.gz
llvm-475002078848d102b6577fe7283464c039b38af6.tar.bz2
llvm-475002078848d102b6577fe7283464c039b38af6.tar.xz
ARM Fixups relative to thumb functions need to have the low bit of the value
set for interworking to work properly. rdar://8755956 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121778 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCAssembler.cpp')
-rw-r--r--lib/MC/MCAssembler.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp
index 319f04cfe7..5bc477d7bc 100644
--- a/lib/MC/MCAssembler.cpp
+++ b/lib/MC/MCAssembler.cpp
@@ -235,12 +235,15 @@ bool MCAssembler::EvaluateFixup(const MCObjectWriter &Writer,
bool IsPCRel = Emitter.getFixupKindInfo(
Fixup.getKind()).Flags & MCFixupKindInfo::FKF_IsPCRel;
bool IsResolved = true;
+ bool IsThumb = false;
if (const MCSymbolRefExpr *A = Target.getSymA()) {
const MCSymbol &Sym = A->getSymbol().AliasedSymbol();
if (Sym.isDefined())
Value += Layout.getSymbolOffset(&getSymbolData(Sym));
else
IsResolved = false;
+ if (isThumbFunc(&Sym))
+ IsThumb = true;
}
if (const MCSymbolRefExpr *B = Target.getSymB()) {
const MCSymbol &Sym = B->getSymbol().AliasedSymbol();
@@ -263,6 +266,13 @@ bool MCAssembler::EvaluateFixup(const MCObjectWriter &Writer,
Value -= Layout.getFragmentOffset(DF) + Fixup.getOffset();
}
+ // 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)
+ Value |= 1;
+
return IsResolved;
}