]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Remove the `link_rust.sh.in` script
authorAlex Crichton <alex@alexcrichton.com>
Tue, 2 Oct 2018 05:50:08 +0000 (22:50 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 2 Oct 2018 05:50:08 +0000 (22:50 -0700)
This is no longer necessary with upstream rust-lang/rust changes as well
as some local tweaks. Namely:

* The `-fsanitize=address`-style options are now passed via `-C
  link-args` through `RUSTFLAGS`. This obviates the need for the shell
  script.
* The `-C default-linker-libraries`, disabling `-nodefaultlibs`, is
  passed through `RUSTFLAGS`, which is necessary to ensure that
  `-fsanitize=address` links correctly.
* The `-C linker` option is passed to ensure we're using the same C
  compiler as normal C code, although it has a bit of hackery to only
  get the `gcc` out of `gcc -std=c99`

configure.ac
link_rust.sh.in [deleted file]
src/test/include.am

index dbeba512cae517ba2656ac75ec90dfa1d9ebc121..ef8bb4e351fa94860fddd1c5d0953b5a856b4dc7 100644 (file)
@@ -1210,17 +1210,17 @@ dnl variable.
 RUST_LINKER_OPTIONS=""
 if test "x$have_clang" = "xyes"; then
        if test "x$CFLAGS_ASAN" != "x"; then
-               RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS $CFLAGS_ASAN"
+               RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -Clink-arg=$CFLAGS_ASAN"
        fi
        if test "x$CFLAGS_UBSAN" != "x"; then
-               RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS $CFLAGS_UBSAN"
+               RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -Clink-arg=$CFLAGS_UBSAN"
        fi
 else
        if test "x$CFLAGS_ASAN" != "x"; then
-               RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -lasan"
+               RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -Clink-arg=-fsanitize=address"
        fi
        if test "x$CFLAGS_UBSAN" != "x"; then
-               RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -lubsan"
+               RUST_LINKER_OPTIONS="$RUST_LINKER_OPTIONS -Clink-arg=-fsanitize=undefined"
        fi
 fi
 AC_SUBST(RUST_LINKER_OPTIONS)
@@ -2416,7 +2416,6 @@ AC_CONFIG_FILES([
        Doxyfile
        Makefile
        config.rust
-       link_rust.sh
        contrib/dist/suse/tor.sh
        contrib/operator-tools/tor.logrotate
        contrib/dist/tor.sh
diff --git a/link_rust.sh.in b/link_rust.sh.in
deleted file mode 100644 (file)
index 59f4142..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-#
-# A linker script used when building Rust tests.  Autoconf makes link_rust.sh
-# from link_rust_sh.in, and uses it to pass extra options to the linker
-# when linking Rust stuff.
-#
-# We'd like to remove the need for this, but build.rs doesn't let us pass
-# -static-libasan and -static-libubsan to the linker.
-
-$CCLD @RUST_LINKER_OPTIONS@ "$@"
index 1055cd0a81e53d94e621051e29bc545a3f9e7586..4314581082bd79fdc32bb270076b76591bd0aab1 100644 (file)
@@ -12,8 +12,7 @@ TESTS_ENVIRONMENT = \
        export EXTRA_CARGO_OPTIONS="$(EXTRA_CARGO_OPTIONS)"; \
        export CARGO_ONLINE="$(CARGO_ONLINE)"; \
        export CCLD="$(CCLD)"; \
-       chmod +x "$(abs_top_builddir)/link_rust.sh"; \
-       export RUSTFLAGS="-C linker=$(abs_top_builddir)/link_rust.sh";
+       export RUSTFLAGS="-C linker=`echo '$(CC)' | cut -d' ' -f 1` $(RUST_LINKER_OPTIONS) -C default-linker-libraries";
 
 TESTSCRIPTS = \
        src/test/fuzz_static_testcases.sh \