Using and Porting GNU CC
4.3.1: Steps of Cross-Compilation
To compile and run a program using a cross-compiler involves several
steps:
-
Run the cross-compiler on the host machine to produce assembler files
for the target machine. This requires header files for the target
machine.
-
Assemble the files produced by the cross-compiler. You can do this
either with an assembler on the target machine, or with a
cross-assembler on the host machine.
-
Link those files to make an executable. You can do this either with a
linker on the target machine, or with a cross-linker on the host
machine. Whichever machine you use, you need libraries and certain
startup files (typically `
crt....o
') for the target machine.
It is most convenient to do all of these steps on the same host machine,
since then you can do it all with a single invocation of GNU CC. This
requires a suitable cross-assembler and cross-linker. For some targets,
the GNU assembler and linker are available.