Skip to content

Commit

Permalink
[asan] do not treat inline asm calls as indirect calls
Browse files Browse the repository at this point in the history
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220985 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
kcc committed Oct 31, 2014
1 parent 9b6ca93 commit 854432d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Transforms/Instrumentation/AddressSanitizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1408,12 +1408,14 @@ void AddressSanitizer::InjectCoverageForIndirectCalls(
for (auto I : IndirCalls) {
IRBuilder<> IRB(I);
CallSite CS(I);
Value *Callee = CS.getCalledValue();
if (dyn_cast<InlineAsm>(Callee)) continue;
GlobalVariable *CalleeCache = new GlobalVariable(
*F.getParent(), Ty, false, GlobalValue::PrivateLinkage,
Constant::getNullValue(Ty), "__asan_gen_callee_cache");
CalleeCache->setAlignment(kCacheAlignment);
IRB.CreateCall2(AsanCovIndirCallFunction,
IRB.CreatePointerCast(CS.getCalledValue(), IntptrTy),
IRB.CreatePointerCast(Callee, IntptrTy),
IRB.CreatePointerCast(CalleeCache, IntptrTy));
}
}
Expand Down
1 change: 1 addition & 0 deletions test/Instrumentation/AddressSanitizer/coverage.ll
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ entry:
%1 = load void (%struct.StructWithVptr*)** %vtable, align 8
tail call void %1(%struct.StructWithVptr* %foo)
tail call void %1(%struct.StructWithVptr* %foo)
tail call void asm sideeffect "", ""()
ret void
}

Expand Down

0 comments on commit 854432d

Please sign in to comment.