public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Porting GCC on a new arch (cross-compilation)
@ 2009-02-25  8:41 Florent DEFAY
  2009-02-25  8:58 ` Meena
  0 siblings, 1 reply; 5+ messages in thread
From: Florent DEFAY @ 2009-02-25  8:41 UTC (permalink / raw)
  To: gcc-help

Hi,

I have to port GCC on a new arch. I'm working on an i686-pc-linux-gnu
machine so it is cross-compilation.

I read tutorials from IIT of Bombay. I read parts of GCC Internals.
I'm working with gcc-4.3.3 sources. The binutils are already installed
in /home/me/target/.

I am now debugging my cc1 with GDB. I try to compile an empty file this way :
gdb /home/me/target/libexec/gcc/target/4.3.3/cc1 -x command.gdb
...
run -quiet -v a.c -quiet -dumpbase a.c -da -auxbase a -version -o a.s

where a.c is an empty file.

The problem is that cc1 comes in an infinite call loop, here is the back trace :
(gdb) bt
#0  0x081f473c in simplify_subreg (outermode=HImode, op=0xb7c525d0,
innermode=HImode, byte=0) at ../../gcc-4.3.3/gcc/simplify-rtx.c:4930
#1  0x081f5968 in simplify_gen_subreg (outermode=HImode,
op=0xb7c525d0, innermode=HImode, byte=0) at
../../gcc-4.3.3/gcc/simplify-rtx.c:5225
#2  0x08121405 in emit_move_multi_word (mode=HImode, x=0xb7c525d0,
y=0xb7c525c0) at ../../gcc-4.3.3/gcc/expr.c:3270
#3  0x08120eca in emit_move_insn (x=0xb7c525d0, y=0xb7c525c0) at
../../gcc-4.3.3/gcc/expr.c:3417
#4  0x081214b6 in emit_move_multi_word (mode=HImode, x=0xb7c525d0,
y=0xb7c525c0) at ../../gcc-4.3.3/gcc/expr.c:3295
#5  0x08120eca in emit_move_insn (x=0xb7c525d0, y=0xb7c525c0) at
../../gcc-4.3.3/gcc/expr.c:3417
#6  0x081214b6 in emit_move_multi_word (mode=HImode, x=0xb7c525d0,
y=0xb7c525c0) at ../../gcc-4.3.3/gcc/expr.c:3295
#7  0x08120eca in emit_move_insn (x=0xb7c525d0, y=0xb7c525c0) at
../../gcc-4.3.3/gcc/expr.c:3417

Why is it running emit_move_... while the file is empty and there is
nothing to compile ?

I did not include any move pattern in the md, I try to construct a
minimal md like it is explained in IITB tutorials, should I ?

Maybe macros in target.h file are not defined well ? Which macros are
concerned with these calls ?

Thank you.

Florent

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Porting GCC on a new arch (cross-compilation)
@ 2009-02-24 13:02 Florent DEFAY
  2009-02-24 13:12 ` Andrew Haley
  0 siblings, 1 reply; 5+ messages in thread
From: Florent DEFAY @ 2009-02-24 13:02 UTC (permalink / raw)
  To: gcc-help

Hi,

I have to port GCC on a new arch. I'm working on an i686-pc-linux-gnu
machine so it is cross-compilation.

I read tutorials from IIT of Bombay. I read parts of GCC Internals.
I'm working with gcc-4.3.3 sources. The binutils are already installed
in /home/me/target/.

I began the port from scratch, I have done these steps :
- modify config.gcc and config.sub to recognize the new target
- create empty files $GCCSOURCES/gcc/config/target/target.h target.c target.md
- fill in target.h with macros, following GCC internals's list, adding
new macros until able to compile target-gcc.
 I configure gcc this way :
configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu
--target=target --enable-langauges=c --prefix=/home/me/target/

When I run 'make', it finishes with this :

checking for suffix of object files... configure: error: cannot
compute suffix of object files: cannot compile
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
make[1]: Leaving directory `/home/me/gcc/build_target'
make: *** [all] Error 2

When I look at config.log in libgcc I find these errors :

configure:2398: /home/me/gcc/build_target/./gcc/xgcc
-B/home/me/gcc/build_target/./gcc/ -B/home/me/target/target/bin/
-B/home/me/target/target/lib/ -isystem /home/me/target/target/include
-isystem /home/me/target/target/sys-include -o conftest -O2 -g -g -O2
   conftest.c  >&5
xgcc: Internal error: Killed (program cc1)

configure:2567: checking for suffix of object files
configure:2588: /home/me/gcc/build_target/./gcc/xgcc
-B/home/me/gcc/build_target/./gcc/ -B/home/me/target/target/bin/
-B/home/me/target/target/lib/ -isystem /home/me/target/target/include
-isystem /home/me/target/target/sys-include -c -O2 -g -g -O2
conftest.c >&5
xgcc: Internal error: Killed (program cc1)

configure: failed program was:
| /* confdefs.h.  */
|
| #define PACKAGE_NAME "GNU C Runtime Library"
| #define PACKAGE_TARNAME "libgcc"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "GNU C Runtime Library 1.0"
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h.  */
|
| int
| main ()
| {
|
|   ;
|   return 0;
| }
configure:2605: error: cannot compute suffix of object files: cannot compile

Is these errors about libgcc in my machine description ? Is libgcc
compulsory in a port ? If it is, how should I implement it ? If not,
how to configure to avoid these problems ?

Finally, I can run 'make install' and in /home/me/target/bin/ I have
my target-gcc built. But when I use it this way :
target-gcc -da -S emptyfile.c

the result is that it does nothing for a while and respond :
target-gcc: Internal error: Killed (program cc1)
Please submit a full bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.

Maybe the target-gcc error and make errors are linked ? Are xgcc and
target-gcc equals ?

Thank you.

Florent

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-02-25 23:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-25  8:41 Porting GCC on a new arch (cross-compilation) Florent DEFAY
2009-02-25  8:58 ` Meena
2009-02-25 23:49   ` Ian Lance Taylor
  -- strict thread matches above, loose matches on Subject: below --
2009-02-24 13:02 Florent DEFAY
2009-02-24 13:12 ` Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).