Skip to Content.
Sympa Menu

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

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, sm-commit AT lists.sourcemage.org
  • Subject: [[SM-Commit] ] GIT changes to master grimoire by Ismael Luceno (147a6769d354968e3f2e390bccb6c9cef78bdede)
  • Date: Thu, 13 Aug 2026 00:50:47 +0000

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

devel/rust/BUILD
| 13
devel/rust/HISTORY
| 6
devel/rust/INSTALL
| 18 -
devel/rust/patches/0001-Adjustments-for-rust-src-and-native-musl-hosts.patch
| 175 ++++++++++

devel/rust/patches/0001-Don't-include-libunwind-in-the-rust-src-component.patch
| 21 -
5 files changed, 191 insertions(+), 42 deletions(-)

New commits:
commit 147a6769d354968e3f2e390bccb6c9cef78bdede
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

rust: Fix build against musl libc

diff --git a/devel/rust/BUILD b/devel/rust/BUILD
index acafd95..775345b 100755
--- a/devel/rust/BUILD
+++ b/devel/rust/BUILD
@@ -67,9 +67,10 @@ export CARGO_HOME="$SOURCE_DIRECTORY/cargo_home" &&
python3 ./x.py build --config="${SOURCE_DIRECTORY}/config.toml" \
-j $((${#DISTCC_HOSTS[*]} * JOBS_PER_HOST + MAKE_NJOBS)) &&

-# fake install
-if spell_ok "${SPELL}"; then
- mkdir -p "${SOURCE_DIRECTORY}/INSTALL_ROOT" &&
- DESTDIR="${SOURCE_DIRECTORY}/INSTALL_ROOT" python3 ./x.py install \
- --config="${SOURCE_DIRECTORY}/config.toml" -j"${MAKE_NJOBS:-1}"
-fi
+# Stage the install here, so INSTALL only has to copy the tree. Running x.py
+# from INSTALL would compile with a different set of C(XX)FLAGS than the ones
+# set up above, which both rebuilds half of rustc and breaks it.
+mkdir -p "${SOURCE_DIRECTORY}/INSTALL_ROOT" &&
+DESTDIR="${SOURCE_DIRECTORY}/INSTALL_ROOT" python3 ./x.py install \
+ --config="${SOURCE_DIRECTORY}/config.toml" \
+ -j $((${#DISTCC_HOSTS[*]} * JOBS_PER_HOST + MAKE_NJOBS))
diff --git a/devel/rust/HISTORY b/devel/rust/HISTORY
index f42939b..4e190be 100644
--- a/devel/rust/HISTORY
+++ b/devel/rust/HISTORY
@@ -1,3 +1,9 @@
+2026-08-13 Ismael Luceno <ismael AT sourcemage.org>
+ * BUILD, INSTALL: always stage the install, because launching x.py
install
+ from the INSTALL phase caused rebuilding with different flags and
breakage.
+ * patches/0001-Adjustments-for-rust-src-and-native-musl-hosts.patch:
+ fixed linking on musl libc systems
+
2026-07-16 Pavel Vinogradov <public AT sourcemage.org>
* DETAILS: version 1.97.1

diff --git a/devel/rust/INSTALL b/devel/rust/INSTALL
index 063f8cf..dd2f91f 100755
--- a/devel/rust/INSTALL
+++ b/devel/rust/INSTALL
@@ -1,15 +1,3 @@
-if test -d "${SOURCE_DIRECTORY}/INSTALL_ROOT"; then
- cd "${SOURCE_DIRECTORY}/INSTALL_ROOT" &&
- find . | cpio --pass-through --make-directories --verbose --unconditional \
- "${INSTALL_ROOT}/"
-else
- # for libressl >= 3.5.x
- CFLAGS+=" -DHAVE_OPAQUE_STRUCTS=1" &&
- CXXFLAGS+=" -DHAVE_OPAQUE_STRUCTS=1" &&
-
- export CFLAGS CXXFLAGS &&
-
- export CARGO_HOME="$SOURCE_DIRECTORY/cargo_home" &&
- DESTDIR="${INSTALL_ROOT}/" python3 ./x.py install
--config="${SOURCE_DIRECTORY}/config.toml" \
- -j $((${#DISTCC_HOSTS[*]} * JOBS_PER_HOST + MAKE_NJOBS))
-fi
+cd "${SOURCE_DIRECTORY}/INSTALL_ROOT" &&
+find . | cpio --pass-through --make-directories --verbose --unconditional \
+ "${INSTALL_ROOT}/"
diff --git
a/devel/rust/patches/0001-Adjustments-for-rust-src-and-native-musl-hosts.patch

b/devel/rust/patches/0001-Adjustments-for-rust-src-and-native-musl-hosts.patch
new file mode 100644
index 0000000..ead8643
--- /dev/null
+++
b/devel/rust/patches/0001-Adjustments-for-rust-src-and-native-musl-hosts.patch
@@ -0,0 +1,175 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Ismael Luceno <ismael AT iodev.co.uk>
+Date: Wed, 12 Aug 2026 18:49:43 +0200
+Subject: [PATCH] Adjustments for the rust-src component and native musl hosts
+
+1. Don't include libunwind in the rust-src component. The component only
+ needs the standard library sources, and the llvm-project tree is removed
+ from the sources before building.
+
+2. Use the system toolchain for musl targets on native musl hosts.
+
+ rustc ships its own copies of the musl CRT objects, libc.a and an LLVM
+ libunwind build, and links musl targets in "self-contained" mode, so that
+ a glibc host can produce musl binaries without a musl toolchain.
+
+ On a native musl system that indirection is unnecessary: the system
+ toolchain already provides those objects, and it's the only one guaranteed
+ to match the installed libc. It also forces bootstrap to build the
+ vendored copies out of the llvm-project tree.
+
+ Gate the self-contained behaviour on the host environment, so that
+ cross-compilation from glibc hosts keeps working unchanged, and default
+ musl targets to dynamic linking on a native musl host, as the system
+ toolchain does for every other language.
+
+Upstream-Status: Pending
+Signed-off-by: Ismael Luceno <ismael AT iodev.co.uk>
+---
+ compiler/rustc_target/src/spec/base/linux_musl.rs |
11 ++++++++++
+ compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs |
5 ++--
+ compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs |
5 ++--
+ compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs |
5 ++--
+ compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs |
5 ++--
+ compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs |
5 ++--
+ src/bootstrap/src/core/build_steps/dist.rs |
3 --
+ src/bootstrap/src/core/config/target_selection.rs |
4 ++-
+ 8 files changed, 30 insertions(+), 13 deletions(-)
+
+diff --git a/src/bootstrap/src/core/build_steps/dist.rs
b/src/bootstrap/src/core/build_steps/dist.rs
+index cfcb144..529be48 100644
+--- a/src/bootstrap/src/core/build_steps/dist.rs
++++ b/src/bootstrap/src/core/build_steps/dist.rs
+@@ -1065,7 +1108,6 @@ fn copy_src_dirs(
+
+ static LLVM_PROJECTS: &[&str] = &[
+ "llvm-project/clang",
+- "llvm-project/libunwind",
+ "llvm-project/lld",
+ "llvm-project/lldb",
+ "llvm-project/llvm",
+@@ -1191,7 +1238,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.
+diff --git a/compiler/rustc_target/src/spec/base/linux_musl.rs
b/compiler/rustc_target/src/spec/base/linux_musl.rs
+index cfcb144..529be48 100644
+--- a/compiler/rustc_target/src/spec/base/linux_musl.rs
++++ b/compiler/rustc_target/src/spec/base/linux_musl.rs
+@@ -1,6 +1,17 @@
+ use crate::spec::{Env, LinkSelfContainedDefault, TargetOptions, base,
crt_objects};
+
+ pub(crate) fn opts() -> TargetOptions {
++ // On a native musl host the system toolchain provides the CRT objects
and
++ // the unwinder, and it is the only one guaranteed to match the
installed
++ // libc, so link against it instead of the copies shipped with rustc.
++ if cfg!(target_env = "musl") {
++ return TargetOptions {
++ env: Env::Musl,
++ link_self_contained: LinkSelfContainedDefault::False,
++ ..base::linux::opts()
++ };
++ }
++
+ TargetOptions {
+ env: Env::Musl,
+ pre_link_objects_self_contained:
crt_objects::pre_musl_self_contained(),
+diff --git
a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
+index cfcb144..529be48 100644
+--- a/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
++++ b/compiler/rustc_target/src/spec/targets/aarch64_unknown_linux_musl.rs
+@@ -14,8 +14,9 @@
+ | SanitizerSet::MEMORY
+ | SanitizerSet::THREAD;
+
+- // FIXME(compiler-team#422): musl targets should be dynamically linked
by default.
+- base.crt_static_default = true;
++ // FIXME(compiler-team#422): musl targets should be dynamically linked
by
++ // default; a native musl host already is.
++ base.crt_static_default = !cfg!(target_env = "musl");
+
+ Target {
+ llvm_target: "aarch64-unknown-linux-musl".into(),
+diff --git
a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs
b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs
+index cfcb144..529be48 100644
+--- a/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs
++++ b/compiler/rustc_target/src/spec/targets/i586_unknown_linux_musl.rs
+@@ -5,7 +5,8 @@
+ base.rustc_abi = None; // overwrite the SSE2 ABI set by the base target
+ base.cpu = "pentium".into();
+ base.llvm_target = "i586-unknown-linux-musl".into();
+- // FIXME(compiler-team#422): musl targets should be dynamically linked
by default.
+- base.crt_static_default = true;
++ // FIXME(compiler-team#422): musl targets should be dynamically linked
by
++ // default; a native musl host already is.
++ base.crt_static_default = !cfg!(target_env = "musl");
+ base
+ }
+diff --git
a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
+index cfcb144..529be48 100644
+--- a/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
++++ b/compiler/rustc_target/src/spec/targets/i686_unknown_linux_musl.rs
+@@ -12,8 +12,9 @@
+ base.max_atomic_width = Some(64);
+ base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m32",
"-Wl,-melf_i386"]);
+ base.stack_probes = StackProbeType::Inline;
+- // FIXME(compiler-team#422): musl targets should be dynamically linked
by default.
+- base.crt_static_default = true;
++ // FIXME(compiler-team#422): musl targets should be dynamically linked
by
++ // default; a native musl host already is.
++ base.crt_static_default = !cfg!(target_env = "musl");
+
+ // The unwinder used by i686-unknown-linux-musl, the LLVM libunwind
+ // implementation, apparently relies on frame pointers existing...
somehow.
+diff --git
a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
+index cfcb144..529be48 100644
+---
a/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
++++
b/compiler/rustc_target/src/spec/targets/powerpc64le_unknown_linux_musl.rs
+@@ -9,8 +9,9 @@
+ base.add_pre_link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-m64"]);
+ base.max_atomic_width = Some(64);
+ base.stack_probes = StackProbeType::Inline;
+- // FIXME(compiler-team#422): musl targets should be dynamically linked
by default.
+- base.crt_static_default = true;
++ // FIXME(compiler-team#422): musl targets should be dynamically linked
by
++ // default; a native musl host already is.
++ base.crt_static_default = !cfg!(target_env = "musl");
+ base.cfg_abi = CfgAbi::ElfV2;
+ base.llvm_abiname = LlvmAbi::ElfV2;
+
+diff --git
a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
+index cfcb144..529be48 100644
+--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
++++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
+@@ -16,8 +16,9 @@
+ | SanitizerSet::MEMORY
+ | SanitizerSet::THREAD;
+ base.supports_xray = true;
+- // FIXME(compiler-team#422): musl targets should be dynamically linked
by default.
+- base.crt_static_default = true;
++ // FIXME(compiler-team#422): musl targets should be dynamically linked
by
++ // default; a native musl host already is.
++ base.crt_static_default = !cfg!(target_env = "musl");
+
+ Target {
+ llvm_target: "x86_64-unknown-linux-musl".into(),
+diff --git a/src/bootstrap/src/core/config/target_selection.rs
b/src/bootstrap/src/core/config/target_selection.rs
+index cfcb144..529be48 100644
+--- a/src/bootstrap/src/core/config/target_selection.rs
++++ b/src/bootstrap/src/core/config/target_selection.rs
+@@ -97,7 +97,9 @@
+ }
+
+ pub fn needs_crt_begin_end(&self) -> bool {
+- self.contains("musl") && !self.contains("unikraft")
++ // A native musl host links against the system toolchain, which
already
++ // provides these objects; see rustc_target's linux_musl base.
++ !cfg!(target_env = "musl") && self.contains("musl") &&
!self.contains("unikraft")
+ }
+
+ /// Path to the file defining the custom target, if any.
diff --git
a/devel/rust/patches/0001-Don't-include-libunwind-in-the-rust-src-component.patch

b/devel/rust/patches/0001-Don't-include-libunwind-in-the-rust-src-component.patch
deleted file mode 100644
index cb9c739..0000000
---
a/devel/rust/patches/0001-Don't-include-libunwind-in-the-rust-src-component.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff --git a/src/bootstrap/src/core/build_steps/dist.rs
b/src/bootstrap/src/core/build_steps/dist.rs
-index cfcb144..529be48 100644
---- a/src/bootstrap/src/core/build_steps/dist.rs
-+++ b/src/bootstrap/src/core/build_steps/dist.rs
-@@ -1065,7 +1108,6 @@ fn copy_src_dirs(
-
- static LLVM_PROJECTS: &[&str] = &[
- "llvm-project/clang",
-- "llvm-project/libunwind",
- "llvm-project/lld",
- "llvm-project/lldb",
- "llvm-project/llvm",
-@@ -1191,7 +1238,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.


  • [[SM-Commit] ] GIT changes to master grimoire by Ismael Luceno (147a6769d354968e3f2e390bccb6c9cef78bdede), Ismael Luceno, 08/12/2026

Archive powered by MHonArc 2.6.24.

Top of Page