aboutsummaryrefslogtreecommitdiffstats
path: root/community/rust/alpine-allow-crt-static.patch
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2017-05-01 00:43:19 +0200
committerJakub Jirutka <jakub@jirutka.cz>2017-05-01 00:43:19 +0200
commit41489596392977197d046ca034685664a3f4afa4 (patch)
treeef791ac83fd7635db59db40e12beb20a66ada3bd /community/rust/alpine-allow-crt-static.patch
parentabfa07f26ff2837922903586b15e137b67b43219 (diff)
downloadaports-41489596392977197d046ca034685664a3f4afa4.tar.bz2
aports-41489596392977197d046ca034685664a3f4afa4.tar.xz
community/rust: move from testing
Diffstat (limited to 'community/rust/alpine-allow-crt-static.patch')
-rw-r--r--community/rust/alpine-allow-crt-static.patch41
1 files changed, 41 insertions, 0 deletions
diff --git a/community/rust/alpine-allow-crt-static.patch b/community/rust/alpine-allow-crt-static.patch
new file mode 100644
index 0000000000..5e81671f60
--- /dev/null
+++ b/community/rust/alpine-allow-crt-static.patch
@@ -0,0 +1,41 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Sat, 08 Aug 2016 14:49:00 +0200
+Subject: [PATCH] Allow to use -C target-feature=+crt-static on stable rustc
+
+Rust links system libraries statically on musl by default, but we want to
+link dynamically. At the same time we want to allow users to optionally
+use static linking.
+
+rustc already provides codegen option to change linking, but currently it's
+allowed only for nightly builds. This patch just removes this check and so
+allows to use it even on stable build.
+
+Build staticaly linked binary with rustc or cargo:
+
+ $ rustc -C target-feature=+crt-static hello_world.rs
+ $ RUSTFLAGS="-C target-feature=+crt-static" cargo build
+
+--- a/src/librustc/session/mod.rs
++++ b/src/librustc/session/mod.rs
+@@ -401,9 +401,9 @@
+ // If we switched from the default then that's only allowed on nightly, so
+ // gate that here.
+ if (found_positive || found_negative) && (!is_nightly || !unstable_options) {
+- self.fatal("specifying the `crt-static` target feature is only allowed \
+- on the nightly channel with `-Z unstable-options` passed \
+- as well");
++ //self.fatal("specifying the `crt-static` target feature is only allowed \
++ // on the nightly channel with `-Z unstable-options` passed \
++ // as well");
+ }
+
+ return crt_static;
+--- a/src/test/compile-fail/crt-static-gated.rs
++++ b/src/test/compile-fail/crt-static-gated.rs
+@@ -10,5 +10,6 @@
+
+ // compile-flags:-C target-feature=+crt-static
+ // error-pattern: specifying the `crt-static` target feature is only allowed
++// ignore-test we just want this feature and no one will stop us!
+
+ fn main() {}