From 70715151746a24c4c6919292956111b00fcd3a26 Mon Sep 17 00:00:00 2001 From: Dan Liew Date: Fri, 25 Nov 2016 08:55:04 +0000 Subject: Teach `klee::getDirectCallTarget()` to resolve weak aliases. This is controlled by a new parameter `moduleIsFullyLinked`. When true the linkage type of a weak alias is ignored. It is legal to do this when the module is fully linked because there won't be another function that could override the weak alias. This fixes a previous assertion failure in `klee::getDirectCallTarget()` triggered by the `test/regression/2016-11-24-bitcast-weak-alias.c` test case. --- include/klee/Internal/Support/ModuleUtil.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/klee/Internal/Support/ModuleUtil.h b/include/klee/Internal/Support/ModuleUtil.h index 29adc94a..c85ba591 100644 --- a/include/klee/Internal/Support/ModuleUtil.h +++ b/include/klee/Internal/Support/ModuleUtil.h @@ -29,7 +29,11 @@ namespace klee { /// null if it cannot be determined (should be only for indirect /// calls, although complicated constant expressions might be /// another possibility). - llvm::Function *getDirectCallTarget(llvm::CallSite); + /// + /// If `moduleIsFullyLinked` is set to true it will be assumed that the + // module containing the `llvm::CallSite` is fully linked. This assumption + // allows resolution of functions that are marked as overridable. + llvm::Function *getDirectCallTarget(llvm::CallSite, bool moduleIsFullyLinked); /// Return true iff the given Function value is used in something /// other than a direct call (or a constant expression that -- cgit 1.4.1