diet 0.33 segfaults

Martin Castillo <[email protected]> Wed, 28 Mar 2018 23:30:04 +0200
Newsgroups gmane.linux.lib.dietlibc
Message-ID <[email protected]>
Hi,

I trying to build dietlibc 0.33 on nixos. I unpacked it, cd into it and
ran make, but make fails here:

bin-x86_64/diet gcc -D__dietlibc__ -Os -fstrict-aliasing
-momit-leaf-frame-pointer -mfancy-math-387 -W -Wall -Wextra
-Wchar-subscripts -Wmissing-prototypes -Wmissing-declarations
-Wno-switch -Wno-unused -Wredundant-decls -o bin-x86_64/elftrunc
contrib/elftrunc.c
make: *** [Makefile:303: bin-x86_64/elftrunc] Segmentation fault

Trying to run just diet has the same result.

$ bin-x86_64/diet
Segmentation fault

$

gdb backtrace just gives me:
(gdb) bt
#0  0x000000000040114d in ?? ()
#1  0x0000000000400ff7 in ?? ()
#2  0x0000000000000001 in ?? ()
#3  0x00007fffffffc755 in ?? ()
#4  0x0000000000000000 in ?? ()

So I removed the strip line of bin-x86/diet in the Makefile and rebuilt
diet:

(gdb) bt
#0  0x000000000040114d in stackgap ()
#1  0x0000000000400ff7 in _start ()

Seems like the stackgap creates the issue. I didn't touch
dietfeatures.h, so WANT_STACKGAP is not defined. Is that option only
used for binaries created with diet, not for diet itself?

I use gcc 7.3.0 and Linux 4.14.29. I don't know, what other information
could be useful.

I uploaded start.o dyn_start.o dyn_stop.o diet diet-i dietlibc.a to [0],
in case you want to look at the binaries.

Martin Castillo

[0]: https://seafile.zfn.uni-bremen.de/d/3610239972954b3586ed/