Index: docs/ASAN.rst |
diff --git a/docs/ASAN.rst b/docs/ASAN.rst |
index d815817c042656f9f56fb4df35bb1a1629ea4872..0c556c82ab106ad93d5f3ca8dd6bbc682a37e608 100644 |
--- a/docs/ASAN.rst |
+++ b/docs/ASAN.rst |
@@ -10,14 +10,20 @@ used in production. |
In Subzero, AddressSanitizer depends on being able to find and instrument calls |
to various functions such as malloc() and free(), and as such the .pexe file |
-being translated must not have had those symbols stripped. Subzero will not |
-complain if it is told to translate a .pexe file with its symbols stripped, but |
-it will not be able to find calls to malloc() and free(), so AddressSanitizer |
-will not work correctly in the final executable. |
+being translated must not have had those symbols stripped or inlined. Subzero |
+will not complain if it is told to translate a .pexe file with its symbols |
+stripped, but it will not be able to find calls to malloc(), calloc(), free(), |
+etc., so AddressSanitizer will not work correctly in the final executable. |
+ |
+Furthermore, pnacl-clang automatically inlines calls to calloc(), even with |
Karl
2016/07/14 17:33:50
s/calls/some calls/?
Do you know it does this to
tlively
2016/07/14 20:26:14
Done.
|
+inlining turned off, so we provide a wrapper script, sz-clang.py, that normally |
+just passes its arguments through to pnacl-clang, but adds instrumentation to |
+replace calls to calloc() at the source level if it is passed |
+-fsanitize-address. |
These are the steps to compile hello.c to an instrumented object file:: |
- pnacl-clang -o hello.nonfinal.pexe hello.c |
+ sz-clang.py -fno-inline -fsanitize-address -o hello.nonfinal.pexe hello.c |
pnacl-finalize --no-strip-syms -o hello.pexe hello.nonfinal.pexe |
pnacl-sz -fsanitize-address -filetype=obj -o hello.o hello.pexe |