[gjs: 6/7] build: Make sanitizer linker flags optional



commit a95097568cfaf648135d7fa9fc371226ae0ec8d7
Author: Philip Chimento <philip chimento gmail com>
Date:   Mon Mar 12 23:34:48 2018 -0700

    build: Make sanitizer linker flags optional
    
    On some platforms, we have to pass the sanitizer flags to the linker. On
    others, we don't. On the latter, the sanitizers will be always off
    because the check that the linker supports those flags will fail. In
    order to fix that, make support for the linker flags optional, and turn
    on the sanitizers only if the compiler supports the flags.
    
    See #120.

 configure.ac | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b802e8e..eb93f8f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -230,7 +230,8 @@ AC_ARG_ENABLE([asan],
 
 AS_IF([test "x$enable_asan" = "xyes"], [
   AX_CHECK_COMPILE_FLAG([-fsanitize=address -fno-omit-frame-pointer -g], [
-    AX_CHECK_LINK_FLAG([-fsanitize=address], [SAN_FLAGS="-fsanitize=address"])
+    AX_CHECK_LINK_FLAG([-fsanitize=address])
+    SAN_FLAGS="-fsanitize=address"
   ])
 ])
 
@@ -239,8 +240,8 @@ AC_ARG_ENABLE([ubsan],
 
 AS_IF([test "x$enable_ubsan" = "xyes"], [
   AX_CHECK_COMPILE_FLAG([-fsanitize=undefined -fno-sanitize=vptr -fno-omit-frame-pointer -g], [
-    AX_CHECK_LINK_FLAG([-fsanitize=undefined -fno-sanitize=vptr],
-      [SAN_FLAGS="$SAN_FLAGS -fsanitize=undefined -fno-sanitize=vptr"])
+    AX_CHECK_LINK_FLAG([-fsanitize=undefined -fno-sanitize=vptr])
+    SAN_FLAGS="$SAN_FLAGS -fsanitize=undefined -fno-sanitize=vptr"
   ])
 ])
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]