OBS-URL: https://build.opensuse.org/package/show/devel:tools:statica/klee?expand=0&rev=43
51 lines
1.8 KiB
Diff
51 lines
1.8 KiB
Diff
From: Jiri Slaby <jirislaby@gmail.com>
|
|
Date: Mon, 15 Jan 2018 10:35:19 +0100
|
|
Subject: llvm50: avoid ++ on function->arg_begin()
|
|
Patch-mainline: no
|
|
|
|
Starting with llvm 5, arguments of a function are not an iterator, but
|
|
an array. So they cannot be incremented in-place. Use +1 to construct a
|
|
new one instead.
|
|
|
|
Otherwise we see:
|
|
../tools/klee/main.cpp:661:23: error: expression is not assignable
|
|
Value *oldArgv = &*(++mainFn->arg_begin());
|
|
^ ~~~~~~~~~~~~~~~~~~~
|
|
|
|
Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
|
|
---
|
|
tools/klee/main.cpp | 8 ++++++++
|
|
1 file changed, 8 insertions(+)
|
|
|
|
diff --git a/tools/klee/main.cpp b/tools/klee/main.cpp
|
|
index 154a76feb361..def83b584167 100644
|
|
--- a/tools/klee/main.cpp
|
|
+++ b/tools/klee/main.cpp
|
|
@@ -658,7 +658,11 @@ static int initEnv(Module *mainModule) {
|
|
Instruction *firstInst = &*(mainFn->begin()->begin());
|
|
|
|
Value *oldArgc = &*(mainFn->arg_begin());
|
|
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
|
|
+ Value *oldArgv = &*(mainFn->arg_begin() + 1);
|
|
+#else
|
|
Value *oldArgv = &*(++mainFn->arg_begin());
|
|
+#endif
|
|
|
|
AllocaInst* argcPtr =
|
|
new AllocaInst(oldArgc->getType(), "argcPtr", firstInst);
|
|
@@ -1117,7 +1121,11 @@ static llvm::Module *linkWithUclibc(llvm::Module *mainModule, StringRef libDir)
|
|
args.push_back(llvm::ConstantExpr::getBitCast(userMainFn,
|
|
ft->getParamType(0)));
|
|
args.push_back(&*(stub->arg_begin())); // argc
|
|
+#if LLVM_VERSION_CODE >= LLVM_VERSION(5, 0)
|
|
+ args.push_back(&*(stub->arg_begin() + 1)); // argv
|
|
+#else
|
|
args.push_back(&*(++stub->arg_begin())); // argv
|
|
+#endif
|
|
args.push_back(Constant::getNullValue(ft->getParamType(3))); // app_init
|
|
args.push_back(Constant::getNullValue(ft->getParamType(4))); // app_fini
|
|
args.push_back(Constant::getNullValue(ft->getParamType(5))); // rtld_fini
|
|
--
|
|
2.17.0
|
|
|