summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-06-20 17:07:47 -0400
committerNick Mathewson <nickm@torproject.org>2018-06-20 17:07:47 -0400
commite99ecf939936ed1e8fabbf2f30488d20389ecb7b (patch)
tree8feae21aa532972c2efc6e813817ecd0ef08f325 /configure.ac
parent7589fd6d403ac2aecb991a07069d78c6dccae719 (diff)
parentbd9ebb3763b90a8ef429376ee578e0571371145f (diff)
downloadtor-e99ecf939936ed1e8fabbf2f30488d20389ecb7b.tar.gz
tor-e99ecf939936ed1e8fabbf2f30488d20389ecb7b.zip
Merge branch 'rust_build_script_v3' into additional_rust_test_fixes
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac20
1 files changed, 20 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 1b57361e02..f976cdd42d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1118,6 +1118,24 @@ if test "$fragile_hardening" = "yes"; then
TOR_CHECK_CFLAGS([-fno-omit-frame-pointer])
fi
+dnl Find the correct libraries to add in order to use the sanitizers.
+dnl
+dnl When building Rust, Cargo will run the linker with the -nodefaultlibs
+dnl option, which will prevent the compiler from linking the sanitizer
+dnl libraries it needs. We need to specify them manually.
+dnl
+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"
+fi
+AC_SUBST(RUST_LINKER_OPTIONS)
+
CFLAGS_BUGTRAP="$CFLAGS_FTRAPV $CFLAGS_ASAN $CFLAGS_UBSAN"
CFLAGS_CONSTTIME="$CFLAGS_FWRAPV"
@@ -2267,6 +2285,8 @@ CPPFLAGS="$CPPFLAGS $TOR_CPPFLAGS_libevent $TOR_CPPFLAGS_openssl $TOR_CPPFLAGS_z
AC_CONFIG_FILES([
Doxyfile
Makefile
+ config.rust
+ link_rust.sh
contrib/dist/suse/tor.sh
contrib/operator-tools/tor.logrotate
contrib/dist/tor.sh