aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Linker/LinkModules.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-07-14 06:52:19 +0000
committerChris Lattner <sabre@nondot.org>2008-07-14 06:52:19 +0000
commitae1132d2b8ae07afd2fe9a7cb434d849f884bfa0 (patch)
treec9b2dd66df433ffc952380f3c1b265b66bd645b2 /lib/Linker/LinkModules.cpp
parentd1ec48c641f76d4c0e5b7cb357a1333d4fb75c4a (diff)
downloadexternal_llvm-ae1132d2b8ae07afd2fe9a7cb434d849f884bfa0.zip
external_llvm-ae1132d2b8ae07afd2fe9a7cb434d849f884bfa0.tar.gz
external_llvm-ae1132d2b8ae07afd2fe9a7cb434d849f884bfa0.tar.bz2
don't do any linkage, not even type resolution, of symbols that have
internal linkage. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53547 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Linker/LinkModules.cpp')
-rw-r--r--lib/Linker/LinkModules.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp
index 5979dc6..1001fbd 100644
--- a/lib/Linker/LinkModules.cpp
+++ b/lib/Linker/LinkModules.cpp
@@ -548,13 +548,15 @@ static bool LinkGlobals(Module *Dest, const Module *Src,
DGV = cast_or_null<GlobalValue>(DestSymTab.lookup(SGV->getNameStart(),
SGV->getNameEnd()));
+ // If we found a global with the same name in the dest module, but it has
+ // internal linkage, we are really not doing any linkage here.
+ if (DGV && DGV->hasInternalLinkage())
+ DGV = 0;
+
// If types don't agree due to opaque types, try to resolve them.
if (DGV && DGV->getType() != SGV->getType())
RecursiveResolveTypes(SGV->getType(), DGV->getType());
- if (DGV && DGV->hasInternalLinkage())
- DGV = 0;
-
assert((SGV->hasInitializer() || SGV->hasExternalWeakLinkage() ||
SGV->hasExternalLinkage() || SGV->hasDLLImportLinkage()) &&
"Global must either be external or have an initializer!");
@@ -901,13 +903,15 @@ static bool LinkFunctionProtos(Module *Dest, const Module *Src,
DGV = cast_or_null<GlobalValue>(DestSymTab.lookup(SF->getNameStart(),
SF->getNameEnd()));
+ // If we found a global with the same name in the dest module, but it has
+ // internal linkage, we are really not doing any linkage here.
+ if (DGV && DGV->hasInternalLinkage())
+ DGV = 0;
+
// If types don't agree due to opaque types, try to resolve them.
if (DGV && DGV->getType() != SF->getType())
RecursiveResolveTypes(SF->getType(), DGV->getType());
- if (DGV && DGV->hasInternalLinkage())
- DGV = 0;
-
// If there is no linkage to be performed, just bring over SF without
// modifying it.
if (DGV == 0) {