[PATCH] D12709: [PATCH] [sanitizers] [msan] Enable MSAN for aarch64
Adhemerval Zanella via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 9 05:46:00 PDT 2015
zatrazz added a comment.
In http://reviews.llvm.org/D12709#242292, @rengolin wrote:
> Hi Adhemerval,
>
> About named register variables, if you use the variable in a piece of inline asm, it works in LLVM, too. If you just declare it, Clang ignores and LLVM optimises it away.
>
> cheers,
> --renato
In this case the variable will not be used for attribution , but instead to catch the value of 'x8'. My understanding is clang should not mark the variable as unused if it is used as a named register variable, otherwise it will not be able to catch registers values as is in function calling.
Another option that came to my mind is to use an volatile inline assembly to explicit get the register value:
INTERCEPTOR(void, mallinfo, __sanitizer_mallinfo *sret) {
#ifdef __aarch64__
uptr r8;
asm volatile("mov %0,x8" : "=r" (r8));
sret = reinterpret_cast<__sanitizer_mallinfo*>(r8);
#endif
REAL(memset)(sret, 0, sizeof(*sret));
__msan_unpoison(sret, sizeof(*sret));
}
This works and make the test pass. I will use it instead.
http://reviews.llvm.org/D12709
More information about the llvm-commits
mailing list