Skip to content
Snippets Groups Projects
Commit 3b2c2faa authored by Jakub Jirutka's avatar Jakub Jirutka :flag_ua:
Browse files

testing/rust: build dynamically linked binaries by default

Note that users still can switch to static linking using
`-C target-feature=+crt-static`, that is allowed in our rustc.
parent 0762f2d2
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,7 @@ pkgver=1.16.0
# Git revision of prebuilt Cargo to use for bootstrapping, from src/stage0.txt.
_cargo_gitrev=6e0c18cccc8b0c06fba8a8d76486f81a792fb420
_llvmver=3.9
pkgrel=2
pkgrel=3
pkgdesc="The Rust Programming Language (compiler)"
url="http://www.rust-lang.org"
arch="x86_64"
......@@ -185,12 +185,12 @@ e9b10d58ae5b51b09dd31a1dbf7367917bd40a05ecb4ba3e0e7ac229a0352d3ceb77de80f7c0120f
4df33353b6be1af822220ca03f9ec5a3b6421c9b10ec17b864be586ba495c6210bac70d904b0e0b35eff62ef2c9a681ded526e5cbd37e326dc3146742aa659de cargo-6e0c18cccc8b0c06fba8a8d76486f81a792fb420-x86_64-unknown-linux-musl.tar.gz
2002faf08cca3be702f25618bc17453c5e76644a6ff6b0739b642c2c0f8536ec7f09c98182aff6b2dcc87c77b0929f2f8f732b8242a8f80d94b3824c8cd0d0fe dont-require-filecheck.patch
b0a8883e4469b60edd150c84486ab950396d757220f97bd271529576614c6c3b49456098507503832c20619d4bd74246dbc99c78116634a68a6df994793e9a94 support-dynamically-linked-musl.patch
67f5933fd2da8f2b5eb0d62e05af52d161bd0602fe9353adc9a2128b9c9ba42578587d4963357a483638af3e5f74cef69a994c45ea20ce6c22f6016e5bcc3125 allow-crt-static-on-stable.patch
b00997c65d1a451fafae8b547893c5cbf03f028d2d70f6971aa670f34c2d6fc82728c740ac4a9909fc1999925ff300e4525cfec745cb9c9521e564eb166872a2 allow-crt-static-on-stable.patch
79d7eb79bb5219beab2fa8394e30b830275ce3062fd7c02077229ad1fdca492f55d321e0bc1015f62252fe4df3cc41c5168ff9d2e848ae06b14f807add7e193a static-pie.patch
f436fddf7ab70ca5f1424081f5b75450270b200b3d997231323863e11addf76e1d65831a7ca09e3a5b7904ce828766c1f70b08326a175890298f28e5bc8646ef fix-linux_musl_base.patch
5813ac0373cb550fff2a99f650a50852088e6f3cd0803edf77b1f1bfa712eb3da5d7579cfe6e00f1d06750b248a5c86d0fff17dc70a31b1520a6430adc64bceb fix-linux_musl_base.patch
37416e1fa0bc0c8651cd060a645d6245ff7e2082279ab5e13495c5ee412c71915469019cfbec95a0fd9a7fc144475079a3ad16f0eba7a2f5c8dd99e0002f3225 llvm-with-ffi.patch
19cc2725d68db3e359e0e3016028374e5818a97fdba24d0103f7d1706601c8b17c4dd95a3152e64f982f98e95ad3e949acddbea8a39ed0ba8dd4f702acc2704d move-py-scripts-to-share.patch
8d6206f8c50856724cf7b4c1854ec82547f040358a1c7d44abeacc27a5c205a963b1fec51e58ec06c68d85bd2f68a9e6e27ebe457f39e8dd043de17758f5063f change-rpath-to-rustlib.patch
f230239d8de1b69536353e5735d3bf32f42a2715aefe4863622d9ab2b25d010209ed0bb38976eaa9302bce2eca6bd162abc8cefd71f689b65b3800920a50967b force-rpath-on-prefer-dynamic.patch
a330fa913faeadb98cb95e644f434ddef4fbbea32bcd11b6621fb9e08f7b0d8c71fae702207465489af3cf793eade0af694a8c515fc1bed49624da25103a4862 fix-jemalloc-musl.patch
37ece048cc4efac0f66e3f6e4cbb37f08fc0f8fe7af474a96e2c1d7400df773d9e33601b09feddae2a716e14fb98f8d8386504c4e36f86c699b6b785115c6bdb check-rustc"
79549055dea81379c890b495c82456ab497a9179ec6702c59e11d0748bc668f47fc3d6a69c27a0545bb87c01318631dffc69260bf2d4badc75f53cbf7fad7528 check-rustc"
......@@ -3,17 +3,17 @@ 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 would like to preserve this behaviour
for consistency with other distros, to not confuse users.
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 dynamically linked binary with rustc or cargo:
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
$ 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
......
......@@ -73,7 +73,7 @@ EOF
_rustc hello_world.rs
assert_ok ./hello_world
assert_static hello_world
assert_dynamic hello_world
assert_pie hello_world
rm -f hello_world
......
......@@ -57,7 +57,8 @@ See https://github.com/rust-lang/rust/pull/40113
- base.post_link_objects.push("crtn.o".to_string());
-
// Except for on MIPS, these targets statically link libc by default.
base.crt_static_default = true;
- base.crt_static_default = true;
+ base.crt_static_default = false;
base
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment