mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-23 17:29:19 +00:00
ARM: correctly mangle dllimport symbols
Add support for tracking DLLImport storage class information on a per symbol basis in the ARM instruction selection. Use that information to correctly mangle the symbol (dllimport symbols are referenced via *__imp_<name>). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212430 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f12de41cee
commit
ecacffa147
@ -795,23 +795,41 @@ getModifierVariantKind(ARMCP::ARMCPModifier Modifier) {
|
||||
|
||||
MCSymbol *ARMAsmPrinter::GetARMGVSymbol(const GlobalValue *GV,
|
||||
unsigned char TargetFlags) {
|
||||
bool isIndirect = Subtarget->isTargetMachO() &&
|
||||
(TargetFlags & ARMII::MO_NONLAZY) &&
|
||||
Subtarget->GVIsIndirectSymbol(GV, TM.getRelocationModel());
|
||||
if (!isIndirect)
|
||||
return getSymbol(GV);
|
||||
if (Subtarget->isTargetMachO()) {
|
||||
bool IsIndirect = (TargetFlags & ARMII::MO_NONLAZY) &&
|
||||
Subtarget->GVIsIndirectSymbol(GV, TM.getRelocationModel());
|
||||
|
||||
// FIXME: Remove this when Darwin transition to @GOT like syntax.
|
||||
MCSymbol *MCSym = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
|
||||
MachineModuleInfoMachO &MMIMachO =
|
||||
MMI->getObjFileInfo<MachineModuleInfoMachO>();
|
||||
MachineModuleInfoImpl::StubValueTy &StubSym =
|
||||
GV->hasHiddenVisibility() ? MMIMachO.getHiddenGVStubEntry(MCSym) :
|
||||
MMIMachO.getGVStubEntry(MCSym);
|
||||
if (!StubSym.getPointer())
|
||||
StubSym = MachineModuleInfoImpl::
|
||||
StubValueTy(getSymbol(GV), !GV->hasInternalLinkage());
|
||||
return MCSym;
|
||||
if (!IsIndirect)
|
||||
return getSymbol(GV);
|
||||
|
||||
// FIXME: Remove this when Darwin transition to @GOT like syntax.
|
||||
MCSymbol *MCSym = getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
|
||||
MachineModuleInfoMachO &MMIMachO =
|
||||
MMI->getObjFileInfo<MachineModuleInfoMachO>();
|
||||
MachineModuleInfoImpl::StubValueTy &StubSym =
|
||||
GV->hasHiddenVisibility() ? MMIMachO.getHiddenGVStubEntry(MCSym)
|
||||
: MMIMachO.getGVStubEntry(MCSym);
|
||||
if (!StubSym.getPointer())
|
||||
StubSym = MachineModuleInfoImpl::StubValueTy(getSymbol(GV),
|
||||
!GV->hasInternalLinkage());
|
||||
return MCSym;
|
||||
} else if (Subtarget->isTargetCOFF()) {
|
||||
assert(Subtarget->isTargetWindows() &&
|
||||
"Windows is the only supported COFF target");
|
||||
|
||||
bool IsIndirect = (TargetFlags & ARMII::MO_DLLIMPORT);
|
||||
if (!IsIndirect)
|
||||
return getSymbol(GV);
|
||||
|
||||
SmallString<128> Name;
|
||||
Name = "__imp_";
|
||||
getNameWithPrefix(Name, GV);
|
||||
|
||||
return OutContext.GetOrCreateSymbol(Name);
|
||||
} else if (Subtarget->isTargetELF()) {
|
||||
return getSymbol(GV);
|
||||
}
|
||||
llvm_unreachable("unexpected target");
|
||||
}
|
||||
|
||||
void ARMAsmPrinter::
|
||||
|
@ -295,7 +295,12 @@ namespace ARMII {
|
||||
|
||||
/// MO_OPTION_MASK - Most flags are mutually exclusive; this mask selects
|
||||
/// just that part of the flag set.
|
||||
MO_OPTION_MASK = 0x7f,
|
||||
MO_OPTION_MASK = 0x3f,
|
||||
|
||||
/// MO_DLLIMPORT - On a symbol operand, this represents that the reference
|
||||
/// to the symbol is for an import stub. This is used for DLL import
|
||||
/// storage class indication on Windows.
|
||||
MO_DLLIMPORT = 0x40,
|
||||
|
||||
/// MO_NONLAZY - This is an independent flag, on a symbol operand "FOO" it
|
||||
/// represents a symbol which, if indirect, will get special Darwin mangling
|
||||
|
Loading…
Reference in New Issue
Block a user