mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-25 13:24:46 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user