From ed11bd286f76e2ea2bf7ba1ebeff2d77a1be93a0 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 9 Dec 2015 22:44:00 +0000 Subject: Synchronize the logic for deciding to link a gv. We were deciding to not link an available_externally gv over a declaration, but then copying over the body anyway. llvm-svn: 255169 --- llvm/lib/Linker/LinkModules.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'llvm/lib/Linker/LinkModules.cpp') diff --git a/llvm/lib/Linker/LinkModules.cpp b/llvm/lib/Linker/LinkModules.cpp index a9fcee7c98c..3d40c126dd2 100644 --- a/llvm/lib/Linker/LinkModules.cpp +++ b/llvm/lib/Linker/LinkModules.cpp @@ -1050,7 +1050,12 @@ bool ModuleLinker::shouldLinkFromSource(bool &LinkFromSrc, return false; } // If the Dest is weak, use the source linkage. - LinkFromSrc = Dest.hasExternalWeakLinkage(); + if (Dest.hasExternalWeakLinkage()) { + LinkFromSrc = true; + return false; + } + // Link an available_externally over a declaration. + LinkFromSrc = !Src.isDeclaration() && Dest.isDeclaration(); return false; } -- cgit v1.2.3