I am trying to port gcc to a new target. The target is a new processor we designed our self with a full instruction set. We want to be able to compile c code in gcc for our new processor. To be able to accomplish that we need to port gcc for this specific target. I have read some gcc documents how to do it. So far I have edited/hacked an existing target of gcc and adopted it for our target, meaning gcc will generate assembly code for our specific processor. So I am using gcc to compile gcc for this new target. gcc will then generate a compiler myprocessor-gcc. This compiler will be able to generate assembly code for our target. by using my compiler a feed it with the following:
myprocessor-gcc test.c test.c looks like:
void __main(void); void main(void) { return; } void __main(void) { int i = 0; int i2 = 1; int i3 = 2; i = i2+i3; return; } gcc was able to compiled this code and generated the correct assembly language I was expected.
So I elaborated my test function to:
void __main(void) { int i = 0; int i2 = 1; int i3 = 2; int i4 = 3; i = i2+i3+i4; return; } After that gcc gives me a segmentation fault. I want to debug this segmentation fault, I need all the debug prints gcc can give me. So when I type:
myprocessor-gcc test.c -g I want to see some debug prints so that I can debug gcc internally. Sorry if I am not clear, I will elaborate if this is still unclear.