public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/rust] f43: Bootstrap and migrate to riscv64a23 for RHEL 11
@ 2026-11-13 21:43 Josh Stone
0 siblings, 0 replies; only message in thread
From: Josh Stone @ 2026-11-13 21:43 UTC (permalink / raw)
To: git-commits
A new commit has been pushed.
Repo : rpms/rust
Branch : f43
Commit : 254c32443c6c2f3579a9ba070a1553a5f52edf3f
Author : Josh Stone <jistone@redhat.com>
Date : 2026-11-05T16:51:35-08:00
Stats : +50/-14 in 3 file(s)
URL : https://src.fedoraproject.org/rpms/rust/c/254c32443c6c2f3579a9ba070a1553a5f52edf3f?branch=f43
Log:
Bootstrap and migrate to riscv64a23 for RHEL 11
---
diff --git a/.gitignore b/.gitignore
index c57a823..52a8c1d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -492,3 +492,9 @@
/wasi-libc-wasi-sdk-34.tar.gz
/rustc-1.99.1-src.tar.xz
/rustc-1.99.1-src.tar.xz.asc
+/cargo-1.98.0-riscv64gc-unknown-linux-gnu.tar.xz
+/cargo-1.98.0-riscv64gc-unknown-linux-gnu.tar.xz.asc
+/rustc-1.98.0-riscv64gc-unknown-linux-gnu.tar.xz
+/rustc-1.98.0-riscv64gc-unknown-linux-gnu.tar.xz.asc
+/rust-std-1.98.0-riscv64gc-unknown-linux-gnu.tar.xz
+/rust-std-1.98.0-riscv64gc-unknown-linux-gnu.tar.xz.asc
diff --git a/rust.spec b/rust.spec
index f32ece9..d0f8e26 100644
--- a/rust.spec
+++ b/rust.spec
@@ -25,6 +25,7 @@ URL: https://www.rust-lang.org
# Run "spectool -g rust.spec" after changing this and then "fedpkg upload" to
# add them to sources. Remember to remove them again after the bootstrap build!
#global bootstrap_arches x86_64 i686 aarch64 ppc64le s390x
+%global bootstrap_arches riscv64
# We need CRT files for *-wasi targets, at least as new as the commit in
# src/ci/docker/host-x86_64/dist-various-2/build-wasi-toolchain.sh
@@ -186,7 +187,8 @@ Patch100: rustc-1.99.0-disable-libssh2.patch
elseif arch == "ppc64le" then
arch = "powerpc64le"
elseif arch == "riscv64" then
- arch = "riscv64gc"
+ local rhel = tonumber(rpm.expand("%{?rhel}")) or 0
+ arch = rhel >= 11 and "riscv64a23" or "riscv64gc"
end
return arch.."-unknown-linux-"..abi
end}
@@ -232,6 +234,7 @@ end}
%if %defined bootstrap_arches
# For each bootstrap arch, add an additional binary Source.
# Also define bootstrap_source just for the current target.
+# For RISC-V, only GC is tier 2 with host tools at this time.
%{lua: do
local bootstrap_arches = {}
for arch in rpm.expand("%{bootstrap_arches}"):gmatch("%S+") do
@@ -242,7 +245,8 @@ end}
local target_arch = rpm.expand("%{_target_cpu}")
for i, arch in ipairs(bootstrap_arches) do
local i = 1000 + i * 6
- local suffix = channel.."-"..rust_triple(arch)
+ local upstream_arch = arch == "riscv64" and "riscv64gc" or arch
+ local suffix = channel.."-"..rust_triple(upstream_arch)
print(string.format("Source%d: %s/cargo-%s.tar.xz\n", i, base, suffix))
print(string.format("Source%d: %s/cargo-%s.tar.xz.asc\n", i+1, base, suffix))
print(string.format("Source%d: %s/rustc-%s.tar.xz\n", i+2, base, suffix))
@@ -840,9 +844,11 @@ end}
# Set up shared environment variables for build/install/check.
# *_USE_PKG_CONFIG=1 convinces *-sys crates to use the system library.
+# We need PKG_CONFIG_ALLOW_CROSS when BOOTSTRAP_TRIPLE is different.
%global rust_env %{shrink:
%{?rustflags:RUSTFLAGS="%{rustflags}"}
%{rustc_target_cpus}
+ PKG_CONFIG_ALLOW_CROSS=1
%{!?with_bundled_sqlite3:LIBSQLITE3_SYS_USE_PKG_CONFIG=1}
%{!?with_disabled_libssh2:LIBSSH2_SYS_USE_PKG_CONFIG=1}
%{?llvm_path:PATH="%{llvm_path}:$PATH"}
@@ -871,6 +877,17 @@ end}
%endif
%constrain_build -m 4096
+%define host_target_config() %{shrink:
+ --set target.%1.linker=%{__cc}
+ --set target.%1.cc=%{__cc}
+ --set target.%1.cxx=%{__cxx}
+ --set target.%1.ar=%{__ar}
+ --set target.%1.ranlib=%{__ranlib}
+ --set target.%1.profiler="%{profiler}"
+ --set target.%1.optimized-compiler-builtins="%{optimized_builtins}"
+ %{!?with_bundled_llvm: --set target.%1.llvm-config=%{llvm_root}/bin/llvm-config}
+}
+
%if %defined mingw_targets
%define mingw_target_config %{shrink:
--set target.i686-pc-windows-gnu.linker=%{mingw32_cc}
@@ -918,24 +935,26 @@ test -r "%{profiler}"
%define optimized_builtins %{clang_lib}/%{_arch}-redhat-linux-gnu/libclang_rt.builtins.a
test -r "%{optimized_builtins}"
+# It is possible to use a different bootstrap triple than the desired host,
+# e.g. using riscv64gc-unknown-linux-gnu to build riscv64a23
+BOOTSTRAP_TRIPLE=$(%{local_rust_root}/bin/rustc --print host-tuple)
+BOOTSTRAP_TARGET_CONFIG=""
+if [ "$BOOTSTRAP_TRIPLE" != "%{rust_triple}" ]; then
+ BOOTSTRAP_TARGET_CONFIG="%{host_target_config $BOOTSTRAP_TRIPLE}"
+fi
+
%configure --disable-option-checking \
--docdir=%{_pkgdocdir} \
--libdir=%{common_libdir} \
- --build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
- --set target.%{rust_triple}.linker=%{__cc} \
- --set target.%{rust_triple}.cc=%{__cc} \
- --set target.%{rust_triple}.cxx=%{__cxx} \
- --set target.%{rust_triple}.ar=%{__ar} \
- --set target.%{rust_triple}.ranlib=%{__ranlib} \
- --set target.%{rust_triple}.profiler="%{profiler}" \
- --set target.%{rust_triple}.optimized-compiler-builtins="%{optimized_builtins}" \
+ --build="$BOOTSTRAP_TRIPLE" $BOOTSTRAP_TARGET_CONFIG \
+ --host=%{rust_triple} --target=%{rust_triple} \
+ %{host_target_config %{rust_triple}} \
%{?mingw_target_config} \
%{?wasm_target_config} \
--python=%{__python3} \
--local-rust-root=%{local_rust_root} \
--set build.rustfmt=/bin/true \
- %{!?with_bundled_llvm: --llvm-root=%{llvm_root} \
- %{!?with_llvm_static: --enable-llvm-link-shared } } \
+ %{!?with_bundled_llvm: %{!?with_llvm_static: --enable-llvm-link-shared }} \
--disable-llvm-static-stdcpp \
--disable-llvm-bitcode-linker \
--disable-lld \
@@ -971,8 +990,8 @@ mkdir -p "%{profraw}"
# We normally use `x.py`, but in this case we invoke the stage 2 compiler and libs
# directly to ensure we use the instrumented compiler.
env LLVM_PROFILE_FILE="%{profraw}/default_%%m_%%p.profraw" \
- LD_LIBRARY_PATH=$PWD/build/host/stage2/lib \
- RUSTC=$PWD/build/host/stage2/bin/rustc \
+ LD_LIBRARY_PATH=$PWD/build/%{rust_triple}/stage2/lib \
+ RUSTC=$PWD/build/%{rust_triple}/stage2/bin/rustc \
%{local_rust_root}/bin/cargo build --manifest-path=src/tools/cargo/Cargo.toml
# Finalize the profile data and clean up the raw files
llvm-profdata merge -o "%{profdata}" "%{profraw}"
@@ -1025,6 +1044,11 @@ rm -rf ./build/dist/ ./build/tmp/
# Some of the components duplicate-install binaries, leaving backups we don't want
rm -f %{buildroot}%{_bindir}/*.old
+# Remove proc-macros libraries leaked by cross builds
+# https://github.com/rust-lang/rust/issues/165478
+find %{buildroot}%{common_libdir} -maxdepth 1 -type f -name '*.so' \
+ ! -name 'librustc_driver-*.so' -exec rm -v '{}' '+'
+
# Make sure the compiler's shared libraries are in the proper libdir
%if "%{_libdir}" != "%{common_libdir}"
mkdir -p %{buildroot}%{_libdir}
diff --git a/sources b/sources
index c6affef..4df9975 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,9 @@
SHA512 (rustc-1.99.1-src.tar.xz) = 641fb7ebb205cc8fc7a05d79f1353ae4aedf5a1080cd3928da51865b6b7ec721c755992c8bfdcc9fe93893dfac15439093e78580e7a78913a7f1db4e3b6f95e8
SHA512 (rustc-1.99.1-src.tar.xz.asc) = 32659fb251cf8869375f06d7f923ec1e2e3288457360b1c2817216bf5976b969ba3eb73b7bbfc843a3cb84c0459a203711ecfb422510493f6569f809fb4421fd
SHA512 (wasi-libc-wasi-sdk-34.tar.gz) = effe714d3ac75f22780ebe21b5cb7c4240fab72a5b0f1f75ce4cb842d1c60d9a5180ef50ce079d483391360819209e4ecfc22def0fec381d570dd2bdec1011ed
+SHA512 (cargo-1.98.0-riscv64gc-unknown-linux-gnu.tar.xz) = 12c1ece81edd94058801472dfd1b9aca79758ecee41012648ff4b8fa020541afa9f0d8188d144bbd49ce0317017c930e38810965794cdc7e58893f0bb77ffbde
+SHA512 (cargo-1.98.0-riscv64gc-unknown-linux-gnu.tar.xz.asc) = 703b58aa2abf125a451690891574d0d86740a7e65e6d016f517021ef0cfa193982b17b982b703bd08f19f59b5947d43ab6924dfccf044fb505f2d6f17164fd9f
+SHA512 (rustc-1.98.0-riscv64gc-unknown-linux-gnu.tar.xz) = 7ed7f44a9d1ed5244ef359ec466bea93366a47e07c7658fe5db2d0fa7f2d390a2f9ef30295afc177e5ed7047e17225abf92bd02c500d738d816c0566adfa2821
+SHA512 (rustc-1.98.0-riscv64gc-unknown-linux-gnu.tar.xz.asc) = 62704b454c1c8b8eac072b6832107730fca2e2cbf9bfea9f87173d412d86766229411c4ad968aa0334cdcb1df27c2ef8b54fc15f691148949f289f06c7fdc5f3
+SHA512 (rust-std-1.98.0-riscv64gc-unknown-linux-gnu.tar.xz) = 6e363a5b32dc4afbe5685456556d0b45cc9c7ac2e11839c1eb275f36f7ad282f56f28c64590472e3cc6be909f5ec5b60554326fbf92f4652eae7c25399fc89a7
+SHA512 (rust-std-1.98.0-riscv64gc-unknown-linux-gnu.tar.xz.asc) = f83a00f912427a20e2ca2ad981894d4d9beb665ccd0da8836f09234f442530608cc4f358df45a2802d3a1ef75c79a282eeef370f12390dc0606ce5083a183c69
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-13 21:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-13 21:43 [rpms/rust] f43: Bootstrap and migrate to riscv64a23 for RHEL 11 Josh Stone
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox