0

I'm using tcc on sabotage. I use below to link LZMA to dietlibc (the start.o and libc.a from dietlibc are in current path):

tcc -nostdlib start.o LzmaUtil.o Alloc.o LzFind.o LzmaEnc.o LzmaDec.o 7zFind.o 7zStream.o -L. -lc

Linking succeeds without any error but always segfault when run the a.out.

If I use ld from binutils, a.out can run without any problems.

If adding linker flag -static, there will be the same situation.

Anyone could advise on how to fix this? Thank you very much!

Versions: tcc-0.9.27.tar.bz2 dietlibc-0.34.tar.xz lzma1900.7z sabotage-1.1.24-x86_64-desktop-1f74666.img.xz

Best regards Sandro Yang

1 Answers1

0

Solved. Dietlibc's start.o is calling stackgap before entering main for x86_64 by default. Everything goes well if I remove stackgap in dietfeatures.h.

I think ld suceed because it doesn't use stack-protector by default.