Reputation: 533
I am currently trying to write a GCC backend for a new architecture, but when I try to compile it I get the following error message:
xgcc: internal compiler error: Segmentation fault signal terminated program cc1
The build is configured with the following command:
../gcc/configure --prefix=--prefix=$HOME/GCC-10.0.1 --disable-bootstrap --target=arch_name --enable-languages=c
How would I go about fixing this error so that I can build my backend?
As far as I am aware, I have implemented the target macro's, functions and insn patterns required to get GCC to build.
Sorry that the question is a bit vague, I am not sure what extra information I can provide. If more specific information is needed please let me know and I will edit the question.
Thanks in advance.
Upvotes: 2
Views: 861
Reputation: 3918
How would I go about fixing this error so that I can build my backend?
Debug cc1
.
xgcc
is located in $builddir/gcc
. Hence run $builddir/xgcc -B$builddir -v -save-temps <options-that-crash-cc1>
.
xgcc -v ...
will print the sub-commands it is calling, record the options it supplies to the crashing cc1
call.
Run a debugger against that cc1
call, supply the right options and put a breakpoint at abort
(will be fancy_abort
) actually.
Build the compiler without optimization. It's enough to run make
in $builddir/gcc
for that. You can supply additional option if you like, e.g. make -j4 cc1 CXXFLAGS='<flags-to-pass>'
.
$builddir/gcc
provides .gdbinit
to augment gdb
with additional hooks to improve debugging experience.
Upvotes: 3