immediate segmentation fault with LLVM/Clang 9
Romain Naour
romain.naour at smile.fr
Fri Oct 25 08:00:06 UTC 2019
Hello,
Le 25/10/2019 à 09:54, David Demelier a écrit :
> Hello,
>
> I don't know where is the appropriate place to ask. I've upgraded my toolchain
> to LLVM 9 on my Clang based Linux distribution and everything built and ran fine
> except... busybox.
>
> I suspect busybox is built with some incompatible flags because it immediately
> segfaults at startup of an applet (not all though). It works like a charm with
> gcc though.
>
> Built with :
>
> # make CC=clang HOSTCC=clang CROSS_COMPILE=llvm-
>
> The .config is the default. I've only added CONFIG_DEBUG=y and CONFIG_STATIC=y.
> But applets crash even without those.
>
> FWIW, the following warnings appear as well while building:
>
> clang-9: warning: optimization flag '-finline-limit=0' is not supported
> [-Wignored-optimization-argument]
> clang-9: warning: optimization flag '-falign-jumps=1' is not supported
> [-Wignored-optimization-argument]
> clang-9: warning: optimization flag '-falign-labels=1' is not supported
> [-Wignored-optimization-argument]
> clang-9: warning: optimization flag '-falign-loops=1' is not supported
> [-Wignored-optimization-argument]
> clang-9: warning: argument unused during compilation: '-static-libgcc'
> [-Wunused-command-line-argument]
>
> I can debug but without many useful information:
>
> (gdb) run sh
> Starting program: /src/vanilla/core/busybox/busybox-1.30.1/busybox sh
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000000002ced34 in ash_main (argc=1, argv=0x7fffffffec80) at shell/ash.c:14155
> 14155 INIT_G_misc();
> (gdb) bt
> #0 0x00000000002ced34 in ash_main (argc=1, argv=0x7fffffffec80) at
> shell/ash.c:14155
> #1 0x000000000022e3ea in run_applet_no_and_exit (applet_no=289, name=<optimized
> out>, argv=0x7fffffffec80) at libbb/appletlib.c:996
> #2 0x000000000022e9b5 in run_applet_and_exit (name=0x7fffffffee96 "sh",
> argv=0x7fffffffec80) at libbb/appletlib.c:1014
> #3 0x000000000022ed51 in busybox_main (argv=0x7fffffffec80) at
> libbb/appletlib.c:957
> #4 0x000000000022e9bd in run_applet_and_exit (name=0x7fffffffee8e "busybox",
> argv=0x7fffffffec78) at libbb/appletlib.c:1007
> #5 0x000000000022e5cb in main (argc=<optimized out>, argv=0x7fffffffec78) at
> libbb/appletlib.c:1122
>
> The trace is not meaningful though.
>
> If I erase all CFLAGS using:
>
> # make CC=clang HOSTCC=clang CROSS_COMPILE=llvm- CFLAGS=""
>
> It works fine so I think there are too much options that are incompatible?
There is an initial patch for this issue:
http://lists.busybox.net/pipermail/busybox/2019-June/087306.html
I tested It but It disable optimizations in Busybox.
Best regards,
Romain
>
More information about the busybox
mailing list