diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2013-04-09 04:35:11 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2013-04-09 04:35:11 +0000 |
commit | 52ca70dc304c694923ac804630d88b1d95bfa941 (patch) | |
tree | f051cc9689e5b902c83b8d9b29ccb28f774bab21 /docs | |
parent | a5796f87229b4aeebca71fa6ee1790ae7a5a0382 (diff) |
If the user requested a zero-base-shadow sanitizer, infer -pie and -fPIC when appropriate.
Differential Revision: http://llvm-reviews.chandlerc.com/D502
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179082 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'docs')
-rw-r--r-- | docs/MemorySanitizer.rst | 9 | ||||
-rw-r--r-- | docs/ThreadSanitizer.rst | 13 |
2 files changed, 14 insertions, 8 deletions
diff --git a/docs/MemorySanitizer.rst b/docs/MemorySanitizer.rst index fdb8a81023..439acc47fa 100644 --- a/docs/MemorySanitizer.rst +++ b/docs/MemorySanitizer.rst @@ -46,7 +46,7 @@ to disable inlining (just use ``-O1``) and tail call elimination return 0; } - % clang -fsanitize=memory -fPIE -pie -fno-omit-frame-pointer -g -O2 umr.cc + % clang -fsanitize=memory -fno-omit-frame-pointer -g -O2 umr.cc If a bug is detected, the program will print an error message to stderr and exit with a non-zero exit code. Currently, MemorySanitizer @@ -103,7 +103,7 @@ the example above, .. code-block:: console - % clang -fsanitize=memory -fsanitize-memory-track-origins -fPIE -pie -fno-omit-frame-pointer -g -O2 umr.cc + % clang -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-frame-pointer -g -O2 umr.cc % ./a.out 2>log % projects/compiler-rt/lib/asan/scripts/asan_symbolize.py / < log | c++filt ==14425== WARNING: MemorySanitizer: UMR (uninitialized-memory-read) @@ -160,7 +160,10 @@ Limitations address space. This means that tools like ``ulimit`` may not work as usually expected. * Static linking is not supported. -* Non-position-independent executables are not supported. +* Non-position-independent executables are not supported. Therefore, the + ``fsanitize=memory`` flag will cause Clang to act as though the ``-fPIE`` + flag had been supplied if compiling without ``-fPIC``, and as though the + ``-pie`` flag had been supplied if linking an executable. * Depending on the version of Linux kernel, running without ASLR may be not supported. Note that GDB disables ASLR by default. To debug instrumented programs, use "set disable-randomization off". diff --git a/docs/ThreadSanitizer.rst b/docs/ThreadSanitizer.rst index c0c576b44a..5e5ee48f7f 100644 --- a/docs/ThreadSanitizer.rst +++ b/docs/ThreadSanitizer.rst @@ -25,9 +25,9 @@ platforms is problematic and not yet planned. Usage ----- -Simply compile your program with ``-fsanitize=thread -fPIE`` and link it with -``-fsanitize=thread -pie``. To get a reasonable performance add ``-O1`` or -higher. Use ``-g`` to get file names and line numbers in the warning messages. +Simply compile and link your program with ``-fsanitize=thread``. To get a +reasonable performance add ``-O1`` or higher. Use ``-g`` to get file names +and line numbers in the warning messages. Example: @@ -48,7 +48,7 @@ Example: return Global; } - $ clang -fsanitize=thread -g -O1 tiny_race.c -fPIE -pie + $ clang -fsanitize=thread -g -O1 tiny_race.c If a bug is detected, the program will print an error message to stderr. Currently, ThreadSanitizer symbolizes its output using an external @@ -107,7 +107,10 @@ Limitations * ThreadSanitizer maps (but does not reserve) a lot of virtual address space. This means that tools like ``ulimit`` may not work as usually expected. * Libc/libstdc++ static linking is not supported. -* ThreadSanitizer requires ``-fPIE -pie`` compiler flags. +* Non-position-independent executables are not supported. Therefore, the + ``fsanitize=thread`` flag will cause Clang to act as though the ``-fPIE`` + flag had been supplied if compiling without ``-fPIC``, and as though the + ``-pie`` flag had been supplied if linking an executable. Current Status -------------- |