From 8160105905385dc99b752da51503050b5dc9ff96 Mon Sep 17 00:00:00 2001 From: Caleb Sander Date: Fri, 13 Oct 2023 17:41:30 -0600 Subject: [PATCH] readme: clarify that LD_PRELOAD is not needed for ASAN The README currently suggests setting LD_PRELOAD to the libasan path. However, this seems to be unnecessary (at least on my gcc 9 setup). The test executables request to link with libasan.so (before libc.so), so it is automatically loaded. The recommended suggestion also ends up running ninja with ASAN instrumentation, which causes it to fail with leaks detected. Signed-off-by: Caleb Sander --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c493ef77..f785d0c2 100644 --- a/README.md +++ b/README.md @@ -171,7 +171,9 @@ To enable address sanitizer (advanced debugging of memory issues): meson setup .build -Db_sanitize=address ``` -This option adds `-fsanitize=address` to the gcc options. Note that when using the sanitize feature, the library `libasan.so` must be available and must be the very first library loaded when running an executable. Ensuring that `libasan.so` gets loaded first can be achieved with the `LD_PRELOAD` environment variable as follows: +This option adds `-fsanitize=address` to the gcc options. The tests can then be run normally (`meson test -C .build`). + +Note that when using the sanitize feature, the library `libasan.so` must be available and must be the very first library loaded when running an executable. If experiencing linking issues, you can ensure that `libasan.so` gets loaded first with the `LD_PRELOAD` environment variable as follows: ``` meson setup .build -Db_sanitize=address && LD_PRELOAD=/lib64/libasan.so.6 ninja -C .build test -- 2.50.1