mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-24 22:24:54 +00:00
ARM: Resolve thumb_bl fixup in same MCFragment.
In Thumb1 mode, bl instruction might be selected for branches between basic blocks in the function if the offset is greater than 2KB. However, this might cause SEGV because the destination symbol is not marked as thumb function and the execution mode will be reset to ARM mode. Since we are sure that these symbols are in the same data fragment, we can simply resolve these local symbols, and don't emit any relocation information for this bl instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200842 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -565,11 +565,18 @@ void ARMAsmBackend::processFixupValue(const MCAssembler &Asm,
|
||||
Value |= 1;
|
||||
}
|
||||
}
|
||||
// For Thumb1 BL instruction, it is possible to be a long jump between
|
||||
// the basic blocks of the same function. Thus, we would like to resolve
|
||||
// the offset when the destination has the same MCFragment.
|
||||
if (A && (unsigned)Fixup.getKind() == ARM::fixup_arm_thumb_bl) {
|
||||
const MCSymbol &Sym = A->getSymbol().AliasedSymbol();
|
||||
MCSymbolData &SymData = Asm.getSymbolData(Sym);
|
||||
IsResolved = (SymData.getFragment() == DF);
|
||||
}
|
||||
// We must always generate a relocation for BL/BLX instructions if we have
|
||||
// a symbol to reference, as the linker relies on knowing the destination
|
||||
// symbol's thumb-ness to get interworking right.
|
||||
if (A && ((unsigned)Fixup.getKind() == ARM::fixup_arm_thumb_blx ||
|
||||
(unsigned)Fixup.getKind() == ARM::fixup_arm_thumb_bl ||
|
||||
(unsigned)Fixup.getKind() == ARM::fixup_arm_blx ||
|
||||
(unsigned)Fixup.getKind() == ARM::fixup_arm_uncondbl ||
|
||||
(unsigned)Fixup.getKind() == ARM::fixup_arm_condbl))
|
||||
|
Reference in New Issue
Block a user