summaryrefslogtreecommitdiffstats
path: root/build/cargo-linker
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 14:29:10 +0000
commit2aa4a82499d4becd2284cdb482213d541b8804dd (patch)
treeb80bf8bf13c3766139fbacc530efd0dd9d54394c /build/cargo-linker
parentInitial commit. (diff)
downloadfirefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz
firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'build/cargo-linker')
-rwxr-xr-xbuild/cargo-linker22
1 files changed, 22 insertions, 0 deletions
diff --git a/build/cargo-linker b/build/cargo-linker
new file mode 100755
index 0000000000..394dabcf7f
--- /dev/null
+++ b/build/cargo-linker
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# If you want to use a custom linker with Cargo, Cargo requires that you
+# specify it in Cargo.toml or via the matching environment variable.
+# Passing extra options to the linker is possible with Cargo via
+# RUSTFLAGS='-C link-args', but testing showed that doing this reliably
+# was difficult.
+#
+# Our solution to these problems is to use this wrapper script. We pass
+# in the LD and the LDFLAGS to use via environment variables. Note that
+# we do *not* quote either MOZ_CARGO_WRAP variable:
+#
+# * MOZ_CARGO_WRAP_LD is equivalent to CC on Unix-y platforms, and CC
+# frequently has additional arguments in addition to the compiler
+# itself.
+# * MOZ_CARGO_WRAP_LDFLAGS contains space-separated arguments to pass,
+# and not quoting it ensures that each of those arguments is passed
+# as a separate argument to the actual LD.
+#
+# $@ is doubly quoted for the eval. See bug 1418598.
+
+eval ${MOZ_CARGO_WRAP_LD} ${MOZ_CARGO_WRAP_LDFLAGS} '"$@"'