summaryrefslogtreecommitdiff
path: root/lib/LTO/LTO.cpp
diff options
context:
space:
mode:
authorDavide Italiano <davide@freebsd.org>2016-12-14 21:57:04 +0000
committerDavide Italiano <davide@freebsd.org>2016-12-14 21:57:04 +0000
commit6b673b85edb18561b5008276da2700a323b41111 (patch)
tree42f4e6311d5167096740743ae774bdfaa9cf2122 /lib/LTO/LTO.cpp
parent62776a860a657b30007c0b24d9341bc405d3afa4 (diff)
[LTO] Reject modules without datalayout.
Also, udpate the ~60 failing tests in the tree which did not contain a valid datalayout. This fixes PR31123. lld will be updated in a following patch, immediately after this is committed. Differential Revision: https://reviews.llvm.org/D27082 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289719 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/LTO/LTO.cpp')
-rw-r--r--lib/LTO/LTO.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/LTO/LTO.cpp b/lib/LTO/LTO.cpp
index 718cbf17048..74de6c18aef 100644
--- a/lib/LTO/LTO.cpp
+++ b/lib/LTO/LTO.cpp
@@ -380,6 +380,11 @@ Error LTO::addModule(InputFile &Input, InputFile::InputModule &IM,
const SymbolResolution *ResE) {
// FIXME: move to backend
Module &M = *IM.Mod;
+
+ if (M.getDataLayoutStr().empty())
+ return make_error<StringError>("input module has no datalayout",
+ inconvertibleErrorCode());
+
if (!Conf.OverrideTriple.empty())
M.setTargetTriple(Conf.OverrideTriple);
else if (M.getTargetTriple().empty())