Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: El Mehdi YOUNES <elmehdi.younes@smile.fr>
Cc: buildroot@buildroot.org, Eric Le Bihan <eric.le.bihan.dev@free.fr>
Subject: Re: [Buildroot] [RFC PATCH 4/5] linux: split HOSTCC from flags
Date: Tue, 3 Feb 2026 14:50:03 +0100	[thread overview]
Message-ID: <aYH8O522wgwXYglG@windsurf> (raw)
In-Reply-To: <20250808133112.3212687-5-elmehdi.younes@smile.fr>

Hello Mehdi,

Thanks for your patch!

On Fri, Aug 08, 2025 at 03:31:11PM +0200, El Mehdi YOUNES via buildroot wrote:

> Since Linux v4.19, Kbuild provides explicit variables for host flags, so splitting
> compiler vs flags is supported upstream (see:
>   https://github.com/torvalds/linux/commit/96f14fe738b69dd97a33efe3cc8ab330af5fd1f1
>   https://github.com/torvalds/linux/commit/b90a368000abe5e015e0b045ca2ff7c2173b94c0
>   https://github.com/torvalds/linux/commit/f92d19e0ef9bbbb2984845682e740934ad45473b).
> 
> But with this change we can have problems with older kernel versions
> (< 4.19), as the Buildroot commit below warned when avoiding HOSTCFLAGS
> to not override internal kernel flags:
>   https://gitlab.com/buildroot.org/buildroot/-/commit/dde090c299b0357fdb1a4ec44ad8d332ac57f65e

Since your change as-is would break Linux < 4.19, here is the
suggestion that we have after discussing at the Buildroot Developers
Meeting: make things condition based on
BR2_LINUX_KERNEL_RUST_SUPPORT. Something along the lines of:

ifeq ($(BR2_LINUX_KERNEL_RUST_SUPPORT),y)
LINUX_MAKE_FLAGS += \
	HOSTCC="$(HOSTCC)" \
	HOSTCFLAGS="$(subst -I/,-isystem /,$(subst -I /,-isystem /,$(HOST_CFLAGS)))" \
	HOSTLDFLAGS="$(HOST_LDFLAGS)"
else
LINUX_MAKE_FLAGS += \
	HOSTCC="$(HOSTCC) $(subst -I/,-isystem /,$(subst -I /,-isystem /,$(HOST_CFLAGS))) $(HOST_LDFLAGS)"
endif

Of course, if someone enables BR2_LINUX_KERNEL_RUST_SUPPORT with a
kernel < 4.19 it would fail to build, but that's acceptable as it's
stupid to do this since Linux 4.19 did not have any Rust support.

Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2026-02-03 13:50 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-08 13:31 [Buildroot] [RFC PATCH 0/5] Add Rust for Linux support El Mehdi YOUNES via buildroot
2025-08-08 13:31 ` [Buildroot] [RFC PATCH 1/5] package/rust-bindgen: add host-clang dependency El Mehdi YOUNES via buildroot
2026-02-03 11:11   ` Thomas Petazzoni via buildroot
2026-02-13 19:37   ` Thomas Perale via buildroot
2025-08-08 13:31 ` [Buildroot] [RFC PATCH 2/5] package/rust-bin: add Rust sources El Mehdi YOUNES via buildroot
2026-02-03 13:33   ` Thomas Petazzoni via buildroot
2026-02-03 14:27     ` El Mehdi YOUNES via buildroot
2025-08-08 13:31 ` [Buildroot] [RFC PATCH 3/5] package/rust-bin: install rustfmt El Mehdi YOUNES via buildroot
2026-02-03 13:35   ` Thomas Petazzoni via buildroot
2026-02-03 14:27     ` El Mehdi YOUNES via buildroot
2025-08-08 13:31 ` [Buildroot] [RFC PATCH 4/5] linux: split HOSTCC from flags El Mehdi YOUNES via buildroot
2026-02-03 13:50   ` Thomas Petazzoni via buildroot [this message]
2026-02-03 14:29     ` El Mehdi YOUNES via buildroot
2025-08-08 13:31 ` [Buildroot] [RFC PATCH 5/5] linux: Add Rust support El Mehdi YOUNES via buildroot
2026-02-03 14:08   ` Thomas Petazzoni via buildroot
2026-02-03 14:34     ` El Mehdi YOUNES via buildroot
2026-02-03 15:09       ` Thomas Petazzoni via buildroot

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=aYH8O522wgwXYglG@windsurf \
    --to=buildroot@buildroot.org \
    --cc=elmehdi.younes@smile.fr \
    --cc=eric.le.bihan.dev@free.fr \
    --cc=thomas.petazzoni@bootlin.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