From 9d576b5cb75cbff18b5cf700871e0db501d6db73 Mon Sep 17 00:00:00 2001 From: krcroft Date: Sun, 12 Apr 2020 11:08:12 -0700 Subject: [PATCH] Statically link libasan during ASAN builds Some deployments of GCC won't link ASAN build without explicitly specifying the library, and report: "ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD" This commit includes the asan library by default for respective builds. --- scripts/automator/build/gcc-defaults | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/automator/build/gcc-defaults b/scripts/automator/build/gcc-defaults index 4da3fe11..d4ac7988 100644 --- a/scripts/automator/build/gcc-defaults +++ b/scripts/automator/build/gcc-defaults @@ -30,8 +30,10 @@ cflags_fdotrain+=("${cflags[@]}" -DNDEBUG -g1 -fno-omit-frame-pointer) cflags_optinfo+=("${cflags_release[@]}" -fopt-info-missed -ftree-vectorizer-verbose=6) cflags_asan+=("${cflags_debug[@]}" -fsanitize=address) +ldflags_asan+=(-static-libasan) cflags_uasan+=("${cflags_debug[@]}" -fsanitize=address,undefined -fsanitize-recover=signed-integer-overflow) +ldflags_uasan+=(-static-libasan) cflags_usan+=("${cflags_debug[@]}" -fsanitize=undefined -fsanitize-recover=signed-integer-overflow) cflags_tsan+=("${cflags_debug[@]}" -fsanitize=thread)