All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Weber <matthew.weber@collins.com>
To: buildroot@busybox.net
Subject: [Buildroot] [External] Re: [PATCH 07/11] package/busybox: fix applets runtime issue when building with clang cross-compiler
Date: Mon, 9 Sep 2019 08:49:12 -0500	[thread overview]
Message-ID: <CANQCQpbzt8JAWvHWV6+SHj87YZGCPH2i9GPayiXeqodbz2ZLVA@mail.gmail.com> (raw)
In-Reply-To: <4215a70e-1973-3e99-4aa4-28df7f576368@smile.fr>

Romain,

On Sat, Sep 7, 2019 at 3:02 AM Romain Naour <romain.naour@smile.fr> wrote:
>
> Hi Matt,
>
> Le 07/09/2019 ? 05:11, Matthew Weber a ?crit :
> > Romain,
> >
> > On Fri, Sep 6, 2019 at 4:10 AM Romain Naour <romain.naour@smile.fr> wrote:
> >>
> >> Apply a patch contributed by Luis Marques on the Busybox mailing list [1]
> >> fixing a runtime issue (segfault) when busybox is compiled by Clang.
> >>
> >> The patch disable the compiler optimizations for Clang/LLVM only.
> >>
> >> Without this patch, busybox segfault with several applets
> >> (login on aarch64 using Clang 8.0.1, init on x86_64 using Clang 9.0.0rc3)
> >>
> >> [1] https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.busybox.net_pipermail_busybox_2019-2DJune_087337.html&d=DwIDaQ&c=ilBQI1lupc9Y65XwNblLtw&r=y1sOV0GV8NZUkffv7oCRxs2Sd3nOBS-NxDM3NY8lOgs&m=gE7oHor6AQZYHYD00ApKk2X5MH2LVRR_EyXIt5jiU4A&s=VKnAVOuzWWTy3aWJijmMwPLpl9NkHk2zZ5nx7u0A-mA&e=
> >>
> >
> > Got a "crtbegin.o no such file or directory" error when I setup a
> > build using master with qemu_aarch64_virt_defconfig (updated for
> > prebuilt external toolchain and enabling clang as cross-compiler).
> > https://urldefense.proofpoint.com/v2/url?u=https-3A__paste.ubuntu.com_p_wxrmVTGVvp_&d=DwIDaQ&c=ilBQI1lupc9Y65XwNblLtw&r=y1sOV0GV8NZUkffv7oCRxs2Sd3nOBS-NxDM3NY8lOgs&m=gE7oHor6AQZYHYD00ApKk2X5MH2LVRR_EyXIt5jiU4A&s=8olVqcVp_os9SDrgZ_W2pw6WsPZiOXiJqkBAI8aqnAI&e=
>
> Thanks for testing the series :)
>
> Ok, the "crtbegin.o no such file or directory" error mean that realpath command
> failed. It failed because the GCC external toolchain was not installed when the
> realpath command is executed, this is due to :
>
> # Allow host-clang to be build as part of the toolchain
> ifeq ($(BR2_USER_HOST_CLANG_AS_CROSS_COMPILER),y)
> HOST_CLANG_ADD_TOOLCHAIN_DEPENDENCY = NO
> endif
>
> I fixed this issue by adding an explicit dependency on toolchain-external:
>
> # Help host-clang to find our external toolchain, use a relative path from the clang
> # installation directory to the external toolchain installation directory in
> order to
> # not hardcode the toolchain absolute path.
> # Install the GCC external toolchain before executing realpath command.
> ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
> HOST_CLANG_DEPENDENCIES += toolchain-external
> HOST_CLANG_CONF_OPTS += -DGCC_INSTALL_PREFIX:PATH=`realpath
> --relative-to=$(HOST_DIR)/bin/ $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)`
> endif
>
> I'll send a v2 shortly.
>
> >
> > From your comment earlier on irc that you tested with 9.0.1 (x86_64
> > and aarch64), I wonder if this error is a difference between building
> > with clang 8.0.1 and 9.
>
> No no, that's me breaking my own patch :p
>
> >
> > I was able to build compiler-rt & libfuzzer with your series applied
> > and pass a runtime test (system still cross compiled with gcc but
> > using "[01/11] package/clang: help host-clang to find our external
> > toolchain" to find the sysroot).  This was instead of using the -B
> > option when building libfuzzer as part of the runtime test.
>
> That's great :)
>
> I'll try to upstream the patch then. I think Clang doesn't like when the
> toolchain sysroot is relocated because it doesn't seem to take into account the
> GCC search patch.
>
> Maybe your libfuzzer may be added at the end of the series (with a dependency on
> Clang cross-compiler option)?

I think the current compiler RT run-time test case is still valid as
you could use the libfuzzer as a way to test the compiler-rt is
working when your primary system is built with GCC.  However you do
have a point that libfuzzer could be added as a package when
compiler-rt is enabled and Clang is the cross-compiler.  I think I'd
still have to keep a copy in the run-time test br2-external for the
test case?

Matt

  reply	other threads:[~2019-09-09 13:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06  9:09 [Buildroot] [PATCH 00/11] Add the support for Clang cross-compiler Romain Naour
2019-09-06  9:09 ` [Buildroot] [PATCH 01/11] package/clang: help host-clang to find our external toolchain Romain Naour
2019-09-06  9:09 ` [Buildroot] [PATCH 02/11] package/llvm: add the version major variable Romain Naour
2019-09-06  9:09 ` [Buildroot] [PATCH 03/11] package/clang: " Romain Naour
2019-09-06  9:09 ` [Buildroot] [PATCH 04/11] package/clang: install a toolchain-wrapper for the host clang cross-compiler Romain Naour
2019-09-06  9:09 ` [Buildroot] [PATCH 05/11] linux: override CC for the case CC is not GCC Romain Naour
2019-09-06  9:09 ` [Buildroot] [PATCH 06/11] package/meson: use TARGET_{CC, CXX} instead of TARGET_CROSS Romain Naour
2019-09-06 15:58   ` Romain Naour
2019-09-06  9:09 ` [Buildroot] [PATCH 07/11] package/busybox: fix applets runtime issue when building with clang cross-compiler Romain Naour
2019-09-07  3:11   ` Matthew Weber
2019-09-07  3:17     ` Matthew Weber
2019-09-07  8:02     ` Romain Naour
2019-09-09 13:49       ` Matthew Weber [this message]
2019-09-06  9:09 ` [Buildroot] [PATCH 08/11] package/clang: add a host entry for clang Romain Naour
2019-09-06  9:09 ` [Buildroot] [PATCH 09/11] core: allow to use Clang as cross-compiler Romain Naour
2019-09-06  9:09 ` [Buildroot] [PATCH 10/11] toolchain: add a warning when Clang is used " Romain Naour
2019-09-06  9:09 ` [Buildroot] [PATCH 11/11] linux: don't set -Wno-attribute-alias flag " 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=CANQCQpbzt8JAWvHWV6+SHj87YZGCPH2i9GPayiXeqodbz2ZLVA@mail.gmail.com \
    --to=matthew.weber@collins.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 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.