|
|
1.1.1.2 ! root 1: This is Info file gcc.info, produced by Makeinfo-1.44 from the input 1.1 root 2: file gcc.texi. 3: 4: This file documents the use and the internals of the GNU compiler. 5: 6: Copyright (C) 1988, 1989, 1992 Free Software Foundation, Inc. 7: 8: Permission is granted to make and distribute verbatim copies of 9: this manual provided the copyright notice and this permission notice 10: are preserved on all copies. 11: 12: Permission is granted to copy and distribute modified versions of 13: this manual under the conditions for verbatim copying, provided also 14: that the section entitled "GNU General Public License" is included 15: exactly as in the original, and provided that the entire resulting 16: derived work is distributed under the terms of a permission notice 17: identical to this one. 18: 19: Permission is granted to copy and distribute translations of this 20: manual into another language, under the above conditions for modified 21: versions, except that the section entitled "GNU General Public 22: License" and this permission notice may be included in translations 23: approved by the Free Software Foundation instead of in the original 24: English. 25: 26: 27: File: gcc.info, Node: M88K Options, Next: RS/6000 Options, Prev: AMD29K Options, Up: Submodel Options 28: 29: M88K Options 30: ------------ 31: 32: These `-m' options are defined for Motorola 88K architectures: 33: 34: `-m88000' 35: Generate code that works well on both the m88100 and the m88110. 36: 37: `-m88100' 38: Generate code tha Generate code that works best for the m88100, 39: but that also runs on the m88110. 40: 41: `-m88110' 42: Generate code that works best for the m88110, and may not run on 43: the m88100. 44: 45: `-midentify-revision' 46: Include an `ident' directive in the assembler output recording the 47: source file name, compiler name and version, timestamp, and 48: compilation flags used. 49: 50: `-mno-underscores' 51: In assembler output, emit symbol names without adding an 52: underscore character at the beginning of each name. The default 53: is to use an underscore as prefix on each name. 54: 55: `-mocs-debug-info' 56: `-mno-ocs-debug-info' 57: Include (or omit) additional debugging information (about 58: registers used in each stack frame) as specified in the 88open 59: Object Compatibility Standard, "OCS". This extra information 60: allows debugging of code that has had the frame pointer 61: eliminated. The default for DG/UX, SVr4, and Delta 88 SVr3.2 is 62: to include this information; other 88k configurations omit this 63: information by default. 64: 65: `-mocs-frame-position' 66: When emitting COFF debugging information for automatic variables 67: and parameters stored on the stack, use the offset from the 68: canonical frame address, which is the stack pointer (register 31) 69: on entry to the function. The DG/UX, SVr4, Delta88 SVr3.2, and 70: BCS configurations use `-mocs-frame-position'; other 88k 71: configurations have the default `-mno-ocs-frame-position'. 72: 73: `-mno-ocs-frame-position' 74: When emitting COFF debugging information for automatic variables 75: and parameters stored on the stack, use the offset from the frame 76: pointer register (register 30). When this option is in effect, 77: the frame pointer is not eliminated when debugging information is 78: selected by the -g switch. 79: 80: `-moptimize-arg-area' 81: `-mno-optimize-arg-area' 82: Control how to store function arguments in stack frames. 83: `-moptimize-arg-area' saves space, but was ruled illegal by 84: 88open. `-mno-optimize-arg-area' conforms to the 88open 85: standards. By default GNU CC does not optimize the argument area. 86: 87: `-mshort-data-NUM' 88: Generate smaller data references by making them relative to `r0', 89: which allows loading a value using a single instruction (rather 90: than the usual two). You control which data references are 91: affected by specifying NUM with this option. For example, if you 92: specify `-mshort-data-512', then the data references affected are 93: those involving displacements of less than 512 bytes. 94: `-mshort-data-NUM' is not effective for NUM greater than 64K. 95: 96: `-msvr4' 97: `-msvr3' 98: Turn on (`-msvr4') or off (`-msvr3') compiler extensions related 99: to System V release 4 (SVr4). This controls the following: 100: 101: 1. Which variant of the assembler syntax to emit (which you can 102: select independently using `-mversion-03.00'). 103: 104: 2. `-msvr4' makes the C preprocessor recognize `#pragma weak' 105: that is used on System V release 4. 106: 107: 3. `-msvr4' makes GNU CC issue additional declaration 108: directives used in SVr4. 109: 110: `-msvr3' is the default for all m88K configurations except the 111: SVr4 configuration. 112: 113: `-mversion-03.00' 114: In the DG/UX configuration, there are two flavors of SVr4. This 115: option modifies `-msvr4' to select whether the hybrid-COFF or 116: real-ELF flavor is used. All other configurations ignore this 117: option. 118: 119: `-mno-check-zero-division' 120: `-mcheck-zero-division' 121: Early models of the 88K architecture had problems with division 122: by zero; in particular, many of them didn't trap. Use these 123: options to avoid including (or to include explicitly) additional 124: code to detect division by zero and signal an exception. All GNU 125: CC configurations for the 88K use `-mcheck-zero-division' by 126: default. 127: 128: `-muse-div-instruction' 129: Do not emit code to check both the divisor and dividend when doing 130: signed integer division to see if either is negative, and adjust 131: the signs so the divide is done using non-negative numbers. 132: Instead, rely on the operating system to calculate the correct 133: value when the `div' instruction traps. This results in 134: different behavior when the most negative number is divided by 135: -1, but is useful when most or all signed integer divisions are 136: done with positive numbers. 137: 138: `-mtrap-large-shift' 139: `-mhandle-large-shift' 140: Include code to detect bit-shifts of more than 31 bits; 141: respectively, trap such shifts or emit code to handle them 142: properly. By default GNU CC makes no special provision for large 143: bit shifts. 144: 145: `-mwarn-passed-structs' 146: Warn when a function passes a struct as an argument or result. 147: Structure-passing conventions have changed during the evolution 148: of the C language, and are often the source of portability 149: problems. By default, GNU CC issues no such warning. 150: 151: 152: File: gcc.info, Node: RS/6000 Options, Next: RT Options, Prev: M88K Options, Up: Submodel Options 153: 154: IBM RS/6000 Options 155: ------------------- 156: 157: Only one pair of `-m' options is defined for the IBM RS/6000: 158: 159: `-mfp-in-toc' 160: `-mno-fp-in-toc' 161: Control whether or not floating-point constants go in the Table of 162: Contents (TOC), a table of all global variable and function 163: addresses. By default GNU CC puts floating-point constants 164: there; if the TOC overflows, `-mno-fp-in-toc' will reduce the 165: size of the TOC, which may avoid the overflow. 166: 167: 168: File: gcc.info, Node: RT Options, Next: MIPS Options, Prev: RS/6000 Options, Up: Submodel Options 169: 170: IBM RT Options 171: -------------- 172: 173: These `-m' options are defined for the IBM RT PC: 174: 175: `-min-line-mul' 176: Use an in-line code sequence for integer multiplies. This is the 177: default. 178: 179: `-mcall-lib-mul' 180: Call `lmul$$' for integer multiples. 181: 182: `-mfull-fp-blocks' 183: Generate full-size floating point data blocks, including the 184: minimum amount of scratch space recommended by IBM. This is the 185: default. 186: 187: `-mminimum-fp-blocks' 188: Do not include extra scratch space in floating point data blocks. 189: This results in smaller code, but slower execution, since 190: scratch space must be allocated dynamically. 191: 192: `-mfp-arg-in-fpregs' 193: Use a calling sequence incompatible with the IBM calling 194: convention in which floating point arguments are passed in 195: floating point registers. Note that `varargs.h' and `stdargs.h' 196: will not work with floating point operands if this option is 197: specified. 198: 199: `-mfp-arg-in-gregs' 200: Use the normal calling convention for floating point arguments. 201: This is the default. 202: 203: `-mhc-struct-return' 204: Return structures of more than one word in memory, rather than in 205: a register. This provides compatibility with the MetaWare HighC 206: (hc) compiler. Use `-fpcc-struct-return' for compatibility with 207: the Portable C Compiler (pcc). 208: 209: `-mnohc-struct-return' 210: Return some structures of more than one word in registers, when 211: convenient. This is the default. For compatibility with the 212: IBM-supplied compilers, use either `-fpcc-struct-return' or 213: `-mhc-struct-return'. 214: 215: 1.1.1.2 ! root 216: File: gcc.info, Node: MIPS Options, Next: i386 Options, Prev: RT Options, Up: Submodel Options 1.1 root 217: 218: MIPS Options 219: ------------ 220: 221: These `-m' options are defined for the MIPS family of computers: 222: 223: `-mcpu=CPU TYPE' 224: Assume the defaults for the machine type CPU TYPE when scheduling 1.1.1.2 ! root 225: instructions. The default CPU TYPE is `default', which picks the 1.1 root 226: longest cycles times for any of the machines, in order that the 227: code run at reasonable rates on all MIPS cpu's. Other choices 228: for CPU TYPE are `r2000', `r3000', `r4000', and `r6000'. While 229: picking a specific CPU TYPE will schedule things appropriately 230: for that particular chip, the compiler will not generate any code 231: that does not meet level 1 of the MIPS ISA (instruction set 232: architecture) without the `-mips2' or `-mips3' switches being 233: used. 234: 235: `-mips2' 236: Issue instructions from level 2 of the MIPS ISA (branch likely, 237: square root instructions). The `-mcpu=r4000' or `-mcpu=r6000' 238: switch must be used in conjuction with `-mips2'. 239: 240: `-mips3' 241: Issue instructions from level 3 of the MIPS ISA (64 bit 242: instructions). You must use the `-mcpu=r4000' switch along with 243: `-mips3'. 244: 245: `-mint64' 246: `-mlong64' 247: `-mlonglong128' 248: These options don't work at present. 249: 250: `-mmips-as' 251: Generate code for the MIPS assembler, and invoke `mips-tfile' to 252: add normal debug information. This is the default for all 253: platforms except for the OSF/1 reference platform, using the 254: OSF/rose object format. If the either of the `-gstabs' or 255: `-gstabs+' switches are used, the `mips-tfile' program will 256: encapsulate the stabs within MIPS ECOFF. 257: 258: `-mgas' 259: Generate code for the GNU assembler. This is the default on the 260: OSF/1 reference platform, using the OSF/rose object format. 261: 262: `-mrnames' 263: `-mno-rnames' 264: The `-mrnames' switch says to output code using the MIPS software 265: names for the registers, instead of the hardware names (ie, A0 266: instead of $4). The GNU assembler does not support the 267: `-mrnames' switch, and the MIPS assembler will be instructed to 268: run the MIPS C preprocessor over the source file. The 269: `-mno-rnames' switch is default. 270: 271: `-mgpopt' 272: `-mno-gpopt' 273: The `-mgpopt' switch says to write all of the data declarations 1.1.1.2 ! root 274: before the instructions in the text section, this allows the MIPS 1.1 root 275: assembler to generate one word memory references instead of using 276: two words for short global or static data items. This is on by 277: default if optimization is selected. 278: 279: `-mstats' 280: `-mno-stats' 281: For each non-inline function processed, the `-mstats' switch 282: causes the compiler to emit one line to the standard error file to 283: print statistics about the program (number of registers saved, 284: stack size, etc.). 285: 286: `-mmemcpy' 287: `-mno-memcpy' 288: The `-mmemcpy' switch makes all block moves call the appropriate 289: string function (`memcpy' or `bcopy') instead of possibly 290: generating inline code. 291: 292: `-mmips-tfile' 293: `-mno-mips-tfile' 294: The `-mno-mips-tfile' switch causes the compiler not postprocess 295: the object file with the `mips-tfile' program, after the MIPS 296: assembler has generated it to add debug support. If `mips-tfile' 297: is not run, then no local variables will be available to the 298: debugger. In addition, `stage2' and `stage3' objects will have 299: the temporary file names passed to the assembler embedded in the 1.1.1.2 ! root 300: object file, which means the objects will not compare the same. ! 301: The `-mno-mips-tfile' switch should only be used when there are ! 302: bugs in the `mips-tfile' program that prevents compilation. 1.1 root 303: 304: `-msoft-float' 305: Generate output containing library calls for floating point. 306: *Warning:* the requisite libraries are not part of GNU CC. 307: Normally the facilities of the machine's usual C compiler are 308: used, but this can't be done directly in cross-compilation. You 309: must make your own arrangements to provide suitable library 310: functions for cross-compilation. 311: 312: `-mhard-float' 313: Generate output containing floating point instructions. This is 314: the default if you use the unmodified sources. 315: 316: `-mfp64' 317: Assume that the FR bit in the status word is on, and that there 318: are 32 64-bit floating point registers, instead of 32 32-bit 319: floating point registers. You must also specify the 320: `-mcpu=r4000' and `-mips3' switches. 321: 322: `-mfp32' 323: Assume that there are 32 32-bit floating point registers. This 324: is the default. 325: 326: `-mabicalls' 327: `-mno-abicalls' 328: Emit the `.abicalls', `.cpload', and `.cprestore' pseudo 329: operations that some System V.4 ports use for position 330: independent code. 331: 332: `-mhalf-pic' 333: `-mno-half-pic' 334: Put pointers to extern references into the data section and load 335: them up, rather than put the references in the text section. 336: These options do not work at present. 337: 338: `-G NUM' 339: Put global and static items less than or equal to NUM bytes into 340: the small data or bss sections instead of the normal data or bss 341: section. This allows the assembler to emit one word memory 342: reference instructions based on the global pointer (GP or $28), 343: instead of the normal two words used. By default, NUM is 8 when 344: the MIPS assembler is used, and 0 when the GNU assembler is used. 345: The `-G NUM' switch is also passed to the assembler and linker. 346: All modules should be compiled with the same `-G NUM' value. 347: 1.1.1.2 ! root 348: `-nocpp' ! 349: Tell the MIPS assembler to not run it's preprocessor over user ! 350: assembler files (with a `.s' suffix) when assembling them. ! 351: 1.1 root 352: These options are defined by the macro `TARGET_SWITCHES' in the 353: machine description. The default for the options is also defined by 354: that macro, which enables you to change the defaults. 355: 356: 1.1.1.2 ! root 357: File: gcc.info, Node: i386 Options, Prev: MIPS Options, Up: Submodel Options ! 358: ! 359: Intel 386 Options ! 360: ----------------- ! 361: ! 362: These `-m' options are defined for the i386 family of computers: ! 363: ! 364: `-m486' ! 365: `-mno486' ! 366: Control whether or not code is optimized for a 486 instead of an ! 367: 386. Code generated for an 486 will run on a 386 and vice versa. ! 368: ! 369: `-msoft-float' ! 370: Generate output containing library calls for floating point. ! 371: *Warning:* the requisite libraries are not part of GNU CC. ! 372: Normally the facilities of the machine's usual C compiler are ! 373: used, but this can't be done directly in cross-compilation. You ! 374: must make your own arrangements to provide suitable library ! 375: functions for cross-compilation. ! 376: ! 377: On machines where a function returnings float point results in ! 378: the 80387 register stack, some floating point opcodes may be ! 379: emitted even if `-msoft-float' is used. ! 380: ! 381: 1.1 root 382: File: gcc.info, Node: Code Gen Options, Next: Environment Variables, Prev: Submodel Options, Up: Invoking GCC 383: 384: Options for Code Generation Conventions 385: ======================================= 386: 387: These machine-independent options control the interface conventions 388: used in code generation. 389: 390: Most of them have both positive and negative forms; the negative 391: form of `-ffoo' would be `-fno-foo'. In the table below, only one of 392: the forms is listed--the one which is not the default. You can figure 393: out the other form by either removing `no-' or adding it. 394: 395: `-fpcc-struct-return' 396: Use the same convention for returning `struct' and `union' values 397: that is used by the usual C compiler on your system. This 398: convention is less efficient for small structures, and on many 399: machines it fails to be reentrant; but it has the advantage of 400: allowing intercallability between GNU CC-compiled code and 401: PCC-compiled code. 402: 403: `-fshort-enums' 404: Allocate to an `enum' type only as many bytes as it needs for the 405: declared range of possible values. Specifically, the `enum' type 406: will be equivalent to the smallest integer type which has enough 407: room. 408: 409: `-fshort-double' 410: Use the same size for `double' as for `float'. 411: 412: `-fshared-data' 413: Requests that the data and non-`const' variables of this 414: compilation be shared data rather than private data. The 415: distinction makes sense only on certain operating systems, where 416: shared data is shared between processes running the same program, 417: while private data exists in one copy per process. 418: 419: `-fno-common' 420: Allocate even uninitialized global variables in the bss section 421: of the object file, rather than generating them as common blocks. 422: This has the effect that if the same variable is declared 423: (without `extern') in two different compilations, you will get an 424: error when you link them. The only reason this might be useful 425: is if you wish to verify that the program will work on other 426: systems which always work this way. 427: 428: `-fno-ident' 429: Ignore the `#ident' directive. 430: 431: `-fno-gnu-linker' 432: Don't output global initializations such as C++ constructors and 433: destructors in the form used by the GNU linker (on systems where 434: the GNU linker is the standard method of handling them). Use 435: this option when you want to use a "collect" program and a 436: non-GNU linker. 437: 438: `-finhibit-size-directive' 439: Don't output a `.size' assembler directive, or anything else that 440: would cause trouble if the function is split in the middle, and 441: the two halves are placed at locations far apart in memory. This 442: option is used when compiling `crtstuff.c'; you should not need 443: to use it for anything else. 444: 445: `-fvolatile' 446: Consider all memory references through pointers to be volatile. 447: 448: `-fpic' 449: If supported for the target machines, generate 450: position-independent code, suitable for use in a shared library. 451: All addresses will be accessed through a global offset table 452: (GOT). If the GOT size for the linked executable exceeds a 453: machine-specific maximum size, you will get an error message from 454: the linker indicating that `-fpic' does not work; recompile with 455: `-fPIC' instead. (These maximums are 16k on the m88k, 8k on the 456: Sparc, and 32k on the m68k and RS/6000. The 386 has no such 457: limit.) 458: 459: Position-independent code requires special support, and therefore 460: works only on certain machines. Code generated for the IBM 461: RS/6000 is always position-independent. 462: 1.1.1.2 ! root 463: The GNU assembler does not fully support PIC. Currently, you ! 464: must use some other assembler in order for PIC to work. We would ! 465: welcome volunteers to upgrade GAS to handle this; the first part ! 466: of the job is to figure out what the assembler must do ! 467: differently. ! 468: 1.1 root 469: `-fPIC' 470: If supported for the target machine, emit position-independent 471: code, suitable for dynamic linking and avoiding any limit on the 472: size of the global offset table. This option makes a difference 473: on the m68k, m88k and the Sparc. 474: 475: Position-independent code requires special support, and therefore 476: works only on certain machines. 477: 478: `-ffixed-REG' 479: Treat the register named REG as a fixed register; generated code 480: should never refer to it (except perhaps as a stack pointer, frame 481: pointer or in some other fixed role). 482: 483: REG must be the name of a register. The register names accepted 484: are machine-specific and are defined in the `REGISTER_NAMES' 485: macro in the machine description macro file. 486: 487: This flag does not have a negative form, because it specifies a 488: three-way choice. 489: 490: `-fcall-used-REG' 491: Treat the register named REG as an allocatable register that is 492: clobbered by function calls. It may be allocated for temporaries 493: or variables that do not live across a call. Functions compiled 494: this way will not save and restore the register REG. 495: 496: Use of this flag for a register that has a fixed pervasive role 497: in the machine's execution model, such as the stack pointer or 498: frame pointer, will produce disastrous results. 499: 500: This flag does not have a negative form, because it specifies a 501: three-way choice. 502: 503: `-fcall-saved-REG' 504: Treat the register named REG as an allocatable register saved by 505: functions. It may be allocated even for temporaries or variables 506: that live across a call. Functions compiled this way will save 507: and restore the register REG if they use it. 508: 509: Use of this flag for a register that has a fixed pervasive role 510: in the machine's execution model, such as the stack pointer or 511: frame pointer, will produce disastrous results. 512: 513: A different sort of disaster will result from the use of this 514: flag for a register in which function values may be returned. 515: 516: This flag does not have a negative form, because it specifies a 517: three-way choice. 518: 519: 520: File: gcc.info, Node: Environment Variables, Prev: Code Gen Options, Up: Invoking GCC 521: 522: Environment Variables Affecting GNU CC 523: ====================================== 524: 525: This section describes several environment variables that affect 526: how GNU CC operates. They work by specifying directories or prefixes 527: to use when searching for various kinds of files. 528: 529: Note that you can also specify places to search using options such 530: as `-B', `-I' and `-L' (*note Directory Options::.). These take 531: precedence over places specified using environment variables, which in 532: turn take precedence over those specified by the configuration of GNU 533: CC. *Note Driver::. 534: 535: `TMPDIR' 536: If `TMPDIR' is set, it specifies the directory to use for 537: temporary files. GNU CC uses temporary files to hold the output 538: of one stage of compilation which is to be used as input to the 539: next stage: for example, the output of the preprocessor, which is 540: the input to the compiler proper. 541: 542: `GCC_EXEC_PREFIX' 543: If `GCC_EXEC_PREFIX' is set, it specifies a prefix to use in the 544: names of the subprograms executed by the compiler. No slash is 545: added when this prefix is combined with the name of a subprogram, 546: but you can specify a prefix that ends with a slash if you wish. 547: 548: If GNU CC cannot find the subprogram using the specified prefix, 549: it tries looking in the usual places for the subprogram. 550: 551: Other prefixes specified with `-B' take precedence over this 552: prefix. 553: 554: This prefix is also used for finding files such as `crt0.o' that 555: are used for linking. 556: 557: In addition, the prefix is used in an unusual way in finding the 558: directories to search for header files. For each of the standard 1.1.1.2 ! root 559: directories whose name normally begins with ! 560: `/usr/local/lib/gcc-lib' (more precisely, with the value of ! 561: `GCC_INCLUDE_DIR'), GNU CC tries replacing that beginning with ! 562: the specified prefix to produce an alternate directory name. ! 563: Thus, with `-Bfoo/', GNU CC will search `foo/bar' where it would ! 564: normally search `/usr/local/lib/bar'. These alternate ! 565: directories are searched first; the standard directories come ! 566: next. 1.1 root 567: 568: `COMPILER_PATH' 569: The value of `COMPILER_PATH' is a colon-separated list of 570: directories, much like `PATH'. GNU CC tries the directories thus 571: specified when searching for subprograms, if it can't find the 572: subprograms using `GCC_EXEC_PREFIX'. 573: 574: `LIBRARY_PATH' 575: The value of `LIBRARY_PATH' is a colon-separated list of 576: directories, much like `PATH'. GNU CC tries the directories thus 577: specified when searching for special linker files, if it can't 578: find them using `GCC_EXEC_PREFIX'. Linking using GNU CC also 579: uses these directories when searching for ordinary libraries for 580: the `-l' option (but directories specified with `-L' come first). 581: 582: `C_INCLUDE_PATH' 1.1.1.2 ! root 583: `CPLUS_INCLUDE_PATH' 1.1 root 584: `OBJC_INCLUDE_PATH' 585: These environment variables pertain to particular languages. Each 586: variable's value is a colon-separated list of directories, much 587: like `PATH'. When GNU CC searches for header files, it tries the 588: directories listed in the variable for the language you are 589: using, after the directories specified with `-I' but before the 590: standard header file directories. 591: 592: `DEPENDENCIES_OUTPUT' 593: If this variable is set, its value specifies how to output 594: dependencies for Make based on the header files processed by the 595: compiler. This output looks much like the output from the `-M' 596: option (*note Preprocessor Options::.), but it goes to a separate 597: file, and is in addition to the usual results of compilation. 598: 599: The value of `DEPENDENCIES_OUTPUT' can be just a file name, in 600: which case the Make rules are written to that file, guessing the 601: target name from the source file name. Or the value can have the 602: form `FILE TARGET', in which case the rules are written to file 603: FILE using TARGET as the target name. 604: 605: 606: File: gcc.info, Node: Installation, Next: Trouble, Prev: Invoking GCC, Up: Top 607: 608: Installing GNU CC 609: ***************** 610: 611: Here is the procedure for installing GNU CC on a Unix system. 612: 613: * Menu: 614: 615: * Other Dir:: Compiling in a separate directory (not where the source is). 616: * Sun Install:: See below for installation on the Sun. 617: * 3B1 Install:: See below for installation on the 3B1. 618: * VMS Install:: See below for installation on VMS. 619: * Unos Install:: See below for installation on Unos (from CRDS). 620: 621: 1. If you have built GNU CC previously in the same directory for a 1.1.1.2 ! root 622: different target machine, do `make distclean' to delete all files ! 623: that might be invalid. 1.1 root 624: 625: 2. On a Sequent system, go to the Berkeley universe. 626: 627: 3. On a System V release 4 system, make sure `/usr/bin' precedes 628: `/usr/ucb' in `PATH'. The `cc' command in `/usr/ucb' uses 629: libraries which have bugs. 630: 631: 4. Specify the host and target machine configurations. You do this 632: by running the file `configure' with appropriate arguments. 633: 634: If you are building a compiler to produce code for the machine 635: it runs on, specify just one machine type. To build a 636: cross-compiler, specify two configurations, one for the "host 637: machine" (which the compiler runs on), and one for the "target 638: machine" (which the compiler produces code for). The command 639: looks like this: 640: 641: configure --host=sun3-sunos3 --target=sparc-sun-sunos4.1 642: 643: A configuration name may be canonical or it may be more or less 644: abbreviated. 645: 646: A canonical configuration name has three parts, separated by 647: dashes. It looks like this: `CPU-COMPANY-SYSTEM'. (The three 648: parts may themselves contain dashes; `configure' can figure out 649: which dashes serve which purpose.) For example, 650: `m68k-sun-sunos4.1' specifies a Sun 3. 651: 652: You can also replace parts of the configuration by nicknames 653: or aliases. For example, `sun3' stands for `m68k-sun', so 654: `sun3-sunos4.1' is another way to specify a Sun 3. You can also 1.1.1.2 ! root 655: use simply `sun3-sunos', since the version of SunOS is assumed by 1.1 root 656: default to be version 4. `sun3-bsd' also works, since 1.1.1.2 ! root 657: `configure' knows that the only BSD variant on a Sun 3 is SunOS. 1.1 root 658: 659: You can specify a version number after any of the system 660: types, and some of the CPU types. In most cases, the version is 661: irrelevant, and will be ignored. So you might as well specify 662: the version if you know it. 663: 664: Here are the possible CPU types: 665: 666: a29k, arm, cN, hppa, i386, i860, m68000, m68k, m88k, mips, 667: ns32k, romp, rs6000, sparc, vax. 668: 669: Here are the recognized company names. As you can see, 670: customary abbreviations are used rather than the longer official 671: names. 672: 673: alliant, altos, apollo, att, convergent, convex, crds, dec, 674: dg, encore, harris, hp, ibm, mips, motorola, ncr, next, ns, 675: omron, sequent, sgi, sony, sun, tti, unicom. 676: 677: The company name is meaningful only to disambiguate when the 678: rest of the information supplied is insufficient. You can omit 679: it, writing just `CPU-SYSTEM', if it is not needed. For example, 680: `vax-ultrix4.2' is equivalent to `vax-dec-ultrix4.2'. 681: 682: Here is a list of system types: 683: 1.1.1.2 ! root 684: bsd, sysv, mach, minix, genix, ultrix, vms, sco, isc, aix, ! 685: sunos, hpux, unos, luna, dgux, newsos, osfrose, osf, dynix, ! 686: aos, ctix. 1.1 root 687: 688: You can omit the system type; then `configure' guesses the 689: operating system from the CPU and company. 690: 1.1.1.2 ! root 691: You can add a version number to the system type; this may or ! 692: may not make a difference. For example, you can write `bsd4.3' or ! 693: `bsd4.4' to distinguish versions of BSD. In practice, the version ! 694: number is most needed for `sysv3' and `sysv4', which are often ! 695: treated differently. ! 696: ! 697: If you specify an impossible combination such as `i860-dg-vms', ! 698: then you may get an error message from `configure', or it may ! 699: ignore part of the information and do the best it can with the ! 700: rest. `configure' always prints the canonical name for the ! 701: alternative that it used. ! 702: ! 703: Often a particular model of machine has a name. Many machine ! 704: names are recognized as aliases for CPU/company combinations. ! 705: Thus, the machine name `sun3', mentioned above, is an alias for ! 706: `m68k-sun'. Sometimes we accept a company name as a machine ! 707: name, when the name is popularly used for a particular machine. ! 708: Here is a table of the known machine names: 1.1 root 709: 710: 3300, 3b1, 7300, altos3068, altos, apollo68, att-7300, 711: balance, convex-cN, crds, decstation-3100, decstation-dec, 712: decstation, delta, encore, gmicro, hp7NN, hp8NN, hp9k2NN, 713: hp9k3NN, hp9k7NN, hp9k8NN, iris4d, iris, isi68, m3230, 714: magnum, merlin, miniframe, mmax, news-3600, news800, news, 715: next, pbd, pc532, pmax, ps2, risc-news, rtpc, sun2, sun386i, 716: sun386, sun3, sun4, symmetry, tower-32, tower. 717: 1.1.1.2 ! root 718: Remember that a machine name specifies both the cpu type and the ! 719: company name. 1.1 root 720: 721: On certain systems, you must specify whether you want GNU CC 722: to work with the usual compilation tools or with the GNU 723: compilation tools (including GAS). Use the `--gas' argument when 724: you run `configure', if you want to use the GNU tools. The 725: systems were this makes a difference are `i386-ANYTHING-sysv', 726: `i860-ANYTHING-bsd', `m68k-hp-hpux', `m68k-sony-bsd', 727: `m68k-altos-sysv', `m68000-hp-hpux', and `m68000-att-sysv'. On 728: any other system, `--gas' has no effect. 729: 730: On certain systems, you must specify whether the machine has a 731: floating point unit. These systems are `m68k-sun-sunosN' and 732: `m68k-isi-bsd'. On any other system, `--nfp' currently has no 733: effect, though perhaps there are other systems where it could 734: usefully make a difference. 735: 736: If you want to install your own homemade configuration files, 737: you can use `local' as the company name to access them. If you 738: use configuration `CPU-local', the entire configuration name is 739: used to form the configuration file names. 740: 741: Thus, if you specify `m68k-local', then the files used are 742: `m68k-local.md', `m68k-local.h', `m68k-local.c', 743: `xm-m68k-local.h', `t-m68k-local', and `x-m68k-local'. 744: 1.1.1.2 ! root 745: Here is a list of configurations that have special treatment ! 746: or special things you must know: ! 747: ! 748: `hppa-hp-hpux' ! 749: HP precision architecture, running HP-UX. `-g' does not work ! 750: on this configuration, since the system uses a peculiar ! 751: debugging format which GNU CC does not know about. ! 752: ! 753: `i386-*-sco' ! 754: Compilation with RCC is recommended, but it produces lots of ! 755: spurious warnings. They do not necessarily indicate that ! 756: anything is wrong. 1.1 root 757: 758: `m68000-att' 759: AT&T 3b1, a.k.a. 7300 PC. Special procedures are needed to 760: compile GNU CC with this machine's standard C compiler, due 761: to bugs in that compiler. *Note 3b1 Install::. You can 762: bootstrap it more easily with previous versions of GNU CC if 763: you have them. 764: 765: `m68000-hp-bsd' 766: HP 9000 series 200 running BSD. Note that the C compiler 767: that comes with this system cannot compile GNU CC; contact 768: `[email protected]' to get binaries of GNU CC for bootstrapping. 769: 770: `m68k-altos' 771: Altos 3068. You must use the GNU assembler, linker and 772: debugger, with COFF-encapsulation. Also, you must fix a 773: kernel bug. Details in the file `ALTOS-README'. 774: 775: `m68k-hp-hpux' 1.1.1.2 ! root 776: HP 9000 series 300 or 400 running HP-UX. HP-UX version 8.0 ! 777: has a bug in the assembler that prevents compilation of GNU ! 778: CC. To fix it, get patch PHCO_0800 from HP. ! 779: ! 780: In addition, `--gas' does not currently work with this ! 781: configuration. Changes in HP-UX have broken the library ! 782: conversion tool and the linker. 1.1 root 783: 784: `m68k-sun' 785: Sun 3. We do not provide a configuration file to use the 786: Sun FPA by default, because programs that establish signal 787: handlers for floating point traps inherently cannot work 788: with the FPA. 789: 790: `m88k-dgux' 791: Motorola m88k running DG/UX. To build native or cross 792: compilers on DG/UX, you must first change to the 88open BCS 793: software development environment. This is done by issuing 794: this command: 795: 796: eval `sde-target m88kbcs` 797: 1.1.1.2 ! root 798: `mips-mips-bsd' ! 799: MIPS machines running the MIPS operating system in BSD mode. ! 800: It's possible that some old versions of the system lack the ! 801: functions `memcpy', `memcmp', and `memset'. If your system ! 802: lacks these, you must remove or undo the definition of ! 803: `TARGET_MEM_FUNCTIONS' in `mips-bsd.h'. ! 804: 1.1 root 805: `ns32k-encore' 806: Encore ns32000 system. Encore systems are supported only 807: under BSD. 808: 809: `ns32k-*-genix' 810: National Semiconductor ns32000 system. Genix has bugs in 811: `alloca' and `malloc'; you must get the compiled versions of 812: these from GNU Emacs. 813: 814: `ns32k-utek' 815: UTEK ns32000 system ("merlin"). The C compiler that comes 816: with this system cannot compile GNU CC; contact 817: `tektronix!reed!mason' to get binaries of GNU CC for 818: bootstrapping. 819: 1.1.1.2 ! root 820: `pyramid' ! 821: The Pyramid C compler is reported to be unable to compile ! 822: GNU CC. You must use an older version of GNU CC for ! 823: bootstrapping. 1.1 root 824: 825: `vax-dec-ultrix' 826: Don't try compiling with Vax C (`vcc'). It produces 827: incorrect code in some cases (for example, when `alloca' is 828: used). 829: 830: Meanwhile, compiling `cp-parse.c' with pcc does not work 831: because of an internal table size limitation in that 832: compiler. To avoid this problem, compile just the GNU C 833: compiler first, and use it to recompile building all the 834: languages that you want to run. 835: 836: Here we spell out what files will be set up by `configure'. 837: Normally you need not be concerned with these files. 838: 839: * A symbolic link named `config.h' is made to the top-level 840: config file for the machine you will run the compiler on 841: (*note Config::.). This file is responsible for defining 842: information about the host machine. It includes `tm.h'. 843: 844: The top-level config file is located in the subdirectory 845: `config'. Its name is always `xm-SOMETHING.h'; usually 846: `xm-MACHINE.h', but there are some exceptions. 847: 848: If your system does not support symbolic links, you might 849: want to set up `config.h' to contain a `#include' command 850: which refers to the appropriate file. 851: 852: * A symbolic link named `tconfig.h' is made to the top-level 853: config file for your target machine. This is used for 854: compiling certain programs to run on that machine. 855: 856: * A symbolic link named `tm.h' is made to the 857: machine-description macro file for your target machine. It 858: should be in the subdirectory `config' and its name is often 859: `MACHINE.h'. 860: 861: * A symbolic link named `md' will be made to the machine 862: description pattern file. It should be in the `config' 863: subdirectory and its name should be `MACHINE.md'; but 864: MACHINE is often not the same as the name used in the `tm.h' 865: file because the `md' files are more general. 866: 867: * A symbolic link named `aux-output.c' will be made to the 868: output subroutine file for your machine. It should be in 869: the `config' subdirectory and its name should be `MACHINE.c'. 870: 871: * The command file `configure' also constructs `Makefile' by 872: adding some text to the template file `Makefile.in'. The 873: additional text comes from files in the `config' directory, 874: named `t-TARGET' and `h-HOST'. If these files do not exist, 875: it means nothing needs to be added for a given target or 876: host. 877: 878: 5. Make sure the Bison parser generator is installed. (This is 879: unnecessary if the Bison output files `c-parse.c' and `cexp.c' 880: are more recent than `c-parse.y' and `cexp.y' and you do not plan 881: to change the `.y' files.) 882: 883: Bison versions older than Sept 8, 1988 will produce incorrect 884: output for `c-parse.c'. 885: 886: 6. Build the compiler. Just type `make LANGUAGES=c' in the compiler 887: directory. 888: 889: `LANGUAGES=c' specifies that only the C compiler should be 890: compiled. The makefile normally builds compilers for all the 891: supported languages; currently, C, C++ and Objective C. However, 892: C is the only language that is sure to work when you build with 893: other non-GNU C compilers. In addition, building anything but C 894: at this stage is a waste of time. 895: 896: In general, you can specify the languages to build by typing 897: the argument `LANGUAGES="LIST"', where LIST is one or more words 898: from the list `c', `c++', and `objective-c'. 899: 900: Ignore any warnings you may see about "statement not reached" 901: in `insn-emit.c'; they are normal. Any other compilation errors 902: may represent bugs in the port to your machine or operating 903: system, and should be investigated and reported (*note Bugs::.). 904: 905: Some commercial compilers fail to compile GNU CC because they 906: have bugs or limitations. For example, the Microsoft compiler is 907: said to run out of macro space. Some Ultrix compilers run out of 908: expression space; then you need to break up the statement where 909: the problem happens. 910: 911: 7. If you are using COFF-encapsulation, you must convert `libgcc.a' 912: to a GNU-format library at this point. See the file 913: `README-ENCAP' in the directory containing the GNU binary file 914: utilities, for directions. 915: 916: 8. Move the first-stage object files and executables into a 917: subdirectory with this command: 918: 919: make stage1 920: 921: The files are moved into a subdirectory named `stage1'. Once 922: installation is complete, you may wish to delete these files with 923: `rm -r stage1'. 924: 925: 9. Recompile the compiler with itself, with this command: 926: 927: make CC=stage1/gcc CFLAGS="-g -O -Bstage1/" 928: 929: This is called making the stage 2 compiler. 930: 931: The command shown above builds compilers for all the supported 932: languages. If you don't want them all, you can specify the 933: languages to build by typing the argument `LANGUAGES="LIST"'. 934: LIST should contain one or more words from the list `c', `c++', 935: and `objective-c', separated by spaces. 936: 937: On a 68000 or 68020 system lacking floating point hardware, 938: unless you have selected a `tm.h' file that expects by default 939: that there is no such hardware, do this instead: 940: 941: make CC=stage1/gcc CFLAGS="-g -O -Bstage1/ -msoft-float" 942: 943: 10. If you wish to test the compiler by compiling it with itself one 944: more time, do this: 945: 946: make stage2 947: make CC=stage2/gcc CFLAGS="-g -O -Bstage2/" 948: 949: This is called making the stage 3 compiler. Aside from the `-B' 950: option, the options should be the same as when you made the stage 951: 2 compiler. 952: 953: Then compare the latest object files with the stage 2 object 954: files--they ought to be identical, unless they contain time 955: stamps. On systems where object files do not contain time 956: stamps, you can do this (in Bourne shell): 957: 958: for file in *.o; do 959: cmp $file stage2/$file 960: done 961: 962: This will mention any object files that differ between stage 2 963: and stage 3. Any difference, no matter how innocuous, indicates 964: that the stage 2 compiler has compiled GNU CC incorrectly, and is 965: therefore a potentially serious bug which you should investigate 966: and report (*note Bugs::.). 967: 1.1.1.2 ! root 968: On systems that use COFF object files, or an object file ! 969: format that is a superset of COFF (such as ECOFF or XCOFF), bytes ! 970: 5 to 8 will always be different, since it is a timestamp. On ! 971: these systems, you can do the comparison as follows (in Bourne ! 972: shell): 1.1 root 973: 974: for file in *.o; do 975: tail +10c $file > foo1 976: tail +10c stage2/$file > foo2 977: cmp foo1 foo2 || echo $file 978: done 979: 1.1.1.2 ! root 980: If you have built the compiler with the `-mno-mips-tfile' ! 981: option on MIPS machines, you will not be able to compare the ! 982: files. 1.1 root 983: 984: 11. Install the compiler driver, the compiler's passes and run-time 985: support. You can use the following command: 986: 987: make CC=stage2/gcc install 988: 989: (Use the same value for `CC' that you used when compiling the 990: files that are being installed.) 991: 992: This copies the files `cc1', `cpp' and `libgcc.a' to files 993: `cc1', `cpp' and `libgcc.a' in directory 1.1.1.2 ! root 994: `/usr/local/lib/gcc-lib/TARGET/VERSION', which is where the ! 995: compiler driver program looks for them. Here TARGET is the target ! 996: machine type specified when you ran `configure', and VERSION is ! 997: the version number of GNU CC. This naming scheme permits various 1.1 root 998: versions and/or cross-compilers to coexist. 999: 1000: It also copies the driver program `gcc' into the directory 1001: `/usr/local/bin', so that it appears in typical execution search 1002: paths. 1003: 1004: *Warning: there is a bug in `alloca' in the Sun library. To 1.1.1.2 ! root 1005: avoid this bug, be sure to install the executables of GNU CC that ! 1006: were compiled by GNU CC. (That is, the executables from stage 2 ! 1007: or 3, not stage 1.) They use `alloca' as a built-in function and ! 1008: never the one in the library.* ! 1009: ! 1010: (It is usually better to install GNU CC executables from stage ! 1011: 2 or 3, since they usually run faster than the ones compiled with ! 1012: some other compiler.) 1.1 root 1013: 1014: 12. If you will be using C++ or Objective C, and your operating 1015: system does not handle constructors, then you must build and 1016: install the program `collect2'. Do this with the following 1017: command: 1018: 1019: make CC="stage2/gcc -O" install-collect2 1020: 1021: The systems that *do* handle constructors on their own include 1022: system V release 4, and system V release 3 on the Intel 386. 1023: 1024: Berkeley systems that use the "a.out" object file format handle 1025: constructors without `collect2' if you use the GNU linker. But if 1026: you don't use the GNU linker, then you need `collect2' on these 1027: systems. 1028: 1029: 13. Build and install `protoize' if you want it. Type 1030: 1031: make CC="stage2/gcc -O" install-proto 1032: 1033: There is as yet no documentation for `protoize'. Sorry. 1034: 1035: 14. Correct errors in the header files on your machine. 1036: 1037: Various system header files often contain constructs which are 1038: incompatible with ANSI C, and they will not work when you compile 1039: programs with GNU CC. This behavior consists of substituting for 1040: macro argument names when they appear inside of character 1041: constants. The most common offender is `ioctl.h'. 1042: 1043: You can overcome this problem when you compile by specifying 1044: the `-traditional' option. 1045: 1046: Alternatively, on Sun systems and 4.3BSD at least, you can 1047: correct the include files by running the shell script 1048: `fixincludes'. This installs modified, corrected copies of the 1049: files `ioctl.h', `ttychars.h' and many others, in a special 1050: directory where only GNU CC will normally look for them. This 1051: script will work on various systems because it chooses the files 1052: by searching all the system headers for the problem cases that we 1053: know about. 1054: 1055: Use the following command to do this: 1056: 1057: make install-fixincludes 1058: 1059: If you selected a different directory for GNU CC installation 1060: when you installed it, by specifying the Make variable `prefix' or 1061: `libdir', specify it the same way in this command. 1062: 1063: Note that some systems are starting to come with ANSI C system 1064: header files. On these systems, don't run `fixincludes'; it may 1065: not work, and is certainly not necessary. 1066: 1067: If you cannot install the compiler's passes and run-time support in 1068: `/usr/local/lib', you can alternatively use the `-B' option to specify 1069: a prefix by which they may be found. The compiler concatenates the 1070: prefix with the names `cpp', `cc1' and `libgcc.a'. Thus, you can put 1071: the files in a directory `/usr/foo/gcc' and specify `-B/usr/foo/gcc/' 1072: when you run GNU CC. 1073: 1074: Also, you can specify an alternative default directory for these 1075: files by setting the Make variable `libdir' when you make GNU CC. 1076: 1077: 1078: File: gcc.info, Node: Other Dir, Next: Sun Install, Prev: Installation, Up: Installation 1079: 1080: Compilation in a Separate Directory 1081: =================================== 1082: 1083: If you wish to build the object files and executables in a directory 1084: other than the one containing the source files, here is what you must 1085: do differently: 1086: 1087: 1. Make sure you have a version of Make that supports the `VPATH' 1088: feature. (GNU Make supports it, as do Make versions on most BSD 1089: systems.) 1090: 1.1.1.2 ! root 1091: 2. If you have ever run `configure' in the source directory, you ! 1092: must undo the configuration. Do this by running: ! 1093: ! 1094: make cleanconfig ! 1095: ! 1096: 3. Go to the directory in which you want to build the compiler before ! 1097: running `configure': 1.1 root 1098: 1099: mkdir gcc-sun3 1100: cd gcc-sun3 1101: 1102: On systems that do not support symbolic links, this directory 1103: must be on the same file system as the source code directory. 1104: 1.1.1.2 ! root 1105: 4. Specify where to find `configure' when you run it: 1.1 root 1106: 1107: ../gcc-2.00/configure ... 1108: 1109: This also tells `configure' where to find the compiler sources; 1110: `configure' takes the directory from the file name that was used 1111: to invoke it. But if you want to be sure, you can specify the 1112: source directory with the `--srcdir' option, like this: 1113: 1114: ../gcc-2.00/configure --srcdir=../gcc-2.00 sun3 1115: 1116: The directory you specify with `--srcdir' need not be the same 1117: as the one that `configure' is found in. 1118: 1119: Now, you can run `make' in that directory. You need not repeat the 1120: configuration steps shown above, when ordinary source files change. 1121: You must, however, run `configure' again when the configuration files 1122: change, if your system does not support symbolic links. 1123: 1124: 1125: File: gcc.info, Node: Sun Install, Next: 3b1 Install, Prev: Other Dir, Up: Installation 1126: 1127: Installing GNU CC on the Sun 1128: ============================ 1129: 1130: Make sure the environment variable `FLOAT_OPTION' is not set when 1131: you compile `libgcc.a'. If this option were set to `f68881' when 1132: `libgcc.a' is compiled, the resulting code would demand to be linked 1133: with a special startup file and would not link properly without 1134: special pains. 1135: 1136: There is a bug in `alloca' in certain versions of the Sun library. 1137: To avoid this bug, install the binaries of GNU CC that were compiled by 1138: GNU CC. They use `alloca' as a built-in function and never the one in 1139: the library. 1140: 1141: Some versions of the Sun compiler crash when compiling GNU CC. The 1142: problem is a segmentation fault in cpp. This problem seems to be due 1143: to the bulk of data in the environment variables. You may be able to 1144: avoid it by using the following command to compile GNU CC with Sun CC: 1145: 1146: make CC="TERMCAP=x OBJS=x LIBFUNCS=x STAGESTUFF=x cc" 1147: 1148: 1.1.1.2 ! root 1149: File: gcc.info, Node: 3b1 Install, Next: Unos Install, Prev: Sun Install, Up: Installation 1.1 root 1150: 1151: Installing GNU CC on the 3b1 1152: ============================ 1153: 1154: Installing GNU CC on the 3b1 is difficult if you do not already have 1155: GNU CC running, due to bugs in the installed C compiler. However, the 1156: following procedure might work. We are unable to test it. 1157: 1158: 1. Comment out the `#include "config.h"' line on line 37 of `cccp.c' 1159: and do `make cpp'. This makes a preliminary version of GNU cpp. 1160: 1161: 2. Save the old `/lib/cpp' and copy the preliminary GNU cpp to that 1162: file name. 1163: 1164: 3. Undo your change in `cccp.c', or reinstall the original version, 1165: and do `make cpp' again. 1166: 1167: 4. Copy this final version of GNU cpp into `/lib/cpp'. 1168: 1169: 5. Replace every occurrence of `obstack_free' in the file `tree.c' 1170: with `_obstack_free'. 1171: 1172: 6. Run `make' to get the first-stage GNU CC. 1173: 1174: 7. Reinstall the original version of `/lib/cpp'. 1175: 1176: 8. Now you can compile GNU CC with itself and install it in the 1177: normal fashion. 1178: 1179:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.