This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Porting GCC on a new arch (cross-compilation)
- From: Andrew Haley <aph at redhat dot com>
- To: Florent DEFAY <spira dot inhabitant at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Tue, 24 Feb 2009 13:12:15 +0000
- Subject: Re: Porting GCC on a new arch (cross-compilation)
- References: <8502af3c0902240502n10554520ie839252cb4624577@mail.gmail.com>
Florent DEFAY wrote:
> 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 ?
xgcc is your newly built cross-compiler. It aborts because there is an error.
Now you have to debug your compiler with gdb.
> 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 ?
xgcc is the target gcc.
Andrew.