Revert "Decouple dllexport/dllimport from linkage"
Revert this for now until I fix an issue in Clang with it.
This reverts commit r199204.
llvm-svn: 199207
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp
index 4d039eb..8f2200e 100644
--- a/llvm/lib/Linker/LinkModules.cpp
+++ b/llvm/lib/Linker/LinkModules.cpp
@@ -543,8 +543,8 @@
if (SrcIsDeclaration) {
// If Src is external or if both Src & Dest are external.. Just link the
// external globals, we aren't adding anything.
- if (Src->hasDLLImportStorageClass()) {
- // If one of GVs is marked as DLLImport, result should be dllimport'ed.
+ if (Src->hasDLLImportLinkage()) {
+ // If one of GVs has DLLImport linkage, result should be dllimport'ed.
if (DestIsDeclaration) {
LinkFromSrc = true;
LT = Src->getLinkage();
@@ -557,7 +557,7 @@
LinkFromSrc = false;
LT = Dest->getLinkage();
}
- } else if (DestIsDeclaration && !Dest->hasDLLImportStorageClass()) {
+ } else if (DestIsDeclaration && !Dest->hasDLLImportLinkage()) {
// If Dest is external but Src is not:
LinkFromSrc = true;
LT = Src->getLinkage();
@@ -584,8 +584,10 @@
LT = GlobalValue::ExternalLinkage;
}
} else {
- assert((Dest->hasExternalLinkage() || Dest->hasExternalWeakLinkage()) &&
- (Src->hasExternalLinkage() || Src->hasExternalWeakLinkage()) &&
+ assert((Dest->hasExternalLinkage() || Dest->hasDLLImportLinkage() ||
+ Dest->hasDLLExportLinkage() || Dest->hasExternalWeakLinkage()) &&
+ (Src->hasExternalLinkage() || Src->hasDLLImportLinkage() ||
+ Src->hasDLLExportLinkage() || Src->hasExternalWeakLinkage()) &&
"Unexpected linkage type!");
return emitError("Linking globals named '" + Src->getName() +
"': symbol multiply defined!");