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
This commit is contained in:
Jim Grosbach
2010-12-14 18:46:57 +00:00
parent d84de8cf62
commit 4750020788
3 changed files with 32 additions and 0 deletions

View File

@@ -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;
}