Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master grimoire by Ismael Luceno (80d6207e3b144ad9e968c5eb17053ebf1e699e92)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Ismael Luceno <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master grimoire by Ismael Luceno (80d6207e3b144ad9e968c5eb17053ebf1e699e92)
  • Date: Tue, 29 Dec 2020 17:13:53 +0000

GIT changes to master grimoire by Ismael Luceno <ismael AT sourcemage.org>:

devel/rust/DEPENDS
| 2
devel/rust/DETAILS
| 11
devel/rust/HISTORY
| 13
devel/rust/PRE_BUILD
| 10
devel/rust/patches/0001-Fix-LLVM-build.patch
| 26
devel/rust/patches/00016-do-not-copy-libunwind.patch
| 26

devel/rust/patches/0004-Remove-nostdlib-and-musl_root-from-musl-targets.patch
| 336 ++++++++++
devel/rust/patches/0005-Prefer-libgcc_eh-over-libunwind-on-musl.patch
| 66 +
devel/rust/patches/0009-Link-stage2-tools-dynamically-to-libstd.patch
| 31
devel/rust/patches/0010-Move-debugger-scripts-to-usr-share-rust.patch
| 37 +
devel/rust/patches/0011-Dynamically-link-libc-on-musl-by-default.patch
| 26

devel/rust/patches/0012-Fix-dynamic-linkage-of-musl-libc-for-the-libc-crate.patch
| 45 +
devel/rust/patches/need-ssp_nonshared.patch
| 23
13 files changed, 637 insertions(+), 15 deletions(-)

New commits:
commit 80d6207e3b144ad9e968c5eb17053ebf1e699e92
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

rust 1.48.0

diff --git a/devel/rust/DEPENDS b/devel/rust/DEPENDS
index 8b2595a..16393d3 100755
--- a/devel/rust/DEPENDS
+++ b/devel/rust/DEPENDS
@@ -4,7 +4,7 @@ depends bison &&
depends curl &&
depends flex &&
depends libxslt &&
-depends python &&
+depends python3 '--python=python3' &&
optional_depends ccache '' '' 'optimise compile times' &&
optional_depends gdb '' '' 'debugger' &&
optional_depends valgrind '' '' 'leak detector'
diff --git a/devel/rust/DETAILS b/devel/rust/DETAILS
index 2abb8ff..36ea3b6 100755
--- a/devel/rust/DETAILS
+++ b/devel/rust/DETAILS
@@ -1,12 +1,11 @@
SPELL=rust
- VERSION=1.47.0
- CARGO_VERSION=0.47.0
+ VERSION=1.48.0
SOURCE_DIRECTORY=$BUILD_DIRECTORY/rustc-$VERSION-src
TMPFS=off
SOURCE=rustc-$VERSION-src.tar.xz
SOURCE2=$SOURCE.asc
BUILDX="${BUILD/-pc-/-unknown-}"
- SOURCE3="cargo-$CARGO_VERSION-${BUILDX}.tar.xz"
+ SOURCE3="cargo-$VERSION-${BUILDX}.tar.xz"
SOURCE4="rust-std-$VERSION-${BUILDX}.tar.xz"
SOURCE5="rustc-$VERSION-${BUILDX}.tar.xz"
DIST_URL=https://static.rust-lang.org/dist
@@ -19,9 +18,9 @@ SOURCE_DIRECTORY=$BUILD_DIRECTORY/rustc-$VERSION-src
SOURCE2_IGNORE=signature
case "${BUILDX}" in
x86_64-unknown-linux-musl)
-
SOURCE3_HASH=sha512:ead47a65ed2c7b4036f71a47419c8d7ee087364be58e49f21481a5376b07d993d94f70b7c29fea4ca5f42d5c99fd9abc9f5b7830561645ccd9b83d91aa657e95
-
SOURCE4_HASH=sha512:6f68870a0722d58b98ccc550af63c60fdbafd3c7e6a683a7821eb51935420005788de8185cce5e37d556ec2156704447bbea242213ebdff1fa9ec05ebb5a6766
-
SOURCE5_HASH=sha512:0c434273a60fcbe67ad56f420cb7c881508ceec964e85b5491fb3e1d3254a8bf86eb0a80d4c8b3ef56dee6e1e92fffc237bd8dc6654f6791847f9d418b26383f
+
SOURCE3_HASH=sha512:557dde175f5f9469fcab3f46c84a58c1a3d10527cac0a953b8c0f6abaaeeed3938e49f4c06db0d8ee5310cf8cd76ffef380acca8aa58d151a176e94263cde29f
+
SOURCE4_HASH=sha512:0337cc460ffabbc85729fa53314ff8bfad287e67a300f8782a780e047f428b82dc995e58d7c35bdadf8796aa9a5890f726c65def25cd78c5d9b385eb21b4817e
+
SOURCE5_HASH=sha512:c20a247c0f9d116d99082d87a7c8d863b6349dfa2025bdda143f36636a200fa59262e65fa5542879880898931279745bed4591001ba20663291233317e9d5cc8
;;
x86_64-unknown-linux-gnu)

SOURCE3_HASH=sha512:4a87588fe0f37d2ddff30dcfbbf909ea2570a78c6ca562aecfa4cc08112e7222418a5dd67f14665730b3813b0de283cd9d86fb1b3d835b5e68277a45c76c85eb
diff --git a/devel/rust/HISTORY b/devel/rust/HISTORY
index f5d9a37..05fac7c 100644
--- a/devel/rust/HISTORY
+++ b/devel/rust/HISTORY
@@ -1,3 +1,16 @@
+2020-12-29 Ismael Luceno <ismael AT sourcemage.org>
+ * DEPENDS: Switched to python3
+ * DETAILS, PRE_BUILD: updated spell to 1.48.0
+ * patches/0001-Fix-LLVM-build.patch,
+ patches/00016-do-not-copy-libunwind.patch,
+ patches/0004-Remove-nostdlib-and-musl_root-from-musl-targets.patch,
+ patches/0005-Prefer-libgcc_eh-over-libunwind-on-musl.patch,
+ patches/0009-Link-stage2-tools-dynamically-to-libstd.patch,
+ patches/0010-Move-debugger-scripts-to-usr-share-rust.patch,
+ patches/0011-Dynamically-link-libc-on-musl-by-default.patch,
+
patches/0012-Fix-dynamic-linkage-of-musl-libc-for-the-libc-crate.patch,
+ patches/need-ssp_nonshared.patch: Fixed build against musl libc
+
2020-10-10 Florian Franzmann <siflfran AT hawo.stw.uni-erlangen.de>
* DETAILS: version 1.47.0, cargo version 0.47.0

diff --git a/devel/rust/PRE_BUILD b/devel/rust/PRE_BUILD
index 69a4a30..e556445 100755
--- a/devel/rust/PRE_BUILD
+++ b/devel/rust/PRE_BUILD
@@ -3,10 +3,8 @@ cd "$SOURCE_DIRECTORY" &&
apply_patch_dir patches &&

# remove checksums to avoid failure with patched sources
-for i in openssl-sys; do
- sedit 's/"files":{[^}]*}/"files":{}/' vendor/"$i"/.cargo-checksum.json ||
- break
-done &&
+sed -i 's/"files":{[^}]*}/"files":{}/' \
+ vendor/{libc,openssl-sys}/.cargo-checksum.json &&

# Bootstrapping
if ! spell_ok "$SPELL"; then
@@ -15,9 +13,5 @@ if ! spell_ok "$SPELL"; then
unpack_file 5
fi &&

-# produce dynamic binaries by default on musl, like on glibc
-sedit '/^ *base[.]crt_static_default *=/s/true/false/' \
- src/librustc_target/spec/linux_musl_base.rs &&
-
# avoid rebuilding llvm
rm -r src/llvm-project
diff --git a/devel/rust/patches/0001-Fix-LLVM-build.patch
b/devel/rust/patches/0001-Fix-LLVM-build.patch
new file mode 100644
index 0000000..0da829a
--- /dev/null
+++ b/devel/rust/patches/0001-Fix-LLVM-build.patch
@@ -0,0 +1,26 @@
+From 4443eca0d6b3ba599832b2f73a5350fdd0c90d10 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel AT sholland.org>
+Date: Fri, 8 Sep 2017 00:04:29 -0500
+Subject: [PATCH 01/15] Fix LLVM build
+
+---
+ src/bootstrap/lib.rs | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
+index a476d25f..c7e63990 100644
+--- a/src/bootstrap/lib.rs
++++ b/src/bootstrap/lib.rs
+@@ -768,7 +768,8 @@ impl Build {
+ .args()
+ .iter()
+ .map(|s| s.to_string_lossy().into_owned())
+- .filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
++ .filter(|s| !s.starts_with("-O") && !s.starts_with("/O")
++ && !s.starts_with("-static"))
+ .collect::<Vec<String>>();
+
+ // If we're compiling on macOS then we add a few unconditional flags
+--
+2.26.2
+
diff --git a/devel/rust/patches/00016-do-not-copy-libunwind.patch
b/devel/rust/patches/00016-do-not-copy-libunwind.patch
new file mode 100644
index 0000000..73c496a
--- /dev/null
+++ b/devel/rust/patches/00016-do-not-copy-libunwind.patch
@@ -0,0 +1,26 @@
+From 227096bde5283269aa1d1002860b6ec54d2cf284 Mon Sep 17 00:00:00 2001
+From: Johannes Brechtmann <johannes.brechtmann AT gmail.com>
+Date: Sun, 22 Nov 2020 16:00:50 +0100
+Subject: [PATCH] Revert "Include libunwind in the rust-src component."
+
+This reverts commit 9f27f3796d3487411ab035803a0757d69040649c.
+---
+ src/bootstrap/dist.rs | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
+index b2a590307a2..020cd665a0e 100644
+--- a/src/bootstrap/dist.rs
++++ b/src/bootstrap/dist.rs
+@@ -1016,7 +1016,7 @@ impl Step for Src {
+ copy_src_dirs(
+ builder,
+ &builder.src,
+- &["library", "src/llvm-project/libunwind"],
++ &["library"],
+ &[
+ // not needed and contains symlinks which rustup currently
+ // chokes on when unpacking.
+--
+2.29.2
+
diff --git
a/devel/rust/patches/0004-Remove-nostdlib-and-musl_root-from-musl-targets.patch

b/devel/rust/patches/0004-Remove-nostdlib-and-musl_root-from-musl-targets.patch
new file mode 100644
index 0000000..326ed1a
--- /dev/null
+++
b/devel/rust/patches/0004-Remove-nostdlib-and-musl_root-from-musl-targets.patch
@@ -0,0 +1,336 @@
+From 4654172e942b5b9250aff70101d54bc880060073 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel AT sholland.org>
+Date: Sun, 3 May 2020 17:53:33 +0200
+Subject: [PATCH 04/15] Remove -nostdlib and musl_root from musl targets
+
+---
+ config.toml.example | 3 ---
+ src/bootstrap/cc_detect.rs | 25 ++----------------
+ src/bootstrap/compile.rs | 22 +---------------
+ src/bootstrap/config.rs | 7 ------
+ src/bootstrap/configure.py | 28 ---------------------
+ src/bootstrap/lib.rs | 10 --------
+ src/bootstrap/sanity.rs | 22 ----------------
+ src/librustc_target/spec/linux_musl_base.rs | 16 ------------
+ 8 files changed, 3 insertions(+), 130 deletions(-)
+
+--- a/config.toml.example
++++ b/config.toml.example
+@@ -525,15 +525,6 @@
+ # only use static libraries. If unset, the target's default linkage is used.
+ #crt-static = false
+
+-# The root location of the musl installation directory. The library
directory
+-# will also need to contain libunwind.a for an unwinding implementation.
Note
+-# that this option only makes sense for musl targets that produce statically
+-# linked binaries
+-#musl-root = "..."
+-
+-# The full path to the musl libdir.
+-#musl-libdir = musl-root/lib
+-
+ # The root location of the `wasm32-wasi` sysroot.
+ #wasi-root = "..."
+
+diff --git a/src/bootstrap/cc_detect.rs b/src/bootstrap/cc_detect.rs
+index a236edf9..54c3cc64 100644
+--- a/src/bootstrap/cc_detect.rs
++++ b/src/bootstrap/cc_detect.rs
+@@ -97,7 +97,7 @@ pub fn find(build: &mut Build) {
+ if let Some(cc) = config.and_then(|c| c.cc.as_ref()) {
+ cfg.compiler(cc);
+ } else {
+- set_compiler(&mut cfg, Language::C, target, config, build);
++ set_compiler(&mut cfg, Language::C, target, config);
+ }
+
+ let compiler = cfg.get_compiler();
+@@ -125,7 +125,7 @@ pub fn find(build: &mut Build) {
+ cfg.compiler(cxx);
+ true
+ } else if build.hosts.contains(&target) || build.build == target {
+- set_compiler(&mut cfg, Language::CPlusPlus, target, config,
build);
++ set_compiler(&mut cfg, Language::CPlusPlus, target, config);
+ true
+ } else {
+ false
+@@ -154,7 +154,6 @@ fn set_compiler(
+ compiler: Language,
+ target: Interned<String>,
+ config: Option<&Target>,
+- build: &Build,
+ ) {
+ match &*target {
+ // When compiling for android we may have the NDK configured in the
+@@ -196,26 +195,6 @@ fn set_compiler(
+ }
+ }
+
+- "mips-unknown-linux-musl" => {
+- if cfg.get_compiler().path().to_str() == Some("gcc") {
+- cfg.compiler("mips-linux-musl-gcc");
+- }
+- }
+- "mipsel-unknown-linux-musl" => {
+- if cfg.get_compiler().path().to_str() == Some("gcc") {
+- cfg.compiler("mipsel-linux-musl-gcc");
+- }
+- }
+-
+- t if t.contains("musl") => {
+- if let Some(root) = build.musl_root(target) {
+- let guess = root.join("bin/musl-gcc");
+- if guess.exists() {
+- cfg.compiler(guess);
+- }
+- }
+- }
+-
+ _ => {}
+ }
+ }
+diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
+index 65a00db3..01fd2cf3 100644
+--- a/src/bootstrap/compile.rs
++++ b/src/bootstrap/compile.rs
+@@ -169,26 +169,7 @@
+ t!(fs::create_dir_all(&libdir_self_contained));
+ let mut target_deps = vec![];
+
+- // Copies the CRT objects.
+- //
+- // rustc historically provides a more self-contained installation for
musl targets
+- // not requiring the presence of a native musl toolchain. For example,
it can fall back
+- // to using gcc from a glibc-targeting toolchain for linking.
+- // To do that we have to distribute musl startup objects as a part of
Rust toolchain
+- // and link with them manually in the self-contained mode.
+- if target.contains("musl") {
+- let srcdir = builder.musl_libdir(target).unwrap();
+- for &obj in &["crt1.o", "Scrt1.o", "rcrt1.o", "crti.o", "crtn.o"] {
+- copy_and_stamp(
+- builder,
+- &libdir_self_contained,
+- &srcdir,
+- obj,
+- &mut target_deps,
+- DependencyType::TargetSelfContained,
+- );
+- }
+- } else if target.ends_with("-wasi") {
++ if target.ends_with("-wasi") {
+ let srcdir =
builder.wasi_root(target).unwrap().join("lib/wasm32-wasi");
+ copy_and_stamp(
+ builder,
+@@ -263,15 +244,6 @@
+ .arg("--manifest-path")
+ .arg(builder.src.join("src/libtest/Cargo.toml"));
+
+- // Help the libc crate compile by assisting it in finding various
+- // sysroot native libraries.
+- if target.contains("musl") {
+- if let Some(p) = builder.musl_libdir(target) {
+- let root = format!("native={}", p.to_str().unwrap());
+- cargo.rustflag("-L").rustflag(&root);
+- }
+- }
+-
+ if target.ends_with("-wasi") {
+ if let Some(p) = builder.wasi_root(target) {
+ let root = format!("native={}/lib/wasm32-wasi",
p.to_str().unwrap());
+diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
+index 56164b74..8c46334a 100644
+--- a/src/bootstrap/config.rs
++++ b/src/bootstrap/config.rs
+@@ -154,8 +154,6 @@
+ pub print_step_timings: bool,
+ pub missing_tools: bool,
+
+- // Fallback musl-root for all targets
+- pub musl_root: Option<PathBuf>,
+ pub prefix: Option<PathBuf>,
+ pub sysconfdir: Option<PathBuf>,
+ pub datadir: Option<PathBuf>,
+@@ -252,8 +250,6 @@
+ pub linker: Option<PathBuf>,
+ pub ndk: Option<PathBuf>,
+ pub crt_static: Option<bool>,
+- pub musl_root: Option<PathBuf>,
+- pub musl_libdir: Option<PathBuf>,
+ pub wasi_root: Option<PathBuf>,
+ pub qemu_rootfs: Option<PathBuf>,
+ pub no_std: bool,
+@@ -438,7 +434,6 @@
+ parallel_compiler: Option<bool>,
+ default_linker: Option<String>,
+ channel: Option<String>,
+- musl_root: Option<String>,
+ rpath: Option<bool>,
+ verbose_tests: Option<bool>,
+ optimize_tests: Option<bool>,
+@@ -475,8 +470,6 @@
+ llvm_filecheck: Option<String>,
+ android_ndk: Option<String>,
+ crt_static: Option<bool>,
+- musl_root: Option<String>,
+- musl_libdir: Option<String>,
+ wasi_root: Option<String>,
+ qemu_rootfs: Option<String>,
+ no_std: Option<bool>,
+@@ -806,7 +799,6 @@
+ set(&mut config.llvm_tools_enabled, rust.llvm_tools);
+ config.rustc_parallel = rust.parallel_compiler.unwrap_or(false);
+ config.rustc_default_linker = rust.default_linker;
+- config.musl_root = rust.musl_root.map(PathBuf::from);
+ config.save_toolstates =
rust.save_toolstates.map(PathBuf::from);
+ set(&mut config.deny_warnings,
flags.deny_warnings.or(rust.deny_warnings));
+ set(&mut config.backtrace_on_ice, rust.backtrace_on_ice);
+@@ -846,8 +838,6 @@
+ target.ranlib = cfg.ranlib.map(PathBuf::from);
+ target.linker = cfg.linker.map(PathBuf::from);
+ target.crt_static = cfg.crt_static;
+- target.musl_root = cfg.musl_root.map(PathBuf::from);
+- target.musl_libdir = cfg.musl_libdir.map(PathBuf::from);
+ target.wasi_root = cfg.wasi_root.map(PathBuf::from);
+ target.qemu_rootfs = cfg.qemu_rootfs.map(PathBuf::from);
+
+diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
+index 2a46c563..025928b9 100755
+--- a/src/bootstrap/configure.py
++++ b/src/bootstrap/configure.py
+@@ -110,34 +110,6 @@ v("aarch64-linux-android-ndk",
"target.aarch64-linux-android.android-ndk",
+ "aarch64-linux-android NDK standalone path")
+ v("x86_64-linux-android-ndk", "target.x86_64-linux-android.android-ndk",
+ "x86_64-linux-android NDK standalone path")
+-v("musl-root", "target.x86_64-unknown-linux-musl.musl-root",
+- "MUSL root installation directory (deprecated)")
+-v("musl-root-x86_64", "target.x86_64-unknown-linux-musl.musl-root",
+- "x86_64-unknown-linux-musl install directory")
+-v("musl-root-i586", "target.i586-unknown-linux-musl.musl-root",
+- "i586-unknown-linux-musl install directory")
+-v("musl-root-i686", "target.i686-unknown-linux-musl.musl-root",
+- "i686-unknown-linux-musl install directory")
+-v("musl-root-arm", "target.arm-unknown-linux-musleabi.musl-root",
+- "arm-unknown-linux-musleabi install directory")
+-v("musl-root-armhf", "target.arm-unknown-linux-musleabihf.musl-root",
+- "arm-unknown-linux-musleabihf install directory")
+-v("musl-root-armv5te", "target.armv5te-unknown-linux-musleabi.musl-root",
+- "armv5te-unknown-linux-musleabi install directory")
+-v("musl-root-armv7", "target.armv7-unknown-linux-musleabi.musl-root",
+- "armv7-unknown-linux-musleabi install directory")
+-v("musl-root-armv7hf", "target.armv7-unknown-linux-musleabihf.musl-root",
+- "armv7-unknown-linux-musleabihf install directory")
+-v("musl-root-aarch64", "target.aarch64-unknown-linux-musl.musl-root",
+- "aarch64-unknown-linux-musl install directory")
+-v("musl-root-mips", "target.mips-unknown-linux-musl.musl-root",
+- "mips-unknown-linux-musl install directory")
+-v("musl-root-mipsel", "target.mipsel-unknown-linux-musl.musl-root",
+- "mipsel-unknown-linux-musl install directory")
+-v("musl-root-mips64", "target.mips64-unknown-linux-muslabi64.musl-root",
+- "mips64-unknown-linux-muslabi64 install directory")
+-v("musl-root-mips64el", "target.mips64el-unknown-linux-muslabi64.musl-root",
+- "mips64el-unknown-linux-muslabi64 install directory")
+ v("qemu-armhf-rootfs", "target.arm-unknown-linux-gnueabihf.qemu-rootfs",
+ "rootfs in qemu testing, you probably don't want to use this")
+ v("qemu-aarch64-rootfs", "target.aarch64-unknown-linux-gnu.qemu-rootfs",
+--- a/src/bootstrap/lib.rs
++++ b/src/bootstrap/lib.rs
+@@ -876,25 +876,6 @@
+ }
+ }
+
+- /// Returns the "musl root" for this `target`, if defined
+- fn musl_root(&self, target: TargetSelection) -> Option<&Path> {
+- self.config
+- .target_config
+- .get(&target)
+- .and_then(|t| t.musl_root.as_ref())
+- .or_else(|| self.config.musl_root.as_ref())
+- .map(|p| &**p)
+- }
+-
+- /// Returns the "musl libdir" for this `target`.
+- fn musl_libdir(&self, target: TargetSelection) -> Option<PathBuf> {
+- let t = self.config.target_config.get(&target)?;
+- if let libdir @ Some(_) = &t.musl_libdir {
+- return libdir.clone();
+- }
+- self.musl_root(target).map(|root| root.join("lib"))
+- }
+-
+ /// Returns the sysroot for the wasi target, if defined
+ fn wasi_root(&self, target: TargetSelection) -> Option<&Path> {
+ self.config.target_config.get(&target).and_then(|t|
t.wasi_root.as_ref()).map(|p| &**p)
+diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs
+index 530e74da..8ec9f046 100644
+--- a/src/bootstrap/sanity.rs
++++ b/src/bootstrap/sanity.rs
+@@ -191,28 +191,6 @@
+ }
+ }
+
+- // Make sure musl-root is valid
+- if target.contains("musl") {
+- // If this is a native target (host is also musl) and no
musl-root is given,
+- // fall back to the system toolchain in /usr before giving up
+- if build.musl_root(*target).is_none() && build.config.build ==
*target {
+- let target =
build.config.target_config.entry(target.clone()).or_default();
+- target.musl_root = Some("/usr".into());
+- }
+- match build.musl_libdir(*target) {
+- Some(libdir) => {
+- if fs::metadata(libdir.join("libc.a")).is_err() {
+- panic!("couldn't find libc.a in musl libdir: {}",
libdir.display());
+- }
+- }
+- None => panic!(
+- "when targeting MUSL either the rust.musl-root \
+- option or the target.$TARGET.musl-root option
must \
+- be specified in config.toml"
+- ),
+- }
+- }
+-
+ if target.contains("msvc") {
+ // There are three builds of cmake on windows: MSVC, MinGW, and
+ // Cygwin. The Cygwin build does not have generators for Visual
+diff --git a/src/librustc_target/spec/linux_musl_base.rs
b/src/librustc_target/spec/linux_musl_base.rs
+index e294e639..58ae91a9 100644
+--- a/compiler/rustc_target/src/spec/linux_musl_base.rs
++++ b/compiler/rustc_target/src/spec/linux_musl_base.rs
+@@ -10,10 +10,6 @@
+ // argument is *not* necessary for normal builds, but it can't hurt!
+
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-Wl,--eh-frame-hdr".to_string());
+
+- base.pre_link_objects_fallback = crt_objects::pre_musl_fallback();
+- base.post_link_objects_fallback = crt_objects::post_musl_fallback();
+- base.crt_objects_fallback = Some(CrtObjectsFallback::Musl);
+-
+ // These targets statically link libc by default
+ base.crt_static_default = true;
+ // These targets allow the user to choose between static and dynamic
linking.
+--- a/compiler/rustc_target/src/spec/crt_objects.rs.orig 2020-08-07
01:01:58.142394507 +0200
++++ b/compiler/rustc_target/src/spec/crt_objects.rs 2020-08-07
01:02:25.030392771 +0200
+@@ -61,21 +61,6 @@
+ ])
+ }
+
+-pub(super) fn pre_musl_fallback() -> CrtObjects {
+- new(&[
+- (LinkOutputKind::DynamicNoPicExe, &["crt1.o", "crti.o"]),
+- (LinkOutputKind::DynamicPicExe, &["Scrt1.o", "crti.o"]),
+- (LinkOutputKind::StaticNoPicExe, &["crt1.o", "crti.o"]),
+- (LinkOutputKind::StaticPicExe, &["rcrt1.o", "crti.o"]),
+- (LinkOutputKind::DynamicDylib, &["crti.o"]),
+- (LinkOutputKind::StaticDylib, &["crti.o"]),
+- ])
+-}
+-
+-pub(super) fn post_musl_fallback() -> CrtObjects {
+- all("crtn.o")
+-}
+-
+ pub(super) fn pre_mingw_fallback() -> CrtObjects {
+ new(&[
+ (LinkOutputKind::DynamicNoPicExe, &["crt2.o", "rsbegin.o"]),
+--
+2.26.2
diff --git
a/devel/rust/patches/0005-Prefer-libgcc_eh-over-libunwind-on-musl.patch
b/devel/rust/patches/0005-Prefer-libgcc_eh-over-libunwind-on-musl.patch
new file mode 100644
index 0000000..6571cb3
--- /dev/null
+++ b/devel/rust/patches/0005-Prefer-libgcc_eh-over-libunwind-on-musl.patch
@@ -0,0 +1,66 @@
+From a640bce17d908a0691d53f22e5257353f694d9b6 Mon Sep 17 00:00:00 2001
+From: q66 <daniel AT octaforge.org>
+Date: Sun, 3 May 2020 17:55:50 +0200
+Subject: [PATCH 05/15] Prefer libgcc_eh over libunwind on musl
+
+---
+ src/libunwind/build.rs | 16 ++--------------
+ src/libunwind/lib.rs | 2 +-
+ 2 files changed, 3 insertions(+), 15 deletions(-)
+
+diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs
+index a24808b3..a1250889 100644
+--- a/library/unwind/build.rs
++++ b/library/unwind/build.rs
+@@ -5,17 +5,14 @@
+ let target = env::var("TARGET").expect("TARGET was not set");
+
+ if cfg!(feature = "llvm-libunwind")
+- && ((target.contains("linux") && !target.contains("musl")) ||
target.contains("fuchsia"))
++ && (target.contains("linux") || target.contains("fuchsia"))
+ {
+ // Build the unwinding from libunwind C/C++ source code.
+ llvm_libunwind::compile();
+ } else if target.contains("x86_64-fortanix-unknown-sgx") {
+ llvm_libunwind::compile();
+ } else if target.contains("linux") {
+- if target.contains("musl") {
+- // linking for musl is handled in lib.rs
+- llvm_libunwind::compile();
+- } else if !target.contains("android") {
++ if !target.contains("android") {
+ println!("cargo:rustc-link-lib=gcc_s");
+ }
+ } else if target.contains("freebsd") {
+@@ -145,15 +142,6 @@
+ cfg.file(root.join("src").join(src));
+ }
+
+- if target_env == "musl" {
+- // use the same C compiler command to compile C++ code so we do
not need to setup the
+- // C++ compiler env variables on the builders
+- cfg.cpp(false);
+- // linking for musl is handled in lib.rs
+- cfg.cargo_metadata(false);
+- println!("cargo:rustc-link-search=native={}",
env::var("OUT_DIR").unwrap());
+- }
+-
+ cfg.compile("unwind");
+ }
+ }
+diff --git a/src/libunwind/lib.rs b/src/libunwind/lib.rs
+index 18d41be7..17f73d69 100644
+--- a/library/unwind/src/lib.rs
++++ b/library/unwind/src/lib.rs
+@@ -19,7 +19,7 @@ cfg_if::cfg_if! {
+ }
+
+ #[cfg(target_env = "musl")]
+-#[link(name = "unwind", kind = "static", cfg(target_feature =
"crt-static"))]
++#[link(name = "gcc_eh", cfg(target_feature = "crt-static"))]
+ #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
+ extern "C" {}
+
+--
+2.26.2
+
diff --git
a/devel/rust/patches/0009-Link-stage2-tools-dynamically-to-libstd.patch
b/devel/rust/patches/0009-Link-stage2-tools-dynamically-to-libstd.patch
new file mode 100644
index 0000000..40f896b
--- /dev/null
+++ b/devel/rust/patches/0009-Link-stage2-tools-dynamically-to-libstd.patch
@@ -0,0 +1,31 @@
+From f5dad49f112151bb0ee74570e971bd475cbec128 Mon Sep 17 00:00:00 2001
+From: q66 <daniel AT octaforge.org>
+Date: Sun, 3 May 2020 18:00:09 +0200
+Subject: [PATCH 09/15] Link stage2 tools dynamically to libstd
+
+Replaces an older patch by Samuel Holland. The RUSTC_NO_PREFER_DYNAMIC
+env var was removed and replaced with the following logic in builder.rs.
+
+The idea for this patch is to link stage2 tools dynamically as these will
+be distributed (if built). Intermediate tools from previous stages will
+be statically linked for convenience.
+---
+ src/bootstrap/builder.rs | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
+index eb0199fd..0ec7cbd8 100644
+--- a/src/bootstrap/builder.rs
++++ b/src/bootstrap/builder.rs
+@@ -1236,6 +1236,8 @@ impl<'a> Builder<'a> {
+ // linking all deps statically into the dylib.
+ if let Mode::Std | Mode::Rustc | Mode::Codegen = mode {
+ rustflags.arg("-Cprefer-dynamic");
++ } else if stage >= 2 {
++ rustflags.arg("-Cprefer-dynamic");
+ }
+
+ // When building incrementally we default to a lower ThinLTO import
limit
+--
+2.26.2
+
diff --git
a/devel/rust/patches/0010-Move-debugger-scripts-to-usr-share-rust.patch
b/devel/rust/patches/0010-Move-debugger-scripts-to-usr-share-rust.patch
new file mode 100644
index 0000000..c9f5132
--- /dev/null
+++ b/devel/rust/patches/0010-Move-debugger-scripts-to-usr-share-rust.patch
@@ -0,0 +1,37 @@
+From 9b0c14783127e195d7bd54ca2c0c498a46714964 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel AT sholland.org>
+Date: Mon, 17 Sep 2018 02:09:10 +0000
+Subject: [PATCH 10/15] Move debugger scripts to /usr/share/rust
+
+---
+ src/bootstrap/dist.rs | 2 +-
+ src/etc/rust-gdb | 2 +-
+ src/etc/rust-lldb | 2 +-
+ 3 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
+index 8215211e..05a173b4 100644
+--- a/src/bootstrap/dist.rs
++++ b/src/bootstrap/dist.rs
+@@ -603,7 +603,7 @@ impl Step for DebuggerScripts {
+ fn run(self, builder: &Builder<'_>) {
+ let host = self.host;
+ let sysroot = self.sysroot;
+- let dst = sysroot.join("lib/rustlib/etc");
++ let dst = sysroot.join("share/rust");
+ t!(fs::create_dir_all(&dst));
+ let cp_debugger_script = |file: &str| {
+ builder.install(&builder.src.join("src/etc/").join(file), &dst,
0o644);
+diff --git a/src/etc/rust-gdb b/src/etc/rust-gdb
+index 23ba93da..dc51b16c 100755
+--- a/src/etc/rust-gdb
++++ b/src/etc/rust-gdb
+@@ -12,7 +12,7 @@
+
+ # Find out where the pretty printer Python module is
+ RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)"
+-GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
++GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/share/rust"
+
+ # Run GDB with the additional arguments that load the pretty printers
+ # Set the environment variable `RUST_GDB` to overwrite the call to a
diff --git
a/devel/rust/patches/0011-Dynamically-link-libc-on-musl-by-default.patch
b/devel/rust/patches/0011-Dynamically-link-libc-on-musl-by-default.patch
new file mode 100644
index 0000000..7f6ca13
--- /dev/null
+++ b/devel/rust/patches/0011-Dynamically-link-libc-on-musl-by-default.patch
@@ -0,0 +1,26 @@
+From d72ad9c226b4ed225c23d88ec5dbe6ba321b37ad Mon Sep 17 00:00:00 2001
+From: q66 <daniel AT octaforge.org>
+Date: Sat, 21 Dec 2019 17:04:13 +0100
+Subject: [PATCH 11/15] Dynamically link libc on musl by default
+
+---
+ src/librustc_target/spec/linux_musl_base.rs | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/src/librustc_target/spec/linux_musl_base.rs
b/src/librustc_target/spec/linux_musl_base.rs
+index 58ae91a9..1fae72d6 100644
+--- a/compiler/rustc_target/src/spec/linux_musl_base.rs
++++ b/compiler/rustc_target/src/spec/linux_musl_base.rs
+@@ -1,11 +1,9 @@
+-use crate::spec::crt_objects::{self, CrtObjectsFallback};
+ use crate::spec::TargetOptions;
+
+ pub fn opts() -> TargetOptions {
+ let mut base = super::linux_base::opts();
+
+- // These targets statically link libc by default
+- base.crt_static_default = true;
++ base.crt_static_default = false;
+ // These targets allow the user to choose between static and dynamic
linking.
+ base.crt_static_respected = true;
+
diff --git
a/devel/rust/patches/0012-Fix-dynamic-linkage-of-musl-libc-for-the-libc-crate.patch

b/devel/rust/patches/0012-Fix-dynamic-linkage-of-musl-libc-for-the-libc-crate.patch
new file mode 100644
index 0000000..e4d4f14
--- /dev/null
+++
b/devel/rust/patches/0012-Fix-dynamic-linkage-of-musl-libc-for-the-libc-crate.patch
@@ -0,0 +1,45 @@
+From e363a0e0ff7ffc8bd83f72ec1a20d289996b6370 Mon Sep 17 00:00:00 2001
+From: q66 <daniel AT octaforge.org>
+Date: Sun, 3 May 2020 18:02:03 +0200
+Subject: [PATCH 12/15] Fix dynamic linkage of musl libc for the libc crate
+
+---
+ vendor/libc/src/lib.rs | 1 +
+ vendor/libc/src/unix/mod.rs | 6 +++---
+ 2 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/vendor/libc/src/lib.rs b/vendor/libc/src/lib.rs
+index 0b1496af..7f7e85a7 100644
+--- a/vendor/libc/src/lib.rs
++++ b/vendor/libc/src/lib.rs
+@@ -33,6 +33,7 @@
+ #![deny(missing_copy_implementations, safe_packed_borrows)]
+ #![no_std]
+ #![cfg_attr(feature = "rustc-dep-of-std", no_core)]
++#![cfg_attr(feature = "rustc-dep-of-std", feature(static_nobundle))]
+ #![cfg_attr(target_os = "redox", feature(static_nobundle))]
+ #![cfg_attr(libc_const_extern_fn, feature(const_extern_fn))]
+
+diff --git a/vendor/libc/src/unix/mod.rs b/vendor/libc/src/unix/mod.rs
+index 238da24b..ffb05ee7 100644
+--- a/vendor/libc/src/unix/mod.rs
++++ b/vendor/libc/src/unix/mod.rs
+@@ -299,11 +299,11 @@ cfg_if! {
+ // cargo build, don't pull in anything extra as the libstd dep
+ // already pulls in all libs.
+ } else if #[cfg(target_env = "musl")] {
++ #[link(name = "c")]
++ extern {}
+ #[cfg_attr(feature = "rustc-dep-of-std",
+- link(name = "c", kind = "static",
++ link(name = "gcc", kind = "static-nobundle",
+ cfg(target_feature = "crt-static")))]
+- #[cfg_attr(feature = "rustc-dep-of-std",
+- link(name = "c", cfg(not(target_feature =
"crt-static"))))]
+ extern {}
+ } else if #[cfg(target_os = "emscripten")] {
+ #[link(name = "c")]
+index 0b1496af..7f7e85a7 100644
+--
+2.26.2
+
diff --git a/devel/rust/patches/need-ssp_nonshared.patch
b/devel/rust/patches/need-ssp_nonshared.patch
new file mode 100644
index 0000000..44c6dc2
--- /dev/null
+++ b/devel/rust/patches/need-ssp_nonshared.patch
@@ -0,0 +1,23 @@
+--- rustc-1.47.0-src/library/std/build.rs.orig
++++ rustc-1.47.0-src/library/std/build.rs
+@@ -8,6 +8,8 @@
+ println!("cargo:rustc-link-lib=dl");
+ println!("cargo:rustc-link-lib=log");
+ println!("cargo:rustc-link-lib=gcc");
++ } else if target.contains("musl") {
++ println!("cargo:rustc-link-lib=ssp_nonshared");
+ }
+ } else if target.contains("freebsd") {
+ println!("cargo:rustc-link-lib=execinfo");
+--- rustc-1.44.0-src/library/unwind/build.rs.orig
++++ rustc-1.44.0-src/library/unwind/build.rs
+@@ -12,6 +12,9 @@ fn main() {
+ } else if target.contains("linux") {
+ if !target.contains("android") {
+ println!("cargo:rustc-link-lib=gcc_s");
++ if target.contains("musl") {
++ println!("cargo:rustc-link-lib=ssp_nonshared");
++ }
+ }
+ } else if target.contains("freebsd") {
+ println!("cargo:rustc-link-lib=gcc_s");



  • [SM-Commit] GIT changes to master grimoire by Ismael Luceno (80d6207e3b144ad9e968c5eb17053ebf1e699e92), Ismael Luceno, 12/29/2020

Archive powered by MHonArc 2.6.24.

Top of Page