From: Kostya Serebryany Date: Fri, 19 Oct 2012 07:00:46 +0000 (+0000) Subject: [asan] update asan docs to explain more about linking and to mention full support... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=460e7a25da073a1cc2bec995bde66877f30ca4f5;p=clang [asan] update asan docs to explain more about linking and to mention full support for i386 Linux git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@166271 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/AddressSanitizer.html b/docs/AddressSanitizer.html index edb2ce42bc..498719afbb 100644 --- a/docs/AddressSanitizer.html +++ b/docs/AddressSanitizer.html @@ -49,6 +49,11 @@ Follow the clang build instructions.

Usage

Simply compile and link your program with -faddress-sanitizer flag.
+The AddressSanitizer run-time library should be linked to the final executable, +so make sure to use clang (not ld) for the final link step.
+When linking shared libraries, the AddressSanitizer run-time is not linked, +so -Wl,-z,defs may cause link errors (don't use it with AddressSanitizer).
+ To get a reasonable performance add -O1 or higher.
To get nicer stack traces in error messages add -fno-omit-frame-pointer.
@@ -65,8 +70,16 @@ int main(int argc, char **argv) {
+# Compile and link
 % clang -O1 -g -faddress-sanitizer -fno-omit-frame-pointer example_UseAfterFree.cc
 
+OR +
+# Compile
+% clang -O1 -g -faddress-sanitizer -fno-omit-frame-pointer -c example_UseAfterFree.cc
+# Link
+% clang -g -faddress-sanitizer example_UseAfterFree.o
+
If a bug is detected, the program will print an error message to stderr and exit with a non-zero exit code. @@ -116,10 +129,10 @@ Note: currently, this attribute will be lost if the function is inlined.

Supported Platforms

AddressSanitizer is supported on -