From f85770c9a670dc5c360015125389c389ae9592c7 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 21 Oct 2003 21:52:20 +0000 Subject: [PATCH] Fix message to make more sense and confuse Chris less git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9354 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Linker/LinkModules.cpp | 9 +++++++-- lib/Transforms/Utils/Linker.cpp | 9 +++++++-- lib/VMCore/Linker.cpp | 9 +++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index bd8ec8c9cef..0e7d887044d 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -463,11 +463,16 @@ static bool LinkGlobals(Module *Dest, const Module *Src, "' have different linkage specifiers!"); } else if (SGV->hasExternalLinkage()) { // Allow linking two exactly identical external global variables... - if (SGV->isConstant() != DGV->isConstant() || - SGV->getInitializer() != DGV->getInitializer()) + if (SGV->isConstant() != DGV->isConstant()) return Error(Err, "Global Variable Collision on '" + SGV->getType()->getDescription() + " %" + SGV->getName() + "' - Global variables differ in const'ness"); + + if (SGV->getInitializer() != DGV->getInitializer()) + return Error(Err, "Global Variable Collision on '" + + SGV->getType()->getDescription() + " %" + SGV->getName() + + "' - External linkage globals have different initializers"); + ValueMap.insert(std::make_pair(SGV, DGV)); } else if (SGV->hasLinkOnceLinkage()) { // If the global variable has a name, and that name is already in use in diff --git a/lib/Transforms/Utils/Linker.cpp b/lib/Transforms/Utils/Linker.cpp index bd8ec8c9cef..0e7d887044d 100644 --- a/lib/Transforms/Utils/Linker.cpp +++ b/lib/Transforms/Utils/Linker.cpp @@ -463,11 +463,16 @@ static bool LinkGlobals(Module *Dest, const Module *Src, "' have different linkage specifiers!"); } else if (SGV->hasExternalLinkage()) { // Allow linking two exactly identical external global variables... - if (SGV->isConstant() != DGV->isConstant() || - SGV->getInitializer() != DGV->getInitializer()) + if (SGV->isConstant() != DGV->isConstant()) return Error(Err, "Global Variable Collision on '" + SGV->getType()->getDescription() + " %" + SGV->getName() + "' - Global variables differ in const'ness"); + + if (SGV->getInitializer() != DGV->getInitializer()) + return Error(Err, "Global Variable Collision on '" + + SGV->getType()->getDescription() + " %" + SGV->getName() + + "' - External linkage globals have different initializers"); + ValueMap.insert(std::make_pair(SGV, DGV)); } else if (SGV->hasLinkOnceLinkage()) { // If the global variable has a name, and that name is already in use in diff --git a/lib/VMCore/Linker.cpp b/lib/VMCore/Linker.cpp index bd8ec8c9cef..0e7d887044d 100644 --- a/lib/VMCore/Linker.cpp +++ b/lib/VMCore/Linker.cpp @@ -463,11 +463,16 @@ static bool LinkGlobals(Module *Dest, const Module *Src, "' have different linkage specifiers!"); } else if (SGV->hasExternalLinkage()) { // Allow linking two exactly identical external global variables... - if (SGV->isConstant() != DGV->isConstant() || - SGV->getInitializer() != DGV->getInitializer()) + if (SGV->isConstant() != DGV->isConstant()) return Error(Err, "Global Variable Collision on '" + SGV->getType()->getDescription() + " %" + SGV->getName() + "' - Global variables differ in const'ness"); + + if (SGV->getInitializer() != DGV->getInitializer()) + return Error(Err, "Global Variable Collision on '" + + SGV->getType()->getDescription() + " %" + SGV->getName() + + "' - External linkage globals have different initializers"); + ValueMap.insert(std::make_pair(SGV, DGV)); } else if (SGV->hasLinkOnceLinkage()) { // If the global variable has a name, and that name is already in use in -- 2.34.1