immediate segmentation fault with LLVM/Clang 9

Torsten Demke Torsten.Demke at windriver.com
Wed Apr 22 13:50:57 UTC 2020


Hi,

Im currently trying to run parts of busybox (e.g. ash) on-top of VxWorks.
I made some progress and can run multiple apps.
With the newest version of VxWorks the clang compiler version 9.0.1.1 is 
used
and now I face the same immediate segfault as described below.

I wonder why the "not_const_pp()" fix does not work (anymore)?

(Native compilation on Linux with 9.0.0-2~ubuntu18.04.2 works es expected.
Older VxWorks with clang-8 also compile&run fine.)

How can I check if the const pointers are correct?

Regards,
Torsten

On 10/25/19 9:54 AM, David Demelier wrote:
> 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?
>



More information about the busybox mailing list