From 2ceb628f364bfb2444df6b819ccc22a46fac0a58 Mon Sep 17 00:00:00 2001 From: Davide Italiano Date: Wed, 14 Dec 2016 21:57:04 +0000 Subject: [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 llvm-svn: 289719 --- llvm/lib/LTO/LTO.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/lib/LTO/LTO.cpp') diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp index 718cbf17048..74de6c18aef 100644 --- a/llvm/lib/LTO/LTO.cpp +++ b/llvm/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("input module has no datalayout", + inconvertibleErrorCode()); + if (!Conf.OverrideTriple.empty()) M.setTargetTriple(Conf.OverrideTriple); else if (M.getTargetTriple().empty()) -- cgit v1.2.3