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. --- lib/Core/StatsTracker.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/Core/StatsTracker.cpp') 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(prev) || isa(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())); - } else if (Function *target = getDirectCallTarget(cs)) { + } else if (Function *target = getDirectCallTarget( + cs, /*moduleIsFullyLinked=*/true)) { callTargets[it].push_back(target); } else { callTargets[it] = -- cgit 1.4.1