diff options
| author | Chris Lattner <sabre@nondot.org> | 2008-07-14 06:52:19 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2008-07-14 06:52:19 +0000 |
| commit | c08e7a00c3d69d2c198e23e76450e994ada352c7 (patch) | |
| tree | 5dca5a5d8bd2eb55490bd7d26ede984666d8f0d2 /llvm/lib | |
| parent | 34fc5a0eaa063c6bfe9c7f4bf6509fc15e8a219e (diff) | |
| download | bcm5719-llvm-c08e7a00c3d69d2c198e23e76450e994ada352c7.tar.gz bcm5719-llvm-c08e7a00c3d69d2c198e23e76450e994ada352c7.zip | |
don't do any linkage, not even type resolution, of symbols that have
internal linkage.
llvm-svn: 53547
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Linker/LinkModules.cpp | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index 5979dc6fbc6..1001fbdf6a1 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/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) { |

