diff options
author | Joseph Myers <jsm@polyomino.org.uk> | 2003-11-05 22:26:58 +0000 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2003-11-05 22:26:58 +0000 |
commit | 01e97976127e9d3c8bc7bd5587da68e1f5241fa2 (patch) | |
tree | 1ed726d768f08eab12fba197aa3ff65f45bcf735 /gcc/doc | |
parent | f6d90f821d4d9b5f6be324d39369617c1c87574a (diff) | |
download | gcc-01e97976127e9d3c8bc7bd5587da68e1f5241fa2.zip gcc-01e97976127e9d3c8bc7bd5587da68e1f5241fa2.tar.gz gcc-01e97976127e9d3c8bc7bd5587da68e1f5241fa2.tar.bz2 |
install-old.texi: Remove old documentation of building cross-compilers.
* doc/install-old.texi: Remove old documentation of building
cross-compilers.
* doc/install.texi: Move some of it to here.
From-SVN: r73283
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/install-old.texi | 269 | ||||
-rw-r--r-- | gcc/doc/install.texi | 51 |
2 files changed, 52 insertions, 268 deletions
diff --git a/gcc/doc/install-old.texi b/gcc/doc/install-old.texi index 4cc10e2..0a4afbe 100644 --- a/gcc/doc/install-old.texi +++ b/gcc/doc/install-old.texi @@ -21,7 +21,6 @@ main manual. @ifnothtml @menu * Configurations:: Configurations Supported by GCC. -* Cross-Compiler:: Building and installing a cross-compiler. @end menu @end ifnothtml @@ -57,8 +56,7 @@ wrong. In those cases, specify the build machine's @dfn{configuration name} with the @option{--host} option; the host and target will default to be -the same as the host machine. (If you are building a cross-compiler, -see @ref{Cross-Compiler}.) +the same as the host machine. Here is an example: @@ -90,7 +88,7 @@ section before proceeding any further with the installation of GCC@. @end enumerate @ifnothtml -@node Configurations, Cross-Compiler, , Old +@node Configurations, , , Old @section Configurations Supported by GCC @end ifnothtml @html @@ -194,266 +192,3 @@ Thus, if you specify @samp{m68k-local}, configuration uses files @file{m68k.md}, @file{local.h}, @file{m68k.c}, @file{xm-local.h}, @file{t-local}, and @file{x-local}, all in the directory @file{config/m68k}. - -@ifnothtml -@node Cross-Compiler, , Configurations, Old -@section Building and Installing a Cross-Compiler -@end ifnothtml -@html -<h2>@anchor{Cross-Compiler}Building and Installing a Cross-Compiler</h2> -@end html -@cindex cross-compiler, installation - -GCC can function as a cross-compiler for many machines, but not all. - -@itemize @bullet -@item -Cross-compilers for the Mips as target using the Mips assembler -currently do not work, because the auxiliary programs -@file{mips-tdump.c} and @file{mips-tfile.c} can't be compiled on -anything but a Mips. It does work to cross compile for a Mips -if you use the GNU assembler and linker. - -@item -Cross-compilers between machines with different floating point formats -have not all been made to work. GCC now has a floating point -emulator with which these can work, but each target machine description -needs to be updated to take advantage of it. - -@item -Cross-compilation between machines of different word sizes is -somewhat problematic and sometimes does not work. -@end itemize - -Since GCC generates assembler code, you probably need a -cross-assembler that GCC can run, in order to produce object files. -If you want to link on other than the target machine, you need a -cross-linker as well. You also need header files and libraries suitable -for the target machine that you can install on the host machine. - -@ifnothtml -@menu -* Steps of Cross:: Using a cross-compiler involves several steps - that may be carried out on different machines. -* Configure Cross:: Configuring a cross-compiler. -* Tools and Libraries:: Where to put the linker and assembler, and the C library. -* Cross Headers:: Finding and installing header files - for a cross-compiler. -* Build Cross:: Actually compiling the cross-compiler. -@end menu -@end ifnothtml - -@ifnothtml -@node Steps of Cross, Configure Cross, , Cross-Compiler -@subsection Steps of Cross-Compilation -@end ifnothtml -@html -<h2>Steps of Cross-Compilation</h2> -@end html - -To compile and run a program using a cross-compiler involves several -steps: - -@itemize @bullet -@item -Run the cross-compiler on the host machine to produce assembler files -for the target machine. This requires header files for the target -machine. - -@item -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. - -@item -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 @file{crt@dots{}.o}) for the target machine. -@end itemize - -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 GCC@. This -requires a suitable cross-assembler and cross-linker. For some targets, -the GNU assembler and linker are available. - -@ifnothtml -@node Configure Cross, Tools and Libraries, Steps of Cross, Cross-Compiler -@subsection Configuring a Cross-Compiler -@end ifnothtml -@html -<h2>Configuring a Cross-Compiler</h2> -@end html - -To build GCC as a cross-compiler, you start out by running -@file{configure}. Use the @option{--target=@var{target}} to specify the -target type. If @file{configure} was unable to correctly identify the -system you are running on, also specify the @option{--build=@var{build}} -option. For example, here is how to configure for a cross-compiler that -produces code for an HP 68030 system running BSD on a system that -@file{configure} can correctly identify: - -@smallexample -./configure --target=m68k-hp-bsd4.3 -@end smallexample - -@ifnothtml -@node Tools and Libraries, Cross Headers, Configure Cross, Cross-Compiler -@subsection Tools and Libraries for a Cross-Compiler -@end ifnothtml -@html -<h2>Tools and Libraries for a Cross-Compiler</h2> -@end html - -If you have a cross-assembler and cross-linker available, you should -install them now. Put them in the directory -@file{/usr/local/@var{target}/bin}. Here is a table of the tools -you should put in this directory: - -@table @file -@item as -This should be the cross-assembler. - -@item ld -This should be the cross-linker. - -@item ar -This should be the cross-archiver: a program which can manipulate -archive files (linker libraries) in the target machine's format. - -@item ranlib -This should be a program to construct a symbol table in an archive file. -@end table - -The installation of GCC will find these programs in that directory, -and copy or link them to the proper place to for the cross-compiler to -find them when run later. - -The easiest way to provide these files is to build the Binutils package -and GAS@. Configure them with the same @option{--host} and @option{--target} -options that you use for configuring GCC, then build and install -them. They install their executables automatically into the proper -directory. Alas, they do not support all the targets that GCC -supports. - -If you want to install libraries to use with the cross-compiler, such as -a standard C library, put them in the directory -@file{/usr/local/@var{target}/lib}; installation of GCC copies -all the files in that subdirectory into the proper place for GCC to -find them and link with them. Here's an example of copying some -libraries from a target machine: - -@example -ftp @var{target-machine} -lcd /usr/local/@var{target}/lib -cd /lib -get libc.a -cd /usr/lib -get libg.a -get libm.a -quit -@end example - -@noindent -The precise set of libraries you'll need, and their locations on -the target machine, vary depending on its operating system. - -@cindex start files -Many targets require ``start files'' such as @file{crt0.o} and -@file{crtn.o} which are linked into each executable; these too should be -placed in @file{/usr/local/@var{target}/lib}. There may be several -alternatives for @file{crt0.o}, for use with profiling or other -compilation options. Check your target's definition of -@code{STARTFILE_SPEC} to find out what start files it uses. -Here's an example of copying these files from a target machine: - -@example -ftp @var{target-machine} -lcd /usr/local/@var{target}/lib -prompt -cd /lib -mget *crt*.o -cd /usr/lib -mget *crt*.o -quit -@end example - -@ifnothtml -@node Cross Headers, Build Cross, Tools and Libraries, Cross-Compiler -@subsection Cross-Compilers and Header Files -@end ifnothtml -@html -<h2>Cross-Compilers and Header Files</h2> -@end html - -If you are cross-compiling a standalone program or a program for an -embedded system, then you may not need any header files except the few -that are part of GCC (and those of your program). However, if you -intend to link your program with a standard C library such as -@file{libc.a}, then you probably need to compile with the header files -that go with the library you use. - -The GNU C compiler does not come with these files, because (1) they are -system-specific, and (2) they belong in a C library, not in a compiler. - -If the GNU C library supports your target machine, then you can get the -header files from there (assuming you actually use the GNU library when -you link your program). - -If your target machine comes with a C compiler, it probably comes with -suitable header files also. If you make these files accessible from the host -machine, the cross-compiler can use them also. - -Otherwise, you're on your own in finding header files to use when -cross-compiling. - -When you have found suitable header files, you should put them in the -directory @file{/usr/local/@var{target}/include}, before building the -cross compiler. Then installation will run fixincludes properly and -install the corrected versions of the header files where the compiler -will use them. - -Provide the header files before you build the cross-compiler, because -the build stage actually runs the cross-compiler to produce parts of -@file{libgcc.a}. (These are the parts that @emph{can} be compiled with -GCC@.) Some of them need suitable header files. - -Here's an example showing how to copy the header files from a target -machine. On the target machine, do this: - -@example -(cd /usr/include; tar cf - .) > tarfile -@end example - -Then, on the host machine, do this: - -@example -ftp @var{target-machine} -lcd /usr/local/@var{target}/include -get tarfile -quit -tar xf tarfile -@end example - -@ifnothtml -@node Build Cross, , Cross Headers, Cross-Compiler -@subsection Actually Building the Cross-Compiler -@end ifnothtml -@html -<h2>Actually Building the Cross-Compiler</h2> -@end html - -Now you can proceed just as for compiling a single-machine compiler -through the step of building stage 1. - -Do not try to build stage 2 for a cross-compiler. It doesn't work to -rebuild GCC as a cross-compiler using the cross-compiler, because -that would produce a program that runs on the target machine, not on the -host. For example, if you compile a 386-to-68030 cross-compiler with -itself, the result will not be right either for the 386 (because it was -compiled into 68030 code) or for the 68030 (because it was configured -for a 386 as the host). If you want to compile GCC into 68030 code, -whether you compile it on a 68030 or with a cross-compiler on a 386, you -must specify a 68030 as the host when you configure it. - -To install the cross-compiler, use @samp{make install}, as usual. diff --git a/gcc/doc/install.texi b/gcc/doc/install.texi index 072f6be..7183df3 100644 --- a/gcc/doc/install.texi +++ b/gcc/doc/install.texi @@ -43,7 +43,7 @@ @end ifset @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -@c 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +@c 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. @c *** Converted to texinfo by Dean Wakerley, dean@wakerley.com @c Include everything if we're not making html @@ -1347,6 +1347,49 @@ Build runtime libraries using the compiler from the previous step. Note that if an error occurs in any step the make process will exit. +If you are not building GNU binutils in the same source tree as GCC, +you will need a cross-assembler and cross-linker installed before +configuring GCC@. Put them in the directory +@file{@var{prefix}/@var{target}/bin}. Here is a table of the tools +you should put in this directory: + +@table @file +@item as +This should be the cross-assembler. + +@item ld +This should be the cross-linker. + +@item ar +This should be the cross-archiver: a program which can manipulate +archive files (linker libraries) in the target machine's format. + +@item ranlib +This should be a program to construct a symbol table in an archive file. +@end table + +The installation of GCC will find these programs in that directory, +and copy or link them to the proper place to for the cross-compiler to +find them when run later. + +The easiest way to provide these files is to build the Binutils package. +Configure it with the same @option{--host} and @option{--target} +options that you use for configuring GCC, then build and install +them. They install their executables automatically into the proper +directory. Alas, they do not support all the targets that GCC +supports. + +If you are not building a C library in the same source tree as GCC, +you should also provide the target libraries and headers before +configuring GCC, specifying the directories with +@option{--with-sysroot} or @option{--with-headers} and +@option{--with-libs}. Many targets also require ``start files'' such +as @file{crt0.o} and +@file{crtn.o} which are linked into each executable. There may be several +alternatives for @file{crt0.o}, for use with profiling or other +compilation options. Check your target's definition of +@code{STARTFILE_SPEC} to find out what start files it uses. + @section Building in parallel You can use @samp{make bootstrap MAKE="make -j 2" -j 2}, or just @@ -2952,6 +2995,12 @@ configure for @samp{mipsel-elf} as a workaround. The @samp{mips*-*-linux*} target continues to use the MIPS II routines. More work on this is expected in future releases. +Cross-compilers for the Mips as target using the Mips assembler +currently do not work, because the auxiliary programs +@file{mips-tdump.c} and @file{mips-tfile.c} can't be compiled on +anything but a Mips. It does work to cross compile for a Mips +if you use the GNU assembler and linker. + @html <hr /> @end html |