avr.c (asm_output_section_name): output section attributes.
[gcc.git] / gcc / INSTALL
1 This file documents the installation of the GNU compiler. Copyright
2 (C) 1988, 1989, 1992, 1994, 1995 Free Software Foundation, Inc. You
3 may copy, distribute, and modify it freely as long as you preserve this
4 copyright notice and permission notice.
5
6 Installing GNU CC
7 *****************
8
9 Note most of this information is out of date and superseded by the
10 EGCS install procedures. It is provided for historical reference only.
11
12 Here is the procedure for installing GNU CC on a GNU or Unix system.
13 See *Note VMS Install::, for VMS systems. In this section we assume you
14 compile in the same directory that contains the source files; see *Note
15 Other Dir::, to find out how to compile in a separate directory on Unix
16 systems.
17
18 You cannot install GNU C by itself on MSDOS; it will not compile
19 under any MSDOS compiler except itself. You need to get the complete
20 compilation package DJGPP, which includes binaries as well as sources,
21 and includes all the necessary compilation tools and libraries.
22
23 1. If you have built GNU CC previously in the same directory for a
24 different target machine, do `make distclean' to delete all files
25 that might be invalid. One of the files this deletes is
26 `Makefile'; if `make distclean' complains that `Makefile' does not
27 exist, it probably means that the directory is already suitably
28 clean.
29
30 2. On a System V release 4 system, make sure `/usr/bin' precedes
31 `/usr/ucb' in `PATH'. The `cc' command in `/usr/ucb' uses
32 libraries which have bugs.
33
34 3. Make sure the Bison parser generator is installed. (This is
35 unnecessary if the Bison output file `c-parse.c' is more recent
36 than `c-parse.y',and you do not plan to change the `.y' file.)
37
38 Bison versions older than Sept 8, 1988 will produce incorrect
39 output for `c-parse.c'.
40
41 4. If you have chosen a configuration for GNU CC which requires other
42 GNU tools (such as GAS or the GNU linker) instead of the standard
43 system tools, install the required tools in the build directory
44 under the names `as', `ld' or whatever is appropriate. This will
45 enable the compiler to find the proper tools for compilation of
46 the program `enquire'.
47
48 Alternatively, you can do subsequent compilation using a value of
49 the `PATH' environment variable such that the necessary GNU tools
50 come before the standard system tools.
51
52 5. Specify the host, build and target machine configurations. You do
53 this when you run the `configure' script.
54
55 The "build" machine is the system which you are using, the "host"
56 machine is the system where you want to run the resulting compiler
57 (normally the build machine), and the "target" machine is the
58 system for which you want the compiler to generate code.
59
60 If you are building a compiler to produce code for the machine it
61 runs on (a native compiler), you normally do not need to specify
62 any operands to `configure'; it will try to guess the type of
63 machine you are on and use that as the build, host and target
64 machines. So you don't need to specify a configuration when
65 building a native compiler unless `configure' cannot figure out
66 what your configuration is or guesses wrong.
67
68 In those cases, specify the build machine's "configuration name"
69 with the `--host' option; the host and target will default to be
70 the same as the host machine. (If you are building a
71 cross-compiler, see *Note Cross-Compiler::.)
72
73 Here is an example:
74
75 ./configure --host=sparc-sun-sunos4.1
76
77 A configuration name may be canonical or it may be more or less
78 abbreviated.
79
80 A canonical configuration name has three parts, separated by
81 dashes. It looks like this: `CPU-COMPANY-SYSTEM'. (The three
82 parts may themselves contain dashes; `configure' can figure out
83 which dashes serve which purpose.) For example,
84 `m68k-sun-sunos4.1' specifies a Sun 3.
85
86 You can also replace parts of the configuration by nicknames or
87 aliases. For example, `sun3' stands for `m68k-sun', so
88 `sun3-sunos4.1' is another way to specify a Sun 3. You can also
89 use simply `sun3-sunos', since the version of SunOS is assumed by
90 default to be version 4.
91
92 You can specify a version number after any of the system types,
93 and some of the CPU types. In most cases, the version is
94 irrelevant, and will be ignored. So you might as well specify the
95 version if you know it.
96
97 See *Note Configurations::, for a list of supported configuration
98 names and notes on many of the configurations. You should check
99 the notes in that section before proceeding any further with the
100 installation of GNU CC.
101
102 6. When running `configure', you may also need to specify certain
103 additional options that describe variant hardware and software
104 configurations. These are `--with-gnu-as', `--with-gnu-ld',
105 `--with-stabs' and `--nfp'.
106
107 `--with-gnu-as'
108 If you will use GNU CC with the GNU assembler (GAS), you
109 should declare this by using the `--with-gnu-as' option when
110 you run `configure'.
111
112 Using this option does not install GAS. It only modifies the
113 output of GNU CC to work with GAS. Building and installing
114 GAS is up to you.
115
116 Conversely, if you *do not* wish to use GAS and do not specify
117 `--with-gnu-as' when building GNU CC, it is up to you to make
118 sure that GAS is not installed. GNU CC searches for a
119 program named `as' in various directories; if the program it
120 finds is GAS, then it runs GAS. If you are not sure where
121 GNU CC finds the assembler it is using, try specifying `-v'
122 when you run it.
123
124 The systems where it makes a difference whether you use GAS
125 are
126 `hppa1.0-ANY-ANY', `hppa1.1-ANY-ANY', `i386-ANY-sysv',
127 `i386-ANY-isc',
128 `i860-ANY-bsd', `m68k-bull-sysv',
129 `m68k-hp-hpux', `m68k-sony-bsd',
130 `m68k-altos-sysv', `m68000-hp-hpux',
131 `m68000-att-sysv', `ANY-lynx-lynxos', and `mips-ANY'). On
132 any other system, `--with-gnu-as' has no effect.
133
134 On the systems listed above (except for the HP-PA, for ISC on
135 the 386, and for `mips-sgi-irix5.*'), if you use GAS, you
136 should also use the GNU linker (and specify `--with-gnu-ld').
137
138 `--with-gnu-ld'
139 Specify the option `--with-gnu-ld' if you plan to use the GNU
140 linker with GNU CC.
141
142 This option does not cause the GNU linker to be installed; it
143 just modifies the behavior of GNU CC to work with the GNU
144 linker.
145
146 `--with-stabs'
147 On MIPS based systems and on Alphas, you must specify whether
148 you want GNU CC to create the normal ECOFF debugging format,
149 or to use BSD-style stabs passed through the ECOFF symbol
150 table. The normal ECOFF debug format cannot fully handle
151 languages other than C. BSD stabs format can handle other
152 languages, but it only works with the GNU debugger GDB.
153
154 Normally, GNU CC uses the ECOFF debugging format by default;
155 if you prefer BSD stabs, specify `--with-stabs' when you
156 configure GNU CC.
157
158 No matter which default you choose when you configure GNU CC,
159 the user can use the `-gcoff' and `-gstabs+' options to
160 specify explicitly the debug format for a particular
161 compilation.
162
163 `--with-stabs' is meaningful on the ISC system on the 386,
164 also, if `--with-gas' is used. It selects use of stabs
165 debugging information embedded in COFF output. This kind of
166 debugging information supports C++ well; ordinary COFF
167 debugging information does not.
168
169 `--with-stabs' is also meaningful on 386 systems running
170 SVR4. It selects use of stabs debugging information embedded
171 in ELF output. The C++ compiler currently (2.6.0) does not
172 support the DWARF debugging information normally used on 386
173 SVR4 platforms; stabs provide a workable alternative. This
174 requires gas and gdb, as the normal SVR4 tools can not
175 generate or interpret stabs.
176
177 `--nfp'
178 On certain systems, you must specify whether the machine has
179 a floating point unit. These systems include
180 `m68k-sun-sunosN' and `m68k-isi-bsd'. On any other system,
181 `--nfp' currently has no effect, though perhaps there are
182 other systems where it could usefully make a difference.
183
184 `--enable-haifa'
185 `--disable-haifa'
186 Use `--enable-haifa' to enable use of an experimental
187 instruction scheduler (from IBM Haifa). This may or may not
188 produce better code. Some targets on which it is known to be
189 a win enable it by default; use `--disable-haifa' to disable
190 it in these cases. `configure' will print out whether the
191 Haifa scheduler is enabled when it is run.
192
193 `--enable-threads=TYPE'
194 Certain systems, notably Linux-based GNU systems, can't be
195 relied on to supply a threads facility for the Objective C
196 runtime and so will default to single-threaded runtime. They
197 may, however, have a library threads implementation
198 available, in which case threads can be enabled with this
199 option by supplying a suitable TYPE, probably `posix'. The
200 possibilities for TYPE are `single', `posix', `win32',
201 `solaris', `irix' and `mach'.
202
203 `--enable-checking'
204 When you specify this option, the compiler is built to
205 perform checking of tree node types when referencing fields
206 of that node. This does not change the generated code, but
207 adds error checking within the compiler. This will slow down
208 the compiler and may only work properly if you are building
209 the compiler with GNU C.
210
211 The `configure' script searches subdirectories of the source
212 directory for other compilers that are to be integrated into
213 GNU CC. The GNU compiler for C++, called G++ is in a
214 subdirectory named `cp'. `configure' inserts rules into
215 `Makefile' to build all of those compilers.
216
217 Here we spell out what files will be set up by `configure'.
218 Normally you need not be concerned with these files.
219
220 * A file named `config.h' is created that contains a
221 `#include' of the top-level config file for the machine
222 you will run the compiler on (*note The Configuration
223 File: (gcc.info)Config.). This file is responsible for
224 defining information about the host machine. It
225 includes `tm.h'.
226
227 The top-level config file is located in the subdirectory
228 `config'. Its name is always `xm-SOMETHING.h'; usually
229 `xm-MACHINE.h', but there are some exceptions.
230
231 If your system does not support symbolic links, you
232 might want to set up `config.h' to contain a `#include'
233 command which refers to the appropriate file.
234
235 * A file named `tconfig.h' is created which includes the
236 top-level config file for your target machine. This is
237 used for compiling certain programs to run on that
238 machine.
239
240 * A file named `tm.h' is created which includes the
241 machine-description macro file for your target machine.
242 It should be in the subdirectory `config' and its name
243 is often `MACHINE.h'.
244
245 `--enable-nls'
246 `--disable-nls'
247 The `--enable-nls' option enables Native Language Support
248 (NLS), which lets GCC output diagnostics in languages other
249 than American English. No translations are available yet, so
250 the main users of this option now are those translating GCC's
251 diagnostics who want to test their work. Once translations
252 become available, Native Language Support will become enabled
253 by default. The `--disable-nls' option disables NLS.
254
255 `--with-included-gettext'
256 If NLS is enabled, the GCC build procedure normally attempts
257 to use the host's `gettext' libraries, and falls back on
258 GCC's copy of the GNU `gettext' library only if the host
259 libraries do not suffice. The `--with-included-gettext'
260 option causes the build procedure to prefer its copy of GNU
261 `gettext'.
262
263 `--with-catgets'
264 If NLS is enabled, and if the host lacks `gettext' but has the
265 inferior `catgets' interface, the GCC build procedure normally
266 ignores `catgets' and instead uses GCC's copy of the GNU
267 `gettext' library. The `--with-catgets' option causes the
268 build procedure to use the host's `catgets' in this situation.
269
270 `--enable-win32-registry'
271 `--enable-win32-registry=KEY'
272 `--disable-win32-registry'
273 The `--enable-win32-registry' option enables Windows-hosted
274 GCC to look up installations paths in the registry using the
275 following key:
276
277 `HKEY_LOCAL_MACHINE\SOFTWARE\Free Software Foundation\<KEY>'
278
279 <KEY> defaults to GCC version number, and can be overridden
280 by the `--enable-win32-registry=KEY' option. Vendors and
281 distributors who use custom installers are encouraged to
282 provide a different key, perhaps one comprised of vendor name
283 and GCC version number, to avoid conflict with existing
284 installations. This feature is enabled by default, and can be
285 disabled by `--disable-win32-registry' option. This option
286 has no effect on the other hosts.
287
288 7. In certain cases, you should specify certain other options when
289 you run `configure'.
290
291 * The standard directory for installing GNU CC is
292 `/usr/local/lib'. If you want to install its files somewhere
293 else, specify `--prefix=DIR' when you run `configure'. Here
294 DIR is a directory name to use instead of `/usr/local' for
295 all purposes with one exception: the directory
296 `/usr/local/include' is searched for header files no matter
297 where you install the compiler. To override this name, use
298 the `--with-local-prefix' option below. The directory you
299 specify need not exist, but its parent directory must exist.
300
301 * Specify `--with-local-prefix=DIR' if you want the compiler to
302 search directory `DIR/include' for locally installed header
303 files *instead* of `/usr/local/include'.
304
305 You should specify `--with-local-prefix' *only* if your site
306 has a different convention (not `/usr/local') for where to put
307 site-specific files.
308
309 The default value for `--with-local-prefix' is `/usr/local'
310 regardless of the value of `--prefix'. Specifying `--prefix'
311 has no effect on which directory GNU CC searches for local
312 header files. This may seem counterintuitive, but actually
313 it is logical.
314
315 The purpose of `--prefix' is to specify where to *install GNU
316 CC*. The local header files in `/usr/local/include'--if you
317 put any in that directory--are not part of GNU CC. They are
318 part of other programs--perhaps many others. (GNU CC
319 installs its own header files in another directory which is
320 based on the `--prefix' value.)
321
322 *Do not* specify `/usr' as the `--with-local-prefix'! The
323 directory you use for `--with-local-prefix' *must not* contain
324 any of the system's standard header files. If it did contain
325 them, certain programs would be miscompiled (including GNU
326 Emacs, on certain targets), because this would override and
327 nullify the header file corrections made by the `fixincludes'
328 script.
329
330 Indications are that people who use this option use it based
331 on mistaken ideas of what it is for. People use it as if it
332 specified where to install part of GNU CC. Perhaps they make
333 this assumption because installing GNU CC creates the
334 directory.
335
336 8. Build the compiler. Just type `make LANGUAGES=c' in the compiler
337 directory.
338
339 `LANGUAGES=c' specifies that only the C compiler should be
340 compiled. The makefile normally builds compilers for all the
341 supported languages; currently, C, C++ and Objective C. However,
342 C is the only language that is sure to work when you build with
343 other non-GNU C compilers. In addition, building anything but C
344 at this stage is a waste of time.
345
346 In general, you can specify the languages to build by typing the
347 argument `LANGUAGES="LIST"', where LIST is one or more words from
348 the list `c', `c++', and `objective-c'. If you have any
349 additional GNU compilers as subdirectories of the GNU CC source
350 directory, you may also specify their names in this list.
351
352 Ignore any warnings you may see about "statement not reached" in
353 `insn-emit.c'; they are normal. Also, warnings about "unknown
354 escape sequence" are normal in `genopinit.c' and perhaps some
355 other files. Likewise, you should ignore warnings about "constant
356 is so large that it is unsigned" in `insn-emit.c' and
357 `insn-recog.c', and a warning about a comparison always being zero
358 in `enquire.o'. Any other compilation errors may represent bugs in
359 the port to your machine or operating system, and should be
360 investigated and reported.
361
362 Some compilers fail to compile GNU CC because they have bugs or
363 limitations. For example, the Microsoft compiler is said to run
364 out of macro space. Some Ultrix compilers run out of expression
365 space; then you need to break up the statement where the problem
366 happens.
367
368 9. If you are building a cross-compiler, stop here. *Note
369 Cross-Compiler::.
370
371 10. Move the first-stage object files and executables into a
372 subdirectory with this command:
373
374 make stage1
375
376 The files are moved into a subdirectory named `stage1'. Once
377 installation is complete, you may wish to delete these files with
378 `rm -r stage1'.
379
380 11. If you have chosen a configuration for GNU CC which requires other
381 GNU tools (such as GAS or the GNU linker) instead of the standard
382 system tools, install the required tools in the `stage1'
383 subdirectory under the names `as', `ld' or whatever is
384 appropriate. This will enable the stage 1 compiler to find the
385 proper tools in the following stage.
386
387 Alternatively, you can do subsequent compilation using a value of
388 the `PATH' environment variable such that the necessary GNU tools
389 come before the standard system tools.
390
391 12. Recompile the compiler with itself, with this command:
392
393 make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O2"
394
395 This is called making the stage 2 compiler.
396
397 The command shown above builds compilers for all the supported
398 languages. If you don't want them all, you can specify the
399 languages to build by typing the argument `LANGUAGES="LIST"'. LIST
400 should contain one or more words from the list `c', `c++',
401 `objective-c', and `proto'. Separate the words with spaces.
402 `proto' stands for the programs `protoize' and `unprotoize'; they
403 are not a separate language, but you use `LANGUAGES' to enable or
404 disable their installation.
405
406 If you are going to build the stage 3 compiler, then you might
407 want to build only the C language in stage 2.
408
409 Once you have built the stage 2 compiler, if you are short of disk
410 space, you can delete the subdirectory `stage1'.
411
412 On a 68000 or 68020 system lacking floating point hardware, unless
413 you have selected a `tm.h' file that expects by default that there
414 is no such hardware, do this instead:
415
416 make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O2 -msoft-float"
417
418 13. If you wish to test the compiler by compiling it with itself one
419 more time, install any other necessary GNU tools (such as GAS or
420 the GNU linker) in the `stage2' subdirectory as you did in the
421 `stage1' subdirectory, then do this:
422
423 make stage2
424 make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O2"
425
426 This is called making the stage 3 compiler. Aside from the `-B'
427 option, the compiler options should be the same as when you made
428 the stage 2 compiler. But the `LANGUAGES' option need not be the
429 same. The command shown above builds compilers for all the
430 supported languages; if you don't want them all, you can specify
431 the languages to build by typing the argument `LANGUAGES="LIST"',
432 as described above.
433
434 If you do not have to install any additional GNU tools, you may
435 use the command
436
437 make bootstrap LANGUAGES=LANGUAGE-LIST BOOT_CFLAGS=OPTION-LIST
438
439 instead of making `stage1', `stage2', and performing the two
440 compiler builds.
441
442 14. Compare the latest object files with the stage 2 object files--they
443 ought to be identical, aside from time stamps (if any).
444
445 On some systems, meaningful comparison of object files is
446 impossible; they always appear "different." This is currently
447 true on Solaris and some systems that use ELF object file format.
448 On some versions of Irix on SGI machines and DEC Unix (OSF/1) on
449 Alpha systems, you will not be able to compare the files without
450 specifying `-save-temps'; see the description of individual
451 systems above to see if you get comparison failures. You may have
452 similar problems on other systems.
453
454 Use this command to compare the files:
455
456 make compare
457
458 This will mention any object files that differ between stage 2 and
459 stage 3. Any difference, no matter how innocuous, indicates that
460 the stage 2 compiler has compiled GNU CC incorrectly, and is
461 therefore a potentially serious bug which you should investigate
462 and report.
463
464 If your system does not put time stamps in the object files, then
465 this is a faster way to compare them (using the Bourne shell):
466
467 for file in *.o; do
468 cmp $file stage2/$file
469 done
470
471 If you have built the compiler with the `-mno-mips-tfile' option on
472 MIPS machines, you will not be able to compare the files.
473
474 15. Install the compiler driver, the compiler's passes and run-time
475 support with `make install'. Use the same value for `CC',
476 `CFLAGS' and `LANGUAGES' that you used when compiling the files
477 that are being installed. One reason this is necessary is that
478 some versions of Make have bugs and recompile files gratuitously
479 when you do this step. If you use the same variable values, those
480 files will be recompiled properly.
481
482 For example, if you have built the stage 2 compiler, you can use
483 the following command:
484
485 make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="LIST"
486
487 This copies the files `cc1', `cpp' and `libgcc.a' to files `cc1',
488 `cpp' and `libgcc.a' in the directory
489 `/usr/local/lib/gcc-lib/TARGET/VERSION', which is where the
490 compiler driver program looks for them. Here TARGET is the
491 canonicalized form of target machine type specified when you ran
492 `configure', and VERSION is the version number of GNU CC. This
493 naming scheme permits various versions and/or cross-compilers to
494 coexist. It also copies the executables for compilers for other
495 languages (e.g., `cc1plus' for C++) to the same directory.
496
497 This also copies the driver program `xgcc' into
498 `/usr/local/bin/gcc', so that it appears in typical execution
499 search paths. It also copies `gcc.1' into `/usr/local/man/man1'
500 and info pages into `/usr/local/info'.
501
502 On some systems, this command causes recompilation of some files.
503 This is usually due to bugs in `make'. You should either ignore
504 this problem, or use GNU Make.
505
506 *Warning: there is a bug in `alloca' in the Sun library. To avoid
507 this bug, be sure to install the executables of GNU CC that were
508 compiled by GNU CC. (That is, the executables from stage 2 or 3,
509 not stage 1.) They use `alloca' as a built-in function and never
510 the one in the library.*
511
512 (It is usually better to install GNU CC executables from stage 2
513 or 3, since they usually run faster than the ones compiled with
514 some other compiler.)
515
516 16. If you're going to use C++, you need to install the C++ runtime
517 library. This includes all I/O functionality, special class
518 libraries, etc.
519
520 The standard C++ runtime library for GNU CC is called `libstdc++'.
521 An obsolescent library `libg++' may also be available, but it's
522 necessary only for older software that hasn't been converted yet;
523 if you don't know whether you need `libg++' then you probably don't
524 need it.
525
526 Here's one way to build and install `libstdc++' for GNU CC:
527
528 * Build and install GNU CC, so that invoking `gcc' obtains the
529 GNU CC that was just built.
530
531 * Obtain a copy of a compatible `libstdc++' distribution. For
532 example, the `libstdc++-2.8.0.tar.gz' distribution should be
533 compatible with GCC 2.8.0. GCC distributors normally
534 distribute `libstdc++' as well.
535
536 * Set the `CXX' environment variable to `gcc' while running the
537 `libstdc++' distribution's `configure' command. Use the same
538 `configure' options that you used when you invoked GCC's
539 `configure' command.
540
541 * Invoke `make' to build the C++ runtime.
542
543 * Invoke `make install' to install the C++ runtime.
544
545 To summarize, after building and installing GNU CC, invoke the
546 following shell commands in the topmost directory of the C++
547 library distribution. For CONFIGURE-OPTIONS, use the same options
548 that you used to configure GNU CC.
549
550 $ CXX=gcc ./configure CONFIGURE-OPTIONS
551 $ make
552 $ make install
553
554 17. GNU CC includes a runtime library for Objective-C because it is an
555 integral part of the language. You can find the files associated
556 with the library in the subdirectory `objc'. The GNU Objective-C
557 Runtime Library requires header files for the target's C library in
558 order to be compiled,and also requires the header files for the
559 target's thread library if you want thread support. *Note
560 Cross-Compilers and Header Files: Cross Headers, for discussion
561 about header files issues for cross-compilation.
562
563 When you run `configure', it picks the appropriate Objective-C
564 thread implementation file for the target platform. In some
565 situations, you may wish to choose a different back-end as some
566 platforms support multiple thread implementations or you may wish
567 to disable thread support completely. You do this by specifying a
568 value for the OBJC_THREAD_FILE makefile variable on the command
569 line when you run make, for example:
570
571 make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O2" OBJC_THREAD_FILE=thr-single
572
573 Below is a list of the currently available back-ends.
574
575 * thr-single Disable thread support, should work for all
576 platforms.
577
578 * thr-decosf1 DEC OSF/1 thread support.
579
580 * thr-irix SGI IRIX thread support.
581
582 * thr-mach Generic MACH thread support, known to work on
583 NEXTSTEP.
584
585 * thr-os2 IBM OS/2 thread support.
586
587 * thr-posix Generix POSIX thread support.
588
589 * thr-pthreads PCThreads on Linux-based GNU systems.
590
591 * thr-solaris SUN Solaris thread support.
592
593 * thr-win32 Microsoft Win32 API thread support.
594
595 Files Created by `configure'
596 ============================
597
598 Here we spell out what files will be set up by `configure'. Normally
599 you need not be concerned with these files.
600
601 * A file named `config.h' is created that contains a `#include' of
602 the top-level config file for the machine you will run the compiler
603 on (*note The Configuration File: (gcc.info)Config.). This file
604 is responsible for defining information about the host machine.
605 It includes `tm.h'.
606
607 The top-level config file is located in the subdirectory `config'.
608 Its name is always `xm-SOMETHING.h'; usually `xm-MACHINE.h', but
609 there are some exceptions.
610
611 If your system does not support symbolic links, you might want to
612 set up `config.h' to contain a `#include' command which refers to
613 the appropriate file.
614
615 * A file named `tconfig.h' is created which includes the top-level
616 config file for your target machine. This is used for compiling
617 certain programs to run on that machine.
618
619 * A file named `tm.h' is created which includes the
620 machine-description macro file for your target machine. It should
621 be in the subdirectory `config' and its name is often `MACHINE.h'.
622
623 * The command file `configure' also constructs the file `Makefile'
624 by adding some text to the template file `Makefile.in'. The
625 additional text comes from files in the `config' directory, named
626 `t-TARGET' and `x-HOST'. If these files do not exist, it means
627 nothing needs to be added for a given target or host.
628
629 Configurations Supported by GNU CC
630 ==================================
631
632 Here are the possible CPU types:
633
634 1750a, a29k, alpha, arm, avr, cN, clipper, dsp16xx, elxsi, fr30,
635 h8300, hppa1.0, hppa1.1, i370, i386, i486, i586, i686, i786, i860,
636 i960, m32r, m68000, m68k, m88k, mcore, mips, mipsel, mips64,
637 mips64el, mn10200, mn10300, ns32k, pdp11, powerpc, powerpcle,
638 romp, rs6000, sh, sparc, sparclite, sparc64, v850, vax, we32k.
639
640 Here are the recognized company names. As you can see, customary
641 abbreviations are used rather than the longer official names.
642
643 acorn, alliant, altos, apollo, apple, att, bull, cbm, convergent,
644 convex, crds, dec, dg, dolphin, elxsi, encore, harris, hitachi,
645 hp, ibm, intergraph, isi, mips, motorola, ncr, next, ns, omron,
646 plexus, sequent, sgi, sony, sun, tti, unicom, wrs.
647
648 The company name is meaningful only to disambiguate when the rest of
649 the information supplied is insufficient. You can omit it, writing
650 just `CPU-SYSTEM', if it is not needed. For example, `vax-ultrix4.2'
651 is equivalent to `vax-dec-ultrix4.2'.
652
653 Here is a list of system types:
654
655 386bsd, aix, acis, amigaos, aos, aout, aux, bosx, bsd, clix, coff,
656 ctix, cxux, dgux, dynix, ebmon, ecoff, elf, esix, freebsd, hms,
657 genix, gnu, linux-gnu, hiux, hpux, iris, irix, isc, luna, lynxos,
658 mach, minix, msdos, mvs, netbsd, newsos, nindy, ns, osf, osfrose,
659 ptx, riscix, riscos, rtu, sco, sim, solaris, sunos, sym, sysv,
660 udi, ultrix, unicos, uniplus, unos, vms, vsta, vxworks, winnt,
661 xenix.
662
663 You can omit the system type; then `configure' guesses the operating
664 system from the CPU and company.
665
666 You can add a version number to the system type; this may or may not
667 make a difference. For example, you can write `bsd4.3' or `bsd4.4' to
668 distinguish versions of BSD. In practice, the version number is most
669 needed for `sysv3' and `sysv4', which are often treated differently.
670
671 If you specify an impossible combination such as `i860-dg-vms', then
672 you may get an error message from `configure', or it may ignore part of
673 the information and do the best it can with the rest. `configure'
674 always prints the canonical name for the alternative that it used. GNU
675 CC does not support all possible alternatives.
676
677 Often a particular model of machine has a name. Many machine names
678 are recognized as aliases for CPU/company combinations. Thus, the
679 machine name `sun3', mentioned above, is an alias for `m68k-sun'.
680 Sometimes we accept a company name as a machine name, when the name is
681 popularly used for a particular machine. Here is a table of the known
682 machine names:
683
684 3300, 3b1, 3bN, 7300, altos3068, altos, apollo68, att-7300,
685 balance, convex-cN, crds, decstation-3100, decstation, delta,
686 encore, fx2800, gmicro, hp7NN, hp8NN, hp9k2NN, hp9k3NN, hp9k7NN,
687 hp9k8NN, iris4d, iris, isi68, m3230, magnum, merlin, miniframe,
688 mmax, news-3600, news800, news, next, pbd, pc532, pmax, powerpc,
689 powerpcle, ps2, risc-news, rtpc, sun2, sun386i, sun386, sun3,
690 sun4, symmetry, tower-32, tower.
691
692 Remember that a machine name specifies both the cpu type and the company
693 name. If you want to install your own homemade configuration files,
694 you can use `local' as the company name to access them. If you use
695 configuration `CPU-local', the configuration name without the cpu prefix
696 is used to form the configuration file names.
697
698 Thus, if you specify `m68k-local', configuration uses files
699 `m68k.md', `local.h', `m68k.c', `xm-local.h', `t-local', and `x-local',
700 all in the directory `config/m68k'.
701
702 Here is a list of configurations that have special treatment or
703 special things you must know:
704
705 `1750a-*-*'
706 MIL-STD-1750A processors.
707
708 The MIL-STD-1750A cross configuration produces output for
709 `as1750', an assembler/linker available under the GNU Public
710 License for the 1750A. `as1750' can be obtained at
711 *ftp://ftp.fta-berlin.de/pub/crossgcc/1750gals/*. A similarly
712 licensed simulator for the 1750A is available from same address.
713
714 You should ignore a fatal error during the building of libgcc
715 (libgcc is not yet implemented for the 1750A.)
716
717 The `as1750' assembler requires the file `ms1750.inc', which is
718 found in the directory `config/1750a'.
719
720 GNU CC produced the same sections as the Fairchild F9450 C
721 Compiler, namely:
722
723 `Normal'
724 The program code section.
725
726 `Static'
727 The read/write (RAM) data section.
728
729 `Konst'
730 The read-only (ROM) constants section.
731
732 `Init'
733 Initialization section (code to copy KREL to SREL).
734
735 The smallest addressable unit is 16 bits (BITS_PER_UNIT is 16).
736 This means that type `char' is represented with a 16-bit word per
737 character. The 1750A's "Load/Store Upper/Lower Byte" instructions
738 are not used by GNU CC.
739
740 `alpha-*-osf1'
741 Systems using processors that implement the DEC Alpha architecture
742 and are running the DEC Unix (OSF/1) operating system, for example
743 the DEC Alpha AXP systems.CC.)
744
745 GNU CC writes a `.verstamp' directive to the assembler output file
746 unless it is built as a cross-compiler. It gets the version to
747 use from the system header file `/usr/include/stamp.h'. If you
748 install a new version of DEC Unix, you should rebuild GCC to pick
749 up the new version stamp.
750
751 Note that since the Alpha is a 64-bit architecture,
752 cross-compilers from 32-bit machines will not generate code as
753 efficient as that generated when the compiler is running on a
754 64-bit machine because many optimizations that depend on being
755 able to represent a word on the target in an integral value on the
756 host cannot be performed. Building cross-compilers on the Alpha
757 for 32-bit machines has only been tested in a few cases and may
758 not work properly.
759
760 `make compare' may fail on old versions of DEC Unix unless you add
761 `-save-temps' to `CFLAGS'. On these systems, the name of the
762 assembler input file is stored in the object file, and that makes
763 comparison fail if it differs between the `stage1' and `stage2'
764 compilations. The option `-save-temps' forces a fixed name to be
765 used for the assembler input file, instead of a randomly chosen
766 name in `/tmp'. Do not add `-save-temps' unless the comparisons
767 fail without that option. If you add `-save-temps', you will have
768 to manually delete the `.i' and `.s' files after each series of
769 compilations.
770
771 GNU CC now supports both the native (ECOFF) debugging format used
772 by DBX and GDB and an encapsulated STABS format for use only with
773 GDB. See the discussion of the `--with-stabs' option of
774 `configure' above for more information on these formats and how to
775 select them.
776
777 There is a bug in DEC's assembler that produces incorrect line
778 numbers for ECOFF format when the `.align' directive is used. To
779 work around this problem, GNU CC will not emit such alignment
780 directives while writing ECOFF format debugging information even
781 if optimization is being performed. Unfortunately, this has the
782 very undesirable side-effect that code addresses when `-O' is
783 specified are different depending on whether or not `-g' is also
784 specified.
785
786 To avoid this behavior, specify `-gstabs+' and use GDB instead of
787 DBX. DEC is now aware of this problem with the assembler and
788 hopes to provide a fix shortly.
789
790 `arc-*-elf'
791 Argonaut ARC processor. This configuration is intended for
792 embedded systems.
793
794 `arm-*-aout'
795 Advanced RISC Machines ARM-family processors. These are often
796 used in embedded applications. There are no standard Unix
797 configurations. This configuration corresponds to the basic
798 instruction sequences and will produce `a.out' format object
799 modules.
800
801 You may need to make a variant of the file `arm.h' for your
802 particular configuration.
803
804 `arm-*-elf'
805 This configuration is intended for embedded systems.
806
807 `arm-*-linux-gnuaout'
808 Any of the ARM-family processors running the Linux-based GNU
809 system with the `a.out' binary format. This is an obsolete
810 configuration.
811
812 `arm-*-linux-gnu'
813 `arm-*-linux-gnuoldld'
814 Any of the ARM-family processors running the Linux-based GNU
815 system with the `ELF' binary format. You must use version
816 2.9.1.0.22 or later of the GNU/Linux binutils, which you can
817 download from `ftp.varesearch.com:/pub/support/hjl/binutils'.
818
819 These two configurations differ only in the required version of GNU
820 binutils. For binutils 2.9.1.0.x, use `arm-*-linux-gnuoldld'. For
821 newer versions of binutils, use `arm-*-linux-gnu'.
822
823 `arm-*-riscix'
824 The ARM2 or ARM3 processor running RISC iX, Acorn's port of BSD
825 Unix. If you are running a version of RISC iX prior to 1.2 then
826 you must specify the version number during configuration. Note
827 that the assembler shipped with RISC iX does not support stabs
828 debugging information; a new version of the assembler, with stabs
829 support included, is now available from Acorn and via ftp
830 `ftp.acorn.com:/pub/riscix/as+xterm.tar.Z'. To enable stabs
831 debugging, pass `--with-gnu-as' to configure.
832
833 You will need to install GNU `sed' before you can run configure.
834
835 `a29k'
836 AMD Am29k-family processors. These are normally used in embedded
837 applications. There are no standard Unix configurations. This
838 configuration corresponds to AMD's standard calling sequence and
839 binary interface and is compatible with other 29k tools.
840
841 You may need to make a variant of the file `a29k.h' for your
842 particular configuration.
843
844 `a29k-*-bsd'
845 AMD Am29050 used in a system running a variant of BSD Unix.
846
847 `avr'
848 ATMEL AVR-family micro controllers. These are used in embedded
849 applications. There are no standard Unix configurations.
850 Supports following MCU's: - AT90S23xx - ATtiny22 - AT90S44xx -
851 AT90S85xx - ATmega603/603L - ATmega103/103L
852
853 `decstation-*'
854 MIPS-based DECstations can support three different personalities:
855 Ultrix, DEC OSF/1, and OSF/rose. (Alpha-based DECstation products
856 have a configuration name beginning with `alpha-dec'.) To
857 configure GCC for these platforms use the following configurations:
858
859 `decstation-ultrix'
860 Ultrix configuration.
861
862 `decstation-osf1'
863 Dec's version of OSF/1.
864
865 `decstation-osfrose'
866 Open Software Foundation reference port of OSF/1 which uses
867 the OSF/rose object file format instead of ECOFF. Normally,
868 you would not select this configuration.
869
870 The MIPS C compiler needs to be told to increase its table size
871 for switch statements with the `-Wf,-XNg1500' option in order to
872 compile `cp/parse.c'. If you use the `-O2' optimization option,
873 you also need to use `-Olimit 3000'. Both of these options are
874 automatically generated in the `Makefile' that the shell script
875 `configure' builds. If you override the `CC' make variable and
876 use the MIPS compilers, you may need to add `-Wf,-XNg1500 -Olimit
877 3000'.
878
879 `elxsi-elxsi-bsd'
880 The Elxsi's C compiler has known limitations that prevent it from
881 compiling GNU C. Please contact `mrs@cygnus.com' for more details.
882
883 `dsp16xx'
884 A port to the AT&T DSP1610 family of processors.
885
886 `h8300-*-*'
887 Hitachi H8/300 series of processors.
888
889 The calling convention and structure layout has changed in release
890 2.6. All code must be recompiled. The calling convention now
891 passes the first three arguments in function calls in registers.
892 Structures are no longer a multiple of 2 bytes.
893
894 `hppa*-*-*'
895 There are several variants of the HP-PA processor which run a
896 variety of operating systems. GNU CC must be configured to use
897 the correct processor type and operating system, or GNU CC will
898 not function correctly. The easiest way to handle this problem is
899 to *not* specify a target when configuring GNU CC, the `configure'
900 script will try to automatically determine the right processor
901 type and operating system.
902
903 `-g' does not work on HP-UX, since that system uses a peculiar
904 debugging format which GNU CC does not know about. However, `-g'
905 will work if you also use GAS and GDB in conjunction with GCC. We
906 highly recommend using GAS for all HP-PA configurations.
907
908 You should be using GAS-2.6 (or later) along with GDB-4.16 (or
909 later). These can be retrieved from all the traditional GNU ftp
910 archive sites.
911
912 On some versions of HP-UX, you will need to install GNU `sed'.
913
914 You will need to be install GAS into a directory before `/bin',
915 `/usr/bin', and `/usr/ccs/bin' in your search path. You should
916 install GAS before you build GNU CC.
917
918 To enable debugging, you must configure GNU CC with the
919 `--with-gnu-as' option before building.
920
921 `i370-*-*'
922 This port is very preliminary and has many known bugs. We hope to
923 have a higher-quality port for this machine soon.
924
925 `i386-*-linux-gnuoldld'
926 Use this configuration to generate `a.out' binaries on Linux-based
927 GNU systems if you do not have gas/binutils version 2.5.2 or later
928 installed. This is an obsolete configuration.
929
930 `i386-*-linux-gnuaout'
931 Use this configuration to generate `a.out' binaries on Linux-based
932 GNU systems. This configuration is being superseded. You must use
933 gas/binutils version 2.5.2 or later.
934
935 `i386-*-linux-gnu'
936 Use this configuration to generate ELF binaries on Linux-based GNU
937 systems. You must use gas/binutils version 2.5.2 or later.
938
939 `i386-*-sco'
940 Compilation with RCC is recommended. Also, it may be a good idea
941 to link with GNU malloc instead of the malloc that comes with the
942 system.
943
944 `i386-*-sco3.2v4'
945 Use this configuration for SCO release 3.2 version 4.
946
947 `i386-*-sco3.2v5*'
948 Use this for the SCO OpenServer Release family including 5.0.0,
949 5.0.2, 5.0.4, 5.0.5, Internet FastStart 1.0, and Internet
950 FastStart 1.1.
951
952 GNU CC can generate COFF binaries if you specify `-mcoff' or ELF
953 binaries, the default. A full `make bootstrap' is recommended
954 so that an ELF compiler that builds ELF is generated.
955
956 You must have TLS597 from `ftp://ftp.sco.com/TLS' installed for ELF
957 C++ binaries to work correctly on releases before 5.0.4.
958
959 The native SCO assembler that is provided with the OS at no charge
960 is normally required. If, however, you must be able to use the GNU
961 assembler (perhaps you have complex asms) you must configure this
962 package `--with-gnu-as'. To do this, install (cp or symlink)
963 gcc/as to your copy of the GNU assembler. You must use a recent
964 version of GNU binutils; version 2.9.1 seems to work well. If you
965 select this option, you will be unable to build COFF images.
966 Trying to do so will result in non-obvious failures. In general,
967 the "-with-gnu-as" option isn't as well tested as the native
968 assembler.
969
970 *NOTE:* If you are building C++, you must follow the instructions
971 about invoking `make bootstrap' because the native OpenServer
972 compiler may build a `cc1plus' that will not correctly parse many
973 valid C++ programs. You must do a `make bootstrap' if you are
974 building with the native compiler.
975
976 `i386-*-isc'
977 It may be a good idea to link with GNU malloc instead of the
978 malloc that comes with the system.
979
980 In ISC version 4.1, `sed' core dumps when building `deduced.h'.
981 Use the version of `sed' from version 4.0.
982
983 `i386-*-esix'
984 It may be good idea to link with GNU malloc instead of the malloc
985 that comes with the system.
986
987 `i386-ibm-aix'
988 You need to use GAS version 2.1 or later, and LD from GNU binutils
989 version 2.2 or later.
990
991 `i386-sequent-bsd'
992 Go to the Berkeley universe before compiling.
993
994 `i386-sequent-ptx1*'
995 `i386-sequent-ptx2*'
996 You must install GNU `sed' before running `configure'.
997
998 `i386-sun-sunos4'
999 You may find that you need another version of GNU CC to begin
1000 bootstrapping with, since the current version when built with the
1001 system's own compiler seems to get an infinite loop compiling part
1002 of `libgcc2.c'. GNU CC version 2 compiled with GNU CC (any
1003 version) seems not to have this problem.
1004
1005 See *Note Sun Install::, for information on installing GNU CC on
1006 Sun systems.
1007
1008 `i[345]86-*-winnt3.5'
1009 This version requires a GAS that has not yet been released. Until
1010 it is, you can get a prebuilt binary version via anonymous ftp from
1011 `cs.washington.edu:pub/gnat' or `cs.nyu.edu:pub/gnat'. You must
1012 also use the Microsoft header files from the Windows NT 3.5 SDK.
1013 Find these on the CDROM in the `/mstools/h' directory dated
1014 9/4/94. You must use a fixed version of Microsoft linker made
1015 especially for NT 3.5, which is also is available on the NT 3.5
1016 SDK CDROM. If you do not have this linker, can you also use the
1017 linker from Visual C/C++ 1.0 or 2.0.
1018
1019 Installing GNU CC for NT builds a wrapper linker, called `ld.exe',
1020 which mimics the behaviour of Unix `ld' in the specification of
1021 libraries (`-L' and `-l'). `ld.exe' looks for both Unix and
1022 Microsoft named libraries. For example, if you specify `-lfoo',
1023 `ld.exe' will look first for `libfoo.a' and then for `foo.lib'.
1024
1025 You may install GNU CC for Windows NT in one of two ways,
1026 depending on whether or not you have a Unix-like shell and various
1027 Unix-like utilities.
1028
1029 1. If you do not have a Unix-like shell and few Unix-like
1030 utilities, you will use a DOS style batch script called
1031 `configure.bat'. Invoke it as `configure winnt' from an
1032 MSDOS console window or from the program manager dialog box.
1033 `configure.bat' assumes you have already installed and have
1034 in your path a Unix-like `sed' program which is used to
1035 create a working `Makefile' from `Makefile.in'.
1036
1037 `Makefile' uses the Microsoft Nmake program maintenance
1038 utility and the Visual C/C++ V8.00 compiler to build GNU CC.
1039 You need only have the utilities `sed' and `touch' to use
1040 this installation method, which only automatically builds the
1041 compiler itself. You must then examine what `fixinc.winnt'
1042 does, edit the header files by hand and build `libgcc.a'
1043 manually.
1044
1045 2. The second type of installation assumes you are running a
1046 Unix-like shell, have a complete suite of Unix-like utilities
1047 in your path, and have a previous version of GNU CC already
1048 installed, either through building it via the above
1049 installation method or acquiring a pre-built binary. In this
1050 case, use the `configure' script in the normal fashion.
1051
1052 `i860-intel-osf1'
1053 This is the Paragon. If you have version 1.0 of the operating
1054 system, you need to take special steps to build GNU CC due to
1055 peculiarities of the system. Newer system versions have no
1056 problem. See the section `Installation Problems' in the GNU CC
1057 Manual.
1058
1059 `*-lynx-lynxos'
1060 LynxOS 2.2 and earlier comes with GNU CC 1.x already installed as
1061 `/bin/gcc'. You should compile with this instead of `/bin/cc'.
1062 You can tell GNU CC to use the GNU assembler and linker, by
1063 specifying `--with-gnu-as --with-gnu-ld' when configuring. These
1064 will produce COFF format object files and executables; otherwise
1065 GNU CC will use the installed tools, which produce `a.out' format
1066 executables.
1067
1068 `m32r-*-elf'
1069 Mitsubishi M32R processor. This configuration is intended for
1070 embedded systems.
1071
1072 `m68000-hp-bsd'
1073 HP 9000 series 200 running BSD. Note that the C compiler that
1074 comes with this system cannot compile GNU CC; contact
1075 `law@cygnus.com' to get binaries of GNU CC for bootstrapping.
1076
1077 `m68k-altos'
1078 Altos 3068. You must use the GNU assembler, linker and debugger.
1079 Also, you must fix a kernel bug. Details in the file
1080 `README.ALTOS'.
1081
1082 `m68k-apple-aux'
1083 Apple Macintosh running A/UX. You may configure GCC to use
1084 either the system assembler and linker or the GNU assembler and
1085 linker. You should use the GNU configuration if you can,
1086 especially if you also want to use GNU C++. You enabled that
1087 configuration with + the `--with-gnu-as' and `--with-gnu-ld'
1088 options to `configure'.
1089
1090 Note the C compiler that comes with this system cannot compile GNU
1091 CC. You can find binaries of GNU CC for bootstrapping on
1092 `jagubox.gsfc.nasa.gov'. You will also a patched version of
1093 `/bin/ld' there that raises some of the arbitrary limits found in
1094 the original.
1095
1096 `m68k-att-sysv'
1097 AT&T 3b1, a.k.a. 7300 PC. This version of GNU CC cannot be
1098 compiled with the system C compiler, which is too buggy. You will
1099 need to get a previous version of GCC and use it to bootstrap.
1100 Binaries are available from the OSU-CIS archive, at
1101 `ftp://archive.cis.ohio-state.edu/pub/att7300/'.
1102
1103 `m68k-bull-sysv'
1104 Bull DPX/2 series 200 and 300 with BOS-2.00.45 up to BOS-2.01. GNU
1105 CC works either with native assembler or GNU assembler. You can use
1106 GNU assembler with native coff generation by providing
1107 `--with-gnu-as' to the configure script or use GNU assembler with
1108 dbx-in-coff encapsulation by providing `--with-gnu-as --stabs'.
1109 For any problem with native assembler or for availability of the
1110 DPX/2 port of GAS, contact `F.Pierresteguy@frcl.bull.fr'.
1111
1112 `m68k-crds-unox'
1113 Use `configure unos' for building on Unos.
1114
1115 The Unos assembler is named `casm' instead of `as'. For some
1116 strange reason linking `/bin/as' to `/bin/casm' changes the
1117 behavior, and does not work. So, when installing GNU CC, you
1118 should install the following script as `as' in the subdirectory
1119 where the passes of GCC are installed:
1120
1121 #!/bin/sh
1122 casm $*
1123
1124 The default Unos library is named `libunos.a' instead of `libc.a'.
1125 To allow GNU CC to function, either change all references to
1126 `-lc' in `gcc.c' to `-lunos' or link `/lib/libc.a' to
1127 `/lib/libunos.a'.
1128
1129 When compiling GNU CC with the standard compiler, to overcome bugs
1130 in the support of `alloca', do not use `-O' when making stage 2.
1131 Then use the stage 2 compiler with `-O' to make the stage 3
1132 compiler. This compiler will have the same characteristics as the
1133 usual stage 2 compiler on other systems. Use it to make a stage 4
1134 compiler and compare that with stage 3 to verify proper
1135 compilation.
1136
1137 (Perhaps simply defining `ALLOCA' in `x-crds' as described in the
1138 comments there will make the above paragraph superfluous. Please
1139 inform us of whether this works.)
1140
1141 Unos uses memory segmentation instead of demand paging, so you
1142 will need a lot of memory. 5 Mb is barely enough if no other
1143 tasks are running. If linking `cc1' fails, try putting the object
1144 files into a library and linking from that library.
1145
1146 `m68k-hp-hpux'
1147 HP 9000 series 300 or 400 running HP-UX. HP-UX version 8.0 has a
1148 bug in the assembler that prevents compilation of GNU CC. To fix
1149 it, get patch PHCO_4484 from HP.
1150
1151 In addition, if you wish to use gas `--with-gnu-as' you must use
1152 gas version 2.1 or later, and you must use the GNU linker version
1153 2.1 or later. Earlier versions of gas relied upon a program which
1154 converted the gas output into the native HP-UX format, but that
1155 program has not been kept up to date. gdb does not understand
1156 that native HP-UX format, so you must use gas if you wish to use
1157 gdb.
1158
1159 `m68k-sun'
1160 Sun 3. We do not provide a configuration file to use the Sun FPA
1161 by default, because programs that establish signal handlers for
1162 floating point traps inherently cannot work with the FPA.
1163
1164 See *Note Sun Install::, for information on installing GNU CC on
1165 Sun systems.
1166
1167 `m88k-*-svr3'
1168 Motorola m88k running the AT&T/Unisoft/Motorola V.3 reference port.
1169 These systems tend to use the Green Hills C, revision 1.8.5, as the
1170 standard C compiler. There are apparently bugs in this compiler
1171 that result in object files differences between stage 2 and stage
1172 3. If this happens, make the stage 4 compiler and compare it to
1173 the stage 3 compiler. If the stage 3 and stage 4 object files are
1174 identical, this suggests you encountered a problem with the
1175 standard C compiler; the stage 3 and 4 compilers may be usable.
1176
1177 It is best, however, to use an older version of GNU CC for
1178 bootstrapping if you have one.
1179
1180 `m88k-*-dgux'
1181 Motorola m88k running DG/UX. To build 88open BCS native or cross
1182 compilers on DG/UX, specify the configuration name as
1183 `m88k-*-dguxbcs' and build in the 88open BCS software development
1184 environment. To build ELF native or cross compilers on DG/UX,
1185 specify `m88k-*-dgux' and build in the DG/UX ELF development
1186 environment. You set the software development environment by
1187 issuing `sde-target' command and specifying either `m88kbcs' or
1188 `m88kdguxelf' as the operand.
1189
1190 If you do not specify a configuration name, `configure' guesses the
1191 configuration based on the current software development
1192 environment.
1193
1194 `m88k-tektronix-sysv3'
1195 Tektronix XD88 running UTekV 3.2e. Do not turn on optimization
1196 while building stage1 if you bootstrap with the buggy Green Hills
1197 compiler. Also, The bundled LAI System V NFS is buggy so if you
1198 build in an NFS mounted directory, start from a fresh reboot, or
1199 avoid NFS all together. Otherwise you may have trouble getting
1200 clean comparisons between stages.
1201
1202 `mips-mips-bsd'
1203 MIPS machines running the MIPS operating system in BSD mode. It's
1204 possible that some old versions of the system lack the functions
1205 `memcpy', `memcmp', and `memset'. If your system lacks these, you
1206 must remove or undo the definition of `TARGET_MEM_FUNCTIONS' in
1207 `mips-bsd.h'.
1208
1209 The MIPS C compiler needs to be told to increase its table size
1210 for switch statements with the `-Wf,-XNg1500' option in order to
1211 compile `cp/parse.c'. If you use the `-O2' optimization option,
1212 you also need to use `-Olimit 3000'. Both of these options are
1213 automatically generated in the `Makefile' that the shell script
1214 `configure' builds. If you override the `CC' make variable and
1215 use the MIPS compilers, you may need to add `-Wf,-XNg1500 -Olimit
1216 3000'.
1217
1218 `mips-mips-riscos*'
1219 The MIPS C compiler needs to be told to increase its table size
1220 for switch statements with the `-Wf,-XNg1500' option in order to
1221 compile `cp/parse.c'. If you use the `-O2' optimization option,
1222 you also need to use `-Olimit 3000'. Both of these options are
1223 automatically generated in the `Makefile' that the shell script
1224 `configure' builds. If you override the `CC' make variable and
1225 use the MIPS compilers, you may need to add `-Wf,-XNg1500 -Olimit
1226 3000'.
1227
1228 MIPS computers running RISC-OS can support four different
1229 personalities: default, BSD 4.3, System V.3, and System V.4 (older
1230 versions of RISC-OS don't support V.4). To configure GCC for
1231 these platforms use the following configurations:
1232
1233 `mips-mips-riscos`rev''
1234 Default configuration for RISC-OS, revision `rev'.
1235
1236 `mips-mips-riscos`rev'bsd'
1237 BSD 4.3 configuration for RISC-OS, revision `rev'.
1238
1239 `mips-mips-riscos`rev'sysv4'
1240 System V.4 configuration for RISC-OS, revision `rev'.
1241
1242 `mips-mips-riscos`rev'sysv'
1243 System V.3 configuration for RISC-OS, revision `rev'.
1244
1245 The revision `rev' mentioned above is the revision of RISC-OS to
1246 use. You must reconfigure GCC when going from a RISC-OS revision
1247 4 to RISC-OS revision 5. This has the effect of avoiding a linker
1248 bug.
1249
1250 `mips-sgi-*'
1251 In order to compile GCC on an SGI running IRIX 4, the "c.hdr.lib"
1252 option must be installed from the CD-ROM supplied from Silicon
1253 Graphics. This is found on the 2nd CD in release 4.0.1.
1254
1255 In order to compile GCC on an SGI running IRIX 5, the
1256 "compiler_dev.hdr" subsystem must be installed from the IDO CD-ROM
1257 supplied by Silicon Graphics.
1258
1259 `make compare' may fail on version 5 of IRIX unless you add
1260 `-save-temps' to `CFLAGS'. On these systems, the name of the
1261 assembler input file is stored in the object file, and that makes
1262 comparison fail if it differs between the `stage1' and `stage2'
1263 compilations. The option `-save-temps' forces a fixed name to be
1264 used for the assembler input file, instead of a randomly chosen
1265 name in `/tmp'. Do not add `-save-temps' unless the comparisons
1266 fail without that option. If you do you `-save-temps', you will
1267 have to manually delete the `.i' and `.s' files after each series
1268 of compilations.
1269
1270 The MIPS C compiler needs to be told to increase its table size
1271 for switch statements with the `-Wf,-XNg1500' option in order to
1272 compile `cp/parse.c'. If you use the `-O2' optimization option,
1273 you also need to use `-Olimit 3000'. Both of these options are
1274 automatically generated in the `Makefile' that the shell script
1275 `configure' builds. If you override the `CC' make variable and
1276 use the MIPS compilers, you may need to add `-Wf,-XNg1500 -Olimit
1277 3000'.
1278
1279 On Irix version 4.0.5F, and perhaps on some other versions as well,
1280 there is an assembler bug that reorders instructions incorrectly.
1281 To work around it, specify the target configuration
1282 `mips-sgi-irix4loser'. This configuration inhibits assembler
1283 optimization.
1284
1285 In a compiler configured with target `mips-sgi-irix4', you can turn
1286 off assembler optimization by using the `-noasmopt' option. This
1287 compiler option passes the option `-O0' to the assembler, to
1288 inhibit reordering.
1289
1290 The `-noasmopt' option can be useful for testing whether a problem
1291 is due to erroneous assembler reordering. Even if a problem does
1292 not go away with `-noasmopt', it may still be due to assembler
1293 reordering--perhaps GNU CC itself was miscompiled as a result.
1294
1295 To enable debugging under Irix 5, you must use GNU as 2.5 or later,
1296 and use the `--with-gnu-as' configure option when configuring gcc.
1297 GNU as is distributed as part of the binutils package.
1298
1299 `mips-sony-sysv'
1300 Sony MIPS NEWS. This works in NEWSOS 5.0.1, but not in 5.0.2
1301 (which uses ELF instead of COFF). Support for 5.0.2 will probably
1302 be provided soon by volunteers. In particular, the linker does
1303 not like the code generated by GCC when shared libraries are
1304 linked in.
1305
1306 `ns32k-encore'
1307 Encore ns32000 system. Encore systems are supported only under
1308 BSD.
1309
1310 `ns32k-*-genix'
1311 National Semiconductor ns32000 system. Genix has bugs in `alloca'
1312 and `malloc'; you must get the compiled versions of these from GNU
1313 Emacs.
1314
1315 `ns32k-sequent'
1316 Go to the Berkeley universe before compiling.
1317
1318 `ns32k-utek'
1319 UTEK ns32000 system ("merlin"). The C compiler that comes with
1320 this system cannot compile GNU CC; contact `tektronix!reed!mason'
1321 to get binaries of GNU CC for bootstrapping.
1322
1323 `romp-*-aos'
1324 `romp-*-mach'
1325 The only operating systems supported for the IBM RT PC are AOS and
1326 MACH. GNU CC does not support AIX running on the RT. We
1327 recommend you compile GNU CC with an earlier version of itself; if
1328 you compile GNU CC with `hc', the Metaware compiler, it will work,
1329 but you will get mismatches between the stage 2 and stage 3
1330 compilers in various files. These errors are minor differences in
1331 some floating-point constants and can be safely ignored; the stage
1332 3 compiler is correct.
1333
1334 `rs6000-*-aix'
1335 `powerpc-*-aix'
1336 Various early versions of each release of the IBM XLC compiler
1337 will not bootstrap GNU CC. Symptoms include differences between
1338 the stage2 and stage3 object files, and errors when compiling
1339 `libgcc.a' or `enquire'. Known problematic releases include:
1340 xlc-1.2.1.8, xlc-1.3.0.0 (distributed with AIX 3.2.5), and
1341 xlc-1.3.0.19. Both xlc-1.2.1.28 and xlc-1.3.0.24 (PTF 432238) are
1342 known to produce working versions of GNU CC, but most other recent
1343 releases correctly bootstrap GNU CC.
1344
1345 Release 4.3.0 of AIX and ones prior to AIX 3.2.4 include a version
1346 of the IBM assembler which does not accept debugging directives:
1347 assembler updates are available as PTFs. Also, if you are using
1348 AIX 3.2.5 or greater and the GNU assembler, you must have a
1349 version modified after October 16th, 1995 in order for the GNU C
1350 compiler to build. See the file `README.RS6000' for more details
1351 on any of these problems.
1352
1353 GNU CC does not yet support the 64-bit PowerPC instructions.
1354
1355 Objective C does not work on this architecture because it makes
1356 assumptions that are incompatible with the calling conventions.
1357
1358 AIX on the RS/6000 provides support (NLS) for environments outside
1359 of the United States. Compilers and assemblers use NLS to support
1360 locale-specific representations of various objects including
1361 floating-point numbers ("." vs "," for separating decimal
1362 fractions). There have been problems reported where the library
1363 linked with GNU CC does not produce the same floating-point
1364 formats that the assembler accepts. If you have this problem, set
1365 the LANG environment variable to "C" or "En_US".
1366
1367 Due to changes in the way that GNU CC invokes the binder (linker)
1368 for AIX 4.1, you may now receive warnings of duplicate symbols
1369 from the link step that were not reported before. The assembly
1370 files generated by GNU CC for AIX have always included multiple
1371 symbol definitions for certain global variable and function
1372 declarations in the original program. The warnings should not
1373 prevent the linker from producing a correct library or runnable
1374 executable.
1375
1376 By default, AIX 4.1 produces code that can be used on either Power
1377 or PowerPC processors.
1378
1379 You can specify a default version for the `-mcpu='CPU_TYPE switch
1380 by using the configure option `--with-cpu-'CPU_TYPE.
1381
1382 `powerpc-*-elf'
1383 `powerpc-*-sysv4'
1384 PowerPC system in big endian mode, running System V.4.
1385
1386 You can specify a default version for the `-mcpu='CPU_TYPE switch
1387 by using the configure option `--with-cpu-'CPU_TYPE.
1388
1389 `powerpc-*-linux-gnu'
1390 PowerPC system in big endian mode, running the Linux-based GNU
1391 system.
1392
1393 You can specify a default version for the `-mcpu='CPU_TYPE switch
1394 by using the configure option `--with-cpu-'CPU_TYPE.
1395
1396 `powerpc-*-eabiaix'
1397 Embedded PowerPC system in big endian mode with -mcall-aix
1398 selected as the default.
1399
1400 You can specify a default version for the `-mcpu='CPU_TYPE switch
1401 by using the configure option `--with-cpu-'CPU_TYPE.
1402
1403 `powerpc-*-eabisim'
1404 Embedded PowerPC system in big endian mode for use in running
1405 under the PSIM simulator.
1406
1407 You can specify a default version for the `-mcpu='CPU_TYPE switch
1408 by using the configure option `--with-cpu-'CPU_TYPE.
1409
1410 `powerpc-*-eabi'
1411 Embedded PowerPC system in big endian mode.
1412
1413 You can specify a default version for the `-mcpu='CPU_TYPE switch
1414 by using the configure option `--with-cpu-'CPU_TYPE.
1415
1416 `powerpcle-*-elf'
1417 `powerpcle-*-sysv4'
1418 PowerPC system in little endian mode, running System V.4.
1419
1420 You can specify a default version for the `-mcpu='CPU_TYPE switch
1421 by using the configure option `--with-cpu-'CPU_TYPE.
1422
1423 `powerpcle-*-solaris2*'
1424 PowerPC system in little endian mode, running Solaris 2.5.1 or
1425 higher.
1426
1427 You can specify a default version for the `-mcpu='CPU_TYPE switch
1428 by using the configure option `--with-cpu-'CPU_TYPE. Beta
1429 versions of the Sun 4.0 compiler do not seem to be able to build
1430 GNU CC correctly. There are also problems with the host assembler
1431 and linker that are fixed by using the GNU versions of these tools.
1432
1433 `powerpcle-*-eabisim'
1434 Embedded PowerPC system in little endian mode for use in running
1435 under the PSIM simulator.
1436
1437 `powerpcle-*-eabi'
1438 Embedded PowerPC system in little endian mode.
1439
1440 You can specify a default version for the `-mcpu='CPU_TYPE switch
1441 by using the configure option `--with-cpu-'CPU_TYPE.
1442
1443 `powerpcle-*-winnt'
1444 `powerpcle-*-pe'
1445 PowerPC system in little endian mode running Windows NT.
1446
1447 You can specify a default version for the `-mcpu='CPU_TYPE switch
1448 by using the configure option `--with-cpu-'CPU_TYPE.
1449
1450 `vax-dec-ultrix'
1451 Don't try compiling with Vax C (`vcc'). It produces incorrect code
1452 in some cases (for example, when `alloca' is used).
1453
1454 Meanwhile, compiling `cp/parse.c' with pcc does not work because of
1455 an internal table size limitation in that compiler. To avoid this
1456 problem, compile just the GNU C compiler first, and use it to
1457 recompile building all the languages that you want to run.
1458
1459 `sparc-sun-*'
1460 See *Note Sun Install::, for information on installing GNU CC on
1461 Sun systems.
1462
1463 `vax-dec-vms'
1464 See *Note VMS Install::, for details on how to install GNU CC on
1465 VMS.
1466
1467 `we32k-*-*'
1468 These computers are also known as the 3b2, 3b5, 3b20 and other
1469 similar names. (However, the 3b1 is actually a 68000; see *Note
1470 Configurations::.)
1471
1472 Don't use `-g' when compiling with the system's compiler. The
1473 system's linker seems to be unable to handle such a large program
1474 with debugging information.
1475
1476 The system's compiler runs out of capacity when compiling `stmt.c'
1477 in GNU CC. You can work around this by building `cpp' in GNU CC
1478 first, then use that instead of the system's preprocessor with the
1479 system's C compiler to compile `stmt.c'. Here is how:
1480
1481 mv /lib/cpp /lib/cpp.att
1482 cp cpp /lib/cpp.gnu
1483 echo '/lib/cpp.gnu -traditional ${1+"$@"}' > /lib/cpp
1484 chmod +x /lib/cpp
1485
1486 The system's compiler produces bad code for some of the GNU CC
1487 optimization files. So you must build the stage 2 compiler without
1488 optimization. Then build a stage 3 compiler with optimization.
1489 That executable should work. Here are the necessary commands:
1490
1491 make LANGUAGES=c CC=stage1/xgcc CFLAGS="-Bstage1/ -g"
1492 make stage2
1493 make CC=stage2/xgcc CFLAGS="-Bstage2/ -g -O"
1494
1495 You may need to raise the ULIMIT setting to build a C++ compiler,
1496 as the file `cc1plus' is larger than one megabyte.
1497
1498 Compilation in a Separate Directory
1499 ===================================
1500
1501 If you wish to build the object files and executables in a directory
1502 other than the one containing the source files, here is what you must
1503 do differently:
1504
1505 1. Make sure you have a version of Make that supports the `VPATH'
1506 feature. (GNU Make supports it, as do Make versions on most BSD
1507 systems.)
1508
1509 2. If you have ever run `configure' in the source directory, you must
1510 undo the configuration. Do this by running:
1511
1512 make distclean
1513
1514 3. Go to the directory in which you want to build the compiler before
1515 running `configure':
1516
1517 mkdir gcc-sun3
1518 cd gcc-sun3
1519
1520 On systems that do not support symbolic links, this directory must
1521 be on the same file system as the source code directory.
1522
1523 4. Specify where to find `configure' when you run it:
1524
1525 ../gcc/configure ...
1526
1527 This also tells `configure' where to find the compiler sources;
1528 `configure' takes the directory from the file name that was used to
1529 invoke it. But if you want to be sure, you can specify the source
1530 directory with the `--srcdir' option, like this:
1531
1532 ../gcc/configure --srcdir=../gcc OTHER OPTIONS
1533
1534 The directory you specify with `--srcdir' need not be the same as
1535 the one that `configure' is found in.
1536
1537 Now, you can run `make' in that directory. You need not repeat the
1538 configuration steps shown above, when ordinary source files change. You
1539 must, however, run `configure' again when the configuration files
1540 change, if your system does not support symbolic links.
1541
1542 Building and Installing a Cross-Compiler
1543 ========================================
1544
1545 GNU CC can function as a cross-compiler for many machines, but not
1546 all.
1547
1548 * Cross-compilers for the Mips as target using the Mips assembler
1549 currently do not work, because the auxiliary programs
1550 `mips-tdump.c' and `mips-tfile.c' can't be compiled on anything
1551 but a Mips. It does work to cross compile for a Mips if you use
1552 the GNU assembler and linker.
1553
1554 * Cross-compilers between machines with different floating point
1555 formats have not all been made to work. GNU CC now has a floating
1556 point emulator with which these can work, but each target machine
1557 description needs to be updated to take advantage of it.
1558
1559 * Cross-compilation between machines of different word sizes is
1560 somewhat problematic and sometimes does not work.
1561
1562 Since GNU CC generates assembler code, you probably need a
1563 cross-assembler that GNU CC can run, in order to produce object files.
1564 If you want to link on other than the target machine, you need a
1565 cross-linker as well. You also need header files and libraries suitable
1566 for the target machine that you can install on the host machine.
1567
1568 Steps of Cross-Compilation
1569 --------------------------
1570
1571 To compile and run a program using a cross-compiler involves several
1572 steps:
1573
1574 * Run the cross-compiler on the host machine to produce assembler
1575 files for the target machine. This requires header files for the
1576 target machine.
1577
1578 * Assemble the files produced by the cross-compiler. You can do this
1579 either with an assembler on the target machine, or with a
1580 cross-assembler on the host machine.
1581
1582 * Link those files to make an executable. You can do this either
1583 with a linker on the target machine, or with a cross-linker on the
1584 host machine. Whichever machine you use, you need libraries and
1585 certain startup files (typically `crt....o') for the target
1586 machine.
1587
1588 It is most convenient to do all of these steps on the same host
1589 machine, since then you can do it all with a single invocation of GNU
1590 CC. This requires a suitable cross-assembler and cross-linker. For
1591 some targets, the GNU assembler and linker are available.
1592
1593 Configuring a Cross-Compiler
1594 ----------------------------
1595
1596 To build GNU CC as a cross-compiler, you start out by running
1597 `configure'. Use the `--target=TARGET' to specify the target type. If
1598 `configure' was unable to correctly identify the system you are running
1599 on, also specify the `--build=BUILD' option. For example, here is how
1600 to configure for a cross-compiler that produces code for an HP 68030
1601 system running BSD on a system that `configure' can correctly identify:
1602
1603 ./configure --target=m68k-hp-bsd4.3
1604
1605 Tools and Libraries for a Cross-Compiler
1606 ----------------------------------------
1607
1608 If you have a cross-assembler and cross-linker available, you should
1609 install them now. Put them in the directory `/usr/local/TARGET/bin'.
1610 Here is a table of the tools you should put in this directory:
1611
1612 `as'
1613 This should be the cross-assembler.
1614
1615 `ld'
1616 This should be the cross-linker.
1617
1618 `ar'
1619 This should be the cross-archiver: a program which can manipulate
1620 archive files (linker libraries) in the target machine's format.
1621
1622 `ranlib'
1623 This should be a program to construct a symbol table in an archive
1624 file.
1625
1626 The installation of GNU CC will find these programs in that
1627 directory, and copy or link them to the proper place to for the
1628 cross-compiler to find them when run later.
1629
1630 The easiest way to provide these files is to build the Binutils
1631 package and GAS. Configure them with the same `--host' and `--target'
1632 options that you use for configuring GNU CC, then build and install
1633 them. They install their executables automatically into the proper
1634 directory. Alas, they do not support all the targets that GNU CC
1635 supports.
1636
1637 If you want to install libraries to use with the cross-compiler,
1638 such as a standard C library, put them in the directory
1639 `/usr/local/TARGET/lib'; installation of GNU CC copies all the files in
1640 that subdirectory into the proper place for GNU CC to find them and
1641 link with them. Here's an example of copying some libraries from a
1642 target machine:
1643
1644 ftp TARGET-MACHINE
1645 lcd /usr/local/TARGET/lib
1646 cd /lib
1647 get libc.a
1648 cd /usr/lib
1649 get libg.a
1650 get libm.a
1651 quit
1652
1653 The precise set of libraries you'll need, and their locations on the
1654 target machine, vary depending on its operating system.
1655
1656 Many targets require "start files" such as `crt0.o' and `crtn.o'
1657 which are linked into each executable; these too should be placed in
1658 `/usr/local/TARGET/lib'. There may be several alternatives for
1659 `crt0.o', for use with profiling or other compilation options. Check
1660 your target's definition of `STARTFILE_SPEC' to find out what start
1661 files it uses. Here's an example of copying these files from a target
1662 machine:
1663
1664 ftp TARGET-MACHINE
1665 lcd /usr/local/TARGET/lib
1666 prompt
1667 cd /lib
1668 mget *crt*.o
1669 cd /usr/lib
1670 mget *crt*.o
1671 quit
1672
1673 `libgcc.a' and Cross-Compilers
1674 ------------------------------
1675
1676 Code compiled by GNU CC uses certain runtime support functions
1677 implicitly. Some of these functions can be compiled successfully with
1678 GNU CC itself, but a few cannot be. These problem functions are in the
1679 source file `libgcc1.c'; the library made from them is called
1680 `libgcc1.a'.
1681
1682 When you build a native compiler, these functions are compiled with
1683 some other compiler-the one that you use for bootstrapping GNU CC.
1684 Presumably it knows how to open code these operations, or else knows how
1685 to call the run-time emulation facilities that the machine comes with.
1686 But this approach doesn't work for building a cross-compiler. The
1687 compiler that you use for building knows about the host system, not the
1688 target system.
1689
1690 So, when you build a cross-compiler you have to supply a suitable
1691 library `libgcc1.a' that does the job it is expected to do.
1692
1693 To compile `libgcc1.c' with the cross-compiler itself does not work.
1694 The functions in this file are supposed to implement arithmetic
1695 operations that GNU CC does not know how to open code for your target
1696 machine. If these functions are compiled with GNU CC itself, they will
1697 compile into infinite recursion.
1698
1699 On any given target, most of these functions are not needed. If GNU
1700 CC can open code an arithmetic operation, it will not call these
1701 functions to perform the operation. It is possible that on your target
1702 machine, none of these functions is needed. If so, you can supply an
1703 empty library as `libgcc1.a'.
1704
1705 Many targets need library support only for multiplication and
1706 division. If you are linking with a library that contains functions for
1707 multiplication and division, you can tell GNU CC to call them directly
1708 by defining the macros `MULSI3_LIBCALL', and the like. These macros
1709 need to be defined in the target description macro file. For some
1710 targets, they are defined already. This may be sufficient to avoid the
1711 need for libgcc1.a; if so, you can supply an empty library.
1712
1713 Some targets do not have floating point instructions; they need other
1714 functions in `libgcc1.a', which do floating arithmetic. Recent
1715 versions of GNU CC have a file which emulates floating point. With a
1716 certain amount of work, you should be able to construct a floating
1717 point emulator that can be used as `libgcc1.a'. Perhaps future
1718 versions will contain code to do this automatically and conveniently.
1719 That depends on whether someone wants to implement it.
1720
1721 Some embedded targets come with all the necessary `libgcc1.a'
1722 routines written in C or assembler. These targets build `libgcc1.a'
1723 automatically and you do not need to do anything special for them.
1724 Other embedded targets do not need any `libgcc1.a' routines since all
1725 the necessary operations are supported by the hardware.
1726
1727 If your target system has another C compiler, you can configure GNU
1728 CC as a native compiler on that machine, build just `libgcc1.a' with
1729 `make libgcc1.a' on that machine, and use the resulting file with the
1730 cross-compiler. To do this, execute the following on the target
1731 machine:
1732
1733 cd TARGET-BUILD-DIR
1734 ./configure --host=sparc --target=sun3
1735 make libgcc1.a
1736
1737 And then this on the host machine:
1738
1739 ftp TARGET-MACHINE
1740 binary
1741 cd TARGET-BUILD-DIR
1742 get libgcc1.a
1743 quit
1744
1745 Another way to provide the functions you need in `libgcc1.a' is to
1746 define the appropriate `perform_...' macros for those functions. If
1747 these definitions do not use the C arithmetic operators that they are
1748 meant to implement, you should be able to compile them with the
1749 cross-compiler you are building. (If these definitions already exist
1750 for your target file, then you are all set.)
1751
1752 To build `libgcc1.a' using the perform macros, use
1753 `LIBGCC1=libgcc1.a OLDCC=./xgcc' when building the compiler.
1754 Otherwise, you should place your replacement library under the name
1755 `libgcc1.a' in the directory in which you will build the
1756 cross-compiler, before you run `make'.
1757
1758 Cross-Compilers and Header Files
1759 --------------------------------
1760
1761 If you are cross-compiling a standalone program or a program for an
1762 embedded system, then you may not need any header files except the few
1763 that are part of GNU CC (and those of your program). However, if you
1764 intend to link your program with a standard C library such as `libc.a',
1765 then you probably need to compile with the header files that go with
1766 the library you use.
1767
1768 The GNU C compiler does not come with these files, because (1) they
1769 are system-specific, and (2) they belong in a C library, not in a
1770 compiler.
1771
1772 If the GNU C library supports your target machine, then you can get
1773 the header files from there (assuming you actually use the GNU library
1774 when you link your program).
1775
1776 If your target machine comes with a C compiler, it probably comes
1777 with suitable header files also. If you make these files accessible
1778 from the host machine, the cross-compiler can use them also.
1779
1780 Otherwise, you're on your own in finding header files to use when
1781 cross-compiling.
1782
1783 When you have found suitable header files, put them in the directory
1784 `/usr/local/TARGET/include', before building the cross compiler. Then
1785 installation will run fixincludes properly and install the corrected
1786 versions of the header files where the compiler will use them.
1787
1788 Provide the header files before you build the cross-compiler, because
1789 the build stage actually runs the cross-compiler to produce parts of
1790 `libgcc.a'. (These are the parts that *can* be compiled with GNU CC.)
1791 Some of them need suitable header files.
1792
1793 Here's an example showing how to copy the header files from a target
1794 machine. On the target machine, do this:
1795
1796 (cd /usr/include; tar cf - .) > tarfile
1797
1798 Then, on the host machine, do this:
1799
1800 ftp TARGET-MACHINE
1801 lcd /usr/local/TARGET/include
1802 get tarfile
1803 quit
1804 tar xf tarfile
1805
1806 Actually Building the Cross-Compiler
1807 ------------------------------------
1808
1809 Now you can proceed just as for compiling a single-machine compiler
1810 through the step of building stage 1. If you have not provided some
1811 sort of `libgcc1.a', then compilation will give up at the point where
1812 it needs that file, printing a suitable error message. If you do
1813 provide `libgcc1.a', then building the compiler will automatically
1814 compile and link a test program called `libgcc1-test'; if you get
1815 errors in the linking, it means that not all of the necessary routines
1816 in `libgcc1.a' are available.
1817
1818 You must provide the header file `float.h'. One way to do this is
1819 to compile `enquire' and run it on your target machine. The job of
1820 `enquire' is to run on the target machine and figure out by experiment
1821 the nature of its floating point representation. `enquire' records its
1822 findings in the header file `float.h'. If you can't produce this file
1823 by running `enquire' on the target machine, then you will need to come
1824 up with a suitable `float.h' in some other way (or else, avoid using it
1825 in your programs).
1826
1827 Do not try to build stage 2 for a cross-compiler. It doesn't work to
1828 rebuild GNU CC as a cross-compiler using the cross-compiler, because
1829 that would produce a program that runs on the target machine, not on the
1830 host. For example, if you compile a 386-to-68030 cross-compiler with
1831 itself, the result will not be right either for the 386 (because it was
1832 compiled into 68030 code) or for the 68030 (because it was configured
1833 for a 386 as the host). If you want to compile GNU CC into 68030 code,
1834 whether you compile it on a 68030 or with a cross-compiler on a 386, you
1835 must specify a 68030 as the host when you configure it.
1836
1837 To install the cross-compiler, use `make install', as usual.
1838
1839 Installing GNU CC on the Sun
1840 ============================
1841
1842 On Solaris, do not use the linker or other tools in `/usr/ucb' to
1843 build GNU CC. Use `/usr/ccs/bin'.
1844
1845 If the assembler reports `Error: misaligned data' when bootstrapping,
1846 you are probably using an obsolete version of the GNU assembler.
1847 Upgrade to the latest version of GNU `binutils', or use the Solaris
1848 assembler.
1849
1850 Make sure the environment variable `FLOAT_OPTION' is not set when
1851 you compile `libgcc.a'. If this option were set to `f68881' when
1852 `libgcc.a' is compiled, the resulting code would demand to be linked
1853 with a special startup file and would not link properly without special
1854 pains.
1855
1856 There is a bug in `alloca' in certain versions of the Sun library.
1857 To avoid this bug, install the binaries of GNU CC that were compiled by
1858 GNU CC. They use `alloca' as a built-in function and never the one in
1859 the library.
1860
1861 Some versions of the Sun compiler crash when compiling GNU CC. The
1862 problem is a segmentation fault in cpp. This problem seems to be due to
1863 the bulk of data in the environment variables. You may be able to avoid
1864 it by using the following command to compile GNU CC with Sun CC:
1865
1866 make CC="TERMCAP=x OBJS=x LIBFUNCS=x STAGESTUFF=x cc"
1867
1868 SunOS 4.1.3 and 4.1.3_U1 have bugs that can cause intermittent core
1869 dumps when compiling GNU CC. A common symptom is an internal compiler
1870 error which does not recur if you run it again. To fix the problem,
1871 install Sun recommended patch 100726 (for SunOS 4.1.3) or 101508 (for
1872 SunOS 4.1.3_U1), or upgrade to a later SunOS release.
1873
1874 Installing GNU CC on VMS
1875 ========================
1876
1877 The VMS version of GNU CC is distributed in a backup saveset
1878 containing both source code and precompiled binaries.
1879
1880 To install the `gcc' command so you can use the compiler easily, in
1881 the same manner as you use the VMS C compiler, you must install the VMS
1882 CLD file for GNU CC as follows:
1883
1884 1. Define the VMS logical names `GNU_CC' and `GNU_CC_INCLUDE' to
1885 point to the directories where the GNU CC executables
1886 (`gcc-cpp.exe', `gcc-cc1.exe', etc.) and the C include files are
1887 kept respectively. This should be done with the commands:
1888
1889 $ assign /system /translation=concealed -
1890 disk:[gcc.] gnu_cc
1891 $ assign /system /translation=concealed -
1892 disk:[gcc.include.] gnu_cc_include
1893
1894 with the appropriate disk and directory names. These commands can
1895 be placed in your system startup file so they will be executed
1896 whenever the machine is rebooted. You may, if you choose, do this
1897 via the `GCC_INSTALL.COM' script in the `[GCC]' directory.
1898
1899 2. Install the `GCC' command with the command line:
1900
1901 $ set command /table=sys$common:[syslib]dcltables -
1902 /output=sys$common:[syslib]dcltables gnu_cc:[000000]gcc
1903 $ install replace sys$common:[syslib]dcltables
1904
1905 3. To install the help file, do the following:
1906
1907 $ library/help sys$library:helplib.hlb gcc.hlp
1908
1909 Now you can invoke the compiler with a command like `gcc /verbose
1910 file.c', which is equivalent to the command `gcc -v -c file.c' in
1911 Unix.
1912
1913 If you wish to use GNU C++ you must first install GNU CC, and then
1914 perform the following steps:
1915
1916 1. Define the VMS logical name `GNU_GXX_INCLUDE' to point to the
1917 directory where the preprocessor will search for the C++ header
1918 files. This can be done with the command:
1919
1920 $ assign /system /translation=concealed -
1921 disk:[gcc.gxx_include.] gnu_gxx_include
1922
1923 with the appropriate disk and directory name. If you are going to
1924 be using a C++ runtime library, this is where its install
1925 procedure will install its header files.
1926
1927 2. Obtain the file `gcc-cc1plus.exe', and place this in the same
1928 directory that `gcc-cc1.exe' is kept.
1929
1930 The GNU C++ compiler can be invoked with a command like `gcc /plus
1931 /verbose file.cc', which is equivalent to the command `g++ -v -c
1932 file.cc' in Unix.
1933
1934 We try to put corresponding binaries and sources on the VMS
1935 distribution tape. But sometimes the binaries will be from an older
1936 version than the sources, because we don't always have time to update
1937 them. (Use the `/version' option to determine the version number of
1938 the binaries and compare it with the source file `version.c' to tell
1939 whether this is so.) In this case, you should use the binaries you get
1940 to recompile the sources. If you must recompile, here is how:
1941
1942 1. Execute the command procedure `vmsconfig.com' to set up the files
1943 `tm.h', `config.h', `aux-output.c', and `md.', and to create files
1944 `tconfig.h' and `hconfig.h'. This procedure also creates several
1945 linker option files used by `make-cc1.com' and a data file used by
1946 `make-l2.com'.
1947
1948 $ @vmsconfig.com
1949
1950 2. Setup the logical names and command tables as defined above. In
1951 addition, define the VMS logical name `GNU_BISON' to point at the
1952 to the directories where the Bison executable is kept. This
1953 should be done with the command:
1954
1955 $ assign /system /translation=concealed -
1956 disk:[bison.] gnu_bison
1957
1958 You may, if you choose, use the `INSTALL_BISON.COM' script in the
1959 `[BISON]' directory.
1960
1961 3. Install the `BISON' command with the command line:
1962
1963 $ set command /table=sys$common:[syslib]dcltables -
1964 /output=sys$common:[syslib]dcltables -
1965 gnu_bison:[000000]bison
1966 $ install replace sys$common:[syslib]dcltables
1967
1968 4. Type `@make-gcc' to recompile everything (alternatively, submit
1969 the file `make-gcc.com' to a batch queue). If you wish to build
1970 the GNU C++ compiler as well as the GNU CC compiler, you must
1971 first edit `make-gcc.com' and follow the instructions that appear
1972 in the comments.
1973
1974 5. In order to use GCC, you need a library of functions which GCC
1975 compiled code will call to perform certain tasks, and these
1976 functions are defined in the file `libgcc2.c'. To compile this
1977 you should use the command procedure `make-l2.com', which will
1978 generate the library `libgcc2.olb'. `libgcc2.olb' should be built
1979 using the compiler built from the same distribution that
1980 `libgcc2.c' came from, and `make-gcc.com' will automatically do
1981 all of this for you.
1982
1983 To install the library, use the following commands:
1984
1985 $ library gnu_cc:[000000]gcclib/delete=(new,eprintf)
1986 $ library gnu_cc:[000000]gcclib/delete=L_*
1987 $ library libgcc2/extract=*/output=libgcc2.obj
1988 $ library gnu_cc:[000000]gcclib libgcc2.obj
1989
1990 The first command simply removes old modules that will be replaced
1991 with modules from `libgcc2' under different module names. The
1992 modules `new' and `eprintf' may not actually be present in your
1993 `gcclib.olb'--if the VMS librarian complains about those modules
1994 not being present, simply ignore the message and continue on with
1995 the next command. The second command removes the modules that
1996 came from the previous version of the library `libgcc2.c'.
1997
1998 Whenever you update the compiler on your system, you should also
1999 update the library with the above procedure.
2000
2001 6. You may wish to build GCC in such a way that no files are written
2002 to the directory where the source files reside. An example would
2003 be the when the source files are on a read-only disk. In these
2004 cases, execute the following DCL commands (substituting your
2005 actual path names):
2006
2007 $ assign dua0:[gcc.build_dir.]/translation=concealed, -
2008 dua1:[gcc.source_dir.]/translation=concealed gcc_build
2009 $ set default gcc_build:[000000]
2010
2011 where the directory `dua1:[gcc.source_dir]' contains the source
2012 code, and the directory `dua0:[gcc.build_dir]' is meant to contain
2013 all of the generated object files and executables. Once you have
2014 done this, you can proceed building GCC as described above. (Keep
2015 in mind that `gcc_build' is a rooted logical name, and thus the
2016 device names in each element of the search list must be an actual
2017 physical device name rather than another rooted logical name).
2018
2019 7. *If you are building GNU CC with a previous version of GNU CC, you
2020 also should check to see that you have the newest version of the
2021 assembler*. In particular, GNU CC version 2 treats global constant
2022 variables slightly differently from GNU CC version 1, and GAS
2023 version 1.38.1 does not have the patches required to work with GCC
2024 version 2. If you use GAS 1.38.1, then `extern const' variables
2025 will not have the read-only bit set, and the linker will generate
2026 warning messages about mismatched psect attributes for these
2027 variables. These warning messages are merely a nuisance, and can
2028 safely be ignored.
2029
2030 If you are compiling with a version of GNU CC older than 1.33,
2031 specify `/DEFINE=("inline=")' as an option in all the
2032 compilations. This requires editing all the `gcc' commands in
2033 `make-cc1.com'. (The older versions had problems supporting
2034 `inline'.) Once you have a working 1.33 or newer GNU CC, you can
2035 change this file back.
2036
2037 8. If you want to build GNU CC with the VAX C compiler, you will need
2038 to make minor changes in `make-cccp.com' and `make-cc1.com' to
2039 choose alternate definitions of `CC', `CFLAGS', and `LIBS'. See
2040 comments in those files. However, you must also have a working
2041 version of the GNU assembler (GNU as, aka GAS) as it is used as
2042 the back-end for GNU CC to produce binary object modules and is
2043 not included in the GNU CC sources. GAS is also needed to compile
2044 `libgcc2' in order to build `gcclib' (see above); `make-l2.com'
2045 expects to be able to find it operational in
2046 `gnu_cc:[000000]gnu-as.exe'.
2047
2048 To use GNU CC on VMS, you need the VMS driver programs `gcc.exe',
2049 `gcc.com', and `gcc.cld'. They are distributed with the VMS
2050 binaries (`gcc-vms') rather than the GNU CC sources. GAS is also
2051 included in `gcc-vms', as is Bison.
2052
2053 Once you have successfully built GNU CC with VAX C, you should use
2054 the resulting compiler to rebuild itself. Before doing this, be
2055 sure to restore the `CC', `CFLAGS', and `LIBS' definitions in
2056 `make-cccp.com' and `make-cc1.com'. The second generation
2057 compiler will be able to take advantage of many optimizations that
2058 must be suppressed when building with other compilers.
2059
2060 Under previous versions of GNU CC, the generated code would
2061 occasionally give strange results when linked with the sharable
2062 `VAXCRTL' library. Now this should work.
2063
2064 Even with this version, however, GNU CC itself should not be linked
2065 with the sharable `VAXCRTL'. The version of `qsort' in `VAXCRTL' has a
2066 bug (known to be present in VMS versions V4.6 through V5.5) which
2067 causes the compiler to fail.
2068
2069 The executables are generated by `make-cc1.com' and `make-cccp.com'
2070 use the object library version of `VAXCRTL' in order to make use of the
2071 `qsort' routine in `gcclib.olb'. If you wish to link the compiler
2072 executables with the shareable image version of `VAXCRTL', you should
2073 edit the file `tm.h' (created by `vmsconfig.com') to define the macro
2074 `QSORT_WORKAROUND'.
2075
2076 `QSORT_WORKAROUND' is always defined when GNU CC is compiled with
2077 VAX C, to avoid a problem in case `gcclib.olb' is not yet available.
2078
2079 `collect2'
2080 ==========
2081
2082 GNU CC uses a utility called `collect2' on nearly all systems to
2083 arrange to call various initialization functions at start time.
2084
2085 The program `collect2' works by linking the program once and looking
2086 through the linker output file for symbols with particular names
2087 indicating they are constructor functions. If it finds any, it creates
2088 a new temporary `.c' file containing a table of them, compiles it, and
2089 links the program a second time including that file.
2090
2091 The actual calls to the constructors are carried out by a subroutine
2092 called `__main', which is called (automatically) at the beginning of
2093 the body of `main' (provided `main' was compiled with GNU CC). Calling
2094 `__main' is necessary, even when compiling C code, to allow linking C
2095 and C++ object code together. (If you use `-nostdlib', you get an
2096 unresolved reference to `__main', since it's defined in the standard
2097 GCC library. Include `-lgcc' at the end of your compiler command line
2098 to resolve this reference.)
2099
2100 The program `collect2' is installed as `ld' in the directory where
2101 the passes of the compiler are installed. When `collect2' needs to
2102 find the *real* `ld', it tries the following file names:
2103
2104 * `real-ld' in the directories listed in the compiler's search
2105 directories.
2106
2107 * `real-ld' in the directories listed in the environment variable
2108 `PATH'.
2109
2110 * The file specified in the `REAL_LD_FILE_NAME' configuration macro,
2111 if specified.
2112
2113 * `ld' in the compiler's search directories, except that `collect2'
2114 will not execute itself recursively.
2115
2116 * `ld' in `PATH'.
2117
2118 "The compiler's search directories" means all the directories where
2119 `gcc' searches for passes of the compiler. This includes directories
2120 that you specify with `-B'.
2121
2122 Cross-compilers search a little differently:
2123
2124 * `real-ld' in the compiler's search directories.
2125
2126 * `TARGET-real-ld' in `PATH'.
2127
2128 * The file specified in the `REAL_LD_FILE_NAME' configuration macro,
2129 if specified.
2130
2131 * `ld' in the compiler's search directories.
2132
2133 * `TARGET-ld' in `PATH'.
2134
2135 `collect2' explicitly avoids running `ld' using the file name under
2136 which `collect2' itself was invoked. In fact, it remembers up a list
2137 of such names--in case one copy of `collect2' finds another copy (or
2138 version) of `collect2' installed as `ld' in a second place in the
2139 search path.
2140
2141 `collect2' searches for the utilities `nm' and `strip' using the
2142 same algorithm as above for `ld'.
2143
2144 Standard Header File Directories
2145 ================================
2146
2147 `GCC_INCLUDE_DIR' means the same thing for native and cross. It is
2148 where GNU CC stores its private include files, and also where GNU CC
2149 stores the fixed include files. A cross compiled GNU CC runs
2150 `fixincludes' on the header files in `$(tooldir)/include'. (If the
2151 cross compilation header files need to be fixed, they must be installed
2152 before GNU CC is built. If the cross compilation header files are
2153 already suitable for ANSI C and GNU CC, nothing special need be done).
2154
2155 `GPLUSPLUS_INCLUDE_DIR' means the same thing for native and cross.
2156 It is where `g++' looks first for header files. The C++ library
2157 installs only target independent header files in that directory.
2158
2159 `LOCAL_INCLUDE_DIR' is used only for a native compiler. It is
2160 normally `/usr/local/include'. GNU CC searches this directory so that
2161 users can install header files in `/usr/local/include'.
2162
2163 `CROSS_INCLUDE_DIR' is used only for a cross compiler. GNU CC
2164 doesn't install anything there.
2165
2166 `TOOL_INCLUDE_DIR' is used for both native and cross compilers. It
2167 is the place for other packages to install header files that GNU CC will
2168 use. For a cross-compiler, this is the equivalent of `/usr/include'.
2169 When you build a cross-compiler, `fixincludes' processes any header
2170 files in this directory.
2171