From 61ad7ec0f78c5089ddc7c1ceda22d674387e1803 Mon Sep 17 00:00:00 2001 From: Devang Patel Date: Thu, 20 Dec 2007 00:24:01 +0000 Subject: [PATCH] Add lto version check mechanism. llvm-svn: 45238 --- include/llvm/LinkTimeOptimizer.h | 4 +++- tools/lto/lto.cpp | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/llvm/LinkTimeOptimizer.h b/include/llvm/LinkTimeOptimizer.h index 164232d2098..fe87ae0acb7 100644 --- a/include/llvm/LinkTimeOptimizer.h +++ b/include/llvm/LinkTimeOptimizer.h @@ -20,6 +20,8 @@ #include #include +#define LLVM_LTO_VERSION 1 + namespace llvm { class Module; @@ -148,6 +150,6 @@ namespace llvm { /// linker to use dlopen() interface to dynamically load LinkTimeOptimizer. /// extern "C" helps, because dlopen() interface uses name to find the symbol. extern "C" -llvm::LinkTimeOptimizer *createLLVMOptimizer(); +llvm::LinkTimeOptimizer *createLLVMOptimizer(unsigned VERSION = LLVM_LTO_VERSION); #endif diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp index e7e00e7f62c..bc752340d50 100644 --- a/tools/lto/lto.cpp +++ b/tools/lto/lto.cpp @@ -45,8 +45,11 @@ using namespace llvm; extern "C" -llvm::LinkTimeOptimizer *createLLVMOptimizer() +llvm::LinkTimeOptimizer *createLLVMOptimizer(unsigned VERSION) { + if (VERSION != LLVM_LTO_VERSION) + return NULL; + llvm::LTO *l = new llvm::LTO(); return l; }