From 43a9994c0164848d44527060da72985c75183a48 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 22 Apr 2003 19:13:20 +0000 Subject: [PATCH] Add warning when linking modules with disagreeing target properties git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5845 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Linker/LinkModules.cpp | 4 ++++ lib/Transforms/Utils/Linker.cpp | 4 ++++ lib/VMCore/Linker.cpp | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/lib/Linker/LinkModules.cpp b/lib/Linker/LinkModules.cpp index 65b05cd65e9..b5cec060763 100644 --- a/lib/Linker/LinkModules.cpp +++ b/lib/Linker/LinkModules.cpp @@ -469,6 +469,10 @@ static bool LinkFunctionBodies(Module *Dest, const Module *Src, // shouldn't be relied on to be consistent. // bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { + if (Dest->getEndianness() != Src->getEndianness()) + std::cerr << "WARNING: Linking two modules of different endianness!\n"; + if (Dest->getPointerSize() != Src->getPointerSize()) + std::cerr << "WARNING: Linking two modules of different pointer size!\n"; // LinkTypes - Go through the symbol table of the Src module and see if any // types are named in the src module that are not named in the Dst module. diff --git a/lib/Transforms/Utils/Linker.cpp b/lib/Transforms/Utils/Linker.cpp index 65b05cd65e9..b5cec060763 100644 --- a/lib/Transforms/Utils/Linker.cpp +++ b/lib/Transforms/Utils/Linker.cpp @@ -469,6 +469,10 @@ static bool LinkFunctionBodies(Module *Dest, const Module *Src, // shouldn't be relied on to be consistent. // bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { + if (Dest->getEndianness() != Src->getEndianness()) + std::cerr << "WARNING: Linking two modules of different endianness!\n"; + if (Dest->getPointerSize() != Src->getPointerSize()) + std::cerr << "WARNING: Linking two modules of different pointer size!\n"; // LinkTypes - Go through the symbol table of the Src module and see if any // types are named in the src module that are not named in the Dst module. diff --git a/lib/VMCore/Linker.cpp b/lib/VMCore/Linker.cpp index 65b05cd65e9..b5cec060763 100644 --- a/lib/VMCore/Linker.cpp +++ b/lib/VMCore/Linker.cpp @@ -469,6 +469,10 @@ static bool LinkFunctionBodies(Module *Dest, const Module *Src, // shouldn't be relied on to be consistent. // bool LinkModules(Module *Dest, const Module *Src, std::string *ErrorMsg) { + if (Dest->getEndianness() != Src->getEndianness()) + std::cerr << "WARNING: Linking two modules of different endianness!\n"; + if (Dest->getPointerSize() != Src->getPointerSize()) + std::cerr << "WARNING: Linking two modules of different pointer size!\n"; // LinkTypes - Go through the symbol table of the Src module and see if any // types are named in the src module that are not named in the Dst module.