[Buildroot] [RFC PATCH v2 05/30] llvm: add config to build backend for host arch

Thomas Preston thomas.preston at codethink.co.uk
Tue Nov 5 12:02:59 UTC 2019


+Romain Naour, as we discussed this on the #buildroot channel yesterday. 

Hi all,

On 19/10/2019 23:20, Arnout Vandecappelle wrote:
> On 20/10/2019 00:04, Arnout Vandecappelle wrote:
>> On 17/10/2019 17:29, Michael Drake wrote:
>>> From: Joseph Kogut <joseph.kogut at gmail.com>
>>  We need a bit more explanation why this option is useful/needed.
>>
>>> Signed-off-by: Joseph Kogut <joseph.kogut at gmail.com>
>>> Signed-off-by: Michael Drake <michael.drake at codethink.co.uk>
>>> Signed-off-by: Thomas Preston <thomas.preston at codethink.co.uk>
> 
>  I think I should clarify my review a little...
> 
>  I think this should be split into two patches, where I doubt the second one is
> relevant:
> 
> 1. Add the host arch as a target for the host-llvm build. I think this can be
> done unconditionally, which makes the patch a whole lot simpler.
> 
> 2. Add a Config.in.host option for llvm. This is only useful if you want to use
> host-llvm outside of Buildroot, in a post-build/image script. I don't think this
> is the case.
> 
>  If the patch is reduced to the first bit, then I think the
> BR2_PACKAGE_HOST_LLVM_HOST_ARCH symbol (the only bit remaining in
> Config.in.host) should move to Config.in. And the change to the .mk file becomes
> very simple, as I indicated.
> 

We agree that the above changes simplify this patch, and have rolled them in. Thanks!

We had an issue yesterday where this didn't actually allow LLVM to build for the host
architecture, but rebuilding all of the LLVM packages fixed that:
    
    host-llvm, host-clang, host-lld
    
We also have to explicitly use lld, as clang tries to use the
arm-buildroot-linux-gnueabihf-ld linker. We noticed this is turned off in
llvm.mk:

    HOST_LLVM_CONF_OPTS += -DLLVM_ENABLE_LLD=OFF

Is there still a reason for this now that host-lld exists?

Many thanks,
Thomas

P.s. Here is some working output:
    
$ codethink/docker-run.sh ./output/host/bin/llc --version

LLVM (http://llvm.org/):
  LLVM version 9.0.0
  Optimized build.
  Default target: arm-buildroot-linux-gnueabihf
  Host CPU: znver1

  Registered Targets:
    arm     - ARM
    armeb   - ARM (big endian)
    thumb   - Thumb
    thumbeb - Thumb (big endian)
    x86     - 32-bit X86: Pentium-Pro and above
    x86-64  - 64-bit X86: EM64T and AMD64

$ ./codethink/docker-run.sh output/host/bin/clang -target x86_64-linux-gnu -fuse-ld=/mnt/output/host/bin/ld.lld -o hello hello.c

$ ./hello
Hello, world




More information about the buildroot mailing list