Use -fsanitize= flag in docs for ASan/TSan
llvm-svn: 167465
This commit is contained in:
parent
c015712992
commit
33bfe09c34
|
@ -49,7 +49,7 @@ Follow the <a href="../get_started.html">clang build instructions</a>.
|
|||
CMake build is supported.<BR>
|
||||
|
||||
<h2 id="usage">Usage</h2>
|
||||
Simply compile and link your program with <tt>-faddress-sanitizer</tt> flag. <BR>
|
||||
Simply compile and link your program with <tt>-fsanitize=address</tt> flag. <BR>
|
||||
The AddressSanitizer run-time library should be linked to the final executable,
|
||||
so make sure to use <tt>clang</tt> (not <tt>ld</tt>) for the final link step.<BR>
|
||||
When linking shared libraries, the AddressSanitizer run-time is not linked,
|
||||
|
@ -72,14 +72,14 @@ int main(int argc, char **argv) {
|
|||
|
||||
<pre>
|
||||
# Compile and link
|
||||
% clang -O1 -g -faddress-sanitizer -fno-omit-frame-pointer example_UseAfterFree.cc
|
||||
% clang -O1 -g -fsanitize=address -fno-omit-frame-pointer example_UseAfterFree.cc
|
||||
</pre>
|
||||
OR
|
||||
<pre>
|
||||
# Compile
|
||||
% clang -O1 -g -faddress-sanitizer -fno-omit-frame-pointer -c example_UseAfterFree.cc
|
||||
% clang -O1 -g -fsanitize=address -fno-omit-frame-pointer -c example_UseAfterFree.cc
|
||||
# Link
|
||||
% clang -g -faddress-sanitizer example_UseAfterFree.o
|
||||
% clang -g -fsanitize=address example_UseAfterFree.o
|
||||
</pre>
|
||||
|
||||
If a bug is detected, the program will print an error message to stderr and exit with a
|
||||
|
|
|
@ -48,8 +48,8 @@ Support for 32-bit platforms is problematic and not yet planned.
|
|||
|
||||
|
||||
<h2 id="usage">Usage</h2>
|
||||
Simply compile your program with <tt>-fthread-sanitizer -fPIE</tt> and link it
|
||||
with <tt>-fthread-sanitizer -pie</tt>.<BR>
|
||||
Simply compile your program with <tt>-fsanitize=thread -fPIE</tt> and link it
|
||||
with <tt>-fsanitize=thread -pie</tt>.<BR>
|
||||
To get a reasonable performance add <tt>-O1</tt> or higher. <BR>
|
||||
Use <tt>-g</tt> to get file names and line numbers in the warning messages. <BR>
|
||||
|
||||
|
@ -72,7 +72,7 @@ int main() {
|
|||
</pre>
|
||||
|
||||
<pre>
|
||||
% clang -fthread-sanitizer -g -O1 tiny_race.c -fPIE -pie
|
||||
% clang -fsanitize=thread -g -O1 tiny_race.c -fPIE -pie
|
||||
</pre>
|
||||
|
||||
If a bug is detected, the program will print an error message to stderr.
|
||||
|
|
Loading…
Reference in New Issue