From bba25501249ff99fce930aaea0c194956aeee2b4 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Wed, 7 May 2014 22:55:46 +0000 Subject: [PATCH] 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. llvm-svn: 208262 --- lib/Linker/LinkModules.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 55654ac25d6..49c5e1cc13e 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -604,6 +604,8 @@ bool ModuleLinker::getLinkageResult(GlobalValue *Dest, const GlobalValue *Src, // 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;