diff options
author | Andrew Lenharth <andrewl@lenharth.org> | 2006-12-15 17:35:32 +0000 |
---|---|---|
committer | Andrew Lenharth <andrewl@lenharth.org> | 2006-12-15 17:35:32 +0000 |
commit | e06036d2293210785c6e4f70c0ea5274bfe07d8c (patch) | |
tree | e42770609d0ac784ddfb2504365cdb203c694be5 /llvm/lib/Linker/LinkModules.cpp | |
parent | 54de5be0b43941307ea246cc58c4ef80e690d5fa (diff) | |
download | bcm5719-llvm-e06036d2293210785c6e4f70c0ea5274bfe07d8c.tar.gz bcm5719-llvm-e06036d2293210785c6e4f70c0ea5274bfe07d8c.zip |
extern_weak linkage. fixes PR1038
llvm-svn: 32603
Diffstat (limited to 'llvm/lib/Linker/LinkModules.cpp')
-rw-r--r-- | llvm/lib/Linker/LinkModules.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index 433dfa682d6..9346c118240 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/lib/Linker/LinkModules.cpp @@ -365,6 +365,10 @@ static bool GetLinkageResult(GlobalValue *Dest, GlobalValue *Src, LinkFromSrc = true; LT = Src->getLinkage(); } + } else if (Dest->hasExternalWeakLinkage()) { + //If the Dest is weak, use the source linkage + LinkFromSrc = true; + LT = Src->getLinkage(); } else { LinkFromSrc = false; LT = Dest->getLinkage(); @@ -446,7 +450,7 @@ static bool LinkGlobals(Module *Dest, Module *Src, if (DGV && DGV->hasInternalLinkage()) DGV = 0; - assert(SGV->hasInitializer() || + assert(SGV->hasInitializer() || SGV->hasExternalWeakLinkage() || SGV->hasExternalLinkage() || SGV->hasDLLImportLinkage() && "Global must either be external or have an initializer!"); |