Hi Marshall,
First, you need to build Clang yourself, because the Chromium-shipped
one doesn't contain the shared runtime. Please refer to
https://code.google.com/p/address-sanitizer/wiki/HowToBuild for the
instructions. You may want to use the Clang revision listed in
Chromium's tools/clang/scripts/update.sh, which is considered stable.
Next, you'll need to add the "-shared-libasan" flag to
build/common.gypi in the places where "-fsanitize=address" is passed
to the linker (keep "-fsanitize=address").
I think this should be enough to build Chrome with asan=1.
On Thu, Nov 27, 2014 at 3:07 AM, Alexander Potapenko <gli...@chromium.org> wrote:Hi Marshall,
First, you need to build Clang yourself, because the Chromium-shipped
one doesn't contain the shared runtime. Please refer to
https://code.google.com/p/address-sanitizer/wiki/HowToBuild for the
instructions. You may want to use the Clang revision listed in
Chromium's tools/clang/scripts/update.sh, which is considered stable.
Next, you'll need to add the "-shared-libasan" flag to
build/common.gypi in the places where "-fsanitize=address" is passed
to the linker (keep "-fsanitize=address").
I think this should be enough to build Chrome with asan=1.Thanks! I added "-DCOMPILER_RT_BUILD_SHARED_ASAN=ON" to the cmake command lines in tools/clang/scripts/update.sh and built clang locally as follows:$ ./update.sh --force-local-build --without-androidThis generated libclang_rt.asan-x86_64.so in the third_party/llvm-build/Release+Asserts/lib/clang/3.6.0/lib/linux directory.I then needed to do the following for Chromium to build with asan=1:1. Copy libclang_rt.asan-x86_64.so to the out/Release/lib directory.2. Add '-shared-libasan' (or modify exclusions) in build/common.gypi, build/sanitizers/sanitizers.gyp, sandbox/linux/sandbox_linux.gypi and third_party/libvpx/libvpx.gyp.