Package: clamav / 0.101.2+dfsg-1

Add-support-for-LLVM-3.9.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
From cb77f255d9bc2871a474227e2a8676dfd930a483 Mon Sep 17 00:00:00 2001
From: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Date: Fri, 14 Oct 2016 20:24:56 +0200
Subject: Add support for LLVM 3.9

Changes:
IRBuilder no longer has a preserveNames template argument.
AtomicOrdering is now a strongly typed enum.

Patch-Name: Add-support-for-LLVM-3.9.patch
---
 libclamav/c++/bytecode2llvm.cpp | 12 +++++++++++-
 libclamav/c++/configure.ac      |  4 ++--
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/libclamav/c++/bytecode2llvm.cpp b/libclamav/c++/bytecode2llvm.cpp
index 8bc1937..19325c2 100644
--- a/libclamav/c++/bytecode2llvm.cpp
+++ b/libclamav/c++/bytecode2llvm.cpp
@@ -787,7 +787,11 @@ class RuntimeLimits : public FunctionPass {
         AbrtC->setDoesNotThrow();
 #endif
         new UnreachableInst(F.getContext(), AbrtBB);
+#if LLVM_VERSION < 39
 	IRBuilder<false> Builder(F.getContext());
+#else
+    IRBuilder<> Builder(F.getContext());
+#endif
 
 #if LLVM_VERSION < 38
 	Value *Flag = F.arg_begin();
@@ -825,8 +829,10 @@ class RuntimeLimits : public FunctionPass {
 #if LLVM_VERSION < 30
 	    // store-load barrier: will be a no-op on x86 but not other arches
 	    Builder.CreateCall(LSBarrier, ARRAYREF(Value*, MBArgs, MBArgs+5));
-#else
+#elif LLVM_VERSION < 39
 	    Builder.CreateFence(Release);
+#else
+        Builder.CreateFence(AtomicOrdering::Release);
 #endif
 	    // Load Flag that tells us we timed out (first byte in bc_ctx)
 	    Value *Cond = Builder.CreateLoad(Flag, true);
@@ -969,7 +975,11 @@ class LLVMCodegen {
     Twine BytecodeID;
 
     TargetFolder Folder;
+#if LLVM_VERSION < 39
     IRBuilder<false, TargetFolder> Builder;
+#else
+    IRBuilder<TargetFolder> Builder;
+#endif
 
     std::vector<Value*> globals;
     DenseMap<unsigned, unsigned> GVoffsetMap;
diff --git a/libclamav/c++/configure.ac b/libclamav/c++/configure.ac
index 291b8a0..c6482de 100644
--- a/libclamav/c++/configure.ac
+++ b/libclamav/c++/configure.ac
@@ -89,14 +89,14 @@ elif test $llvmver_test -lt 290; then
 elif test $llvmver_test -lt 360; then
     llvmcomp="jit nativecodegen scalaropts ipo"
     AC_MSG_RESULT([ok ($llvmver)])
-elif test $llvmver_test -lt 390; then
+elif test $llvmver_test -lt 400; then
     dnl LLVM 3.6.0 removed jit, so we have to use mcjit
     dnl and we're using InitializeNativeTargetAsmParser, so we need the architecture specific parsers
     llvmcomp="mcjit nativecodegen scalaropts ipo x86asmparser powerpcasmparser"
     AC_MSG_RESULT([ok ($llvmver)])
 else
     AC_MSG_RESULT([no ($llvmver)])
-    AC_MSG_ERROR([LLVM < 3.9 required, but "$llvmver"($llvmver_test) found])
+    AC_MSG_ERROR([LLVM < 4.0 required, but "$llvmver"($llvmver_test) found])
 fi
 
 dnl acquire the required flags to properly link in external LLVM