Cancel builtin llvm and clang support when LLVM version is
less than 3.9.0: following commits uses newer API.
Since Clang/LLVM's API is not guaranteed to be stable,
add a test-llvm-version.cpp feature checker, issue warning if
LLVM found in compiling environment is not tested yet.
Signed-off-by: Wang Nan <wangnan0@xxxxxxxxxx>
Cc: Alexei Starovoitov <ast@xxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: He Kuang <hekuang@xxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Joe Stringer <joe@xxxxxxx>
Cc: Zefan Li <lizefan@xxxxxxxxxx>
Cc: pi3orama@xxxxxxx
---
tools/build/feature/Makefile | 8 ++++++--
tools/build/feature/test-llvm-version.cpp | 12 ++++++++++++
tools/build/feature/test-llvm.cpp | 5 +++++
tools/perf/Makefile.config | 8 ++++++--
4 files changed, 29 insertions(+), 4 deletions(-)
create mode 100644 tools/build/feature/test-llvm-version.cpp
diff --git a/tools/build/feature/test-llvm-version.cpp b/tools/build/feature/test-llvm-version.cppSorry for this blank line. Will resend.
new file mode 100644
index 0000000..e86b642
--- /dev/null
+++ b/tools/build/feature/test-llvm-version.cpp
@@ -0,0 +1,12 @@
+#include <cstdio>
+#include "llvm/Config/llvm-config.h"
+
+#define NUM_VERSION (((LLVM_VERSION_MAJOR) << 16) + (LLVM_VERSION_MINOR << 8) + LLVM_VERSION_PATCH)
+#define pass int main() {printf("%x\n", NUM_VERSION); return 0;}
+
+#if NUM_VERSION >= 0x030900
+pass
+#else
+# error This LLVM is not tested yet.
+#endif
+