[llvm] r208262 - LTO: Assert visibility of local linkage when merging symbols

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed May 7 15:55:46 PDT 2014

Author: dexonsmith
Date: Wed May  7 17:55:46 2014
New Revision: 208262

URL: http://llvm.org/viewvc/llvm-project?rev=208262&view=rev
LTO: Assert visibility of local linkage when merging symbols

`ModuleLinker::getLinkageResult()` shouldn't create symbols with local
linkage and non-default visibility -- in fact, symbols with local
linkage shouldn't be merged at all.  Assert to that effect.


Modified: llvm/trunk/lib/Linker/LinkModules.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/LinkModules.cpp?rev=208262&r1=208261&r2=208262&view=diff
--- llvm/trunk/lib/Linker/LinkModules.cpp (original)
+++ llvm/trunk/lib/Linker/LinkModules.cpp Wed May  7 17:55:46 2014
@@ -604,6 +604,8 @@ bool ModuleLinker::getLinkageResult(Glob
   // Compute the visibility. We follow the rules in the System V Application
   // Binary Interface.
+  assert(!GlobalValue::isLocalLinkage(LT) &&
+         "Symbols with local linkage should not be merged");
   Vis = isLessConstraining(Src->getVisibility(), Dest->getVisibility()) ?
     Dest->getVisibility() : Src->getVisibility();
   return false;

More information about the llvm-commits mailing list