Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [RFC PATCH v4 5/9] llvm: add config to build backend for host arch
Date: Fri, 15 Jun 2018 22:10:39 +0200	[thread overview]
Message-ID: <20180615221039.14df3974@windsurf> (raw)
In-Reply-To: <20180614224820.27126-6-joseph.kogut@gmail.com>

Hello,

On Thu, 14 Jun 2018 15:48:16 -0700, Joseph Kogut wrote:
> Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com>
> ---
>  package/llvm/Config.in | 11 +++++++++++
>  package/llvm/llvm.mk   |  9 ++++++++-
>  2 files changed, 19 insertions(+), 1 deletion(-)
> 
> diff --git a/package/llvm/Config.in b/package/llvm/Config.in
> index 83e94660eb..dd07b23e07 100644
> --- a/package/llvm/Config.in
> +++ b/package/llvm/Config.in
> @@ -11,6 +11,12 @@ config BR2_PACKAGE_LLVM_TARGET_ARCH
>  	default "ARM" if BR2_arm || BR2_armeb
>  	default "X86" if BR2_i386 || BR2_x86_64
>  
> +config BR2_PACKAGE_LLVM_HOST_ARCH
> +	string
> +	default "AArch64" if BR2_HOSTARCH="aarch64"
> +	default "X86" if BR2_HOSTARCH = "x86" || BR2_HOSTARCH = "x86_64"
> +	default "ARM" if BR2_HOSTARCH = "arm"
> +
>  config BR2_PACKAGE_LLVM
>  	bool "llvm"
>  	depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS
> @@ -27,6 +33,11 @@ config BR2_PACKAGE_LLVM
>  
>  	  http://llvm.org
>  
> +config BR2_PACKAGE_LLVM_ENABLE_HOST_ARCH
> +	bool "Build backend for host architecture"
> +	help
> +	  Build code generator for host machine.

So I'm going to disagree a bit with Valentin on this one. If I
understand correctly, this option is going to change what host-llvm
builds, not what the target llvm package builds. So it is a host
package option, and as such is more logically named
BR2_PACKAGE_HOST_LLVM_<something>.

*But* they should be moved to a new package/llvm/Config.in.host file,
and BR2_PACKAGE_HOST_LLVM_ENABLE_HOST_ARCH should be made a blind
option (i.e without prompt). This blind option will be selected by
whichever package needs host architecture support in host-llvm.

> diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk
> index 3abf428989..50cc74d299 100644
> --- a/package/llvm/llvm.mk
> +++ b/package/llvm/llvm.mk
> @@ -39,8 +39,9 @@ LLVM_CONF_OPTS += -DLLVM_BUILD_GLOBAL_ISEL=OFF
>  LLVM_TARGET_ARCH = $(call qstrip,$(BR2_PACKAGE_LLVM_TARGET_ARCH))
>  
>  # Build backend for target architecture. This include backends like AMDGPU.
> +HOST_LLVM_TARGETS_TO_BUILD = $(LLVM_TARGET_ARCH)
>  LLVM_TARGETS_TO_BUILD = $(LLVM_TARGET_ARCH)
> -HOST_LLVM_CONF_OPTS += -DLLVM_TARGETS_TO_BUILD="$(subst $(space),;,$(LLVM_TARGETS_TO_BUILD))"
> +HOST_LLVM_CONF_OPTS += -DLLVM_TARGETS_TO_BUILD="$(subst $(space),;,$(HOST_LLVM_TARGETS_TO_BUILD))"
>  LLVM_CONF_OPTS += -DLLVM_TARGETS_TO_BUILD="$(subst $(space),;,$(LLVM_TARGETS_TO_BUILD))"
>  
>  # LLVM target to use for native code generation. This is required for JIT generation.
> @@ -56,9 +57,15 @@ LLVM_CONF_OPTS += -DLLVM_TARGET_ARCH=$(LLVM_TARGET_ARCH)
>  # output only $(LLVM_TARGET_ARCH) if not, and mesa3d won't build as
>  # it thinks AMDGPU backend is not installed on the target.
>  ifeq ($(BR2_PACKAGE_LLVM_AMDGPU),y)
> +HOST_LLVM_TARGETS_TO_BUILD += AMDGPU
>  LLVM_TARGETS_TO_BUILD += AMDGPU
>  endif
>  
> +# Build backend for host architecture
> +ifeq ($(BR2_PACKAGE_LLVM_ENABLE_HOST_ARCH),y)
> +HOST_LLVM_TARGETS_TO_BUILD += $(call qstrip,$(BR2_PACKAGE_LLVM_HOST_ARCH))
> +endif

I think this could be improved. Something like this:

LLVM_TARGETS_TO_BUILD = $(LLVM_TARGET_ARCH)

ifeq ($(BR2_PACKAGE_LLVM_AMDGPU),y)
LLVM_TARGETS_TO_BUILD += AMDGPU
endif

 ... potentially more additions to LLVM_TARGETS_TO_BUILD here ...

LLVM_CONF_OPTS += -DLLVM_TARGETS_TO_BUILD="$(subst $(space),;,$(LLVM_TARGETS_TO_BUILD))"

# host-llvm at least needs to build the same targets as the ones needed
# by the target llvm
HOST_LLVM_TARGETS_TO_BUILD = $(LLVM_TARGETS_TO_BUILD)

ifeq ($(BR2_PACKAGE_HOST_LLVM_ENABLE_HOST_ARCH),y)
HOST_LLVM_TARGETS_TO_BUILD += $(call qstrip,$(BR2_PACKAGE_LLVM_HOST_ARCH))
endif

HOST_LLVM_CONF_OPTS += -DLLVM_TARGETS_TO_BUILD="$(subst $(space),;,$(HOST_LLVM_TARGETS_TO_BUILD))"

And there you go.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2018-06-15 20:10 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-08 22:59 [Buildroot] [RFC PATCH 0/8] chromium: new package Joseph Kogut
2018-06-08 22:59 ` [Buildroot] [RFC PATCH 1/8] atk: bump to version 2.25.2 Joseph Kogut
2018-06-09 17:36   ` Thomas Petazzoni
2018-06-09 18:19     ` Joseph Kogut
2018-06-08 22:59 ` [Buildroot] [RFC PATCH 2/8] at-spi2-core: new package Joseph Kogut
2018-06-08 22:59 ` [Buildroot] [RFC PATCH 3/8] at-spi2-atk: " Joseph Kogut
2018-06-08 22:59 ` [Buildroot] [RFC PATCH 4/8] libgtk3: remove patch to disable atk-bridge support Joseph Kogut
2018-06-08 22:59 ` [Buildroot] [RFC PATCH 5/8] llvm: add config to build backend for host arch Joseph Kogut
2018-06-08 22:59 ` [Buildroot] [RFC PATCH 6/8] llvm: bump to version 6.0.0 Joseph Kogut
2018-06-12 14:34   ` Valentin Korenblit
2018-06-12 17:07     ` Joseph Kogut
2018-06-08 22:59 ` [Buildroot] [RFC PATCH 7/8] clang: " Joseph Kogut
2018-06-08 22:59 ` [Buildroot] [RFC PATCH 8/8] chromium: new package Joseph Kogut
2018-06-10 20:44 ` [Buildroot] [RFC PATCH v2 0/9] " Joseph Kogut
2018-06-10 20:44   ` [Buildroot] [RFC PATCH v2 1/9] atk: bump to version 2.25.2 Joseph Kogut
2018-06-10 20:44   ` [Buildroot] [RFC PATCH v2 1/9] atk: bump to version 2.28.1 Joseph Kogut
2018-06-10 20:44   ` [Buildroot] [RFC PATCH v2 2/9] at-spi2-core: new package Joseph Kogut
2018-06-10 20:44   ` [Buildroot] [RFC PATCH v2 3/9] at-spi2-atk: " Joseph Kogut
2018-06-10 20:44   ` [Buildroot] [RFC PATCH v2 4/9] libgtk3: remove patch to disable atk-bridge support Joseph Kogut
2018-06-10 20:44   ` [Buildroot] [RFC PATCH v2 5/9] llvm: add config to build backend for host arch Joseph Kogut
2018-06-10 20:44   ` [Buildroot] [RFC PATCH v2 6/9] llvm: bump to version 6.0.0 Joseph Kogut
2018-06-10 20:44   ` [Buildroot] [RFC PATCH v2 7/9] clang: " Joseph Kogut
2018-06-10 20:44   ` [Buildroot] [RFC PATCH v2 8/9] lld: new package Joseph Kogut
2018-06-10 20:44   ` [Buildroot] [RFC PATCH v2 9/9] chromium: " Joseph Kogut
2018-06-10 20:54   ` [Buildroot] [RFC PATCH v2 0/9] " Joseph Kogut
2018-06-10 20:54     ` [Buildroot] [RFC PATCH v3 1/9] atk: bump to version 2.28.1 Joseph Kogut
2018-06-10 20:54     ` [Buildroot] [RFC PATCH v3 2/9] at-spi2-core: new package Joseph Kogut
2018-06-10 20:54     ` [Buildroot] [RFC PATCH v3 3/9] at-spi2-atk: " Joseph Kogut
2018-06-10 20:54     ` [Buildroot] [RFC PATCH v3 4/9] libgtk3: remove patch to disable atk-bridge support Joseph Kogut
2018-06-10 20:54     ` [Buildroot] [RFC PATCH v3 5/9] llvm: add config to build backend for host arch Joseph Kogut
2018-06-11  9:06       ` Valentin Korenblit
2018-06-11 16:24         ` Joseph Kogut
2018-06-11 17:54         ` Joseph Kogut
2018-06-12 13:46           ` Valentin Korenblit
2018-06-10 20:54     ` [Buildroot] [RFC PATCH v3 6/9] llvm: bump to version 6.0.0 Joseph Kogut
2018-06-10 20:54     ` [Buildroot] [RFC PATCH v3 7/9] clang: " Joseph Kogut
2018-06-10 20:54     ` [Buildroot] [RFC PATCH v3 8/9] lld: new package Joseph Kogut
2018-06-10 20:54     ` [Buildroot] [RFC PATCH v3 9/9] chromium: " Joseph Kogut
2018-06-14 22:48     ` [Buildroot] [RFC PATCH v4 0/9] " Joseph Kogut
2018-06-14 22:48       ` [Buildroot] [RFC PATCH v4 1/9] atk: bump to version 2.28.1 Joseph Kogut
2018-06-15 19:38         ` Thomas Petazzoni
2018-06-14 22:48       ` [Buildroot] [RFC PATCH v4 2/9] at-spi2-core: new package Joseph Kogut
2018-06-15 19:45         ` Thomas Petazzoni
2018-06-14 22:48       ` [Buildroot] [RFC PATCH v4 3/9] at-spi2-atk: " Joseph Kogut
2018-06-15 19:47         ` Thomas Petazzoni
2018-06-14 22:48       ` [Buildroot] [RFC PATCH v4 4/9] libgtk3: remove patch to disable atk-bridge support Joseph Kogut
2018-06-15 19:53         ` Thomas Petazzoni
2018-06-20 18:05           ` Joseph Kogut
2018-06-21  8:48             ` Thomas Petazzoni
2018-06-14 22:48       ` [Buildroot] [RFC PATCH v4 5/9] llvm: add config to build backend for host arch Joseph Kogut
2018-06-15 20:10         ` Thomas Petazzoni [this message]
2018-06-14 22:48       ` [Buildroot] [RFC PATCH v4 6/9] llvm: bump to version 6.0.0 Joseph Kogut
2018-06-15 20:20         ` Thomas Petazzoni
2018-06-15 20:44           ` Joseph Kogut
2018-06-15 20:51         ` Thomas Petazzoni
2018-06-14 22:48       ` [Buildroot] [RFC PATCH v4 7/9] clang: " Joseph Kogut
2018-06-15 20:51         ` Thomas Petazzoni
2018-06-14 22:48       ` [Buildroot] [RFC PATCH v4 8/9] lld: new package Joseph Kogut
2018-06-15 21:01         ` Thomas Petazzoni
2018-06-20 19:14           ` Joseph Kogut
2018-06-21 12:45             ` Thomas Petazzoni
2018-06-21 23:32               ` Joseph Kogut
2018-06-14 22:48       ` [Buildroot] [RFC PATCH v4 9/9] chromium: " Joseph Kogut
2018-06-20 20:57         ` Matthew Weber
2018-06-20 23:07           ` Joseph Kogut
2018-06-21  2:29             ` Matthew Weber

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=20180615221039.14df3974@windsurf \
    --to=thomas.petazzoni@bootlin.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox