diff options
author | Dan Liew <daniel.liew@imperial.ac.uk> | 2016-11-25 08:55:04 +0000 |
---|---|---|
committer | Dan Liew <daniel.liew@imperial.ac.uk> | 2017-02-21 21:32:52 +0000 |
commit | 70715151746a24c4c6919292956111b00fcd3a26 (patch) | |
tree | d7cd3c59f4e8f68f106ab638f1dad8ebfa09b1a7 /lib/Core | |
parent | 17705a0ecea3d5c6ad74587cc76adf92e6e8be6d (diff) | |
download | klee-70715151746a24c4c6919292956111b00fcd3a26.tar.gz |
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.
Diffstat (limited to 'lib/Core')
-rw-r--r-- | lib/Core/StatsTracker.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp index 97ed26ea..dbd86524 100644 --- a/lib/Core/StatsTracker.cpp +++ b/lib/Core/StatsTracker.cpp @@ -167,7 +167,8 @@ static bool instructionIsCoverable(Instruction *i) { } else { Instruction *prev = --it; if (isa<CallInst>(prev) || isa<InvokeInst>(prev)) { - Function *target = getDirectCallTarget(prev); + Function *target = + getDirectCallTarget(prev, /*moduleIsFullyLinked=*/true); if (target && target->doesNotReturn()) return false; } @@ -690,7 +691,8 @@ void StatsTracker::computeReachableUncovered() { // (which should be correct anyhow). callTargets.insert(std::make_pair(it, std::vector<Function*>())); - } else if (Function *target = getDirectCallTarget(cs)) { + } else if (Function *target = getDirectCallTarget( + cs, /*moduleIsFullyLinked=*/true)) { callTargets[it].push_back(target); } else { callTargets[it] = |