All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 05/12] linux: override CC for the case CC is not GCC
Date: Sun, 30 Aug 2020 09:57:52 +0200	[thread overview]
Message-ID: <266c06e4-9067-7895-4fe2-739c09d93590@mind.be> (raw)
In-Reply-To: <20190907094027.9537-6-romain.naour@smile.fr>



On 07/09/2019 11:40, Romain Naour wrote:
> Until now we provided only CROSS_COMPILE to the kernel
> buildsystem to use our GCC cross-compiler. Internally,
> the buildsystem defined CC=$(CROSS_COMPILE)gcc.

 I don't like that we have to patch every package that happens to refer to
gcc... Note that we have roughly 70 packages that use CROSS_COMPILE, so unless
you checked all of them, it is likely that some of them are still referring to
gcc as well (most of them probably not because we set CC=... in
TARGET_CONFIGURE_OPTS, which gets used by most packages (but not by linux.mk)).

 Therefore, maybe a better alternative is to lie to the packages :-) We can
symlink gcc etc. to clang instead of the toolchain wrapper. Then we just have to
find a way to convert g++ to clang++ etc, but note that clang behaves correctly
when called as aarch64-none-linux-gnu-g++ (i.e. it acts as if it was called
through clang-c++), so we can probably work with that.

 Regards,
 Arnout


> Since Clang can now be used as cross-compiler, Buildroot
> may define in the future TARGET_CC to use clang instead
> of GCC.
> 
> In order to build the kernel with the selected compiler,
> make sure to define CC=$(TARGET_CC) in LINUX_MAKE_FLAGS.
> 
> Signed-off-by: Romain Naour <romain.naour@smile.fr>
> Cc: Matt Weber <matthew.weber@rockwellcollins.com>
> Cc: Valentin Korenblit <valentinkorenblit@gmail.com>
> ---
>  linux/linux.mk | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/linux/linux.mk b/linux/linux.mk
> index 29d2f0ee69..d381c96d85 100644
> --- a/linux/linux.mk
> +++ b/linux/linux.mk
> @@ -128,6 +128,7 @@ LINUX_MAKE_FLAGS = \
>  	ARCH=$(KERNEL_ARCH) \
>  	INSTALL_MOD_PATH=$(TARGET_DIR) \
>  	CROSS_COMPILE="$(TARGET_CROSS)" \
> +	CC="$(TARGET_CC)" \
>  	DEPMOD=$(HOST_DIR)/sbin/depmod
>  
>  ifeq ($(BR2_REPRODUCIBLE),y)
> 

  reply	other threads:[~2020-08-30  7:57 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-07  9:40 [Buildroot] [PATCH v2 00/12] Add the support for Clang cross-compiler Romain Naour
2019-09-07  9:40 ` [Buildroot] [PATCH v2 01/12] package/clang: help host-clang to find our external toolchain Romain Naour
2019-09-09 14:26   ` Matthew Weber
2020-08-29 19:00   ` Arnout Vandecappelle
2019-09-07  9:40 ` [Buildroot] [PATCH v2 02/12] package/llvm: add the version major variable Romain Naour
2020-08-29 19:00   ` Arnout Vandecappelle
2019-09-07  9:40 ` [Buildroot] [PATCH v2 03/12] package/clang: " Romain Naour
2019-09-07  9:40 ` [Buildroot] [PATCH v2 04/12] package/clang: install a toolchain-wrapper for the host clang cross-compiler Romain Naour
2020-08-29 19:40   ` Arnout Vandecappelle
2019-09-07  9:40 ` [Buildroot] [PATCH v2 05/12] linux: override CC for the case CC is not GCC Romain Naour
2020-08-30  7:57   ` Arnout Vandecappelle [this message]
2019-09-07  9:40 ` [Buildroot] [PATCH v2 06/12] package/meson: use TARGET_{CC, CXX} instead of TARGET_CROSS for cc and cpp Romain Naour
2019-09-07  9:40 ` [Buildroot] [PATCH v2 07/12] package/busybox: fix applets runtime issue when building with clang cross-compiler Romain Naour
2019-09-09 14:29   ` Matthew Weber
2020-08-29 20:21   ` Arnout Vandecappelle
2020-09-14 19:58     ` Romain Naour
2019-09-07  9:40 ` [Buildroot] [PATCH v2 08/12] package/clang: add a host entry for clang Romain Naour
2020-08-29 20:34   ` Arnout Vandecappelle
2019-09-07  9:40 ` [Buildroot] [PATCH v2 09/12] package/glibc: use GCC cross-compiler if Clang is used as cross-compiler Romain Naour
2019-09-07  9:40 ` [Buildroot] [PATCH v2 10/12] core: allow to use Clang " Romain Naour
2019-09-09 14:29   ` Matthew Weber
2020-08-29 21:13   ` Arnout Vandecappelle
2019-09-07  9:40 ` [Buildroot] [PATCH v2 11/12] toolchain: add a warning when Clang is used " Romain Naour
2019-09-07  9:40 ` [Buildroot] [PATCH v2 12/12] linux: don't set -Wno-attribute-alias flag " Romain Naour
2019-09-09 14:28   ` Matthew Weber
2020-08-29 18:53 ` [Buildroot] [PATCH v2 00/12] Add the support for Clang cross-compiler Arnout Vandecappelle
2020-09-14 19:53   ` Romain Naour

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=266c06e4-9067-7895-4fe2-739c09d93590@mind.be \
    --to=arnout@mind.be \
    --cc=buildroot@busybox.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.