commit:     caea6d9760e3f9a67d6e9205ae6c176548b19927
Author:     Z. Liu <zhixu.liu <AT> gmail <DOT> com>
AuthorDate: Wed Feb 26 15:18:52 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Mar 21 19:12:55 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=caea6d97

dev-lang/rust: fix build using clang but not lld

use-lld appeared first in commit bfba6ef328bbba327cae8918e795c11b89217672
refactored in commit befd1eb4ec78e19f0c8628fa75241ea3ed6ec792

Closes: https://bugs.gentoo.org/948027
Signed-off-by: Z. Liu <zhixu.liu <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/40772
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-lang/rust/rust-1.84.0-r1.ebuild              | 8 ++++++++
 dev-lang/rust/rust-1.84.1-r1.ebuild              | 8 ++++++++
 dev-lang/rust/rust-1.85.0-r1.ebuild              | 8 ++++++++
 dev-lang/rust/rust-1.85.0.ebuild                 | 8 ++++++++
 dev-lang/rust/rust-1.85.1.ebuild                 | 8 ++++++++
 dev-lang/rust/rust-1.86.0_beta20250218-r1.ebuild | 8 ++++++++
 dev-lang/rust/rust-1.86.0_beta20250225.ebuild    | 8 ++++++++
 dev-lang/rust/rust-9999.ebuild                   | 8 ++++++++
 8 files changed, 64 insertions(+)

diff --git a/dev-lang/rust/rust-1.84.0-r1.ebuild 
b/dev-lang/rust/rust-1.84.0-r1.ebuild
index 6fc4e46d7241..83b5a9c1a3dd 100644
--- a/dev-lang/rust/rust-1.84.0-r1.ebuild
+++ b/dev-lang/rust/rust-1.84.0-r1.ebuild
@@ -68,6 +68,7 @@ BDEPEND="${PYTHON_DEPS}
                >=sys-devel/gcc-4.7[cxx]
                >=llvm-core/clang-3.5
        )
+       lto? ( $(llvm_gen_dep 'llvm-core/lld:${LLVM_SLOT}') )
        !system-llvm? (
                >=dev-build/cmake-3.13.4
                app-alternatives/ninja
@@ -234,6 +235,10 @@ src_prepare() {
                fi
        fi
 
+       if use lto && tc-is-clang && ! tc-ld-is-lld; then
+               export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
+       fi
+
        default
 }
 
@@ -386,6 +391,9 @@ src_configure() {
                dist-src = false
                remap-debuginfo = true
                lld = $(usex system-llvm false $(toml_usex wasm))
+               $(if use lto && tc-is-clang ; then
+                       echo "use-lld = true"
+               fi)
                # only deny warnings if doc+wasm are NOT requested, documenting 
stage0 wasm std fails without it
                # https://github.com/rust-lang/rust/issues/74976
                # https://github.com/rust-lang/rust/issues/76526

diff --git a/dev-lang/rust/rust-1.84.1-r1.ebuild 
b/dev-lang/rust/rust-1.84.1-r1.ebuild
index 4dd53ebc8d05..b6f28c029fd4 100644
--- a/dev-lang/rust/rust-1.84.1-r1.ebuild
+++ b/dev-lang/rust/rust-1.84.1-r1.ebuild
@@ -68,6 +68,7 @@ BDEPEND="${PYTHON_DEPS}
                >=sys-devel/gcc-4.7[cxx]
                >=llvm-core/clang-3.5
        )
+       lto? ( $(llvm_gen_dep 'llvm-core/lld:${LLVM_SLOT}') )
        !system-llvm? (
                >=dev-build/cmake-3.13.4
                app-alternatives/ninja
@@ -234,6 +235,10 @@ src_prepare() {
                fi
        fi
 
+       if use lto && tc-is-clang && ! tc-ld-is-lld; then
+               export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
+       fi
+
        default
 }
 
@@ -386,6 +391,9 @@ src_configure() {
                dist-src = false
                remap-debuginfo = true
                lld = $(usex system-llvm false $(toml_usex wasm))
+               $(if use lto && tc-is-clang ; then
+                       echo "use-lld = true"
+               fi)
                # only deny warnings if doc+wasm are NOT requested, documenting 
stage0 wasm std fails without it
                # https://github.com/rust-lang/rust/issues/74976
                # https://github.com/rust-lang/rust/issues/76526

diff --git a/dev-lang/rust/rust-1.85.0-r1.ebuild 
b/dev-lang/rust/rust-1.85.0-r1.ebuild
index 011b8572a939..9bfbad9c8626 100644
--- a/dev-lang/rust/rust-1.85.0-r1.ebuild
+++ b/dev-lang/rust/rust-1.85.0-r1.ebuild
@@ -94,6 +94,7 @@ BDEPEND="${PYTHON_DEPS}
                >=sys-devel/gcc-4.7[cxx]
                >=llvm-core/clang-3.5
        )
+       lto? ( $(llvm_gen_dep 'llvm-core/lld:${LLVM_SLOT}') )
        !system-llvm? (
                >=dev-build/cmake-3.13.4
                app-alternatives/ninja
@@ -306,6 +307,10 @@ src_prepare() {
                fi
        fi
 
+       if use lto && tc-is-clang && ! tc-ld-is-lld; then
+               export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
+       fi
+
        default
 }
 
@@ -473,6 +478,9 @@ src_configure() {
                dist-src = false
                remap-debuginfo = true
                lld = $(usex system-llvm false $(toml_usex wasm))
+               $(if use lto && tc-is-clang ; then
+                       echo "use-lld = true"
+               fi)
                # only deny warnings if doc+wasm are NOT requested, documenting 
stage0 wasm std fails without it
                # https://github.com/rust-lang/rust/issues/74976
                # https://github.com/rust-lang/rust/issues/76526

diff --git a/dev-lang/rust/rust-1.85.0.ebuild b/dev-lang/rust/rust-1.85.0.ebuild
index e7079ae7c11e..88b742cc5112 100644
--- a/dev-lang/rust/rust-1.85.0.ebuild
+++ b/dev-lang/rust/rust-1.85.0.ebuild
@@ -94,6 +94,7 @@ BDEPEND="${PYTHON_DEPS}
                >=sys-devel/gcc-4.7[cxx]
                >=llvm-core/clang-3.5
        )
+       lto? ( $(llvm_gen_dep 'llvm-core/lld:${LLVM_SLOT}') )
        !system-llvm? (
                >=dev-build/cmake-3.13.4
                app-alternatives/ninja
@@ -305,6 +306,10 @@ src_prepare() {
                fi
        fi
 
+       if use lto && tc-is-clang && ! tc-ld-is-lld; then
+               export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
+       fi
+
        default
 }
 
@@ -472,6 +477,9 @@ src_configure() {
                dist-src = false
                remap-debuginfo = true
                lld = $(usex system-llvm false $(toml_usex wasm))
+               $(if use lto && tc-is-clang ; then
+                       echo "use-lld = true"
+               fi)
                # only deny warnings if doc+wasm are NOT requested, documenting 
stage0 wasm std fails without it
                # https://github.com/rust-lang/rust/issues/74976
                # https://github.com/rust-lang/rust/issues/76526

diff --git a/dev-lang/rust/rust-1.85.1.ebuild b/dev-lang/rust/rust-1.85.1.ebuild
index 011b8572a939..9bfbad9c8626 100644
--- a/dev-lang/rust/rust-1.85.1.ebuild
+++ b/dev-lang/rust/rust-1.85.1.ebuild
@@ -94,6 +94,7 @@ BDEPEND="${PYTHON_DEPS}
                >=sys-devel/gcc-4.7[cxx]
                >=llvm-core/clang-3.5
        )
+       lto? ( $(llvm_gen_dep 'llvm-core/lld:${LLVM_SLOT}') )
        !system-llvm? (
                >=dev-build/cmake-3.13.4
                app-alternatives/ninja
@@ -306,6 +307,10 @@ src_prepare() {
                fi
        fi
 
+       if use lto && tc-is-clang && ! tc-ld-is-lld; then
+               export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
+       fi
+
        default
 }
 
@@ -473,6 +478,9 @@ src_configure() {
                dist-src = false
                remap-debuginfo = true
                lld = $(usex system-llvm false $(toml_usex wasm))
+               $(if use lto && tc-is-clang ; then
+                       echo "use-lld = true"
+               fi)
                # only deny warnings if doc+wasm are NOT requested, documenting 
stage0 wasm std fails without it
                # https://github.com/rust-lang/rust/issues/74976
                # https://github.com/rust-lang/rust/issues/76526

diff --git a/dev-lang/rust/rust-1.86.0_beta20250218-r1.ebuild 
b/dev-lang/rust/rust-1.86.0_beta20250218-r1.ebuild
index bbf7e2c95c8c..c22abb3204b7 100644
--- a/dev-lang/rust/rust-1.86.0_beta20250218-r1.ebuild
+++ b/dev-lang/rust/rust-1.86.0_beta20250218-r1.ebuild
@@ -95,6 +95,7 @@ BDEPEND="${PYTHON_DEPS}
                >=sys-devel/gcc-4.7[cxx]
                >=llvm-core/clang-3.5
        )
+       lto? ( $(llvm_gen_dep 'llvm-core/lld:${LLVM_SLOT}') )
        !system-llvm? (
                >=dev-build/cmake-3.13.4
                app-alternatives/ninja
@@ -313,6 +314,10 @@ src_prepare() {
                fi
        fi
 
+       if use lto && tc-is-clang && ! tc-ld-is-lld; then
+               export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
+       fi
+
        default
 }
 
@@ -480,6 +485,9 @@ src_configure() {
                dist-src = false
                remap-debuginfo = true
                lld = $(usex system-llvm false $(toml_usex wasm))
+               $(if use lto && tc-is-clang ; then
+                       echo "use-lld = true"
+               fi)
                # only deny warnings if doc+wasm are NOT requested, documenting 
stage0 wasm std fails without it
                # https://github.com/rust-lang/rust/issues/74976
                # https://github.com/rust-lang/rust/issues/76526

diff --git a/dev-lang/rust/rust-1.86.0_beta20250225.ebuild 
b/dev-lang/rust/rust-1.86.0_beta20250225.ebuild
index 7ccdcd48b3d6..7590d615f095 100644
--- a/dev-lang/rust/rust-1.86.0_beta20250225.ebuild
+++ b/dev-lang/rust/rust-1.86.0_beta20250225.ebuild
@@ -95,6 +95,7 @@ BDEPEND="${PYTHON_DEPS}
                >=sys-devel/gcc-4.7[cxx]
                >=llvm-core/clang-3.5
        )
+       lto? ( $(llvm_gen_dep 'llvm-core/lld:${LLVM_SLOT}') )
        !system-llvm? (
                >=dev-build/cmake-3.13.4
                app-alternatives/ninja
@@ -313,6 +314,10 @@ src_prepare() {
                fi
        fi
 
+       if use lto && tc-is-clang && ! tc-ld-is-lld; then
+               export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
+       fi
+
        default
 }
 
@@ -480,6 +485,9 @@ src_configure() {
                dist-src = false
                remap-debuginfo = true
                lld = $(usex system-llvm false $(toml_usex wasm))
+               $(if use lto && tc-is-clang ; then
+                       echo "use-lld = true"
+               fi)
                # only deny warnings if doc+wasm are NOT requested, documenting 
stage0 wasm std fails without it
                # https://github.com/rust-lang/rust/issues/74976
                # https://github.com/rust-lang/rust/issues/76526

diff --git a/dev-lang/rust/rust-9999.ebuild b/dev-lang/rust/rust-9999.ebuild
index d7dd9d8d660c..72e640905646 100644
--- a/dev-lang/rust/rust-9999.ebuild
+++ b/dev-lang/rust/rust-9999.ebuild
@@ -94,6 +94,7 @@ BDEPEND="${PYTHON_DEPS}
                >=sys-devel/gcc-4.7[cxx]
                >=llvm-core/clang-3.5
        )
+       lto? ( $(llvm_gen_dep 'llvm-core/lld:${LLVM_SLOT}') )
        !system-llvm? (
                >=dev-build/cmake-3.13.4
                app-alternatives/ninja
@@ -306,6 +307,10 @@ src_prepare() {
                fi
        fi
 
+       if use lto && tc-is-clang && ! tc-ld-is-lld; then
+               export RUSTFLAGS+=" -C link-arg=-fuse-ld=lld"
+       fi
+
        default
 }
 
@@ -474,6 +479,9 @@ src_configure() {
                dist-src = false
                remap-debuginfo = true
                lld = $(usex system-llvm false $(toml_usex wasm))
+               $(if use lto && tc-is-clang ; then
+                       echo "use-lld = true"
+               fi)
                # only deny warnings if doc+wasm are NOT requested, documenting 
stage0 wasm std fails without it
                # https://github.com/rust-lang/rust/issues/74976
                # https://github.com/rust-lang/rust/issues/76526

Reply via email to