aboutsummaryrefslogtreecommitdiffstats
path: root/tools/llvm-link
diff options
context:
space:
mode:
Diffstat (limited to 'tools/llvm-link')
-rw-r--r--tools/llvm-link/llvm-link.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/llvm-link/llvm-link.cpp b/tools/llvm-link/llvm-link.cpp
index 58959cf..5c9e21c 100644
--- a/tools/llvm-link/llvm-link.cpp
+++ b/tools/llvm-link/llvm-link.cpp
@@ -6,10 +6,11 @@
//
//===----------------------------------------------------------------------===//
-#include "llvm/Transforms/Utils/Linker.h"
+#include "llvm/Module.h"
+#include "llvm/Analysis/Verifier.h"
#include "llvm/Bytecode/Reader.h"
#include "llvm/Bytecode/Writer.h"
-#include "llvm/Module.h"
+#include "llvm/Transforms/Utils/Linker.h"
#include "Support/CommandLine.h"
#include "Support/Signals.h"
#include <fstream>
@@ -125,6 +126,11 @@ int main(int argc, char **argv) {
RemoveFileOnSignal(OutputFilename);
}
+ if (verifyModule(*Composite.get())) {
+ std::cerr << argv[0] << ": linked module is broken!\n";
+ return 1;
+ }
+
if (Verbose) std::cerr << "Writing bytecode...\n";
WriteBytecodeToFile(Composite.get(), *Out);