[Buildroot] [RFC PATCH v3 5/9] llvm: add config to build backend for host arch
valentin.korenblit at smile.fr
Tue Jun 12 13:46:05 UTC 2018
On 11/06/2018 19:54, Joseph Kogut wrote:
> Hi Valentin,
> On Mon, Jun 11, 2018 at 2:06 AM, Valentin Korenblit
> <valentin.korenblit at smile.fr> wrote:
>> Hi Joseph,
>> On 10/06/2018 22:54, Joseph Kogut wrote:
>>> +# Build backend for host architecture
>>> +ifeq ($(BR2_PACKAGE_LLVM_ENABLE_HOST_ARCH),y)
>>> +LLVM_TARGETS_TO_BUILD += $(call qstrip,$(BR2_PACKAGE_LLVM_HOST_ARCH))
>> 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)
LLVM_TARGETS_TO_BUILD += AMDGPU
HOST_LLVM_TARGETS_TO_BUILD += AMDGPU
# Build backend for host architecture
HOST_LLVM_TARGETS_TO_BUILD += $(call qstrip,$(BR2_PACKAGE_LLVM_HOST_ARCH))
HOST_LLVM_CONF_OPTS += -DLLVM_TARGETS_TO_BUILD="$(subst $(space),;,$(HOST_LLVM_TARGETS_TO_BUILD))"
And in Config.in:
bool "Build backend for host architecture"
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
More information about the buildroot