From: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: Alfred Wingate <parona@protonmail.com>,
Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Subject: [gentoo-dev] [PATCH 3/3] kernel-build.eclass: set toolchain variables more comprehensibly
Date: Wed, 24 Jul 2024 11:52:34 +0200 [thread overview]
Message-ID: <20240724095234.310603-3-andrewammerlaan@gentoo.org> (raw)
In-Reply-To: <20240724095234.310603-1-andrewammerlaan@gentoo.org>
From: Alfred Wingate <parona@protonmail.com>
Building on llvm profiles is problematic if toolchain variables are not properly
set. So set HOSTLD and HOSTAR to match at least the kernels own LLVM=1 variable
to ensure a smoother build for end users.
For example an unset HOSTLD causes issues as it defaults to GNU ld
otherwise.
https://docs.kernel.org/kbuild/llvm.html#the-llvm-argument
Signed-off-by: Alfred Wingate <parona@protonmail.com>
Closes: https://github.com/gentoo/gentoo/pull/37690
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
---
eclass/kernel-build.eclass | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
index f478cf636a27..893a1bdb449c 100644
--- a/eclass/kernel-build.eclass
+++ b/eclass/kernel-build.eclass
@@ -187,6 +187,10 @@ kernel-build_src_configure() {
fi
# force ld.bfd if we can find it easily
+ local HOSTLD="$(tc-getBUILD_LD)"
+ if type -P "${HOSTLD}.bfd" &>/dev/null; then
+ HOSTLD+=.bfd
+ fi
local LD="$(tc-getLD)"
if type -P "${LD}.bfd" &>/dev/null; then
LD+=.bfd
@@ -198,6 +202,8 @@ kernel-build_src_configure() {
HOSTCC="$(tc-getBUILD_CC)"
HOSTCXX="$(tc-getBUILD_CXX)"
+ HOSTLD="${HOSTLD}"
+ HOSTAR="$(tc-getBUILD_AR)"
HOSTCFLAGS="${BUILD_CFLAGS}"
HOSTLDFLAGS="${BUILD_LDFLAGS}"
@@ -210,6 +216,7 @@ kernel-build_src_configure() {
STRIP="$(tc-getSTRIP)"
OBJCOPY="$(tc-getOBJCOPY)"
OBJDUMP="$(tc-getOBJDUMP)"
+ READELF="$(tc-getREADELF)"
# we need to pass it to override colliding Gentoo envvar
ARCH=$(tc-arch-kernel)
--
2.45.2
prev parent reply other threads:[~2024-07-24 9:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-24 9:52 [gentoo-dev] [PATCH 1/3] eclass/kernel-{build,install}.eclass: link to config,Sys.map in moddir Andrew Ammerlaan
2024-07-24 9:52 ` [gentoo-dev] [PATCH 2/3] kernel-build.eclass: fix determining kernel release with MODULES=n Andrew Ammerlaan
2024-07-24 9:52 ` Andrew Ammerlaan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240724095234.310603-3-andrewammerlaan@gentoo.org \
--to=andrewammerlaan@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
--cc=parona@protonmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox