I am working on cross-compiling an experimental GNU-free Linux toolchain using clang(instead gcc), compiler-rt(instead libgcc), libunwind(available at http://llvm.org/git/libunwind.git ) (instead libgcc_s), lld(instead of GNU ld), libcxx(instead libstdc++), libcxxabi(instead of not of course, I do not understand the differences between GNU libstdc++and its ABI) and musl(instead glibc).
Using a cross-compiler based and several patches, I was able to successfully compile all of the above and successfully compile and link a simple C world hello program to it. It seems that something went wrong when a segmentation error occurs in the world hello program: muslgcc
$ ./hello
Segmentation fault
$
I usually just debugged it using gdb, but here is the problem:
$ gdb ./hello
Reading symbols from ./hello...Dwarf Error: Could not find abbrev number 5 in CU at offset 0x52 [in module /home/main/code/main/asm/hello]
(no debugging symbols found)...done.
(gdb) start
Temporary breakpoint 1 at 0x206
Starting program: /hello
During startup program terminated with signal SIGSEGV, Segmentation fault.
(gdb)
I canβt go through the program in any way, I assume that the error occurs somewhere at the beginning of the C run. I canβt even build using layout asmand stepi, therefore, I really donβt know how to find out exactly where the error occurs (debugging my tool chain).
, lld GNU binutils ld, hello world () , . lld , , , .
. hello -v gcc/clang, , .
- GDB :
Unix , , gdb) . run , , -. , , , :
(gdb) run
Starting program: ./a.out
During startup program terminated with signal SIGSEGV, Segmentation fault.
, , "exec-wrapper", , .
, , , , , GNU ld, , (set startup-with-shell off) .