X-Original-To: alpine-aports@lists.alpinelinux.org Received: from luna.geeknet.cz (luna.geeknet.cz [37.205.9.141]) by lists.alpinelinux.org (Postfix) with ESMTP id 5440E5C359A for ; Mon, 23 Oct 2017 13:10:34 +0000 (GMT) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by luna.geeknet.cz (Postfix) with ESMTPSA id 883369380D; Mon, 23 Oct 2017 15:10:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jirutka.cz; s=mail; t=1508764232; bh=sD6xlPcfCr7SA5/LWEPq2AO+7SjCfN2dXIOCN3A27a4=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=apNC6SiDjnoYrIpadP+utPntfjwkZJBz2WliTdcgmF9+ieG7Gj4g6y2wkvRTspKvi KGhN1VR0hLGSK26Br/vbBiowhYUlykPj1LX60/uBHsiwimPpUQXdTOdNCKfFTnjtpf wlSIipDBJMz3X70nxCZn2H5ZzcwfPqEiFRdKAXhc= Content-Type: text/plain; charset=utf-8 X-Mailinglist: alpine-aports Precedence: list List-Id: Alpine Development List-Unsubscribe: List-Post: List-Help: List-Subscribe: Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Subject: Re: [alpine-aports] [PATCH] community/rust: upgrade to 1.8 From: Jakub Jirutka In-Reply-To: Date: Mon, 23 Oct 2017 15:10:32 +0200 Cc: alpine-aports@lists.alpinelinux.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <20171018124500.27823-1-jeizsm@gmail.com> <20171023140116.413ec154@ncopa-macbook.copa.dup.pw> To: =?utf-8?B?0KHQsNGE0LjQvSDQnNCw0YDQsNGC?= Hi, the patch is malformed, maybe due to formatting applied by email client, = but raw source didn=E2=80=99t help either. I very appreciate your contribution, but please have some respect to our = time and don=E2=80=99t send patches via email. This way I have to = manually extract it to a patch file, apply it, run build to verify that = it really works. If I request some changes, then you would send me next = email with new set of patches which I have to again manually extract, = apply=E2=80=A6 and also compare with previous patches, so I can review = only changes and not complete patches. This is really insane! We have = much better methods in the 21st century. Please open a pull request in = https://github.com/alpinelinux/aports/pulls, there it=E2=80=99s = automatically tested on CI, we can directly discuss changes and you can = just keep adding commits in normal git way, while I can easily see = changes you made. You have to just =E2=80=9CFork=E2=80=9D = https://github.com/alpinelinux/aports/ (as upstream) to get your own = remote clone (as origin), clone it locally, create a new branch, commit = changes, push it to your origin and open a PR against = alpinelinux/aports@master. I we request some changes, you just commit it = to your existing branch and push to origin. All of it can be done even = using CLI (except creating account on GH if you don=E2=80=99t have one = yet). If you really don=E2=80=99t wanna use GitHub, please at least send me = the patch in mbox format in email attachment. Thanks, Jakub > On 23. Oct 2017, at 14:19, =D0=A1=D0=B0=D1=84=D0=B8=D0=BD =D0=9C=D0=B0=D1= =80=D0=B0=D1=82 wrote: >=20 > Use this patch instead. Thanks > --- > community/rust/APKBUILD | 21 +++--- > community/rust/alpine-target.patch | 8 +- > community/rust/fix-build.patch | 92 = +++++++++++++++++++++++ > community/rust/musl-fix-jemalloc.patch | 61 --------------- > community/rust/musl-fix-linux_musl_base.patch | 8 +- > community/rust/musl-fix-static-linking.patch | 42 +++++++---- > community/rust/musl-support-dynamic-linking.patch | 12 ++- > 7 files changed, 147 insertions(+), 97 deletions(-) > create mode 100644 community/rust/fix-build.patch > delete mode 100644 community/rust/musl-fix-jemalloc.patch >=20 > diff --git a/community/rust/APKBUILD b/community/rust/APKBUILD > index 48ce4e7ffa..62f9462f9c 100644 > --- a/community/rust/APKBUILD > +++ b/community/rust/APKBUILD > @@ -1,11 +1,12 @@ > # Contributor: Jakub Jirutka > # Contributor: Shiz > +# Contributor: Jeizsm > # Maintainer: Jakub Jirutka > pkgname=3Drust > -pkgver=3D1.17.0 > +pkgver=3D1.18.0 > _llvmver=3D3.9 > -_bootver=3D1.16.0 > -pkgrel=3D3 > +_bootver=3D1.17.0 > +pkgrel=3D1 > pkgdesc=3D"The Rust Programming Language (compiler)" > url=3D"http://www.rust-lang.org" > arch=3D"x86_64" > @@ -29,7 +30,6 @@ = source=3D"https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.gz > musl-support-dynamic-linking.patch > musl-fix-static-linking.patch > musl-fix-linux_musl_base.patch > - musl-fix-jemalloc.patch > llvm-with-ffi.patch > static-pie.patch > need-rpath.patch > @@ -38,6 +38,7 @@ = source=3D"https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.gz > alpine-move-py-scripts-to-share.patch > alpine-change-rpath-to-rustlib.patch > alpine-target.patch > + fix-build.patch > check-rustc > " > builddir=3D"$srcdir/rustc-$pkgver-src" > @@ -169,11 +170,10 @@ _mv() { > mv $@ > } >=20 > = -sha512sums=3D"781799b29d83b4f0f433814bd818df034526db8e7f88c2df51d3b814eac= afe8098d4bbe47ace951e1943325b3267b244007cf04f1f11083645b25aeacd40ebb6 = rustc-1.17.0-src.tar.gz > = -b0a8883e4469b60edd150c84486ab950396d757220f97bd271529576614c6c3b494560985= 07503832c20619d4bd74246dbc99c78116634a68a6df994793e9a94 = musl-support-dynamic-linking.patch > = -292c1cb4f751d830f5f1300d7ef94f573f698ac51e18243d7ff0d5a47bb1729bb2cbe8fb4= 56e7a479213df5e5fbf49e360c9439d0f5ad7126cb72d161c91566a = musl-fix-static-linking.patch > = -f436fddf7ab70ca5f1424081f5b75450270b200b3d997231323863e11addf76e1d65831a7= ca09e3a5b7904ce828766c1f70b08326a175890298f28e5bc8646ef = musl-fix-linux_musl_base.patch > = -c913d04ef419b2b6d8e453f72894070f263c9292abf97114a51884d475d03ce5b032053f1= 676ba9364800b4b35e394f707995058530ad5e4122c60f65ddd3db7 = musl-fix-jemalloc.patch > = +sha512sums=3D"eff0460b647dfb3490e28d4dec4f9781d31a942f22de75d9bd1ba315915= 97226b6862ec5132e8b4fcdbcf6e6ffa085ca5dda7ff8260cd82388fc13e8d3b4a2eb = rustc-1.18.0-src.tar.gz > = +b5db9ed04eac26c6fc62cde3f19d29837a5feea68e79165c23b5b5cade2e1d193f2399d27= f7622b230996da9565f78825be154574f1cd59189ded8a03a766cfb = musl-support-dynamic-linking.patch > = +d4d39514eca638852307f470250fd12a21781e1e7944377744b7d50290d3a2ab3776fbdfc= cb7a9221f5da00ca694ac3a5b8c05f72c5e1a0c8711b684b16b1084 = musl-fix-static-linking.patch > = +9ebfb10abb50d74ff08d257d85257ce70ac3ce834aa95a8901808497b14acf3ea898fb197= de64d13554eb5feedabe9fd04fec2cc6a7bea9b1335684bfcdcd88b = musl-fix-linux_musl_base.patch > = dc6432293bd060d5e3a73f25870867654fae61995dcd919e244a2dc686b6107556deed8c59= ca6002182bfeff5ebc1ca2b89c4028ab0fbfb79e65defe47c9b4b0 = llvm-with-ffi.patch > = 5aaf6715b27b8b786740a55b91216d47985fbef3ccb0ef7e6a81696a2823671f8306143f7e= cf77e66af91ef1500072524b9b4c7569508922ad5268df6080fda1 static-pie.patch > = ff633f2a46c683ad698d1c09c98c06ce9ee9b8d55fa5593cdd485b439ebca3273794d29b5f= f32b887be8666f52913a23af6e133c782bd0c4e2c88e306dd3a494 need-rpath.patch > @@ -181,5 +181,6 @@ = d352614e7c774e181decae210140e789de7fc090327ff371981ad28a11ce51c8c01b27c110= 1a24bb > = b00997c65d1a451fafae8b547893c5cbf03f028d2d70f6971aa670f34c2d6fc82728c740ac= 4a9909fc1999925ff300e4525cfec745cb9c9521e564eb166872a2 = alpine-allow-crt-static.patch > = 498f4649163974afc4f042c43cd0c15d36784031514201a2962061f288a9336c2bc9749f8d= 2308b8ce3656f8097b5fc5bef505f61e2a6ed422ef4153f5339d77 = alpine-move-py-scripts-to-share.patch > = 8d6206f8c50856724cf7b4c1854ec82547f040358a1c7d44abeacc27a5c205a963b1fec51e= 58ec06c68d85bd2f68a9e6e27ebe457f39e8dd043de17758f5063f = alpine-change-rpath-to-rustlib.patch > = -aaf359dbfb8f379bef42647890e99ada4b5326c29f726edb16c51b23a5033b5e00363d2fb= 6d74a4f11dfbb241b21b22c578e2ec269ecd77a87cf20d3620b29a5 = alpine-target.patch > = +e9935f88f959d37da9e696f2722569bc6da6ed17eddc8d496af4a2ee9a561d8e40bd76440= 89ee26114bb920e04ff05def18d70a6f2347545500d1a23ee96eefa = alpine-target.patch > = +5c1bcd78d2579e1aeacd4f20d849f75127111fb2f06124531af370c7afdcf9ae78d9e3952= 911197c02099cdedfeb2335699f98568123bdd83c7acc1ddbae7f54 fix-build.patch > = 79549055dea81379c890b495c82456ab497a9179ec6702c59e11d0748bc668f47fc3d6a69c= 27a0545bb87c01318631dffc69260bf2d4badc75f53cbf7fad7528 check-rustc" > diff --git a/community/rust/alpine-target.patch = b/community/rust/alpine-target.patch > index e013a6bc2e..fc79b45b9a 100644 > --- a/community/rust/alpine-target.patch > +++ b/community/rust/alpine-target.patch > @@ -8,7 +8,7 @@ and distribution-specific quirks instead of polluting = the main musl target of >=20 > --- /dev/null > +++ b/src/librustc_back/target/i586_alpine_linux_musl.rs > -@@ -0,0 +1,32 @@ > +@@ -0,0 +1,34 @@ > +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT > +// file at the top-level directory of this distribution and at > +// http://rust-lang.org/COPYRIGHT. > @@ -19,6 +19,7 @@ and distribution-specific quirks instead of = polluting the main musl target of > +// option. This file may not be copied, modified, or distributed > +// except according to those terms. > + > ++use LinkerFlavor; > +use target::{Target, TargetResult}; > + > +pub fn target() -> TargetResult { > @@ -38,6 +39,7 @@ and distribution-specific quirks instead of = polluting the main musl target of > + target_os: "linux".to_string(), > + target_env: "musl".to_string(), > + target_vendor: "alpine".to_string(), > ++ linker_flavor: LinkerFlavor::Gcc, > + options: base, > + }) > +} > @@ -55,7 +57,7 @@ and distribution-specific quirks instead of = polluting the main musl target of > /// Everything `rustc` knows about how to compile for a specific = target. > --- /dev/null > +++ b/src/librustc_back/target/x86_64_alpine_linux_musl.rs > -@@ -0,0 +1,32 @@ > +@@ -0,0 +1,34 @@ > +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT > +// file at the top-level directory of this distribution and at > +// http://rust-lang.org/COPYRIGHT. > @@ -66,6 +68,7 @@ and distribution-specific quirks instead of = polluting the main musl target of > +// option. This file may not be copied, modified, or distributed > +// except according to those terms. > + > ++use LinkerFlavor; > +use target::{Target, TargetResult}; > + > +pub fn target() -> TargetResult { > @@ -85,6 +88,7 @@ and distribution-specific quirks instead of = polluting the main musl target of > + target_os: "linux".to_string(), > + target_env: "musl".to_string(), > + target_vendor: "alpine".to_string(), > ++ linker_flavor: LinkerFlavor::Gcc, > + options: base, > + }) > +} > diff --git a/community/rust/fix-build.patch = b/community/rust/fix-build.patch > new file mode 100644 > index 0000000000..0a8482d731 > --- /dev/null > +++ b/community/rust/fix-build.patch > @@ -0,0 +1,92 @@ > +diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs > +index 56cbb4cecf2a..dc9dac736278 100644 > +--- a/src/bootstrap/flags.rs > ++++ b/src/bootstrap/flags.rs > +@@ -242,11 +242,18 @@ Arguments: > + let cwd =3D t!(env::current_dir()); > + let paths =3D matches.free[1..].iter().map(|p| = cwd.join(p)).collect::>(); > +=20 > ++ let cfg_file =3D = matches.opt_str("config").map(PathBuf::from).or_else(|| { > ++ if fs::metadata("config.toml").is_ok() { > ++ Some(PathBuf::from("config.toml")) > ++ } else { > ++ None > ++ } > ++ }); > +=20 > + // All subcommands can have an optional "Available paths" = section > + if matches.opt_present("verbose") { > + let flags =3D Flags::parse(&["build".to_string()]); > +- let mut config =3D Config::default(); > ++ let mut config =3D Config::parse(&flags.build, = cfg_file.clone()); > + config.build =3D flags.build.clone(); > + let mut build =3D Build::new(flags, config); > + metadata::build(&mut build); > +@@ -307,14 +314,6 @@ Arguments: > + }; > +=20 > +=20 > +- let cfg_file =3D = matches.opt_str("config").map(PathBuf::from).or_else(|| { > +- if fs::metadata("config.toml").is_ok() { > +- Some(PathBuf::from("config.toml")) > +- } else { > +- None > +- } > +- }); > +- > + let mut stage =3D matches.opt_str("stage").map(|j| = j.parse().unwrap()); > +=20 > + if matches.opt_present("incremental") { > +diff --git a/src/bootstrap/bin/main.rs b/src/bootstrap/bin/main.rs > +index 5ca5ce1648f2..5ef18b89841f 100644 > +--- a/src/bootstrap/bin/main.rs > ++++ b/src/bootstrap/bin/main.rs > +@@ -26,12 +26,6 @@ use bootstrap::{Flags, Config, Build}; > + fn main() { > + let args =3D env::args().skip(1).collect::>(); > + let flags =3D Flags::parse(&args); > +- let mut config =3D Config::parse(&flags.build, = flags.config.clone()); > +- > +- // compat with `./configure` while we're still using that > +- if std::fs::metadata("config.mk").is_ok() { > +- config.update_with_config_mk(); > +- } > +- > ++ let config =3D Config::parse(&flags.build, = flags.config.clone()); > + Build::new(flags, config).build(); > + } > +diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs > +index fd8aa320fb3d..902cd0997a8e 100644 > +--- a/src/bootstrap/config.rs > ++++ b/src/bootstrap/config.rs > +@@ -15,7 +15,7 @@ > +=20 > + use std::collections::HashMap; > + use std::env; > +-use std::fs::File; > ++use std::fs::{self, File}; > + use std::io::prelude::*; > + use std::path::PathBuf; > + use std::process; > +@@ -410,6 +410,12 @@ impl Config { > + set(&mut config.rust_dist_src, t.src_tarball); > + } > +=20 > ++ > ++ // compat with `./configure` while we're still using that > ++ if fs::metadata("config.mk").is_ok() { > ++ config.update_with_config_mk(); > ++ } > ++ > + return config > + } > +=20 > +@@ -418,7 +424,7 @@ impl Config { > + /// While we still have `./configure` this implements the = ability to decode > + /// that configuration into this. This isn't exactly a = full-blown makefile > + /// parser, but hey it gets the job done! > +- pub fn update_with_config_mk(&mut self) { > ++ fn update_with_config_mk(&mut self) { > + let mut config =3D String::new(); > + File::open("config.mk").unwrap().read_to_string(&mut = config).unwrap(); > + for line in config.lines() { > diff --git a/community/rust/musl-fix-jemalloc.patch = b/community/rust/musl-fix-jemalloc.patch > deleted file mode 100644 > index 345398a301..0000000000 > --- a/community/rust/musl-fix-jemalloc.patch > +++ /dev/null > @@ -1,61 +0,0 @@ > -=46rom 536011d929ecbd1170baf34e09580e567c971f95 Mon Sep 17 00:00:00 = 2001 > -From: Shiz > -Date: Sat, 8 Apr 2017 20:36:00 +0200 > -Subject: [PATCH] Fix jemalloc support for musl > - > -Just like DragonFlyBSD, using the same symbols as the system = allocator will > -result in a segmentation fault at runtime due to allocator = mismatches. > -As such, prefix the jemalloc symbols instead. > - > -Upstream-Issue: https://github.com/rust-lang/rust/pull/41168 > ---- > - src/liballoc_jemalloc/build.rs | 2 +- > - src/liballoc_jemalloc/lib.rs | 10 +++++----- > - 2 files changed, 6 insertions(+), 6 deletions(-) > - > -diff --git a/src/liballoc_jemalloc/build.rs = b/src/liballoc_jemalloc/build.rs > -index ae040a2..f3a0eeb 100644 > ---- a/src/liballoc_jemalloc/build.rs > -+++ b/src/liballoc_jemalloc/build.rs > -@@ -138,7 +138,7 @@ fn main() { > - // should be good to go! > - cmd.arg("--with-jemalloc-prefix=3Dje_"); > - cmd.arg("--disable-tls"); > -- } else if target.contains("dragonfly") { > -+ } else if target.contains("dragonfly") || = target.contains("musl") { > - cmd.arg("--with-jemalloc-prefix=3Dje_"); > - } > -=20 > -diff --git a/src/liballoc_jemalloc/lib.rs = b/src/liballoc_jemalloc/lib.rs > -index a7a67ef..83cc1ef 100644 > ---- a/src/liballoc_jemalloc/lib.rs > -+++ b/src/liballoc_jemalloc/lib.rs > -@@ -51,23 +51,23 @@ mod imp { > - // request it as unprefixing cause segfaults (mismatches in = allocators). > - extern "C" { > - #[cfg_attr(any(target_os =3D "macos", target_os =3D = "android", target_os =3D "ios", > -- target_os =3D "dragonfly", target_os =3D = "windows"), > -+ target_os =3D "dragonfly", target_os =3D = "windows", target_env =3D "musl"), > - link_name =3D "je_mallocx")] > - fn mallocx(size: size_t, flags: c_int) -> *mut c_void; > - #[cfg_attr(any(target_os =3D "macos", target_os =3D = "android", target_os =3D "ios", > -- target_os =3D "dragonfly", target_os =3D = "windows"), > -+ target_os =3D "dragonfly", target_os =3D = "windows", target_env =3D "musl"), > - link_name =3D "je_rallocx")] > - fn rallocx(ptr: *mut c_void, size: size_t, flags: c_int) -> = *mut c_void; > - #[cfg_attr(any(target_os =3D "macos", target_os =3D = "android", target_os =3D "ios", > -- target_os =3D "dragonfly", target_os =3D = "windows"), > -+ target_os =3D "dragonfly", target_os =3D = "windows", target_env =3D "musl"), > - link_name =3D "je_xallocx")] > - fn xallocx(ptr: *mut c_void, size: size_t, extra: size_t, = flags: c_int) -> size_t; > - #[cfg_attr(any(target_os =3D "macos", target_os =3D = "android", target_os =3D "ios", > -- target_os =3D "dragonfly", target_os =3D = "windows"), > -+ target_os =3D "dragonfly", target_os =3D = "windows", target_env =3D "musl"), > - link_name =3D "je_sdallocx")] > - fn sdallocx(ptr: *mut c_void, size: size_t, flags: c_int); > - #[cfg_attr(any(target_os =3D "macos", target_os =3D = "android", target_os =3D "ios", > -- target_os =3D "dragonfly", target_os =3D = "windows"), > -+ target_os =3D "dragonfly", target_os =3D = "windows", target_env =3D "musl"), > - link_name =3D "je_nallocx")] > - fn nallocx(size: size_t, flags: c_int) -> size_t; > - } > diff --git a/community/rust/musl-fix-linux_musl_base.patch = b/community/rust/musl-fix-linux_musl_base.patch > index 38194290cb..f2efb065e0 100644 > --- a/community/rust/musl-fix-linux_musl_base.patch > +++ b/community/rust/musl-fix-linux_musl_base.patch > @@ -12,13 +12,13 @@ See https://github.com/rust-lang/rust/pull/40113 >=20 > - // Make sure that the linker/gcc really don't pull in anything, = including > - // default objects, libs, etc. > -- base.pre_link_args.push("-nostdlib".to_string()); > +- = base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-nostdlib".t= o_string()); > - > // At least when this was tested, the linker would not add the > // `GNU_EH_FRAME` program header to executables generated, which = is required > // when unwinding to locate the unwinding information. I'm not = sure why this > // argument is *not* necessary for normal builds, but it can't = hurt! > - base.pre_link_args.push("-Wl,--eh-frame-hdr".to_string()); > + = base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-Wl,--eh-fra= me-hdr".to_string()); >=20 > - // There's a whole bunch of circular dependencies when dealing = with MUSL > - // unfortunately. To put this in perspective libc is statically = linked to > @@ -42,8 +42,8 @@ See https://github.com/rust-lang/rust/pull/40113 > - // link everything as a group, not stripping anything out until = everything > - // is processed. The linker will still perform a pass to strip = out object > - // files but it won't do so until all objects/archives have been = processed. > -- base.pre_link_args.push("-Wl,-(".to_string()); > -- base.post_link_args.push("-Wl,-)".to_string()); > +- = base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-Wl,-(".to_s= tring()); > +- base.post_link_args.insert(LinkerFlavor::Gcc, = vec!["-Wl,-)".to_string()]); > - > - // When generating a statically linked executable there's = generally some > - // small setup needed which is listed in these files. These are = provided by > diff --git a/community/rust/musl-fix-static-linking.patch = b/community/rust/musl-fix-static-linking.patch > index 85de05e542..93fe79d15f 100644 > --- a/community/rust/musl-fix-static-linking.patch > +++ b/community/rust/musl-fix-static-linking.patch > @@ -100,22 +100,20 @@ static linking is requested, instead of = dynamically as before. >=20 > // # Telling the linker what we're doing >=20 > -@@ -983,11 +983,14 @@=20 > - cmd.link_whole_staticlib(&l.name.as_str(), &search_path); > - } > -=20 > -- cmd.hint_dynamic(); > -+ let fully_static =3D sess.fully_static(); > -+ if !fully_static { > -+ cmd.hint_dynamic(); > -+ } > -=20 > - for lib in others { > +@@ -983,13 +983,13 @@ > + let relevant_libs =3D = sess.cstore.used_libraries().into_iter().filter(|l| { > + relevant_lib(sess, l) > + }); > + > + let search_path =3D archive_search_paths(sess); > + for lib in relevant_libs { > match lib.kind { > - NativeLibraryKind::NativeUnknown =3D> = cmd.link_dylib(&lib.name.as_str()), > -+ NativeLibraryKind::NativeUnknown =3D> if fully_static { = cmd.link_staticlib(&lib.name.as_str()) } else { = cmd.link_dylib(&lib.name.as_str()) }, > ++ NativeLibraryKind::NativeUnknown =3D> if = sess.fully_static() { cmd.link_staticlib(&lib.name.as_str()) } else { = cmd.link_dylib(&lib.name.as_str()) }, > NativeLibraryKind::NativeFramework =3D> = cmd.link_framework(&lib.name.as_str()), > - NativeLibraryKind::NativeStatic =3D> bug!(), > + NativeLibraryKind::NativeStaticNobundle =3D> = cmd.link_staticlib(&lib.name.as_str()), > + NativeLibraryKind::NativeStatic =3D> = cmd.link_whole_staticlib(&lib.name.as_str(), > + = &search_path) > } > --- a/src/librustc_trans/back/linker.rs=20 > +++ b/src/librustc_trans/back/linker.rs=20 > @@ -127,16 +125,18 @@ static linking is requested, instead of = dynamically as before. > fn optimize(&mut self); > fn debuginfo(&mut self); > fn no_default_libraries(&mut self); > -@@ -93,6 +93,8 @@ > +@@ -93,8 +93,10 @@ > fn no_whole_archives(&mut self); > fn export_symbols(&mut self, tmpdir: &Path, crate_type: = CrateType); > fn subsystem(&mut self, subsystem: &str); > + // Should have been finalize(self), but we don't support = self-by-value on trait objects (yet?). > + fn finalize(&mut self) -> Command; > + fn start_group(&mut self); > + fn end_group(&mut self); > } >=20 > - pub struct GnuLinker<'a> { > -@@ -116,6 +117,9 @@=20 > + pub struct GccLinker<'a> { > +@@ -116,6 +117,9 @@ > fn output_filename(&mut self, path: &Path) { = self.cmd.arg("-o").arg(path); } > fn add_object(&mut self, path: &Path) { self.cmd.arg(path); } > fn position_independent_executable(&mut self) { = self.cmd.arg("-pie"); } > @@ -198,3 +198,13 @@ static linking is requested, instead of = dynamically as before. > } > } >=20 > +--- a/src/librustc_trans/back/linker.rs=20 > ++++ b/src/librustc_trans/back/linker.rs=20 > +@@ -158,6 +158,7 @@ impl<'a> GccLinker<'a> { > + } > +=20 > + fn hint_dynamic(&mut self) { > ++ if self.sess.fully_static() { return } > + if !self.takes_hints() { return } > + if self.hinted_static { > + self.linker_arg("-Bdynamic"); > diff --git a/community/rust/musl-support-dynamic-linking.patch = b/community/rust/musl-support-dynamic-linking.patch > index 7c4e93681b..efbbd7f0b0 100644 > --- a/community/rust/musl-support-dynamic-linking.patch > +++ b/community/rust/musl-support-dynamic-linking.patch > @@ -303,10 +303,12 @@ index defbb44448..f10c7d5c83 100644 > } >=20 > { > -@@ -718,8 +720,10 @@ fn link_natively(sess: &Session, > - objects, out_filename, outputs, trans); > +@@ -718,12 +720,14 @@ fn link_natively(sess: &Session, > + cmd =3D linker.finalize(); > + } > + if let Some(args) =3D = sess.target.target.options.late_link_args.get(&flavor) { > + cmd.args(args); > } > - cmd.args(&sess.target.target.options.late_link_args); > - for obj in &sess.target.target.options.post_link_objects { > - cmd.arg(root.join(obj)); > + if sess.crt_static() { > @@ -314,7 +316,9 @@ index defbb44448..f10c7d5c83 100644 > + cmd.arg(root.join(obj)); > + } > } > - cmd.args(&sess.target.target.options.post_link_args); > + if let Some(args) =3D = sess.target.target.options.post_link_args.get(&flavor) { > + cmd.args(args); > + } >=20 > diff --git a/src/libstd/build.rs b/src/libstd/build.rs > index 9504194393..dd2008c206 100644 > --=20 > 2.14.2 >=20 >> On 23 Oct 2017, at 15:01, Natanael Copa = wrote: >>=20 >> Jakub, >>=20 >> ok to push this? (with fixed commit message 1.8 -> 1.18) >>=20 >> -nc >>=20 >> On Wed, 18 Oct 2017 15:45:00 +0300 >> Marat Safin wrote: >>=20 >>> Signed-off-by: Marat Safin >>> --- >>> community/rust/APKBUILD | 13 ++-- >>> community/rust/alpine-target.patch | 8 +- >>> community/rust/fix-build.patch | 92 = +++++++++++++++++++++++ >>> community/rust/musl-fix-jemalloc.patch | 61 = --------------- >>> community/rust/musl-fix-linux_musl_base.patch | 8 +- >>> community/rust/musl-fix-static-linking.patch | 42 +++++++---- >>> community/rust/musl-support-dynamic-linking.patch | 12 ++- >>> 7 files changed, 142 insertions(+), 94 deletions(-) >>> create mode 100644 community/rust/fix-build.patch >>> delete mode 100644 community/rust/musl-fix-jemalloc.patch >>>=20 >>> diff --git a/community/rust/APKBUILD b/community/rust/APKBUILD >>> index 48ce4e7ffa..80f8ad0c4e 100644 >>> --- a/community/rust/APKBUILD >>> +++ b/community/rust/APKBUILD >>> @@ -2,7 +2,7 @@ >>> # Contributor: Shiz >>> # Maintainer: Jakub Jirutka >>> pkgname=3Drust >>> -pkgver=3D1.17.0 >>> +pkgver=3D1.18.0 >>> _llvmver=3D3.9 >>> _bootver=3D1.16.0 >>> pkgrel=3D3 >>> @@ -29,7 +29,6 @@ = source=3D"https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.gz >>> musl-support-dynamic-linking.patch >>> musl-fix-static-linking.patch >>> musl-fix-linux_musl_base.patch >>> - musl-fix-jemalloc.patch >>> llvm-with-ffi.patch >>> static-pie.patch >>> need-rpath.patch >>> @@ -38,6 +37,7 @@ = source=3D"https://static.rust-lang.org/dist/rustc-$pkgver-src.tar.gz >>> alpine-move-py-scripts-to-share.patch >>> alpine-change-rpath-to-rustlib.patch >>> alpine-target.patch >>> + fix-build.patch >>> check-rustc >>> " >>> builddir=3D"$srcdir/rustc-$pkgver-src" >>> @@ -169,11 +169,10 @@ _mv() { >>> mv $@ >>> } >>>=20 >>> = -sha512sums=3D"781799b29d83b4f0f433814bd818df034526db8e7f88c2df51d3b814eac= afe8098d4bbe47ace951e1943325b3267b244007cf04f1f11083645b25aeacd40ebb6 = rustc-1.17.0-src.tar.gz >>> = -b0a8883e4469b60edd150c84486ab950396d757220f97bd271529576614c6c3b494560985= 07503832c20619d4bd74246dbc99c78116634a68a6df994793e9a94 = musl-support-dynamic-linking.patch >>> = -292c1cb4f751d830f5f1300d7ef94f573f698ac51e18243d7ff0d5a47bb1729bb2cbe8fb4= 56e7a479213df5e5fbf49e360c9439d0f5ad7126cb72d161c91566a = musl-fix-static-linking.patch >>> = -f436fddf7ab70ca5f1424081f5b75450270b200b3d997231323863e11addf76e1d65831a7= ca09e3a5b7904ce828766c1f70b08326a175890298f28e5bc8646ef = musl-fix-linux_musl_base.patch >>> = -c913d04ef419b2b6d8e453f72894070f263c9292abf97114a51884d475d03ce5b032053f1= 676ba9364800b4b35e394f707995058530ad5e4122c60f65ddd3db7 = musl-fix-jemalloc.patch >>> = +sha512sums=3D"eff0460b647dfb3490e28d4dec4f9781d31a942f22de75d9bd1ba315915= 97226b6862ec5132e8b4fcdbcf6e6ffa085ca5dda7ff8260cd82388fc13e8d3b4a2eb = rustc-1.18.0-src.tar.gz >>> = +b5db9ed04eac26c6fc62cde3f19d29837a5feea68e79165c23b5b5cade2e1d193f2399d27= f7622b230996da9565f78825be154574f1cd59189ded8a03a766cfb = musl-support-dynamic-linking.patch >>> = +a6071aab49a7fcd38189a73b0c49ee0808e2063b4e6531643ef154b65bae699e8b42537a9= c4400bf2662169d2350ad25f1166de03438efaf9578d9422dffdd8f = musl-fix-static-linking.patch >>> = +9ebfb10abb50d74ff08d257d85257ce70ac3ce834aa95a8901808497b14acf3ea898fb197= de64d13554eb5feedabe9fd04fec2cc6a7bea9b1335684bfcdcd88b = musl-fix-linux_musl_base.patch >>> = dc6432293bd060d5e3a73f25870867654fae61995dcd919e244a2dc686b6107556deed8c59= ca6002182bfeff5ebc1ca2b89c4028ab0fbfb79e65defe47c9b4b0 = llvm-with-ffi.patch >>> = 5aaf6715b27b8b786740a55b91216d47985fbef3ccb0ef7e6a81696a2823671f8306143f7e= cf77e66af91ef1500072524b9b4c7569508922ad5268df6080fda1 static-pie.patch >>> = ff633f2a46c683ad698d1c09c98c06ce9ee9b8d55fa5593cdd485b439ebca3273794d29b5f= f32b887be8666f52913a23af6e133c782bd0c4e2c88e306dd3a494 need-rpath.patch >>> diff --git a/community/rust/alpine-target.patch = b/community/rust/alpine-target.patch >>> index e013a6bc2e..fc79b45b9a 100644 >>> --- a/community/rust/alpine-target.patch >>> +++ b/community/rust/alpine-target.patch >>> @@ -8,7 +8,7 @@ and distribution-specific quirks instead of = polluting the main musl target of >>>=20 >>> --- /dev/null >>> +++ b/src/librustc_back/target/i586_alpine_linux_musl.rs >>> -@@ -0,0 +1,32 @@ >>> +@@ -0,0 +1,34 @@ >>> +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT >>> +// file at the top-level directory of this distribution and at >>> +// http://rust-lang.org/COPYRIGHT. >>> @@ -19,6 +19,7 @@ and distribution-specific quirks instead of = polluting the main musl target of >>> +// option. This file may not be copied, modified, or distributed >>> +// except according to those terms. >>> + >>> ++use LinkerFlavor; >>> +use target::{Target, TargetResult}; >>> + >>> +pub fn target() -> TargetResult { >>> @@ -38,6 +39,7 @@ and distribution-specific quirks instead of = polluting the main musl target of >>> + target_os: "linux".to_string(), >>> + target_env: "musl".to_string(), >>> + target_vendor: "alpine".to_string(), >>> ++ linker_flavor: LinkerFlavor::Gcc, >>> + options: base, >>> + }) >>> +} >>> @@ -55,7 +57,7 @@ and distribution-specific quirks instead of = polluting the main musl target of >>> /// Everything `rustc` knows about how to compile for a specific = target. >>> --- /dev/null >>> +++ b/src/librustc_back/target/x86_64_alpine_linux_musl.rs >>> -@@ -0,0 +1,32 @@ >>> +@@ -0,0 +1,34 @@ >>> +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT >>> +// file at the top-level directory of this distribution and at >>> +// http://rust-lang.org/COPYRIGHT. >>> @@ -66,6 +68,7 @@ and distribution-specific quirks instead of = polluting the main musl target of >>> +// option. This file may not be copied, modified, or distributed >>> +// except according to those terms. >>> + >>> ++use LinkerFlavor; >>> +use target::{Target, TargetResult}; >>> + >>> +pub fn target() -> TargetResult { >>> @@ -85,6 +88,7 @@ and distribution-specific quirks instead of = polluting the main musl target of >>> + target_os: "linux".to_string(), >>> + target_env: "musl".to_string(), >>> + target_vendor: "alpine".to_string(), >>> ++ linker_flavor: LinkerFlavor::Gcc, >>> + options: base, >>> + }) >>> +} >>> diff --git a/community/rust/fix-build.patch = b/community/rust/fix-build.patch >>> new file mode 100644 >>> index 0000000000..0a8482d731 >>> --- /dev/null >>> +++ b/community/rust/fix-build.patch >>> @@ -0,0 +1,92 @@ >>> +diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs >>> +index 56cbb4cecf2a..dc9dac736278 100644 >>> +--- a/src/bootstrap/flags.rs >>> ++++ b/src/bootstrap/flags.rs >>> +@@ -242,11 +242,18 @@ Arguments: >>> + let cwd =3D t!(env::current_dir()); >>> + let paths =3D matches.free[1..].iter().map(|p| = cwd.join(p)).collect::>(); >>> +=20 >>> ++ let cfg_file =3D = matches.opt_str("config").map(PathBuf::from).or_else(|| { >>> ++ if fs::metadata("config.toml").is_ok() { >>> ++ Some(PathBuf::from("config.toml")) >>> ++ } else { >>> ++ None >>> ++ } >>> ++ }); >>> +=20 >>> + // All subcommands can have an optional "Available paths" = section >>> + if matches.opt_present("verbose") { >>> + let flags =3D Flags::parse(&["build".to_string()]); >>> +- let mut config =3D Config::default(); >>> ++ let mut config =3D Config::parse(&flags.build, = cfg_file.clone()); >>> + config.build =3D flags.build.clone(); >>> + let mut build =3D Build::new(flags, config); >>> + metadata::build(&mut build); >>> +@@ -307,14 +314,6 @@ Arguments: >>> + }; >>> +=20 >>> +=20 >>> +- let cfg_file =3D = matches.opt_str("config").map(PathBuf::from).or_else(|| { >>> +- if fs::metadata("config.toml").is_ok() { >>> +- Some(PathBuf::from("config.toml")) >>> +- } else { >>> +- None >>> +- } >>> +- }); >>> +- >>> + let mut stage =3D matches.opt_str("stage").map(|j| = j.parse().unwrap()); >>> +=20 >>> + if matches.opt_present("incremental") { >>> +diff --git a/src/bootstrap/bin/main.rs b/src/bootstrap/bin/main.rs >>> +index 5ca5ce1648f2..5ef18b89841f 100644 >>> +--- a/src/bootstrap/bin/main.rs >>> ++++ b/src/bootstrap/bin/main.rs >>> +@@ -26,12 +26,6 @@ use bootstrap::{Flags, Config, Build}; >>> + fn main() { >>> + let args =3D env::args().skip(1).collect::>(); >>> + let flags =3D Flags::parse(&args); >>> +- let mut config =3D Config::parse(&flags.build, = flags.config.clone()); >>> +- >>> +- // compat with `./configure` while we're still using that >>> +- if std::fs::metadata("config.mk").is_ok() { >>> +- config.update_with_config_mk(); >>> +- } >>> +- >>> ++ let config =3D Config::parse(&flags.build, = flags.config.clone()); >>> + Build::new(flags, config).build(); >>> + } >>> +diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs >>> +index fd8aa320fb3d..902cd0997a8e 100644 >>> +--- a/src/bootstrap/config.rs >>> ++++ b/src/bootstrap/config.rs >>> +@@ -15,7 +15,7 @@ >>> +=20 >>> + use std::collections::HashMap; >>> + use std::env; >>> +-use std::fs::File; >>> ++use std::fs::{self, File}; >>> + use std::io::prelude::*; >>> + use std::path::PathBuf; >>> + use std::process; >>> +@@ -410,6 +410,12 @@ impl Config { >>> + set(&mut config.rust_dist_src, t.src_tarball); >>> + } >>> +=20 >>> ++ >>> ++ // compat with `./configure` while we're still using that >>> ++ if fs::metadata("config.mk").is_ok() { >>> ++ config.update_with_config_mk(); >>> ++ } >>> ++ >>> + return config >>> + } >>> +=20 >>> +@@ -418,7 +424,7 @@ impl Config { >>> + /// While we still have `./configure` this implements the = ability to decode >>> + /// that configuration into this. This isn't exactly a = full-blown makefile >>> + /// parser, but hey it gets the job done! >>> +- pub fn update_with_config_mk(&mut self) { >>> ++ fn update_with_config_mk(&mut self) { >>> + let mut config =3D String::new(); >>> + File::open("config.mk").unwrap().read_to_string(&mut = config).unwrap(); >>> + for line in config.lines() { >>> diff --git a/community/rust/musl-fix-jemalloc.patch = b/community/rust/musl-fix-jemalloc.patch >>> deleted file mode 100644 >>> index 345398a301..0000000000 >>> --- a/community/rust/musl-fix-jemalloc.patch >>> +++ /dev/null >>> @@ -1,61 +0,0 @@ >>> -=46rom 536011d929ecbd1170baf34e09580e567c971f95 Mon Sep 17 00:00:00 = 2001 >>> -From: Shiz >>> -Date: Sat, 8 Apr 2017 20:36:00 +0200 >>> -Subject: [PATCH] Fix jemalloc support for musl >>> - >>> -Just like DragonFlyBSD, using the same symbols as the system = allocator will >>> -result in a segmentation fault at runtime due to allocator = mismatches. >>> -As such, prefix the jemalloc symbols instead. >>> - >>> -Upstream-Issue: https://github.com/rust-lang/rust/pull/41168 >>> ---- >>> - src/liballoc_jemalloc/build.rs | 2 +- >>> - src/liballoc_jemalloc/lib.rs | 10 +++++----- >>> - 2 files changed, 6 insertions(+), 6 deletions(-) >>> - >>> -diff --git a/src/liballoc_jemalloc/build.rs = b/src/liballoc_jemalloc/build.rs >>> -index ae040a2..f3a0eeb 100644 >>> ---- a/src/liballoc_jemalloc/build.rs >>> -+++ b/src/liballoc_jemalloc/build.rs >>> -@@ -138,7 +138,7 @@ fn main() { >>> - // should be good to go! >>> - cmd.arg("--with-jemalloc-prefix=3Dje_"); >>> - cmd.arg("--disable-tls"); >>> -- } else if target.contains("dragonfly") { >>> -+ } else if target.contains("dragonfly") || = target.contains("musl") { >>> - cmd.arg("--with-jemalloc-prefix=3Dje_"); >>> - } >>> -=20 >>> -diff --git a/src/liballoc_jemalloc/lib.rs = b/src/liballoc_jemalloc/lib.rs >>> -index a7a67ef..83cc1ef 100644 >>> ---- a/src/liballoc_jemalloc/lib.rs >>> -+++ b/src/liballoc_jemalloc/lib.rs >>> -@@ -51,23 +51,23 @@ mod imp { >>> - // request it as unprefixing cause segfaults (mismatches in = allocators). >>> - extern "C" { >>> - #[cfg_attr(any(target_os =3D "macos", target_os =3D = "android", target_os =3D "ios", >>> -- target_os =3D "dragonfly", target_os =3D = "windows"), >>> -+ target_os =3D "dragonfly", target_os =3D = "windows", target_env =3D "musl"), >>> - link_name =3D "je_mallocx")] >>> - fn mallocx(size: size_t, flags: c_int) -> *mut c_void; >>> - #[cfg_attr(any(target_os =3D "macos", target_os =3D = "android", target_os =3D "ios", >>> -- target_os =3D "dragonfly", target_os =3D = "windows"), >>> -+ target_os =3D "dragonfly", target_os =3D = "windows", target_env =3D "musl"), >>> - link_name =3D "je_rallocx")] >>> - fn rallocx(ptr: *mut c_void, size: size_t, flags: c_int) = -> *mut c_void; >>> - #[cfg_attr(any(target_os =3D "macos", target_os =3D = "android", target_os =3D "ios", >>> -- target_os =3D "dragonfly", target_os =3D = "windows"), >>> -+ target_os =3D "dragonfly", target_os =3D = "windows", target_env =3D "musl"), >>> - link_name =3D "je_xallocx")] >>> - fn xallocx(ptr: *mut c_void, size: size_t, extra: size_t, = flags: c_int) -> size_t; >>> - #[cfg_attr(any(target_os =3D "macos", target_os =3D = "android", target_os =3D "ios", >>> -- target_os =3D "dragonfly", target_os =3D = "windows"), >>> -+ target_os =3D "dragonfly", target_os =3D = "windows", target_env =3D "musl"), >>> - link_name =3D "je_sdallocx")] >>> - fn sdallocx(ptr: *mut c_void, size: size_t, flags: c_int); >>> - #[cfg_attr(any(target_os =3D "macos", target_os =3D = "android", target_os =3D "ios", >>> -- target_os =3D "dragonfly", target_os =3D = "windows"), >>> -+ target_os =3D "dragonfly", target_os =3D = "windows", target_env =3D "musl"), >>> - link_name =3D "je_nallocx")] >>> - fn nallocx(size: size_t, flags: c_int) -> size_t; >>> - } >>> diff --git a/community/rust/musl-fix-linux_musl_base.patch = b/community/rust/musl-fix-linux_musl_base.patch >>> index 38194290cb..f2efb065e0 100644 >>> --- a/community/rust/musl-fix-linux_musl_base.patch >>> +++ b/community/rust/musl-fix-linux_musl_base.patch >>> @@ -12,13 +12,13 @@ See https://github.com/rust-lang/rust/pull/40113 >>>=20 >>> - // Make sure that the linker/gcc really don't pull in anything, = including >>> - // default objects, libs, etc. >>> -- base.pre_link_args.push("-nostdlib".to_string()); >>> +- = base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-nostdlib".t= o_string()); >>> - >>> // At least when this was tested, the linker would not add the >>> // `GNU_EH_FRAME` program header to executables generated, which = is required >>> // when unwinding to locate the unwinding information. I'm not = sure why this >>> // argument is *not* necessary for normal builds, but it can't = hurt! >>> - base.pre_link_args.push("-Wl,--eh-frame-hdr".to_string()); >>> + = base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-Wl,--eh-fra= me-hdr".to_string()); >>>=20 >>> - // There's a whole bunch of circular dependencies when dealing = with MUSL >>> - // unfortunately. To put this in perspective libc is statically = linked to >>> @@ -42,8 +42,8 @@ See https://github.com/rust-lang/rust/pull/40113 >>> - // link everything as a group, not stripping anything out until = everything >>> - // is processed. The linker will still perform a pass to strip = out object >>> - // files but it won't do so until all objects/archives have = been processed. >>> -- base.pre_link_args.push("-Wl,-(".to_string()); >>> -- base.post_link_args.push("-Wl,-)".to_string()); >>> +- = base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-Wl,-(".to_s= tring()); >>> +- base.post_link_args.insert(LinkerFlavor::Gcc, = vec!["-Wl,-)".to_string()]); >>> - >>> - // When generating a statically linked executable there's = generally some >>> - // small setup needed which is listed in these files. These are = provided by >>> diff --git a/community/rust/musl-fix-static-linking.patch = b/community/rust/musl-fix-static-linking.patch >>> index 85de05e542..93fe79d15f 100644 >>> --- a/community/rust/musl-fix-static-linking.patch >>> +++ b/community/rust/musl-fix-static-linking.patch >>> @@ -100,22 +100,20 @@ static linking is requested, instead of = dynamically as before. >>>=20 >>> // # Telling the linker what we're doing >>>=20 >>> -@@ -983,11 +983,14 @@=20 >>> - cmd.link_whole_staticlib(&l.name.as_str(), &search_path); >>> - } >>> -=20 >>> -- cmd.hint_dynamic(); >>> -+ let fully_static =3D sess.fully_static(); >>> -+ if !fully_static { >>> -+ cmd.hint_dynamic(); >>> -+ } >>> -=20 >>> - for lib in others { >>> +@@ -983,13 +983,13 @@ >>> + let relevant_libs =3D = sess.cstore.used_libraries().into_iter().filter(|l| { >>> + relevant_lib(sess, l) >>> + }); >>> + >>> + let search_path =3D archive_search_paths(sess); >>> + for lib in relevant_libs { >>> match lib.kind { >>> - NativeLibraryKind::NativeUnknown =3D> = cmd.link_dylib(&lib.name.as_str()), >>> -+ NativeLibraryKind::NativeUnknown =3D> if fully_static = { cmd.link_staticlib(&lib.name.as_str()) } else { = cmd.link_dylib(&lib.name.as_str()) }, >>> ++ NativeLibraryKind::NativeUnknown =3D> if = sess.fully_static() { cmd.link_staticlib(&lib.name.as_str()) } else { = cmd.link_dylib(&lib.name.as_str()) }, >>> NativeLibraryKind::NativeFramework =3D> = cmd.link_framework(&lib.name.as_str()), >>> - NativeLibraryKind::NativeStatic =3D> bug!(), >>> + NativeLibraryKind::NativeStaticNobundle =3D> = cmd.link_staticlib(&lib.name.as_str()), >>> + NativeLibraryKind::NativeStatic =3D> = cmd.link_whole_staticlib(&lib.name.as_str(), >>> + = &search_path) >>> } >>> --- a/src/librustc_trans/back/linker.rs=20 >>> +++ b/src/librustc_trans/back/linker.rs=20 >>> @@ -127,16 +125,18 @@ static linking is requested, instead of = dynamically as before. >>> fn optimize(&mut self); >>> fn debuginfo(&mut self); >>> fn no_default_libraries(&mut self); >>> -@@ -93,6 +93,8 @@ >>> +@@ -93,8 +93,10 @@ >>> fn no_whole_archives(&mut self); >>> fn export_symbols(&mut self, tmpdir: &Path, crate_type: = CrateType); >>> fn subsystem(&mut self, subsystem: &str); >>> + // Should have been finalize(self), but we don't support = self-by-value on trait objects (yet?). >>> + fn finalize(&mut self) -> Command; >>> + fn start_group(&mut self); >>> + fn end_group(&mut self); >>> } >>>=20 >>> - pub struct GnuLinker<'a> { >>> -@@ -116,6 +117,9 @@=20 >>> + pub struct GccLinker<'a> { >>> +@@ -116,6 +117,9 @@ >>> fn output_filename(&mut self, path: &Path) { = self.cmd.arg("-o").arg(path); } >>> fn add_object(&mut self, path: &Path) { self.cmd.arg(path); } >>> fn position_independent_executable(&mut self) { = self.cmd.arg("-pie"); } >>> @@ -198,3 +198,13 @@ static linking is requested, instead of = dynamically as before. >>> } >>> } >>>=20 >>> +--- a/src/librustc_trans/back/linker.rs=20 >>> ++++ b/src/librustc_trans/back/linker.rs=20 >>> +@@ -158,6 +158,7 @@ impl<'a> GccLinker<'a> { >>> + } >>> +=20 >>> + fn hint_dynamic(&mut self) { >>> ++ if self.sess.fully_static() { return } >>> + if !self.takes_hints() { return } >>> + if self.hinted_static { >>> + self.linker_arg("-Bdynamic"); >>> diff --git a/community/rust/musl-support-dynamic-linking.patch = b/community/rust/musl-support-dynamic-linking.patch >>> index 7c4e93681b..efbbd7f0b0 100644 >>> --- a/community/rust/musl-support-dynamic-linking.patch >>> +++ b/community/rust/musl-support-dynamic-linking.patch >>> @@ -303,10 +303,12 @@ index defbb44448..f10c7d5c83 100644 >>> } >>>=20 >>> { >>> -@@ -718,8 +720,10 @@ fn link_natively(sess: &Session, >>> - objects, out_filename, outputs, trans); >>> +@@ -718,12 +720,14 @@ fn link_natively(sess: &Session, >>> + cmd =3D linker.finalize(); >>> + } >>> + if let Some(args) =3D = sess.target.target.options.late_link_args.get(&flavor) { >>> + cmd.args(args); >>> } >>> - cmd.args(&sess.target.target.options.late_link_args); >>> - for obj in &sess.target.target.options.post_link_objects { >>> - cmd.arg(root.join(obj)); >>> + if sess.crt_static() { >>> @@ -314,7 +316,9 @@ index defbb44448..f10c7d5c83 100644 >>> + cmd.arg(root.join(obj)); >>> + } >>> } >>> - cmd.args(&sess.target.target.options.post_link_args); >>> + if let Some(args) =3D = sess.target.target.options.post_link_args.get(&flavor) { >>> + cmd.args(args); >>> + } >>>=20 >>> diff --git a/src/libstd/build.rs b/src/libstd/build.rs >>> index 9504194393..dd2008c206 100644 >>=20 >=20 --- Unsubscribe: alpine-aports+unsubscribe@lists.alpinelinux.org Help: alpine-aports+help@lists.alpinelinux.org ---