summaryrefslogtreecommitdiff
path: root/link_rust.sh.in
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-06-18 17:08:23 -0400
committerNick Mathewson <nickm@torproject.org>2018-06-19 12:01:13 -0400
commitbd9ebb3763b90a8ef429376ee578e0571371145f (patch)
tree06a8e6fd20118ec47e87dc36a4b9780f809360d6 /link_rust.sh.in
parentd27745d81de8829d1a6da851fe9be057458e86df (diff)
downloadtor-bd9ebb3763b90a8ef429376ee578e0571371145f.tar.gz
tor-bd9ebb3763b90a8ef429376ee578e0571371145f.zip
Use a rust build script to set linker options correctly for tests.
We need this trick because some of our Rust tests depend on our C code, which in turn depend on other native libraries, which thereby pulls a whole mess of our build system into "cargo test". To solve this, we add a build script (build.rs) to set most of the options that we want based on the contents of config.rust. Some options can't be set, and need to go to the linker directly: we use a linker replacement (link_rust.sh) for these. Both config.rust and link_rust.sh are generated by autoconf for us. This patch on its own should enough to make the crypto test build, but not necessarily enough to make it pass.
Diffstat (limited to 'link_rust.sh.in')
-rw-r--r--link_rust.sh.in10
1 files changed, 10 insertions, 0 deletions
diff --git a/link_rust.sh.in b/link_rust.sh.in
new file mode 100644
index 0000000000..2b972fdf27
--- /dev/null
+++ b/link_rust.sh.in
@@ -0,0 +1,10 @@
+#!/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@ "$@"