This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch to move cross-compilation documentation from install-old.texi


This patch moves the old cross-compilation documentation out of
install-old.texi into the main installation manual.  It passes "make
info", "make dvi" and install.texi2html.  Applied to mainline.  All that
remains now in install-old.texi are the old lists of the components of
target triplets; Phil Edwards was working on obsoleting that through
having install.texi list all distinct equivalence classes of target
triplets (whether or not there's anything special to say about them).

I just deleted parts that seemed to be entirely obsolete, or to be purely 
tutorial documentation of cross-compilation concepts or how to copy files 
(I presume that people wanting to build a cross-compiler will already 
understand the basic concepts of them).

If you think that parts of the documentation now in install.texi are wrong
or out of date, *submit patches*; so far (see PR 5301 - the documentation
still needs a lot of work to address that PR properly) people with
relevant experience of building cross-compilers in complicated situations
haven't done anything about this documentation which is why I'm moving it
without the relevant experience.

Index: ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ChangeLog,v
retrieving revision 2.1681
diff -u -r2.1681 ChangeLog
--- ChangeLog	5 Nov 2003 21:24:31 -0000	2.1681
+++ ChangeLog	5 Nov 2003 22:23:34 -0000
@@ -1,3 +1,9 @@
+2003-11-05  Joseph S. Myers  <jsm@polyomino.org.uk>
+
+	* doc/install-old.texi: Remove old documentation of building
+	cross-compilers.
+	* doc/install.texi: Move some of it to here.
+
 2003-11-05  Per Bothner  <pbothner@apple.com>
 
 	PR preprocessor/12891
Index: doc/install.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/install.texi,v
retrieving revision 1.232
diff -u -r1.232 install.texi
--- doc/install.texi	29 Oct 2003 10:14:21 -0000	1.232
+++ doc/install.texi	5 Nov 2003 22:23:36 -0000
@@ -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 @@
 
 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
@@ -2951,6 +2994,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 />
Index: doc/install-old.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/doc/install-old.texi,v
retrieving revision 1.18
diff -u -r1.18 install-old.texi
--- doc/install-old.texi	3 Nov 2003 19:11:02 -0000	1.18
+++ doc/install-old.texi	5 Nov 2003 22:23:36 -0000
@@ -21,7 +21,6 @@
 @ifnothtml
 @menu
 * Configurations::    Configurations Supported by GCC.
-* Cross-Compiler::   Building and installing a cross-compiler.
 @end menu
 @end ifnothtml
 
@@ -57,8 +56,7 @@
 
 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 @@
 @end enumerate
 
 @ifnothtml
-@node Configurations, Cross-Compiler, , Old
+@node Configurations, , , Old
 @section Configurations Supported by GCC
 @end ifnothtml
 @html
@@ -194,266 +192,3 @@
 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.

-- 
Joseph S. Myers
jsm@polyomino.org.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]