summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2015-06-09 22:09:53 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2015-06-09 22:09:53 +0000
commit9fe51fdf184df8030f98ec70d5349e7bcd75e0f2 (patch)
tree7bc46c48941959ba9d92d9615b311e568562ed0c /llvm/lib
parentbd1cb792d32c28e887387611fc0aba8638a32756 (diff)
downloadbcm5719-llvm-9fe51fdf184df8030f98ec70d5349e7bcd75e0f2.tar.gz
bcm5719-llvm-9fe51fdf184df8030f98ec70d5349e7bcd75e0f2.zip
Move dllimport name mangling to IR mangler.
This ensures that LTO clients see the correct external symbol name. Differential Revision: http://reviews.llvm.org/D10318 llvm-svn: 239437
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/IR/Mangler.cpp4
-rw-r--r--llvm/lib/Target/ARM/ARMAsmPrinter.cpp11
-rw-r--r--llvm/lib/Target/ARM/ARMISelLowering.cpp9
-rw-r--r--llvm/lib/Target/ARM/MCTargetDesc/ARMBaseInfo.h7
-rw-r--r--llvm/lib/Target/X86/X86AsmPrinter.cpp5
-rw-r--r--llvm/lib/Target/X86/X86MCInstLower.cpp4
6 files changed, 8 insertions, 32 deletions
diff --git a/llvm/lib/IR/Mangler.cpp b/llvm/lib/IR/Mangler.cpp
index a0e1b25056c..1c8f01abb60 100644
--- a/llvm/lib/IR/Mangler.cpp
+++ b/llvm/lib/IR/Mangler.cpp
@@ -112,6 +112,10 @@ void Mangler::getNameWithPrefix(raw_ostream &OS, const GlobalValue *GV,
return;
}
+ // dllimported symbols have a __imp_ prefix.
+ if (GV->hasDLLImportStorageClass())
+ OS << "__imp_";
+
StringRef Name = GV->getName();
char Prefix = DL->getGlobalPrefix();
diff --git a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
index d84f2961d81..ac68a064fbd 100644
--- a/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
+++ b/llvm/lib/Target/ARM/ARMAsmPrinter.cpp
@@ -851,16 +851,7 @@ MCSymbol *ARMAsmPrinter::GetARMGVSymbol(const GlobalValue *GV,
} 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);
+ return getSymbol(GV);
} else if (Subtarget->isTargetELF()) {
return getSymbol(GV);
}
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index 2cfbc39a05b..28069cea5c0 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -1751,11 +1751,8 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
} else if (Subtarget->isTargetCOFF()) {
assert(Subtarget->isTargetWindows() &&
"Windows is the only supported COFF target");
- unsigned TargetFlags = GV->hasDLLImportStorageClass()
- ? ARMII::MO_DLLIMPORT
- : ARMII::MO_NO_FLAG;
Callee = DAG.getTargetGlobalAddress(GV, dl, getPointerTy(), /*Offset=*/0,
- TargetFlags);
+ ARMII::MO_NO_FLAG);
if (GV->hasDLLImportStorageClass())
Callee = DAG.getLoad(getPointerTy(), dl, DAG.getEntryNode(),
DAG.getNode(ARMISD::Wrapper, dl, getPointerTy(),
@@ -2646,8 +2643,6 @@ SDValue ARMTargetLowering::LowerGlobalAddressWindows(SDValue Op,
"Windows on ARM expects to use movw/movt");
const GlobalValue *GV = cast<GlobalAddressSDNode>(Op)->getGlobal();
- const ARMII::TOF TargetFlags =
- (GV->hasDLLImportStorageClass() ? ARMII::MO_DLLIMPORT : ARMII::MO_NO_FLAG);
EVT PtrVT = getPointerTy();
SDValue Result;
SDLoc DL(Op);
@@ -2658,7 +2653,7 @@ SDValue ARMTargetLowering::LowerGlobalAddressWindows(SDValue Op,
// operands, expand this into two nodes.
Result = DAG.getNode(ARMISD::Wrapper, DL, PtrVT,
DAG.getTargetGlobalAddress(GV, DL, PtrVT, /*Offset=*/0,
- TargetFlags));
+ ARMII::MO_NO_FLAG));
if (GV->hasDLLImportStorageClass())
Result = DAG.getLoad(PtrVT, DL, DAG.getEntryNode(), Result,
MachinePointerInfo::getGOT(), false, false, false, 0);
diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMBaseInfo.h b/llvm/lib/Target/ARM/MCTargetDesc/ARMBaseInfo.h
index 4289a73e9d6..6c8f0ea34a0 100644
--- a/llvm/lib/Target/ARM/MCTargetDesc/ARMBaseInfo.h
+++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMBaseInfo.h
@@ -297,17 +297,12 @@ namespace ARMII {
/// just that part of the flag set.
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
/// as a non-lazy-ptr indirect symbol (i.e. "L_FOO$non_lazy_ptr"). Can be
/// combined with MO_LO16, MO_HI16 or MO_NO_FLAG (in a constant-pool, for
/// example).
- MO_NONLAZY = 0x80,
+ MO_NONLAZY = 0x40,
// It's undefined behaviour if an enum overflows the range between its
// smallest and largest values, but since these are |ed together, it can
diff --git a/llvm/lib/Target/X86/X86AsmPrinter.cpp b/llvm/lib/Target/X86/X86AsmPrinter.cpp
index 64fc6d0d7e5..b28384694ec 100644
--- a/llvm/lib/Target/X86/X86AsmPrinter.cpp
+++ b/llvm/lib/Target/X86/X86AsmPrinter.cpp
@@ -94,11 +94,6 @@ static void printSymbolOperand(X86AsmPrinter &P, const MachineOperand &MO,
else
GVSym = P.getSymbol(GV);
- // Handle dllimport linkage.
- if (MO.getTargetFlags() == X86II::MO_DLLIMPORT)
- GVSym =
- P.OutContext.getOrCreateSymbol(Twine("__imp_") + GVSym->getName());
-
if (MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY ||
MO.getTargetFlags() == X86II::MO_DARWIN_NONLAZY_PIC_BASE) {
MCSymbol *Sym = P.getSymbolWithGlobalValueBase(GV, "$non_lazy_ptr");
diff --git a/llvm/lib/Target/X86/X86MCInstLower.cpp b/llvm/lib/Target/X86/X86MCInstLower.cpp
index ff1436af4ec..931abb07eb9 100644
--- a/llvm/lib/Target/X86/X86MCInstLower.cpp
+++ b/llvm/lib/Target/X86/X86MCInstLower.cpp
@@ -133,10 +133,6 @@ GetSymbolFromOperand(const MachineOperand &MO) const {
StringRef Suffix;
switch (MO.getTargetFlags()) {
- case X86II::MO_DLLIMPORT:
- // Handle dllimport linkage.
- Name += "__imp_";
- break;
case X86II::MO_DARWIN_STUB:
Suffix = "$stub";
break;
OpenPOWER on IntegriCloud