Message ID | 20180610205417.13963-6-joseph.kogut@gmail.com |
---|---|
State | Superseded |
Headers | show |
Series | [RFC,v3,1/9] atk: bump to version 2.28.1 | expand |
Hi Joseph, On 10/06/2018 22:54, Joseph Kogut wrote: > Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com> > --- > package/llvm/Config.in | 9 +++++++++ > package/llvm/llvm.mk | 5 +++++ > 2 files changed, 14 insertions(+) > > diff --git a/package/llvm/Config.in b/package/llvm/Config.in > index 83e94660eb..e9c461b92f 100644 > --- a/package/llvm/Config.in > +++ b/package/llvm/Config.in > @@ -11,6 +11,15 @@ 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_HOST_LLVM_ENABLE_HOST_ARCH > + bool > + I think we could rename this option BR2_PACKAGE_LLVM_ENABLE_HOST_ARCH and make it user-selectable: config BR2_PACKAGE_LLVM_ENABLE_HOST_ARCH bool "Build backend for host architecture" > config BR2_PACKAGE_LLVM > bool "llvm" > depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS > diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk > index 3abf428989..04e99eb5b4 100644 > --- a/package/llvm/llvm.mk > +++ b/package/llvm/llvm.mk > @@ -59,6 +59,11 @@ ifeq ($(BR2_PACKAGE_LLVM_AMDGPU),y) > LLVM_TARGETS_TO_BUILD += AMDGPU > endif > > +# Build backend for host architecture > +ifeq ($(BR2_PACKAGE_LLVM_ENABLE_HOST_ARCH),y) > +LLVM_TARGETS_TO_BUILD += $(call qstrip,$(BR2_PACKAGE_LLVM_HOST_ARCH)) > +endif > + The only problem I see here is that we are going to build the backend for the host architecture also for the target, which is not necessary. Maybe we can use another variable like HOST_LLVM_TARGETS_TO_BUILD. This will break the compatibility of llvm-config for host and target when passing --targets-built but I don't think this should be a problem. > # Use native llvm-tblgen from host-llvm (needed for cross-compilation) > LLVM_CONF_OPTS += -DLLVM_TABLEGEN=$(HOST_DIR)/bin/llvm-tblgen > Best regards, Valentin
Hi Valentin, On Mon, Jun 11, 2018 at 2:06 AM, Valentin Korenblit <valentin.korenblit@smile.fr> wrote: > Hi Joseph, > > On 10/06/2018 22:54, Joseph Kogut wrote: >> >> Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com> >> --- >> package/llvm/Config.in | 9 +++++++++ >> package/llvm/llvm.mk | 5 +++++ >> 2 files changed, 14 insertions(+) >> >> diff --git a/package/llvm/Config.in b/package/llvm/Config.in >> index 83e94660eb..e9c461b92f 100644 >> --- a/package/llvm/Config.in >> +++ b/package/llvm/Config.in >> @@ -11,6 +11,15 @@ 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_HOST_LLVM_ENABLE_HOST_ARCH >> + bool >> + > > > I think we could rename this option BR2_PACKAGE_LLVM_ENABLE_HOST_ARCH > and make it user-selectable: > I agree, I'll make these changes. > config BR2_PACKAGE_LLVM_ENABLE_HOST_ARCH > bool "Build backend for host architecture" > >> config BR2_PACKAGE_LLVM >> bool "llvm" >> depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS >> diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk >> index 3abf428989..04e99eb5b4 100644 >> --- a/package/llvm/llvm.mk >> +++ b/package/llvm/llvm.mk >> @@ -59,6 +59,11 @@ ifeq ($(BR2_PACKAGE_LLVM_AMDGPU),y) >> LLVM_TARGETS_TO_BUILD += AMDGPU >> endif >> +# Build backend for host architecture >> +ifeq ($(BR2_PACKAGE_LLVM_ENABLE_HOST_ARCH),y) >> +LLVM_TARGETS_TO_BUILD += $(call qstrip,$(BR2_PACKAGE_LLVM_HOST_ARCH)) >> +endif >> + > > > The only problem I see here is that we are going to build the backend for > the host architecture also for the target, which is not necessary. Maybe > we can use another variable like HOST_LLVM_TARGETS_TO_BUILD. This will > break the compatibility of llvm-config for host and target when passing > --targets-built but I don't think this should be a problem. > I'll make these changes and give it a shot. >> # Use native llvm-tblgen from host-llvm (needed for cross-compilation) >> LLVM_CONF_OPTS += -DLLVM_TABLEGEN=$(HOST_DIR)/bin/llvm-tblgen >> > > > Best regards, > > Valentin > Thanks for the feedback! Joseph
Hi Valentin, On Mon, Jun 11, 2018 at 2:06 AM, Valentin Korenblit <valentin.korenblit@smile.fr> wrote: > Hi Joseph, > > On 10/06/2018 22:54, Joseph Kogut wrote: <snip> >> +# Build backend for host architecture >> +ifeq ($(BR2_PACKAGE_LLVM_ENABLE_HOST_ARCH),y) >> +LLVM_TARGETS_TO_BUILD += $(call qstrip,$(BR2_PACKAGE_LLVM_HOST_ARCH)) >> +endif >> + > > > The only problem I see here is that we are going to build the backend for > the host architecture also for the target, which is not necessary. Maybe > we can use another variable like HOST_LLVM_TARGETS_TO_BUILD. This will > break the compatibility of llvm-config for host and target when passing > --targets-built but I don't think this should be a problem. > Looking at the Makefile again, it seems to me that HOST_LLVM_TARGETS_TO_BUILD would always be a superset of LLVM_TARGETS_TO_BUILD. What do you think about naming it HOST_LLVM_ADDTL_TARGETS_TO_BUILD, appending only additional architecture backends to be built for host-llvm, and and appending it to LLVM_TARGETS_TO_BUILD in HOST_LLVM_CONF_OPTS? That way, if a backend is enabled for the target, it's also always enabled for the host, but the host package can enable additional backends that the target package will not build. >> # Use native llvm-tblgen from host-llvm (needed for cross-compilation) >> LLVM_CONF_OPTS += -DLLVM_TABLEGEN=$(HOST_DIR)/bin/llvm-tblgen >> > > > Best regards, > > Valentin >
Hi Joseph, On 11/06/2018 19:54, Joseph Kogut wrote: > Hi Valentin, > > On Mon, Jun 11, 2018 at 2:06 AM, Valentin Korenblit > <valentin.korenblit@smile.fr> wrote: >> Hi Joseph, >> >> On 10/06/2018 22:54, Joseph Kogut wrote: > <snip> > >>> +# Build backend for host architecture >>> +ifeq ($(BR2_PACKAGE_LLVM_ENABLE_HOST_ARCH),y) >>> +LLVM_TARGETS_TO_BUILD += $(call qstrip,$(BR2_PACKAGE_LLVM_HOST_ARCH)) >>> +endif >>> + >> >> The only problem I see here is that we are going to build the backend for >> the host architecture also for the target, which is not necessary. Maybe >> we can use another variable like HOST_LLVM_TARGETS_TO_BUILD. This will >> break the compatibility of llvm-config for host and target when passing >> --targets-built but I don't think this should be a problem. >> > Looking at the Makefile again, it seems to me that > HOST_LLVM_TARGETS_TO_BUILD would always be a superset of > LLVM_TARGETS_TO_BUILD. What do you think about naming it > HOST_LLVM_ADDTL_TARGETS_TO_BUILD, appending only additional > architecture backends to be built for host-llvm, and and appending it > to LLVM_TARGETS_TO_BUILD in HOST_LLVM_CONF_OPTS? > > That way, if a backend is enabled for the target, it's also always > enabled for the host, but the host package can enable additional backends > that the target package will not build. Yes, actually I meant that. I would do something like this: LLVM_TARGETS_TO_BUILD = $(LLVM_TARGET_ARCH) HOST_LLVM_TARGETS_TO_BUILD = $(LLVM_TARGET_ARCH) ifeq ($(BR2_PACKAGE_LLVM_AMDGPU),y) LLVM_TARGETS_TO_BUILD += AMDGPU HOST_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 and finally: HOST_LLVM_CONF_OPTS += -DLLVM_TARGETS_TO_BUILD="$(subst $(space),;,$(HOST_LLVM_TARGETS_TO_BUILD))" And in Config.in: config BR2_PACKAGE_LLVM_ENABLE_HOST_ARCH bool "Build backend for host architecture" help Build code generator for host machine. >>> # Use native llvm-tblgen from host-llvm (needed for cross-compilation) >>> LLVM_CONF_OPTS += -DLLVM_TABLEGEN=$(HOST_DIR)/bin/llvm-tblgen >>> Best regards, Valentin
diff --git a/package/llvm/Config.in b/package/llvm/Config.in index 83e94660eb..e9c461b92f 100644 --- a/package/llvm/Config.in +++ b/package/llvm/Config.in @@ -11,6 +11,15 @@ 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_HOST_LLVM_ENABLE_HOST_ARCH + bool + config BR2_PACKAGE_LLVM bool "llvm" depends on BR2_PACKAGE_LLVM_ARCH_SUPPORTS diff --git a/package/llvm/llvm.mk b/package/llvm/llvm.mk index 3abf428989..04e99eb5b4 100644 --- a/package/llvm/llvm.mk +++ b/package/llvm/llvm.mk @@ -59,6 +59,11 @@ ifeq ($(BR2_PACKAGE_LLVM_AMDGPU),y) LLVM_TARGETS_TO_BUILD += AMDGPU endif +# Build backend for host architecture +ifeq ($(BR2_PACKAGE_LLVM_ENABLE_HOST_ARCH),y) +LLVM_TARGETS_TO_BUILD += $(call qstrip,$(BR2_PACKAGE_LLVM_HOST_ARCH)) +endif + # Use native llvm-tblgen from host-llvm (needed for cross-compilation) LLVM_CONF_OPTS += -DLLVM_TABLEGEN=$(HOST_DIR)/bin/llvm-tblgen
Signed-off-by: Joseph Kogut <joseph.kogut@gmail.com> --- package/llvm/Config.in | 9 +++++++++ package/llvm/llvm.mk | 5 +++++ 2 files changed, 14 insertions(+)