commit:     d6ad14c67d113ec61a90484a024d696ee1165c79
Author:     Krzysztof Nowicki <krzysztof.a.nowicki <AT> gmail <DOT> com>
AuthorDate: Wed Jan 14 09:38:15 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jan 15 21:00:12 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d6ad14c6

dev-lang/rust: don't cross-compile profiler for bare-metal targets

By default Rust is build with profiler support for the native
architecture as well as for all cross-compiled targets due to
inheritance. However building the profiles for bare-metal targets will
result in an error due to lack of support.

Fix this by explicitly disabling profiling for such targets. This change
specifically addresses the UEFI targets, as they are susceptible to this
problem, but other similar targets may need to be added to the list.

Signed-off-by: Krzysztof Nowicki <krzysztof.a.nowicki <AT> gmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/45372
Closes: https://github.com/gentoo/gentoo/pull/45372
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-lang/rust/rust-1.90.0-r1.ebuild    | 8 +++++++-
 dev-lang/rust/rust-1.91.0.ebuild       | 8 +++++++-
 dev-lang/rust/rust-1.92.0_p1-r1.ebuild | 8 +++++++-
 dev-lang/rust/rust-9999.ebuild         | 8 +++++++-
 4 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/dev-lang/rust/rust-1.90.0-r1.ebuild 
b/dev-lang/rust/rust-1.90.0-r1.ebuild
index 23b3deb58e80..574b2a3a3429 100644
--- a/dev-lang/rust/rust-1.90.0-r1.ebuild
+++ b/dev-lang/rust/rust-1.90.0-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2025 Gentoo Authors
+# Copyright 1999-2026 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -641,6 +641,12 @@ src_configure() {
                                musl-root = "$(${cross_toolchain}-gcc 
-print-sysroot)/usr"
                        _EOF_
                fi
+               if [[ "${cross_rust_target}" == *-uefi ]]; then
+                       # Profiler is not supported on bare-metal
+                       cat <<- _EOF_ >> "${S}"/bootstrap.toml
+                               profiler = false
+                       _EOF_
+               fi
 
                # append cross target to "normal" target list
                # example 'target = ["powerpc64le-unknown-linux-gnu"]'

diff --git a/dev-lang/rust/rust-1.91.0.ebuild b/dev-lang/rust/rust-1.91.0.ebuild
index c88a61d4333f..47a1f638f60f 100644
--- a/dev-lang/rust/rust-1.91.0.ebuild
+++ b/dev-lang/rust/rust-1.91.0.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2025 Gentoo Authors
+# Copyright 1999-2026 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -636,6 +636,12 @@ src_configure() {
                                musl-root = "$(${cross_toolchain}-gcc 
-print-sysroot)/usr"
                        _EOF_
                fi
+               if [[ "${cross_rust_target}" == *-uefi ]]; then
+                       # Profiler is not supported on bare-metal
+                       cat <<- _EOF_ >> "${S}"/bootstrap.toml
+                               profiler = false
+                       _EOF_
+               fi
 
                # append cross target to "normal" target list
                # example 'target = ["powerpc64le-unknown-linux-gnu"]'

diff --git a/dev-lang/rust/rust-1.92.0_p1-r1.ebuild 
b/dev-lang/rust/rust-1.92.0_p1-r1.ebuild
index 6086b58e2f2f..197913a535aa 100644
--- a/dev-lang/rust/rust-1.92.0_p1-r1.ebuild
+++ b/dev-lang/rust/rust-1.92.0_p1-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2025 Gentoo Authors
+# Copyright 1999-2026 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -669,6 +669,12 @@ src_configure() {
                                musl-root = "$(${cross_toolchain}-gcc 
-print-sysroot)/usr"
                        _EOF_
                fi
+               if [[ "${cross_rust_target}" == *-uefi ]]; then
+                       # Profiler is not supported on bare-metal
+                       cat <<- _EOF_ >> "${S}"/bootstrap.toml
+                               profiler = false
+                       _EOF_
+               fi
 
                # append cross target to "normal" target list
                # example 'target = ["powerpc64le-unknown-linux-gnu"]'

diff --git a/dev-lang/rust/rust-9999.ebuild b/dev-lang/rust/rust-9999.ebuild
index 6086b58e2f2f..197913a535aa 100644
--- a/dev-lang/rust/rust-9999.ebuild
+++ b/dev-lang/rust/rust-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2025 Gentoo Authors
+# Copyright 1999-2026 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -669,6 +669,12 @@ src_configure() {
                                musl-root = "$(${cross_toolchain}-gcc 
-print-sysroot)/usr"
                        _EOF_
                fi
+               if [[ "${cross_rust_target}" == *-uefi ]]; then
+                       # Profiler is not supported on bare-metal
+                       cat <<- _EOF_ >> "${S}"/bootstrap.toml
+                               profiler = false
+                       _EOF_
+               fi
 
                # append cross target to "normal" target list
                # example 'target = ["powerpc64le-unknown-linux-gnu"]'

Reply via email to