]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Use different RUST_LINKER_OPTIONS for sanitizers
authorNick Mathewson <nickm@torproject.org>
Wed, 20 Jun 2018 21:53:09 +0000 (17:53 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 20 Jun 2018 21:53:09 +0000 (17:53 -0400)
These appear to work for me.

configure.ac

index f976cdd42d3f16428e4d2055bddc1d3d387352d2..606bceeda527ca4eed876cac01bbb85ebe28c6e2 100644 (file)
@@ -1128,11 +1128,20 @@ dnl What's more, we need to specify them in a linker script rather than
 dnl from build.rs: these options aren't allowed in the cargo:rustc-flags
 dnl variable.
 RUST_LINKER_OPTIONS=""
-if test "x$CFLAGS_ASAN" != "x"; then
-        RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -static-libasan"
-fi
-if test "x$CFLAGS_UBSAN" != "x"; then
-         RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -static-libubsan"
+if test "x$have_clang" = "xyes"; then
+       if test "x$CFLAGS_ASAN" != "x"; then
+               RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS $CFLAGS_ASAN"
+       fi
+       if test "x$CFLAGS_UBSAN" != "x"; then
+               RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS $CFLAGS_UBSAN"
+       fi
+else
+       if test "x$CFLAGS_ASAN" != "x"; then
+               RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -lasan"
+       fi
+       if test "x$CFLAGS_UBSAN" != "x"; then
+               RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -lubsan"
+       fi
 fi
 AC_SUBST(RUST_LINKER_OPTIONS)