On 4/13/20 12:17 AM, Finn Thain wrote:
On Sun, 12 Apr 2020, Rob Landley wrote:
Target: m68k-linux-musl
Configured with: ../src_gcc/configure --enable-languages=c,c++ CFLAGS=' -g0 -Os'
Was toysh also built with -Os in CFLAGS? If so, I suggest you try -O2. The
It was. -O2 still segfaults the same way, but -O1 runs fine.
Sigh, tracking this down,
https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html says -O2 adds:
-falign-functions -falign-jumps -falign-labels -falign-loops -fcaller-saves
-fcode-hoisting -fcrossjumping -fcse-follow-jumps -fcse-skip-blocks
-fdelete-null-pointer-checks -fdevirtualize -fdevirtualize-speculatively
-fexpensive-optimizations -ffinite-loops -fgcse -fgcse-lm
-fhoist-adjacent-loads -finline-functions -finline-small-functions
-findirect-inlining -fipa-bit-cp -fipa-cp -fipa-icf -fipa-ra -fipa-sra
-fipa-vrp -fisolate-erroneous-paths-dereference -flra-remat
-foptimize-sibling-calls -foptimize-strlen -fpartial-inlining -fpeephole2
-freorder-blocks-algorithm=stc -freorder-blocks-and-partition
-freorder-functions -frerun-cse-after-loop -fschedule-insns -fschedule-insns2
-fsched-interblock -fsched-spec -fstore-merging -fstrict-aliasing
-fthread-jumps -ftree-builtin-call-dce -ftree-pre -ftree-switch-conversion
-ftree-tail-merge -ftree-vrp
So let's try...
unrecognized command line option '-ffinite-loops'; did you mean '-fsplit-loops'?
Did I mention I'm really done with gcc development ever since they decided to
rewrite everything in C++? Sigh. [grind grind grind...]
CFLAGS='-fgcse'
That's the one.
I have a todo item to pare my 2700 line toysh source file (plus however
muchof main.c and lib/*.c it's pulling in, "LDFLAGS=--static
CROSS_COMPILE=ccc/m68k-linux-musl-cross/bin/m68k-linux-musl- make sh"
makes a 99k m68k binary) down into a minimal reproduction thingy, but
I'm trying to get the other targets to finish parsing the init script so
I can cut a toybox release.
It would be great to have a minimal reproducer from toysh. Getting that
from the python build looks hard, even with creduce.
https://embed.cs.utah.edu/creduce/
Oh it's not hard, it's just tedious.
Rob