home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / languages / progs / gcc / !GCC / docs / UsingGCC < prev   
Encoding:
GNU Info File  |  1995-02-24  |  257.5 KB  |  6,249 lines

  1. This is Info file @.Distr.UsingGCC, produced by Makeinfo-1.55 from the
  2. input file gcc.texi.
  3.  
  4.    This file documents the use of the GNU compiler.
  5.  
  6.    Published by the Free Software Foundation 675 Massachusetts Avenue
  7. Cambridge, MA 02139 USA
  8.  
  9.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  10.  
  11.    Permission is granted to make and distribute verbatim copies of this
  12. manual provided the copyright notice and this permission notice are
  13. preserved on all copies.
  14.  
  15.    Permission is granted to copy and distribute modified versions of
  16. this manual under the conditions for verbatim copying, provided also
  17. that the sections entitled "GNU General Public License" and "Protect
  18. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  19. original, and provided that the entire resulting derived work is
  20. distributed under the terms of a permission notice identical to this
  21. one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that the sections entitled "GNU General Public
  26. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  27. permission notice, may be included in translations approved by the Free
  28. Software Foundation instead of in the original English.
  29.  
  30. 
  31. File: @.Distr.UsingGCC,  Node: Top,  Next: Copying,  Up: (DIR)
  32.  
  33. Introduction
  34. ************
  35.  
  36.    This manual documents how to run and install the GNU compiler, as
  37. well as its new features and incompatibilities, and how to report bugs.
  38. It corresponds to GNU CC version 2.4.
  39.  
  40. * Menu:
  41.  
  42. * Copying::         GNU General Public License says
  43.                      how you can copy and share GNU CC.
  44. * Contributors::    People who have contributed to GNU CC.
  45. * Boycott::        Protect your freedom--fight "look and feel".
  46.  
  47. * G++ and GCC::     You can compile C or C++ programs.
  48. * Invoking GCC::    Command options supported by `gcc'.
  49. * Installation::    How to configure, compile and install GNU CC.
  50. * C Extensions::    GNU extensions to the C language family.
  51. * C++ Extensions::  GNU extensions to the C++ language.
  52. * Trouble::         If you have trouble installing GNU CC.
  53. * Bugs::            How, why and where to report bugs.
  54. * Service::         How to find suppliers of support for GNU CC.
  55. * VMS::             Using GNU CC on VMS.
  56.  
  57. * Index::        Index of concepts and symbol names.
  58.  
  59. 
  60. File: @.Distr.UsingGCC,  Node: Copying,  Next: Contributors,  Prev: Top,  Up: Top
  61.  
  62. GNU GENERAL PUBLIC LICENSE
  63. **************************
  64.  
  65.                          Version 2, June 1991
  66.  
  67.      Copyright (C) 1989, 1991 Free Software Foundation, Inc.
  68.      675 Mass Ave, Cambridge, MA 02139, USA
  69.      
  70.      Everyone is permitted to copy and distribute verbatim copies
  71.      of this license document, but changing it is not allowed.
  72.  
  73. Preamble
  74. ========
  75.  
  76.    The licenses for most software are designed to take away your
  77. freedom to share and change it.  By contrast, the GNU General Public
  78. License is intended to guarantee your freedom to share and change free
  79. software--to make sure the software is free for all its users.  This
  80. General Public License applies to most of the Free Software
  81. Foundation's software and to any other program whose authors commit to
  82. using it.  (Some other Free Software Foundation software is covered by
  83. the GNU Library General Public License instead.)  You can apply it to
  84. your programs, too.
  85.  
  86.    When we speak of free software, we are referring to freedom, not
  87. price.  Our General Public Licenses are designed to make sure that you
  88. have the freedom to distribute copies of free software (and charge for
  89. this service if you wish), that you receive source code or can get it
  90. if you want it, that you can change the software or use pieces of it in
  91. new free programs; and that you know you can do these things.
  92.  
  93.    To protect your rights, we need to make restrictions that forbid
  94. anyone to deny you these rights or to ask you to surrender the rights.
  95. These restrictions translate to certain responsibilities for you if you
  96. distribute copies of the software, or if you modify it.
  97.  
  98.    For example, if you distribute copies of such a program, whether
  99. gratis or for a fee, you must give the recipients all the rights that
  100. you have.  You must make sure that they, too, receive or can get the
  101. source code.  And you must show them these terms so they know their
  102. rights.
  103.  
  104.    We protect your rights with two steps: (1) copyright the software,
  105. and (2) offer you this license which gives you legal permission to copy,
  106. distribute and/or modify the software.
  107.  
  108.    Also, for each author's protection and ours, we want to make certain
  109. that everyone understands that there is no warranty for this free
  110. software.  If the software is modified by someone else and passed on, we
  111. want its recipients to know that what they have is not the original, so
  112. that any problems introduced by others will not reflect on the original
  113. authors' reputations.
  114.  
  115.    Finally, any free program is threatened constantly by software
  116. patents.  We wish to avoid the danger that redistributors of a free
  117. program will individually obtain patent licenses, in effect making the
  118. program proprietary.  To prevent this, we have made it clear that any
  119. patent must be licensed for everyone's free use or not licensed at all.
  120.  
  121.    The precise terms and conditions for copying, distribution and
  122. modification follow.
  123.  
  124.     TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  125.  
  126.   0. This License applies to any program or other work which contains a
  127.      notice placed by the copyright holder saying it may be distributed
  128.      under the terms of this General Public License.  The "Program",
  129.      below, refers to any such program or work, and a "work based on
  130.      the Program" means either the Program or any derivative work under
  131.      copyright law: that is to say, a work containing the Program or a
  132.      portion of it, either verbatim or with modifications and/or
  133.      translated into another language.  (Hereinafter, translation is
  134.      included without limitation in the term "modification".)  Each
  135.      licensee is addressed as "you".
  136.  
  137.      Activities other than copying, distribution and modification are
  138.      not covered by this License; they are outside its scope.  The act
  139.      of running the Program is not restricted, and the output from the
  140.      Program is covered only if its contents constitute a work based on
  141.      the Program (independent of having been made by running the
  142.      Program).  Whether that is true depends on what the Program does.
  143.  
  144.   1. You may copy and distribute verbatim copies of the Program's
  145.      source code as you receive it, in any medium, provided that you
  146.      conspicuously and appropriately publish on each copy an appropriate
  147.      copyright notice and disclaimer of warranty; keep intact all the
  148.      notices that refer to this License and to the absence of any
  149.      warranty; and give any other recipients of the Program a copy of
  150.      this License along with the Program.
  151.  
  152.      You may charge a fee for the physical act of transferring a copy,
  153.      and you may at your option offer warranty protection in exchange
  154.      for a fee.
  155.  
  156.   2. You may modify your copy or copies of the Program or any portion
  157.      of it, thus forming a work based on the Program, and copy and
  158.      distribute such modifications or work under the terms of Section 1
  159.      above, provided that you also meet all of these conditions:
  160.  
  161.        a. You must cause the modified files to carry prominent notices
  162.           stating that you changed the files and the date of any change.
  163.  
  164.        b. You must cause any work that you distribute or publish, that
  165.           in whole or in part contains or is derived from the Program
  166.           or any part thereof, to be licensed as a whole at no charge
  167.           to all third parties under the terms of this License.
  168.  
  169.        c. If the modified program normally reads commands interactively
  170.           when run, you must cause it, when started running for such
  171.           interactive use in the most ordinary way, to print or display
  172.           an announcement including an appropriate copyright notice and
  173.           a notice that there is no warranty (or else, saying that you
  174.           provide a warranty) and that users may redistribute the
  175.           program under these conditions, and telling the user how to
  176.           view a copy of this License.  (Exception: if the Program
  177.           itself is interactive but does not normally print such an
  178.           announcement, your work based on the Program is not required
  179.           to print an announcement.)
  180.  
  181.      These requirements apply to the modified work as a whole.  If
  182.      identifiable sections of that work are not derived from the
  183.      Program, and can be reasonably considered independent and separate
  184.      works in themselves, then this License, and its terms, do not
  185.      apply to those sections when you distribute them as separate
  186.      works.  But when you distribute the same sections as part of a
  187.      whole which is a work based on the Program, the distribution of
  188.      the whole must be on the terms of this License, whose permissions
  189.      for other licensees extend to the entire whole, and thus to each
  190.      and every part regardless of who wrote it.
  191.  
  192.      Thus, it is not the intent of this section to claim rights or
  193.      contest your rights to work written entirely by you; rather, the
  194.      intent is to exercise the right to control the distribution of
  195.      derivative or collective works based on the Program.
  196.  
  197.      In addition, mere aggregation of another work not based on the
  198.      Program with the Program (or with a work based on the Program) on
  199.      a volume of a storage or distribution medium does not bring the
  200.      other work under the scope of this License.
  201.  
  202.   3. You may copy and distribute the Program (or a work based on it,
  203.      under Section 2) in object code or executable form under the terms
  204.      of Sections 1 and 2 above provided that you also do one of the
  205.      following:
  206.  
  207.        a. Accompany it with the complete corresponding machine-readable
  208.           source code, which must be distributed under the terms of
  209.           Sections 1 and 2 above on a medium customarily used for
  210.           software interchange; or,
  211.  
  212.        b. Accompany it with a written offer, valid for at least three
  213.           years, to give any third party, for a charge no more than your
  214.           cost of physically performing source distribution, a complete
  215.           machine-readable copy of the corresponding source code, to be
  216.           distributed under the terms of Sections 1 and 2 above on a
  217.           medium customarily used for software interchange; or,
  218.  
  219.        c. Accompany it with the information you received as to the offer
  220.           to distribute corresponding source code.  (This alternative is
  221.           allowed only for noncommercial distribution and only if you
  222.           received the program in object code or executable form with
  223.           such an offer, in accord with Subsection b above.)
  224.  
  225.      The source code for a work means the preferred form of the work for
  226.      making modifications to it.  For an executable work, complete
  227.      source code means all the source code for all modules it contains,
  228.      plus any associated interface definition files, plus the scripts
  229.      used to control compilation and installation of the executable.
  230.      However, as a special exception, the source code distributed need
  231.      not include anything that is normally distributed (in either
  232.      source or binary form) with the major components (compiler,
  233.      kernel, and so on) of the operating system on which the executable
  234.      runs, unless that component itself accompanies the executable.
  235.  
  236.      If distribution of executable or object code is made by offering
  237.      access to copy from a designated place, then offering equivalent
  238.      access to copy the source code from the same place counts as
  239.      distribution of the source code, even though third parties are not
  240.      compelled to copy the source along with the object code.
  241.  
  242.   4. You may not copy, modify, sublicense, or distribute the Program
  243.      except as expressly provided under this License.  Any attempt
  244.      otherwise to copy, modify, sublicense or distribute the Program is
  245.      void, and will automatically terminate your rights under this
  246.      License.  However, parties who have received copies, or rights,
  247.      from you under this License will not have their licenses
  248.      terminated so long as such parties remain in full compliance.
  249.  
  250.   5. You are not required to accept this License, since you have not
  251.      signed it.  However, nothing else grants you permission to modify
  252.      or distribute the Program or its derivative works.  These actions
  253.      are prohibited by law if you do not accept this License.
  254.      Therefore, by modifying or distributing the Program (or any work
  255.      based on the Program), you indicate your acceptance of this
  256.      License to do so, and all its terms and conditions for copying,
  257.      distributing or modifying the Program or works based on it.
  258.  
  259.   6. Each time you redistribute the Program (or any work based on the
  260.      Program), the recipient automatically receives a license from the
  261.      original licensor to copy, distribute or modify the Program
  262.      subject to these terms and conditions.  You may not impose any
  263.      further restrictions on the recipients' exercise of the rights
  264.      granted herein.  You are not responsible for enforcing compliance
  265.      by third parties to this License.
  266.  
  267.   7. If, as a consequence of a court judgment or allegation of patent
  268.      infringement or for any other reason (not limited to patent
  269.      issues), conditions are imposed on you (whether by court order,
  270.      agreement or otherwise) that contradict the conditions of this
  271.      License, they do not excuse you from the conditions of this
  272.      License.  If you cannot distribute so as to satisfy simultaneously
  273.      your obligations under this License and any other pertinent
  274.      obligations, then as a consequence you may not distribute the
  275.      Program at all.  For example, if a patent license would not permit
  276.      royalty-free redistribution of the Program by all those who
  277.      receive copies directly or indirectly through you, then the only
  278.      way you could satisfy both it and this License would be to refrain
  279.      entirely from distribution of the Program.
  280.  
  281.      If any portion of this section is held invalid or unenforceable
  282.      under any particular circumstance, the balance of the section is
  283.      intended to apply and the section as a whole is intended to apply
  284.      in other circumstances.
  285.  
  286.      It is not the purpose of this section to induce you to infringe any
  287.      patents or other property right claims or to contest validity of
  288.      any such claims; this section has the sole purpose of protecting
  289.      the integrity of the free software distribution system, which is
  290.      implemented by public license practices.  Many people have made
  291.      generous contributions to the wide range of software distributed
  292.      through that system in reliance on consistent application of that
  293.      system; it is up to the author/donor to decide if he or she is
  294.      willing to distribute software through any other system and a
  295.      licensee cannot impose that choice.
  296.  
  297.      This section is intended to make thoroughly clear what is believed
  298.      to be a consequence of the rest of this License.
  299.  
  300.   8. If the distribution and/or use of the Program is restricted in
  301.      certain countries either by patents or by copyrighted interfaces,
  302.      the original copyright holder who places the Program under this
  303.      License may add an explicit geographical distribution limitation
  304.      excluding those countries, so that distribution is permitted only
  305.      in or among countries not thus excluded.  In such case, this
  306.      License incorporates the limitation as if written in the body of
  307.      this License.
  308.  
  309.   9. The Free Software Foundation may publish revised and/or new
  310.      versions of the General Public License from time to time.  Such
  311.      new versions will be similar in spirit to the present version, but
  312.      may differ in detail to address new problems or concerns.
  313.  
  314.      Each version is given a distinguishing version number.  If the
  315.      Program specifies a version number of this License which applies
  316.      to it and "any later version", you have the option of following
  317.      the terms and conditions either of that version or of any later
  318.      version published by the Free Software Foundation.  If the Program
  319.      does not specify a version number of this License, you may choose
  320.      any version ever published by the Free Software Foundation.
  321.  
  322.  10. If you wish to incorporate parts of the Program into other free
  323.      programs whose distribution conditions are different, write to the
  324.      author to ask for permission.  For software which is copyrighted
  325.      by the Free Software Foundation, write to the Free Software
  326.      Foundation; we sometimes make exceptions for this.  Our decision
  327.      will be guided by the two goals of preserving the free status of
  328.      all derivatives of our free software and of promoting the sharing
  329.      and reuse of software generally.
  330.  
  331.                                 NO WARRANTY
  332.  
  333.  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO
  334.      WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE
  335.      LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
  336.      HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT
  337.      WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT
  338.      NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  339.      FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE
  340.      QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
  341.      PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
  342.      SERVICING, REPAIR OR CORRECTION.
  343.  
  344.  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
  345.      WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY
  346.      MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE
  347.      LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL,
  348.      INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
  349.      INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
  350.      DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
  351.      OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY
  352.      OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN
  353.      ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
  354.  
  355.                       END OF TERMS AND CONDITIONS
  356.  
  357. How to Apply These Terms to Your New Programs
  358. =============================================
  359.  
  360.    If you develop a new program, and you want it to be of the greatest
  361. possible use to the public, the best way to achieve this is to make it
  362. free software which everyone can redistribute and change under these
  363. terms.
  364.  
  365.    To do so, attach the following notices to the program.  It is safest
  366. to attach them to the start of each source file to most effectively
  367. convey the exclusion of warranty; and each file should have at least
  368. the "copyright" line and a pointer to where the full notice is found.
  369.  
  370.      ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
  371.      Copyright (C) 19YY  NAME OF AUTHOR
  372.      
  373.      This program is free software; you can redistribute it and/or modify
  374.      it under the terms of the GNU General Public License as published by
  375.      the Free Software Foundation; either version 2 of the License, or
  376.      (at your option) any later version.
  377.      
  378.      This program is distributed in the hope that it will be useful,
  379.      but WITHOUT ANY WARRANTY; without even the implied warranty of
  380.      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  381.      GNU General Public License for more details.
  382.      
  383.      You should have received a copy of the GNU General Public License
  384.      along with this program; if not, write to the Free Software
  385.      Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  386.  
  387.    Also add information on how to contact you by electronic and paper
  388. mail.
  389.  
  390.    If the program is interactive, make it output a short notice like
  391. this when it starts in an interactive mode:
  392.  
  393.      Gnomovision version 69, Copyright (C) 19YY NAME OF AUTHOR
  394.      Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
  395.      type `show w'.
  396.      This is free software, and you are welcome to redistribute it
  397.      under certain conditions; type `show c' for details.
  398.  
  399.    The hypothetical commands `show w' and `show c' should show the
  400. appropriate parts of the General Public License.  Of course, the
  401. commands you use may be called something other than `show w' and `show
  402. c'; they could even be mouse-clicks or menu items--whatever suits your
  403. program.
  404.  
  405.    You should also get your employer (if you work as a programmer) or
  406. your school, if any, to sign a "copyright disclaimer" for the program,
  407. if necessary.  Here is a sample; alter the names:
  408.  
  409.      Yoyodyne, Inc., hereby disclaims all copyright interest in the program
  410.      `Gnomovision' (which makes passes at compilers) written by James Hacker.
  411.      
  412.      SIGNATURE OF TY COON, 1 April 1989
  413.      Ty Coon, President of Vice
  414.  
  415.    This General Public License does not permit incorporating your
  416. program into proprietary programs.  If your program is a subroutine
  417. library, you may consider it more useful to permit linking proprietary
  418. applications with the library.  If this is what you want to do, use the
  419. GNU Library General Public License instead of this License.
  420.  
  421. 
  422. File: @.Distr.UsingGCC,  Node: Contributors,  Next: Boycott,  Prev: Copying,  Up: Top
  423.  
  424. Contributors to GNU CC
  425. **********************
  426.  
  427.    In addition to Richard Stallman, several people have written parts
  428. of GNU CC.
  429.  
  430.    * The idea of using RTL and some of the optimization ideas came from
  431.      the program PO written at the University of Arizona by Jack
  432.      Davidson and Christopher Fraser.  See "Register Allocation and
  433.      Exhaustive Peephole Optimization", Software Practice and
  434.      Experience 14 (9), Sept. 1984, 857-866.
  435.  
  436.    * Paul Rubin wrote most of the preprocessor.
  437.  
  438.    * Leonard Tower wrote parts of the parser, RTL generator, and RTL
  439.      definitions, and of the Vax machine description.
  440.  
  441.    * Ted Lemon wrote parts of the RTL reader and printer.
  442.  
  443.    * Jim Wilson implemented loop strength reduction and some other loop
  444.      optimizations.
  445.  
  446.    * Nobuyuki Hikichi of Software Research Associates, Tokyo,
  447.      contributed the support for the Sony NEWS machine.
  448.  
  449.    * Charles LaBrec contributed the support for the Integrated Solutions
  450.      68020 system.
  451.  
  452.    * Michael Tiemann of Cygnus Support wrote the front end for C++, as
  453.      well as the support for inline functions and instruction
  454.      scheduling.  Also the descriptions of the National Semiconductor
  455.      32000 series cpu, the SPARC cpu and part of the Motorola 88000 cpu.
  456.  
  457.    * Jan Stein of the Chalmers Computer Society provided support for
  458.      Genix, as well as part of the 32000 machine description.
  459.  
  460.    * Randy Smith finished the Sun FPA support.
  461.  
  462.    * Robert Brown implemented the support for Encore 32000 systems.
  463.  
  464.    * David Kashtan of SRI adapted GNU CC to the Vomit-Making System
  465.      (VMS).
  466.  
  467.    * Alex Crain provided changes for the 3b1.
  468.  
  469.    * Greg Satz and Chris Hanson assisted in making GNU CC work on HP-UX
  470.      for the 9000 series 300.
  471.  
  472.    * William Schelter did most of the work on the Intel 80386 support.
  473.  
  474.    * Christopher Smith did the port for Convex machines.
  475.  
  476.    * Paul Petersen wrote the machine description for the Alliant FX/8.
  477.  
  478.    * Alain Lichnewsky ported GNU CC to the Mips cpu.
  479.  
  480.    * Devon Bowen, Dale Wiles and Kevin Zachmann ported GNU CC to the
  481.      Tahoe.
  482.  
  483.    * Jonathan Stone wrote the machine description for the Pyramid
  484.      computer.
  485.  
  486.    * Gary Miller ported GNU CC to Charles River Data Systems machines.
  487.  
  488.    * Richard Kenner of the New York University Ultracomputer Research
  489.      Laboratory wrote the machine descriptions for the AMD 29000, the
  490.      DEC Alpha, the IBM RT PC, and the IBM RS/6000 as well as the
  491.      support for instruction attributes.  He also made changes to
  492.      better support RISC processors including changes to common
  493.      subexpression elimination, strength reduction, function calling
  494.      sequence handling, and condition code support, in addition to
  495.      generalizing the code for frame pointer elimination.
  496.  
  497.    * Richard Kenner and Michael Tiemann jointly developed reorg.c, the
  498.      delay slot scheduler.
  499.  
  500.    * Mike Meissner and Tom Wood of Data General finished the port to the
  501.      Motorola 88000.
  502.  
  503.    * Masanobu Yuhara of Fujitsu Laboratories implemented the machine
  504.      description for the Tron architecture (specifically, the Gmicro).
  505.  
  506.    * NeXT, Inc. donated the front end that supports the Objective C
  507.      language.
  508.  
  509.    * James van Artsdalen wrote the code that makes efficient use of the
  510.      Intel 80387 register stack.
  511.  
  512.    * Mike Meissner at the Open Software Foundation finished the port to
  513.      the MIPS cpu, including adding ECOFF debug support.
  514.  
  515.    * Ron Guilmette implemented the `protoize' and `unprotoize' tools,
  516.      the support for Dwarf symbolic debugging information, and much of
  517.      the support for System V Release 4.  He has also worked heavily on
  518.      the Intel 386 and 860 support.
  519.  
  520.    * Torbjorn Granlund of the Swedish Institute of Computer Science
  521.      implemented multiply-by-constant optimization and better long long
  522.      support, and improved leaf function register allocation.
  523.  
  524.    * Mike Stump implemented the support for Elxsi 64 bit CPU.
  525.  
  526.    * John Wehle added the machine description for the Western Electric
  527.      32000 processor used in several 3b series machines (no relation to
  528.      the National Semiconductor 32000 processor).
  529.  
  530.    * Holger Teutsch provided the support for the Clipper cpu.
  531.  
  532.    * Kresten Krab Thorup wrote the run time support for the Objective C
  533.      language.
  534.  
  535.    * Stephen Moshier contributed the floating point emulator that
  536.      assists in cross-compilation and permits support for floating
  537.      point numbers wider than 64 bits.
  538.  
  539.    * Steve Chamberlain wrote the support for the Hitachi SH processor.
  540.  
  541. 
  542. File: @.Distr.UsingGCC,  Node: Boycott,  Next: G++ and GCC,  Prev: Contributors,  Up: Top
  543.  
  544. Protect Your Freedom--Fight "Look And Feel"
  545. *******************************************
  546.  
  547.      This section is a political message from the League for Programming
  548.      Freedom to the users of GNU CC.  It is included here as an
  549.      expression of support for the League on the part of the Free
  550.      Software Foundation.
  551.  
  552.    Apple and Lotus are trying to create a new form of legal monopoly: a
  553. copyright on a class of user interfaces.  These monopolies would cause
  554. serious problems for users and developers of computer software and
  555. systems.  Xerox, too, has tried to make a monopoly for itself on window
  556. systems; their suit against Apple was thrown out on a technicality, but
  557. Xerox has not said anything to indicate it wouldn't try again.
  558.  
  559.    Until a few years ago, the law seemed clear: no one could restrict
  560. others from using a user interface; programmers were free to implement
  561. any interface they chose.  Imitating interfaces, sometimes with changes,
  562. was standard practice in the computer field.  The interfaces we know
  563. evolved gradually in this way; for example, the Macintosh user interface
  564. drew ideas from the Xerox interface, which in turn drew on work done at
  565. Stanford and SRI.  1-2-3 imitated VisiCalc, and dBase imitated a
  566. database program from JPL.
  567.  
  568.    Most computer companies, and nearly all computer users, were happy
  569. with this state of affairs.  The companies that are suing say it does
  570. not offer "enough incentive" to develop their products, but they must
  571. have considered it "enough" when they made their decision to do so.  It
  572. seems they are not satisfied with the opportunity to continue to compete
  573. in the marketplace--not even with a head start.
  574.  
  575.    If companies like Xerox, Lotus, and Apple are permitted to make law
  576. through the courts, the precedent will hobble the software industry:
  577.  
  578.    * Gratuitous incompatibilities will burden users.  Imagine if each
  579.      car manufacturer had to arrange the pedals in a different order.
  580.  
  581.    * Software will become and remain more expensive.  Users will be
  582.      "locked in" to proprietary interfaces, for which there is no real
  583.      competition.
  584.  
  585.    * Large companies have an unfair advantage wherever lawsuits become
  586.      commonplace.  Since they can easily afford to sue, they can
  587.      intimidate small companies with threats even when they don't
  588.      really have a case.
  589.  
  590.    * User interface improvements will come slower, since incremental
  591.      evolution through creative imitation will no longer be permitted.
  592.  
  593.    * Even Apple, etc., will find it harder to make improvements if they
  594.      can no longer adapt the good ideas that others introduce, for fear
  595.      of weakening their own legal positions.  Some users suggest that
  596.      this stagnation may already have started.
  597.  
  598.    * If you use GNU software, you might find it of some concern that
  599.      user interface copyright will make it hard for the Free Software
  600.      Foundation to develop programs compatible with the interfaces that
  601.      you already know.
  602.  
  603.    To protect our freedom from lawsuits like these, a group of
  604. programmers and users have formed a new grass-roots political
  605. organization, the League for Programming Freedom.
  606.  
  607.    The purpose of the League is to oppose new monopolistic practices
  608. such as user-interface copyright and software patents; it calls for a
  609. return to the legal policies of the recent past, in which these
  610. practices were not allowed.  The League is not concerned with free
  611. software as an issue, and not affiliated with the Free Software
  612. Foundation.
  613.  
  614.    The League's membership rolls include John McCarthy, inventor of
  615. Lisp, Marvin Minsky, founder of the Artificial Intelligence lab, Guy L.
  616. Steele, Jr., author of well-known books on Lisp and C, as well as
  617. Richard Stallman, the developer of GNU CC.  Please join and add your
  618. name to the list.  Membership dues in the League are $42 per year for
  619. programmers, managers and professionals; $10.50 for students; $21 for
  620. others.
  621.  
  622.    The League needs both activist members and members who only pay their
  623. dues.
  624.  
  625.    To join, or for more information, phone (617) 243-4091 or write to:
  626.  
  627.      League for Programming Freedom
  628.      1 Kendall Square #143
  629.      P.O. Box 9171
  630.      Cambridge, MA 02139
  631.  
  632.    You can also send electronic mail to `league@prep.ai.mit.edu'.
  633.  
  634.    Here are some suggestions from the League for things you can do to
  635. protect your freedom to write programs:
  636.  
  637.    * Don't buy from Xerox, Lotus or Apple.  Buy from their competitors
  638.      or from the defendants they are suing.
  639.  
  640.    * Don't develop software to work with the systems made by these
  641.      companies.
  642.  
  643.    * Port your existing software to competing systems, so that you
  644.      encourage users to switch.
  645.  
  646.    * Write letters to company presidents to let them know their conduct
  647.      is unacceptable.
  648.  
  649.    * Tell your friends and colleagues about this issue and how it
  650.      threatens to ruin the computer industry.
  651.  
  652.    * Above all, don't work for the look-and-feel plaintiffs, and don't
  653.      accept contracts from them.
  654.  
  655.    * Write to Congress to explain the importance of this issue.
  656.  
  657.           House Subcommittee on Intellectual Property
  658.           2137 Rayburn Bldg
  659.           Washington, DC 20515
  660.           
  661.           Senate Subcommittee on Patents, Trademarks and Copyrights
  662.           United States Senate
  663.           Washington, DC 20510
  664.  
  665.      (These committees have received lots of mail already; let's give
  666.      them even more.)
  667.  
  668.    Express your opinion!  You can make a difference.
  669.  
  670. 
  671. File: @.Distr.UsingGCC,  Node: G++ and GCC,  Next: Invoking GCC,  Prev: Boycott,  Up: Top
  672.  
  673. Compile C, C++, or Objective C
  674. ******************************
  675.  
  676.    The C, C++, and Objective C versions of the compiler are integrated;
  677. the GNU C compiler can compile programs written in C, C++, or Objective
  678. C.
  679.  
  680.    "GCC" is a common shorthand term for the GNU C compiler.  This is
  681. both the most general name for the compiler, and the name used when the
  682. emphasis is on compiling C programs.
  683.  
  684.    When referring to C++ compilation, it is usual to call the compiler
  685. "G++".  Since there is only one compiler, it is also accurate to call
  686. it "GCC" no matter what the language context; however, the term "G++"
  687. is more useful when the emphasis is on compiling C++ programs.
  688.  
  689.    G++ is a *compiler*, not merely a preprocessor.  G++ builds object
  690. code directly from your C++ program source.  There is no intermediate C
  691. version of the program.  (By contrast, for example, some other
  692. implementations use a program that generates a C program from your C++
  693. source.)  Avoiding an intermediate C representation of the program means
  694. that you get better object code, and better debugging information.  The
  695. GNU debugger, GDB, works with this information in the object code to
  696. give you comprehensive C++ source-level editing capabilities (*note C
  697. and C++: (gdb.info)C.).
  698.  
  699. 
  700. File: @.Distr.UsingGCC,  Node: Invoking GCC,  Next: Installation,  Prev: G++ and GCC,  Up: Top
  701.  
  702. GNU CC Command Options
  703. **********************
  704.  
  705.    When you invoke GNU CC, it normally does preprocessing, compilation,
  706. assembly and linking.  The "overall options" allow you to stop this
  707. process at an intermediate stage.  For example, the `-c' option says
  708. not to run the linker.  Then the output consists of object files output
  709. by the assembler.
  710.  
  711.    Other options are passed on to one stage of processing.  Some options
  712. control the preprocessor and others the compiler itself.  Yet other
  713. options control the assembler and linker; most of these are not
  714. documented here, since you rarely need to use any of them.
  715.  
  716.    Most of the command line options that you can use with GNU CC are
  717. useful for C programs; when an option is only useful with another
  718. language (usually C++), the explanation says so explicitly.  If the
  719. description for a particular option does not mention a source language,
  720. you can use that option with all supported languages.
  721.  
  722.    *Note Compiling C++ Programs: Invoking G++, for a summary of special
  723. options for compiling C++ programs.
  724.  
  725.    The `gcc' program accepts options and file names as operands.  Many
  726. options have multiletter names; therefore multiple single-letter options
  727. may *not* be grouped: `-dr' is very different from `-d -r'.
  728.  
  729.    You can mix options and other arguments.  For the most part, the
  730. order you use doesn't matter.  Order does matter when you use several
  731. options of the same kind; for example, if you specify `-L' more than
  732. once, the directories are searched in the order specified.
  733.  
  734.    Many options have long names starting with `-f' or with `-W'--for
  735. example, `-fforce-mem', `-fstrength-reduce', `-Wformat' and so on.
  736. Most of these have both positive and negative forms; the negative form
  737. of `-ffoo' would be `-fno-foo'.  This manual documents only one of
  738. these two forms, whichever one is not the default.
  739.  
  740. * Menu:
  741.  
  742. * Option Summary::    Brief list of all options, without explanations.
  743. * Overall Options::     Controlling the kind of output:
  744.                         an executable, object files, assembler files,
  745.                         or preprocessed source.
  746. * Invoking G++::    Compiling C++ programs.
  747. * C Dialect Options::   Controlling the variant of C language compiled.
  748. * C++ Dialect Options:: Variations on C++.
  749. * Warning Options::     How picky should the compiler be?
  750. * Debugging Options::   Symbol tables, measurements, and debugging dumps.
  751. * Optimize Options::    How much optimization?
  752. * Preprocessor Options:: Controlling header files and macro definitions.
  753.                          Also, getting dependency information for Make.
  754. * Assembler Options::   Passing options to the assembler.
  755. * Link Options::        Specifying libraries and so on.
  756. * Directory Options::   Where to find header files and libraries.
  757.                         Where to find the compiler executable files.
  758. * Target Options::      Running a cross-compiler, or an old version of GNU CC.
  759. * Submodel Options::    Specifying minor hardware or convention variations,
  760.                         such as 68010 vs 68020.
  761. * Code Gen Options::    Specifying conventions for function calls, data layout
  762.                         and register usage.
  763. * Environment Variables:: Env vars that affect GNU CC.
  764. * Running Protoize::    Automatically adding or removing function prototypes.
  765.  
  766. 
  767. File: @.Distr.UsingGCC,  Node: Option Summary,  Next: Overall Options,  Up: Invoking GCC
  768.  
  769. Option Summary
  770. ==============
  771.  
  772.    Here is a summary of all the options, grouped by type.  Explanations
  773. are in the following sections.
  774.  
  775. *Overall Options*
  776.      *Note Options Controlling the Kind of Output: Overall Options.
  777.           -c  -S  -E  -o FILE  -pipe  -v  -x LANGUAGE
  778.  
  779. *C Language Options*
  780.      *Note Options Controlling C Dialect: C Dialect Options.
  781.           -ansi  -fcond-mismatch  -fno-asm  -fno-builtin
  782.           -fsigned-bitfields  -fsigned-char
  783.           -funsigned-bitfields  -funsigned-char  -fwritable-strings
  784.           -traditional  -traditional-cpp  -trigraphs
  785.  
  786. *C++ Language Options*
  787.      *Note Options Controlling C++ Dialect: C++ Dialect Options.
  788.           -fall-virtual  -fdollars-in-identifiers
  789.           -felide-constructors  -fenum-int-equiv  -fmemoize-lookups
  790.           -fno-strict-prototype  -fnonnull-objects
  791.           -fthis-is-variable  -nostdinc++
  792.  
  793. *Warning Options*
  794.      *Note Options to Request or Suppress Warnings: Warning Options.
  795.           -fsyntax-only  -pedantic  -pedantic-errors
  796.           -w  -W  -Wall  -Waggregate-return  -Wcast-align
  797.           -Wcast-qual  -Wchar-subscript  -Wcomment  -Wconversion
  798.           -Wenum-clash  -Werror  -Wformat  -Wid-clash-LEN
  799.           -Wimplicit  -Wimport  -Winline  -Wmissing-prototypes
  800.           -Wnested-externs  -Woverloaded-virtual  -Wparentheses
  801.           -Wpointer-arith  -Wredundant-decls  -Wreturn-type
  802.           -Wshadow  -Wstrict-prototypes  -Wswitch
  803.           -Wtemplate-debugging  -Wtraditional  -Wtrigraphs
  804.           -Wuninitialized  -Wunused  -Wwrite-strings
  805.  
  806. *Debugging Options*
  807.      *Note Options for Debugging Your Program or GCC: Debugging Options.
  808.           -a  -dLETTERS  -fpretend-float
  809.           -g  -gLEVEL -ggdb  -gdwarf -gdwarf+
  810.           -gstabs  -gstabs+  -gcoff -gxcoff  -gxcoff+
  811.           -p  -pg  -save-temps  -print-libgcc-file-name
  812.  
  813. *Optimization Options*
  814.      *Note Options that Control Optimization: Optimize Options.
  815.           -fcaller-saves  -fcse-follow-jumps  -fcse-skip-blocks
  816.           -fdelayed-branch   -fexpensive-optimizations
  817.           -ffast-math  -ffloat-store  -fforce-addr  -fforce-mem
  818.           -finline-functions  -fkeep-inline-functions
  819.           -fno-default-inline  -fno-defer-pop  -fno-function-cse
  820.           -fno-inline  -fno-peephole  -fomit-frame-pointer
  821.           -frerun-cse-after-loop  -fschedule-insns
  822.           -fschedule-insns2  -fstrength-reduce  -fthread-jumps
  823.           -funroll-all-loops  -funroll-loops
  824.           -O  -O2
  825.  
  826. *Preprocessor Options*
  827.      *Note Options Controlling the Preprocessor: Preprocessor Options.
  828.           -AASSERTION  -C  -dD  -dM  -dN
  829.           -DMACRO[=DEFN]  -E  -H
  830.           -idirafter DIR
  831.           -include FILE  -imacros FILE
  832.           -iprefix FILE  -iwithprefix DIR
  833.           -M  -MD  -MM  -MMD  -nostdinc  -P  -trigraphs  -UMACRO
  834.  
  835. *Assembler Option*
  836.      *Note Passing Options to the Assembler: Assembler Options.
  837.           -Wa,OPTION
  838.  
  839. *Linker Options*
  840.      *Note Options for Linking: Link Options.
  841.           OBJECT-FILE-NAME
  842.           -lLIBRARY  -nostartfiles  -nostdlib
  843.           -static  -shared  -symbolic
  844.           -Wl,OPTION  -Xlinker OPTION
  845.           -u SYMBOL
  846.  
  847. *Directory Options*
  848.      *Note Options for Directory Search: Directory Options.
  849.           -BPREFIX  -IDIR  -I-  -LDIR
  850.  
  851. *Target Options*
  852.      *Note Target Options::.
  853.           -b MACHINE  -V VERSION
  854.  
  855. *Machine Dependent Options*
  856.      *Note Hardware Models and Configurations: Submodel Options.
  857.           *M680x0 Options*
  858.           -m68000  -m68020  -m68020-40  -m68030  -m68040  -m68881
  859.           -mbitfield  -mc68000  -mc68020  -mfpa  -mnobitfield
  860.           -mrtd  -mshort  -msoft-float
  861.           
  862.           *VAX Options*
  863.           -mg  -mgnu  -munix
  864.           
  865.           *SPARC Options*
  866.           -mepilogue  -mfpu  -mhard-float
  867.           -mno-fpu  -mno-epilogue  -msoft-float
  868.           -msparclite  -mv8
  869.           
  870.           *Convex Options*
  871.           -mc1  -mc2  -mc32  -mc34  -mc38
  872.           -margcount  -mnoargcount
  873.           -mlong32  -mlong64
  874.           -mbolatile-cache  -mvolatile-nocache
  875.           
  876.           *AMD29K Options*
  877.           -m29000  -m29050  -mbw  -mdw  -mkernel-registers
  878.           -mlarge  -mnbw  -mnodw  -msmall  -mstack-check
  879.           -muser-registers
  880.           
  881.           *M88K Options*
  882.           -m88000  -m88100  -m88110  -mbig-pic
  883.           -mcheck-zero-division  -mhandle-large-shift
  884.           -midentify-revision  -mno-check-zero-division
  885.           -mno-ocs-debug-info  -mno-ocs-frame-position
  886.           -mno-optimize-arg-area  -mno-serialize-volatile
  887.           -mno-underscores  -mocs-debug-info
  888.           -mocs-frame-position  -moptimize-arg-area
  889.           -mserialize-volatile  -mshort-data-NUM  -msvr3
  890.           -msvr4  -mtrap-large-shift  -muse-div-instruction
  891.           -mversion-03.00  -mwarn-passed-structs
  892.           
  893.           *RS/6000 Options*
  894.           -mfp-in-toc  -mno-fop-in-toc
  895.           
  896.           *RT Options*
  897.           -mcall-lib-mul  -mfp-arg-in-fpregs  -mfp-arg-in-gregs
  898.           -mfull-fp-blocks  -mhc-struct-return  -min-line-mul
  899.           -mminimum-fp-blocks  -mnohc-struct-return
  900.           
  901.           *MIPS Options*
  902.           -mcpu=CPU  TYPE  -mips2  -mips3  -mint64
  903.           -mlong64  -mlonglong128  -mmips-as  -mgas  -mrnames
  904.           -mno-rnames  -mgpopt  -mno-gpopt  -mstats  -mno-stats
  905.           -mmemcpy  -mno-memcpy  -mno-mips-tfile  -mmips-tfile
  906.           -msoft-float  -mhard-float  -mabicalls  -mno-abicalls
  907.           -mhalf-pic  -mno-half-pic -mlong-calls -mno-long-calls
  908.           -G  NUM  -nocpp
  909.           
  910.           *i386 Options*
  911.           -m486  -mno-486  -msoft-float  -msvr3-shlib  -mieee-fp
  912.           -mno-fp-ret-in-387
  913.           
  914.           *HPPA Options*
  915.           -mpa-risc-1-0
  916.           -mpa-risc-1-1
  917.           -mkernel
  918.           -mshared-libs
  919.           -mno-shared-libs
  920.           -mlong-calls
  921.           -mdisable-fpregs
  922.           -mdisable-indexing
  923.           -mtrailing-colon
  924.           
  925.           *Intel 960 Options*
  926.           -mCPU TYPE
  927.           -mnumerics  -msoft-float
  928.           -mcode-align  -mno-code-align
  929.           -mleaf-procedures  -mno-leaf-procedures
  930.           -mtail-call  -mno-tail-call
  931.           -mcomplex-addr  -mno-complex-addr
  932.           -mclean-linkage  -mno-clean-linkage
  933.           -mic-compat  -mic2.0-compat  -mic3.0-compat
  934.           -masm-compat  -mintel-asm
  935.           -mstrict-align  -mno-strict-align
  936.           -mold-align  -mno-old-align
  937.           
  938.           *DEC Alpha Options*
  939.           -mfp-regs  -mno-fp-regs  -mno-soft-float
  940.           -msoft-float
  941.           
  942.           *System V Options*
  943.           -G  -Qy  -Qn  -YP,PATHS  -Ym,DIR
  944.  
  945. *Code Generation Options*
  946.      *Note Options for Code Generation Conventions: Code Gen Options.
  947.           -fcall-saved-REG  -fcall-used-REG
  948.           -ffixed-REG  -finhibit-size-directive
  949.           -fno-common  -fno-ident
  950.           -fno-gnu-linker  -fpcc-struct-return  -fpic  -fPIC
  951.           -freg-struct-return  -fshared-data  -fshort-enums
  952.           -fshort-double  -fvolatile  -fvolatile-global
  953.           -fverbose-asm
  954.  
  955. * Menu:
  956.  
  957. * Overall Options::     Controlling the kind of output:
  958.                         an executable, object files, assembler files,
  959.                         or preprocessed source.
  960. * C Dialect Options::   Controlling the variant of C language compiled.
  961. * C++ Dialect Options:: Variations on C++.
  962. * Warning Options::     How picky should the compiler be?
  963. * Debugging Options::   Symbol tables, measurements, and debugging dumps.
  964. * Optimize Options::    How much optimization?
  965. * Preprocessor Options:: Controlling header files and macro definitions.
  966.                          Also, getting dependency information for Make.
  967. * Assembler Options::   Passing options to the assembler.
  968. * Link Options::        Specifying libraries and so on.
  969. * Directory Options::   Where to find header files and libraries.
  970.                         Where to find the compiler executable files.
  971. * Target Options::      Running a cross-compiler, or an old version of GNU CC.
  972.  
  973. 
  974. File: @.Distr.UsingGCC,  Node: Overall Options,  Next: Invoking G++,  Prev: Option Summary,  Up: Invoking GCC
  975.  
  976. Options Controlling the Kind of Output
  977. ======================================
  978.  
  979.    Compilation can involve up to four stages: preprocessing, compilation
  980. proper, assembly and linking, always in that order.  The first three
  981. stages apply to an individual source file, and end by producing an
  982. object file; linking combines all the object files (those newly
  983. compiled, and those specified as input) into an executable file.
  984.  
  985.    For any given input file, the file name suffix determines what kind
  986. of compilation is done:
  987.  
  988. `FILE.c'
  989.      C source code which must be preprocessed.
  990.  
  991. `FILE.i'
  992.      C source code which should not be preprocessed.
  993.  
  994. `FILE.ii'
  995.      C++ source code which should not be preprocessed.
  996.  
  997. `FILE.m'
  998.      Objective-C source code.  Note that you must link with the library
  999.      `libobjc.a' to make an Objective-C program work.
  1000.  
  1001. `FILE.h'
  1002.      C header file (not to be compiled or linked).
  1003.  
  1004. `FILE.cc'
  1005. `FILE.cxx'
  1006. `FILE.C'
  1007.      C++ source code which must be preprocessed.  Note that in `.cxx',
  1008.      the last two letters must both be literally `x'.  Likewise, `.C'
  1009.      refers to a literal capital C.
  1010.  
  1011. `FILE.s'
  1012.      Assembler code.
  1013.  
  1014. `FILE.S'
  1015.      Assembler code which must be preprocessed.
  1016.  
  1017. `OTHER'
  1018.      An object file to be fed straight into linking.  Any file name
  1019.      with no recognized suffix is treated this way.
  1020.  
  1021.    You can specify the input language explicitly with the `-x' option:
  1022.  
  1023. `-x LANGUAGE'
  1024.      Specify explicitly the LANGUAGE for the following input files
  1025.      (rather than letting the compiler choose a default based on the
  1026.      file name suffix).  This option applies to all following input
  1027.      files until the next `-x' option.  Possible values for LANGUAGE
  1028.      are:
  1029.           c  objective-c  c++
  1030.           c-header  cpp-output  c++-cpp-output
  1031.           assembler  assembler-with-cpp
  1032.  
  1033. `-x none'
  1034.      Turn off any specification of a language, so that subsequent files
  1035.      are handled according to their file name suffixes (as they are if
  1036.      `-x' has not been used at all).
  1037.  
  1038.    If you only want some of the stages of compilation, you can use `-x'
  1039. (or filename suffixes) to tell `gcc' where to start, and one of the
  1040. options `-c', `-S', or `-E' to say where `gcc' is to stop.  Note that
  1041. some combinations (for example, `-x cpp-output -E' instruct `gcc' to do
  1042. nothing at all.
  1043.  
  1044. `-c'
  1045.      Compile or assemble the source files, but do not link.  The linking
  1046.      stage simply is not done.  The ultimate output is in the form of an
  1047.      object file for each source file.
  1048.  
  1049.      By default, the object file name for a source file is made by
  1050.      replacing the suffix `.c', `.i', `.s', etc., with `.o'.
  1051.  
  1052.      Unrecognized input files, not requiring compilation or assembly,
  1053.      are ignored.
  1054.  
  1055. `-S'
  1056.      Stop after the stage of compilation proper; do not assemble.  The
  1057.      output is in the form of an assembler code file for each
  1058.      non-assembler input file specified.
  1059.  
  1060.      By default, the assembler file name for a source file is made by
  1061.      replacing the suffix `.c', `.i', etc., with `.s'.
  1062.  
  1063.      Input files that don't require compilation are ignored.
  1064.  
  1065. `-E'
  1066.      Stop after the preprocessing stage; do not run the compiler
  1067.      proper.  The output is in the form of preprocessed source code,
  1068.      which is sent to the standard output.
  1069.  
  1070.      Input files which don't require preprocessing are ignored.
  1071.  
  1072. `-o FILE'
  1073.      Place output in file FILE.  This applies regardless to whatever
  1074.      sort of output is being produced, whether it be an executable file,
  1075.      an object file, an assembler file or preprocessed C code.
  1076.  
  1077.      Since only one output file can be specified, it does not make
  1078.      sense to use `-o' when compiling more than one input file, unless
  1079.      you are producing an executable file as output.
  1080.  
  1081.      If `-o' is not specified, the default is to put an executable file
  1082.      in `a.out', the object file for `SOURCE.SUFFIX' in `SOURCE.o', its
  1083.      assembler file in `SOURCE.s', and all preprocessed C source on
  1084.      standard output.
  1085.  
  1086. `-v'
  1087.      Print (on standard error output) the commands executed to run the
  1088.      stages of compilation.  Also print the version number of the
  1089.      compiler driver program and of the preprocessor and the compiler
  1090.      proper.
  1091.  
  1092. `-pipe'
  1093.      Use pipes rather than temporary files for communication between the
  1094.      various stages of compilation.  This fails to work on some systems
  1095.      where the assembler is unable to read from a pipe; but the GNU
  1096.      assembler has no trouble.
  1097.  
  1098. 
  1099. File: @.Distr.UsingGCC,  Node: Invoking G++,  Next: C Dialect Options,  Prev: Overall Options,  Up: Invoking GCC
  1100.  
  1101. Compiling C++ Programs
  1102. ======================
  1103.  
  1104.    C++ source files conventionally use one of the suffixes `.C', `.cc',
  1105. or `.cxx'; preprocessed C++ files use the suffix `.ii'.  GNU CC
  1106. recognizes files with these names and compiles them as C++ programs
  1107. even if you call the compiler the same way as for compiling C programs
  1108. (usually with the name `gcc').
  1109.  
  1110.    However, C++ programs often require class libraries as well as a
  1111. compiler that understands the C++ language--and under some
  1112. circumstances, you might want to compile programs from standard input,
  1113. or otherwise without a suffix that flags them as C++ programs.  `g++'
  1114. is a shell script that calls GNU CC with the default language set to
  1115. C++, and automatically specifies linking against the GNU class library
  1116. libg++.  (1) On many systems, the script `g++' is also installed with
  1117. the name `c++'.
  1118.  
  1119.    When you compile C++ programs, you may specify many of the same
  1120. command-line options that you use for compiling programs in any
  1121. language; or command-line options meaningful for C and related
  1122. languages; or options that are meaningful only for C++ programs.  *Note
  1123. Options Controlling C Dialect: C Dialect Options, for explanations of
  1124. options for languages related to C.  *Note Options Controlling C++
  1125. Dialect: C++ Dialect Options, for explanations of options that are
  1126. meaningful only for C++ programs.
  1127.  
  1128.    ---------- Footnotes ----------
  1129.  
  1130.    (1)  Prior to release 2 of the compiler, there was a separate `g++'
  1131. compiler.  That version was based on GNU CC, but not integrated with
  1132. it.  Versions of `g++' with a `1.XX' version number--for example, `g++'
  1133. version 1.37 or 1.42--are much less reliable than the versions
  1134. integrated with GCC 2.  Moreover, combining G++ `1.XX' with a version 2
  1135. GCC will simply not work.
  1136.  
  1137. 
  1138. File: @.Distr.UsingGCC,  Node: C Dialect Options,  Next: C++ Dialect Options,  Prev: Invoking G++,  Up: Invoking GCC
  1139.  
  1140. Options Controlling C Dialect
  1141. =============================
  1142.  
  1143.    The following options control the dialect of C (or languages derived
  1144. from C, such as C++ and Objective C) that the compiler accepts:
  1145.  
  1146. `-ansi'
  1147.      Support all ANSI standard C programs.
  1148.  
  1149.      This turns off certain features of GNU C that are incompatible
  1150.      with ANSI C, such as the `asm', `inline' and `typeof' keywords, and
  1151.      predefined macros such as `unix' and `vax' that identify the type
  1152.      of system you are using.  It also enables the undesirable and
  1153.      rarely used ANSI trigraph feature, and disallows `$' as part of
  1154.      identifiers.
  1155.  
  1156.      The alternate keywords `__asm__', `__extension__', `__inline__'
  1157.      and `__typeof__' continue to work despite `-ansi'.  You would not
  1158.      want to use them in an ANSI C program, of course, but it useful to
  1159.      put them in header files that might be included in compilations
  1160.      done with `-ansi'.  Alternate predefined macros such as `__unix__'
  1161.      and `__vax__' are also available, with or without `-ansi'.
  1162.  
  1163.      The `-ansi' option does not cause non-ANSI programs to be rejected
  1164.      gratuitously.  For that, `-pedantic' is required in addition to
  1165.      `-ansi'.  *Note Warning Options::.
  1166.  
  1167.      The macro `__STRICT_ANSI__' is predefined when the `-ansi' option
  1168.      is used.  Some header files may notice this macro and refrain from
  1169.      declaring certain functions or defining certain macros that the
  1170.      ANSI standard doesn't call for; this is to avoid interfering with
  1171.      any programs that might use these names for other things.
  1172.  
  1173.      The functions `alloca', `abort', `exit', and `_exit' are not
  1174.      builtin functions when `-ansi' is used.
  1175.  
  1176. `-fno-asm'
  1177.      Do not recognize `asm', `inline' or `typeof' as a keyword.  These
  1178.      words may then be used as identifiers.  You can use the keywords
  1179.      `__asm__', `__inline__' and `__typeof__' instead.  `-ansi' implies
  1180.      `-fno-asm'.
  1181.  
  1182. `-fno-builtin'
  1183.      Don't recognize built-in functions that do not begin with two
  1184.      leading underscores.  Currently, the functions affected include
  1185.      `abort', `abs', `alloca', `cos', `exit', `fabs', `ffs', `labs',
  1186.      `memcmp', `memcpy', `sin', `sqrt', `strcmp', `strcpy', and
  1187.      `strlen'.
  1188.  
  1189.      The `-ansi' option prevents `alloca' and `ffs' from being builtin
  1190.      functions, since these functions do not have an ANSI standard
  1191.      meaning.
  1192.  
  1193. `-trigraphs'
  1194.      Support ANSI C trigraphs.  You don't want to know about this
  1195.      brain-damage.  The `-ansi' option implies `-trigraphs'.
  1196.  
  1197. `-traditional'
  1198.      Attempt to support some aspects of traditional C compilers.
  1199.      Specifically:
  1200.  
  1201.         * All `extern' declarations take effect globally even if they
  1202.           are written inside of a function definition.  This includes
  1203.           implicit declarations of functions.
  1204.  
  1205.         * The newer keywords `typeof', `inline', `signed', `const' and
  1206.           `volatile' are not recognized.  (You can still use the
  1207.           alternative keywords such as `__typeof__', `__inline__', and
  1208.           so on.)
  1209.  
  1210.         * Comparisons between pointers and integers are always allowed.
  1211.  
  1212.         * Integer types `unsigned short' and `unsigned char' promote to
  1213.           `unsigned int'.
  1214.  
  1215.         * Out-of-range floating point literals are not an error.
  1216.  
  1217.         * Certain constructs which ANSI regards as a single invalid
  1218.           preprocessing number, such as `0xe-0xd', are treated as
  1219.           expressions instead.
  1220.  
  1221.         * String "constants" are not necessarily constant; they are
  1222.           stored in writable space, and identical looking constants are
  1223.           allocated separately.  (This is the same as the effect of
  1224.           `-fwritable-strings'.)
  1225.  
  1226.         * All automatic variables not declared `register' are preserved
  1227.           by `longjmp'.  Ordinarily, GNU C follows ANSI C: automatic
  1228.           variables not declared `volatile' may be clobbered.
  1229.  
  1230.         * In the preprocessor, comments convert to nothing at all,
  1231.           rather than to a space.  This allows traditional token
  1232.           concatenation.
  1233.  
  1234.         * In the preprocessor, macro arguments are recognized within
  1235.           string constants in a macro definition (and their values are
  1236.           stringified, though without additional quote marks, when they
  1237.           appear in such a context).  The preprocessor always considers
  1238.           a string constant to end at a newline.
  1239.  
  1240.         * The predefined macro `__STDC__' is not defined when you use
  1241.           `-traditional', but `__GNUC__' is (since the GNU extensions
  1242.           which `__GNUC__' indicates are not affected by
  1243.           `-traditional').  If you need to write header files that work
  1244.           differently depending on whether `-traditional' is in use, by
  1245.           testing both of these predefined macros you can distinguish
  1246.           four situations: GNU C, traditional GNU C, other ANSI C
  1247.           compilers, and other old C compilers.  *Note Standard
  1248.           Predefined Macros: (cpp.info)Standard Predefined, for more
  1249.           discussion of these and other predefined macros.
  1250.  
  1251.         * The preprocessor considers a string constant to end at a
  1252.           newline (unless the newline is escaped with `\').  (Without
  1253.           `-traditional', string constants can contain the newline
  1254.           character as typed.)
  1255.  
  1256.         * The character escape sequences `\x' and `\a' evaluate as the
  1257.           literal characters `x' and `a' respectively.  Without
  1258.           `-traditional', `\x' is a prefix for the hexadecimal
  1259.           representation of a character, and `\a' produces a bell.
  1260.  
  1261.         * In C++ programs, assignment to `this' is permitted with
  1262.           `-traditional'.  (The option `-fthis-is-variable' also has
  1263.           this effect.)
  1264.  
  1265.      You may wish to use `-fno-builtin' as well as `-traditional' if
  1266.      your program uses names that are normally GNU C builtin functions
  1267.      for other purposes of its own.
  1268.  
  1269. `-traditional-cpp'
  1270.      Attempt to support some aspects of traditional C preprocessors.
  1271.      This includes the last three items in the table immediately above,
  1272.      but none of the other effects of `-traditional'.
  1273.  
  1274. `-fcond-mismatch'
  1275.      Allow conditional expressions with mismatched types in the second
  1276.      and third arguments.  The value of such an expression is void.
  1277.  
  1278. `-funsigned-char'
  1279.      Let the type `char' be unsigned, like `unsigned char'.
  1280.  
  1281.      Each kind of machine has a default for what `char' should be.  It
  1282.      is either like `unsigned char' by default or like `signed char' by
  1283.      default.
  1284.  
  1285.      Ideally, a portable program should always use `signed char' or
  1286.      `unsigned char' when it depends on the signedness of an object.
  1287.      But many programs have been written to use plain `char' and expect
  1288.      it to be signed, or expect it to be unsigned, depending on the
  1289.      machines they were written for.  This option, and its inverse, let
  1290.      you make such a program work with the opposite default.
  1291.  
  1292.      The type `char' is always a distinct type from each of `signed
  1293.      char' or `unsigned char', even though its behavior is always just
  1294.      like one of those two.
  1295.  
  1296. `-fsigned-char'
  1297.      Let the type `char' be signed, like `signed char'.
  1298.  
  1299.      Note that this is equivalent to `-fno-unsigned-char', which is the
  1300.      negative form of `-funsigned-char'.  Likewise, the option
  1301.      `-fno-signed-char' is equivalent to `-funsigned-char'.
  1302.  
  1303. `-fsigned-bitfields'
  1304. `-funsigned-bitfields'
  1305. `-fno-signed-bitfields'
  1306. `-fno-unsigned-bitfields'
  1307.      These options control whether a bitfield is signed or unsigned,
  1308.      when the declaration does not use either `signed' or `unsigned'.
  1309.      By default, such a bitfield is signed, because this is consistent:
  1310.      the basic integer types such as `int' are signed types.
  1311.  
  1312.      However, when `-traditional' is used, bitfields are all unsigned
  1313.      no matter what.
  1314.  
  1315. `-fwritable-strings'
  1316.      Store string constants in the writable data segment and don't
  1317.      uniquize them.  This is for compatibility with old programs which
  1318.      assume they can write into string constants.  The option
  1319.      `-traditional' also has this effect.
  1320.  
  1321.      Writing into string constants is a very bad idea; "constants"
  1322.      should be constant.
  1323.  
  1324. 
  1325. File: @.Distr.UsingGCC,  Node: C++ Dialect Options,  Next: Warning Options,  Prev: C Dialect Options,  Up: Invoking GCC
  1326.  
  1327. Options Controlling C++ Dialect
  1328. ===============================
  1329.  
  1330.    This section describes the command-line options that are only
  1331. meaningful for C++ programs; but you can also use most of the GNU
  1332. compiler options regardless of what language your program is in.  For
  1333. example, you might compile a file `firstClass.C' like this:
  1334.  
  1335.      g++ -g -felide-constructors -O -c firstClass.C
  1336.  
  1337. In this example, only `-felide-constructors' is an option meant only
  1338. for C++ programs; you can use the other options with any language
  1339. supported by GNU CC.
  1340.  
  1341.    Here is a list of options that are *only* for compiling C++ programs:
  1342.  
  1343. `-fall-virtual'
  1344.      Treat all possible member functions as virtual, implicitly.  All
  1345.      member functions (except for constructor functions and `new' or
  1346.      `delete' member operators) are treated as virtual functions of the
  1347.      class where they appear.
  1348.  
  1349.      This does not mean that all calls to these member functions will
  1350.      be made through the internal table of virtual functions.  Under
  1351.      some circumstances, the compiler can determine that a call to a
  1352.      given virtual function can be made directly; in these cases the
  1353.      calls are direct in any case.
  1354.  
  1355. `-fdollars-in-identifiers'
  1356.      Accept `$' in identifiers.  You can also explicitly prohibit use of
  1357.      `$' with the option `-fno-dollars-in-identifiers'.  (GNU C++
  1358.      allows `$' by default on some target systems but not others.)
  1359.      Traditional C allowed the character `$' to form part of
  1360.      identifiers.  However, ANSI C and C++ forbid `$' in identifiers.
  1361.  
  1362. `-felide-constructors'
  1363.      Elide constructors when this seems plausible.  With this option,
  1364.      GNU C++ initializes `y' directly from the call to `foo' without
  1365.      going through a temporary in the following code:
  1366.  
  1367.           A foo ();
  1368.           A y = foo ();
  1369.  
  1370.      Without this option, GNU C++ (1) initializes `y' by calling the
  1371.      appropriate constructor for type `A'; (2) assigns the result of
  1372.      `foo' to a temporary; and, finally, (3) replaces the initial value
  1373.      of `y' with the temporary.
  1374.  
  1375.      The default behavior (`-fno-elide-constructors') is specified by
  1376.      the draft ANSI C++ standard.  If your program's constructors have
  1377.      side effects, `-felide-constructors' can change your program's
  1378.      behavior, since some constructor calls may be omitted.
  1379.  
  1380. `-fenum-int-equiv'
  1381.      Permit implicit conversion of `int' to enumeration types.  Normally
  1382.      GNU C++ allows conversion of `enum' to `int', but not the other
  1383.      way around.
  1384.  
  1385. `-fmemoize-lookups'
  1386. `-fsave-memoized'
  1387.      Use heuristics to compile faster.  These heuristics are not
  1388.      enabled by default, since they are only effective for certain
  1389.      input files.  Other input files compile more slowly.
  1390.  
  1391.      The first time the compiler must build a call to a member function
  1392.      (or reference to a data member), it must (1) determine whether the
  1393.      class implements member functions of that name; (2) resolve which
  1394.      member function to call (which involves figuring out what sorts of
  1395.      type conversions need to be made); and (3) check the visibility of
  1396.      the member function to the caller.  All of this adds up to slower
  1397.      compilation.  Normally, the second time a call is made to that
  1398.      member function (or reference to that data member), it must go
  1399.      through the same lengthy process again.  This means that code like
  1400.      this:
  1401.  
  1402.           cout << "This " << p << " has " << n << " legs.\n";
  1403.  
  1404.      makes six passes through all three steps.  By using a software
  1405.      cache, a "hit" significantly reduces this cost.  Unfortunately,
  1406.      using the cache introduces another layer of mechanisms which must
  1407.      be implemented, and so incurs its own overhead.
  1408.      `-fmemoize-lookups' enables the software cache.
  1409.  
  1410.      Because access privileges (visibility) to members and member
  1411.      functions may differ from one function context to the next, G++
  1412.      may need to flush the cache.  With the `-fmemoize-lookups' flag,
  1413.      the cache is flushed after every function that is compiled.  The
  1414.      `-fsave-memoized' flag enables the same software cache, but when
  1415.      the compiler determines that the context of the last function
  1416.      compiled would yield the same access privileges of the next
  1417.      function to compile, it preserves the cache.  This is most helpful
  1418.      when defining many member functions for the same class: with the
  1419.      exception of member functions which are friends of other classes,
  1420.      each member function has exactly the same access privileges as
  1421.      every other, and the cache need not be flushed.
  1422.  
  1423. `-fno-strict-prototype'
  1424.      Treat a function declaration with no arguments, such as `int foo
  1425.      ();', as C would treat it--as saying nothing about the number of
  1426.      arguments or their types.  Normally, such a declaration in C++
  1427.      means that the function `foo' takes no arguments.
  1428.  
  1429. `-fnonnull-objects'
  1430.      Assume that objects reached through references are not null.
  1431.  
  1432.      Normally, GNU C++ makes conservative assumptions about objects
  1433.      reached through references.  For example, the compiler must check
  1434.      that `a' is not null in code like the following:
  1435.  
  1436.           obj &a = g ();
  1437.           a.f (2);
  1438.  
  1439.      Checking that references of this sort have non-null values requires
  1440.      extra code, however, and it is unnecessary for many programs.  You
  1441.      can use `-fnonnull-objects' to omit the checks for null, if your
  1442.      program doesn't require checking.
  1443.  
  1444. `-fthis-is-variable'
  1445.      Permit assignment to `this'.  The incorporation of user-defined
  1446.      free store management into C++ has made assignment to `this' an
  1447.      anachronism.  Therefore, by default it is invalid to assign to
  1448.      `this' within a class member function; that is, GNU C++ treats the
  1449.      type of `this' in a member function of class `X' to be `X *const'.
  1450.      However, for backwards compatibility, you can make it valid with
  1451.      `-fthis-is-variable'.
  1452.  
  1453. `-nostdinc++'
  1454.      Do not search for header files in the standard directories
  1455.      specific to C++, but do still search the other standard
  1456.      directories.  (This option is used when building libg++.)
  1457.  
  1458. `-traditional'
  1459.      For C++ programs (in addition to the effects that apply to both C
  1460.      and C++), this has the same effect as `-fthis-is-variable'.  *Note
  1461.      Options Controlling C Dialect: C Dialect Options.
  1462.  
  1463.    In addition, these optimization, warning, and code generation options
  1464. have meanings only for C++ programs:
  1465.  
  1466. `-fno-default-inline'
  1467.      Do not assume `inline' for functions defined inside a class scope.
  1468.      *Note Options That Control Optimization: Optimize Options.
  1469.  
  1470. `-Wenum-clash'
  1471. `-Woverloaded-virtual'
  1472. `-Wtemplate-debugging'
  1473.      Warnings that apply only to C++ programs.  *Note Options to
  1474.      Request or Suppress Warnings: Warning Options.
  1475.  
  1476. `+eN'
  1477.      Control how virtual function definitions are used, in a fashion
  1478.      compatible with `cfront' 1.x.  *Note Options for Code Generation
  1479.      Conventions: Code Gen Options.
  1480.  
  1481. 
  1482. File: @.Distr.UsingGCC,  Node: Warning Options,  Next: Debugging Options,  Prev: C++ Dialect Options,  Up: Invoking GCC
  1483.  
  1484. Options to Request or Suppress Warnings
  1485. =======================================
  1486.  
  1487.    Warnings are diagnostic messages that report constructions which are
  1488. not inherently erroneous but which are risky or suggest there may have
  1489. been an error.
  1490.  
  1491.    You can request many specific warnings with options beginning `-W',
  1492. for example `-Wimplicit' to request warnings on implicit declarations.
  1493. Each of these specific warning options also has a negative form
  1494. beginning `-Wno-' to turn off warnings; for example, `-Wno-implicit'.
  1495. This manual lists only one of the two forms, whichever is not the
  1496. default.
  1497.  
  1498.    These options control the amount and kinds of warnings produced by
  1499. GNU CC:
  1500.  
  1501. `-fsyntax-only'
  1502.      Check the code for syntax errors, but don't do anything beyond
  1503.      that.
  1504.  
  1505. `-w'
  1506.      Inhibit all warning messages.
  1507.  
  1508. `-Wno-import'
  1509.      Inhibit warning messages about the use of `#import'.
  1510.  
  1511. `-pedantic'
  1512.      Issue all the warnings demanded by strict ANSI standard C; reject
  1513.      all programs that use forbidden extensions.
  1514.  
  1515.      Valid ANSI standard C programs should compile properly with or
  1516.      without this option (though a rare few will require `-ansi').
  1517.      However, without this option, certain GNU extensions and
  1518.      traditional C features are supported as well.  With this option,
  1519.      they are rejected.
  1520.  
  1521.      `-pedantic' does not cause warning messages for use of the
  1522.      alternate keywords whose names begin and end with `__'.  Pedantic
  1523.      warnings are also disabled in the expression that follows
  1524.      `__extension__'.  However, only system header files should use
  1525.      these escape routes; application programs should avoid them.
  1526.      *Note Alternate Keywords::.
  1527.  
  1528.      This option is not intended to be useful; it exists only to satisfy
  1529.      pedants who would otherwise claim that GNU CC fails to support the
  1530.      ANSI standard.
  1531.  
  1532.      Some users try to use `-pedantic' to check programs for strict ANSI
  1533.      C conformance.  They soon find that it does not do quite what they
  1534.      want: it finds some non-ANSI practices, but not all--only those
  1535.      for which ANSI C *requires* a diagnostic.
  1536.  
  1537.      A feature to report any failure to conform to ANSI C might be
  1538.      useful in some instances, but would require considerable
  1539.      additional work and would be quite different from `-pedantic'.  We
  1540.      recommend, rather, that users take advantage of the extensions of
  1541.      GNU C and disregard the limitations of other compilers.  Aside
  1542.      from certain supercomputers and obsolete small machines, there is
  1543.      less and less reason ever to use any other C compiler other than
  1544.      for bootstrapping GNU CC.
  1545.  
  1546. `-pedantic-errors'
  1547.      Like `-pedantic', except that errors are produced rather than
  1548.      warnings.
  1549.  
  1550. `-W'
  1551.      Print extra warning messages for these events:
  1552.  
  1553.         * A nonvolatile automatic variable might be changed by a call to
  1554.           `longjmp'.  These warnings as well are possible only in
  1555.           optimizing compilation.
  1556.  
  1557.           The compiler sees only the calls to `setjmp'.  It cannot know
  1558.           where `longjmp' will be called; in fact, a signal handler
  1559.           could call it at any point in the code.  As a result, you may
  1560.           get a warning even when there is in fact no problem because
  1561.           `longjmp' cannot in fact be called at the place which would
  1562.           cause a problem.
  1563.  
  1564.         * A function can return either with or without a value.
  1565.           (Falling off the end of the function body is considered
  1566.           returning without a value.)  For example, this function would
  1567.           evoke such a warning:
  1568.  
  1569.                foo (a)
  1570.                {
  1571.                  if (a > 0)
  1572.                    return a;
  1573.                }
  1574.  
  1575.         * An expression-statement contains no side effects.
  1576.  
  1577.         * An unsigned value is compared against zero with `>' or `<='.
  1578.  
  1579.         * A comparison like `x<=y<=z' appears; this is equivalent to
  1580.           `(x<=y ? 1 : 0) <= z', which is a different interpretation
  1581.           from that of ordinary mathematical notation.
  1582.  
  1583.         * Storage-class specifiers like `static' are not the first
  1584.           things in a declaration.  According to the C Standard, this
  1585.           usage is obsolescent.
  1586.  
  1587.         * An aggregate has a partly bracketed initializer.  For
  1588.           example, the following code would evoke such a warning,
  1589.           because braces are missing around the initializer for `x.h':
  1590.  
  1591.                struct s { int f, g; };
  1592.                struct t { struct s h; int i; };
  1593.                struct t x = { 1, 2, 3 };
  1594.  
  1595. `-Wimplicit'
  1596.      Warn whenever a function or parameter is implicitly declared.
  1597.  
  1598. `-Wreturn-type'
  1599.      Warn whenever a function is defined with a return-type that
  1600.      defaults to `int'.  Also warn about any `return' statement with no
  1601.      return-value in a function whose return-type is not `void'.
  1602.  
  1603. `-Wunused'
  1604.      Warn whenever a local variable is unused aside from its
  1605.      declaration, whenever a function is declared static but never
  1606.      defined, and whenever a statement computes a result that is
  1607.      explicitly not used.
  1608.  
  1609.      If you want to prevent a warning for a particular variable, you
  1610.      can use this macro:
  1611.  
  1612.           #define USE(var) \
  1613.             static void * use_##var = (&use_##var, (void *) &var)
  1614.           
  1615.           USE (string);
  1616.  
  1617. `-Wswitch'
  1618.      Warn whenever a `switch' statement has an index of enumeral type
  1619.      and lacks a `case' for one or more of the named codes of that
  1620.      enumeration.  (The presence of a `default' label prevents this
  1621.      warning.)  `case' labels outside the enumeration range also
  1622.      provoke warnings when this option is used.
  1623.  
  1624. `-Wcomment'
  1625.      Warn whenever a comment-start sequence `/*' appears in a comment.
  1626.  
  1627. `-Wtrigraphs'
  1628.      Warn if any trigraphs are encountered (assuming they are enabled).
  1629.  
  1630. `-Wformat'
  1631.      Check calls to `printf' and `scanf', etc., to make sure that the
  1632.      arguments supplied have types appropriate to the format string
  1633.      specified.
  1634.  
  1635. `-Wchar-subscripts'
  1636.      Warn if an array subscript has type `char'.  This is a common cause
  1637.      of error, as programmers often forget that this type is signed on
  1638.      some machines.
  1639.  
  1640. `-Wuninitialized'
  1641.      An automatic variable is used without first being initialized.
  1642.  
  1643.      These warnings are possible only in optimizing compilation,
  1644.      because they require data flow information that is computed only
  1645.      when optimizing.  If you don't specify `-O', you simply won't get
  1646.      these warnings.
  1647.  
  1648.      These warnings occur only for variables that are candidates for
  1649.      register allocation.  Therefore, they do not occur for a variable
  1650.      that is declared `volatile', or whose address is taken, or whose
  1651.      size is other than 1, 2, 4 or 8 bytes.  Also, they do not occur for
  1652.      structures, unions or arrays, even when they are in registers.
  1653.  
  1654.      Note that there may be no warning about a variable that is used
  1655.      only to compute a value that itself is never used, because such
  1656.      computations may be deleted by data flow analysis before the
  1657.      warnings are printed.
  1658.  
  1659.      These warnings are made optional because GNU CC is not smart
  1660.      enough to see all the reasons why the code might be correct
  1661.      despite appearing to have an error.  Here is one example of how
  1662.      this can happen:
  1663.  
  1664.           {
  1665.             int x;
  1666.             switch (y)
  1667.               {
  1668.               case 1: x = 1;
  1669.                 break;
  1670.               case 2: x = 4;
  1671.                 break;
  1672.               case 3: x = 5;
  1673.               }
  1674.             foo (x);
  1675.           }
  1676.  
  1677.      If the value of `y' is always 1, 2 or 3, then `x' is always
  1678.      initialized, but GNU CC doesn't know this.  Here is another common
  1679.      case:
  1680.  
  1681.           {
  1682.             int save_y;
  1683.             if (change_y) save_y = y, y = new_y;
  1684.             ...
  1685.             if (change_y) y = save_y;
  1686.           }
  1687.  
  1688.      This has no bug because `save_y' is used only if it is set.
  1689.  
  1690.      Some spurious warnings can be avoided if you declare all the
  1691.      functions you use that never return as `volatile'.  *Note Function
  1692.      Attributes::.
  1693.  
  1694. `-Wparentheses'
  1695.      Warn if parentheses are omitted in certain contexts, such as when
  1696.      there is an assignment in a context where a truth value is
  1697.      expected, or when operators are nested whose precedence people
  1698.      often get confused about.
  1699.  
  1700. `-Wenum-clash'
  1701.      Warn about conversion between different enumeration types.  (C++
  1702.      only).
  1703.  
  1704. `-Wtemplate-debugging'
  1705.      When using templates in a C++ program, warn if debugging is not yet
  1706.      fully available (C++ only).
  1707.  
  1708. `-Wall'
  1709.      All of the above `-W' options combined.  These are all the options
  1710.      which pertain to usage that we recommend avoiding and that we
  1711.      believe is easy to avoid, even in conjunction with macros.
  1712.  
  1713.    The remaining `-W...' options are not implied by `-Wall' because
  1714. they warn about constructions that we consider reasonable to use, on
  1715. occasion, in clean programs.
  1716.  
  1717. `-Wtraditional'
  1718.      Warn about certain constructs that behave differently in
  1719.      traditional and ANSI C.
  1720.  
  1721.         * Macro arguments occurring within string constants in the
  1722.           macro body.  These would substitute the argument in
  1723.           traditional C, but are part of the constant in ANSI C.
  1724.  
  1725.         * A function declared external in one block and then used after
  1726.           the end of the block.
  1727.  
  1728.         * A `switch' statement has an operand of type `long'.
  1729.  
  1730. `-Wshadow'
  1731.      Warn whenever a local variable shadows another local variable.
  1732.  
  1733. `-Wid-clash-LEN'
  1734.      Warn whenever two distinct identifiers match in the first LEN
  1735.      characters.  This may help you prepare a program that will compile
  1736.      with certain obsolete, brain-damaged compilers.
  1737.  
  1738. `-Wpointer-arith'
  1739.      Warn about anything that depends on the "size of" a function type
  1740.      or of `void'.  GNU C assigns these types a size of 1, for
  1741.      convenience in calculations with `void *' pointers and pointers to
  1742.      functions.
  1743.  
  1744. `-Wcast-qual'
  1745.      Warn whenever a pointer is cast so as to remove a type qualifier
  1746.      from the target type.  For example, warn if a `const char *' is
  1747.      cast to an ordinary `char *'.
  1748.  
  1749. `-Wcast-align'
  1750.      Warn whenever a pointer is cast such that the required alignment
  1751.      of the target is increased.  For example, warn if a `char *' is
  1752.      cast to an `int *' on machines where integers can only be accessed
  1753.      at two- or four-byte boundaries.
  1754.  
  1755. `-Wwrite-strings'
  1756.      Give string constants the type `const char[LENGTH]' so that
  1757.      copying the address of one into a non-`const' `char *' pointer
  1758.      will get a warning.  These warnings will help you find at compile
  1759.      time code that can try to write into a string constant, but only
  1760.      if you have been very careful about using `const' in declarations
  1761.      and prototypes.  Otherwise, it will just be a nuisance; this is
  1762.      why we did not make `-Wall' request these warnings.
  1763.  
  1764. `-Wconversion'
  1765.      Warn if a prototype causes a type conversion that is different
  1766.      from what would happen to the same argument in the absence of a
  1767.      prototype.  This includes conversions of fixed point to floating
  1768.      and vice versa, and conversions changing the width or signedness
  1769.      of a fixed point argument except when the same as the default
  1770.      promotion.
  1771.  
  1772.      Also, warn if a negative integer constant expression is implicitly
  1773.      converted to an unsigned type.  For example, warn about the
  1774.      assignment `x = -1' if `x' is unsigned.  But do not warn about
  1775.      explicit casts like `(unsigned) -1'.
  1776.  
  1777. `-Waggregate-return'
  1778.      Warn if any functions that return structures or unions are defined
  1779.      or called.  (In languages where you can return an array, this also
  1780.      elicits a warning.)
  1781.  
  1782. `-Wstrict-prototypes'
  1783.      Warn if a function is declared or defined without specifying the
  1784.      argument types.  (An old-style function definition is permitted
  1785.      without a warning if preceded by a declaration which specifies the
  1786.      argument types.)
  1787.  
  1788. `-Wmissing-prototypes'
  1789.      Warn if a global function is defined without a previous prototype
  1790.      declaration.  This warning is issued even if the definition itself
  1791.      provides a prototype.  The aim is to detect global functions that
  1792.      fail to be declared in header files.
  1793.  
  1794. `-Wredundant-decls'
  1795.      Warn if anything is declared more than once in the same scope,
  1796.      even in cases where multiple declaration is valid and changes
  1797.      nothing.
  1798.  
  1799. `-Wnested-externs'
  1800.      Warn if an `extern' declaration is encountered within an function.
  1801.  
  1802. `-Winline'
  1803.      Warn if a function can not be inlined, and either it was declared
  1804.      as inline, or else the `-finline-functions' option was given.
  1805.  
  1806. `-Woverloaded-virtual'
  1807.      Warn when a derived class function declaration may be an error in
  1808.      defining a virtual function (C++ only).  In a derived class, the
  1809.      definitions of virtual functions must match the type signature of a
  1810.      virtual function declared in the base class.  With this option, the
  1811.      compiler warns when you define a function with the same name as a
  1812.      virtual function, but with a type signature that does not match any
  1813.      declarations from the base class.
  1814.  
  1815. `-Werror'
  1816.      Make all warnings into errors.
  1817.  
  1818. 
  1819. File: @.Distr.UsingGCC,  Node: Debugging Options,  Next: Optimize Options,  Prev: Warning Options,  Up: Invoking GCC
  1820.  
  1821. Options for Debugging Your Program or GNU CC
  1822. ============================================
  1823.  
  1824.    GNU CC has various special options that are used for debugging
  1825. either your program or GCC:
  1826.  
  1827. `-g'
  1828.      Produce debugging information in the operating system's native
  1829.      format (stabs, COFF, XCOFF, or DWARF).  GDB can work with this
  1830.      debugging information.
  1831.  
  1832.      On most systems that use stabs format, `-g' enables use of extra
  1833.      debugging information that only GDB can use; this extra information
  1834.      makes debugging work better in GDB but will probably make other
  1835.      debuggers crash or refuse to read the program.  If you want to
  1836.      control for certain whether to generate the extra information, use
  1837.      `-gstabs+', `-gstabs', `-gxcoff+', `-gxcoff', `-gdwarf+', or
  1838.      `-gdwarf' (see below).
  1839.  
  1840.      Unlike most other C compilers, GNU CC allows you to use `-g' with
  1841.      `-O'.  The shortcuts taken by optimized code may occasionally
  1842.      produce surprising results: some variables you declared may not
  1843.      exist at all; flow of control may briefly move where you did not
  1844.      expect it; some statements may not be executed because they
  1845.      compute constant results or their values were already at hand;
  1846.      some statements may execute in different places because they were
  1847.      moved out of loops.
  1848.  
  1849.      Nevertheless it proves possible to debug optimized output.  This
  1850.      makes it reasonable to use the optimizer for programs that might
  1851.      have bugs.
  1852.  
  1853.      The following options are useful when GNU CC is generated with the
  1854.      capability for more than one debugging format.
  1855.  
  1856. `-ggdb'
  1857.      Produce debugging information in the native format (if that is
  1858.      supported), including GDB extensions if at all possible.
  1859.  
  1860. `-gstabs'
  1861.      Produce debugging information in stabs format (if that is
  1862.      supported), without GDB extensions.  This is the format used by
  1863.      DBX on most BSD systems.
  1864.  
  1865. `-gstabs+'
  1866.      Produce debugging information in stabs format (if that is
  1867.      supported), using GNU extensions understood only by the GNU
  1868.      debugger (GDB).  The use of these extensions is likely to make
  1869.      other debuggers crash or refuse to read the program.
  1870.  
  1871. `-gcoff'
  1872.      Produce debugging information in COFF format (if that is
  1873.      supported).  This is the format used by SDB on most System V
  1874.      systems prior to System V Release 4.
  1875.  
  1876. `-gxcoff'
  1877.      Produce debugging information in XCOFF format (if that is
  1878.      supported).  This is the format used by the DBX debugger on IBM
  1879.      RS/6000 systems.
  1880.  
  1881. `-gxcoff+'
  1882.      Produce debugging information in XCOFF format (if that is
  1883.      supported), using GNU extensions understood only by the GNU
  1884.      debugger (GDB).  The use of these extensions is likely to make
  1885.      other debuggers crash or refuse to read the program.
  1886.  
  1887. `-gdwarf'
  1888.      Produce debugging information in DWARF format (if that is
  1889.      supported).  This is the format used by SDB on most System V
  1890.      Release 4 systems.
  1891.  
  1892. `-gdwarf+'
  1893.      Produce debugging information in DWARF format (if that is
  1894.      supported), using GNU extensions understood only by the GNU
  1895.      debugger (GDB).  The use of these extensions is likely to make
  1896.      other debuggers crash or refuse to read the program.
  1897.  
  1898. `-gLEVEL'
  1899. `-ggdbLEVEL'
  1900. `-gstabsLEVEL'
  1901. `-gcoffLEVEL'
  1902. `-gxcoffLEVEL'
  1903. `-gdwarfLEVEL'
  1904.      Request debugging information and also use LEVEL to specify how
  1905.      much information.  The default level is 2.
  1906.  
  1907.      Level 1 produces minimal information, enough for making backtraces
  1908.      in parts of the program that you don't plan to debug.  This
  1909.      includes descriptions of functions and external variables, but no
  1910.      information about local variables and no line numbers.
  1911.  
  1912.      Level 3 includes extra information, such as all the macro
  1913.      definitions present in the program.  Some debuggers support macro
  1914.      expansion when you use `-g3'.
  1915.  
  1916. `-p'
  1917.      Generate extra code to write profile information suitable for the
  1918.      analysis program `prof'.  You must use this option when compiling
  1919.      the source files you want data about, and you must also use it when
  1920.      linking.
  1921.  
  1922. `-pg'
  1923.      Generate extra code to write profile information suitable for the
  1924.      analysis program `gprof'.  You must use this option when compiling
  1925.      the source files you want data about, and you must also use it when
  1926.      linking.
  1927.  
  1928. `-a'
  1929.      Generate extra code to write profile information for basic blocks,
  1930.      which will record the number of times each basic block is executed.
  1931.      This data could be analyzed by a program like `tcov'.  Note,
  1932.      however, that the format of the data is not what `tcov' expects.
  1933.      Eventually GNU `gprof' should be extended to process this data.
  1934.  
  1935. `-dLETTERS'
  1936.      Says to make debugging dumps during compilation at times specified
  1937.      by LETTERS.  This is used for debugging the compiler.  The file
  1938.      names for most of the dumps are made by appending a word to the
  1939.      source file name (e.g.  `foo.c.rtl' or `foo.c.jump').  Here are the
  1940.      possible letters for use in LETTERS, and their meanings:
  1941.  
  1942.     `M'
  1943.           Dump all macro definitions, at the end of preprocessing, and
  1944.           write no output.
  1945.  
  1946.     `N'
  1947.           Dump all macro names, at the end of preprocessing.
  1948.  
  1949.     `D'
  1950.           Dump all macro definitions, at the end of preprocessing, in
  1951.           addition to normal output.
  1952.  
  1953.     `y'
  1954.           Dump debugging information during parsing, to standard error.
  1955.  
  1956.     `r'
  1957.           Dump after RTL generation, to `FILE.rtl'.
  1958.  
  1959.     `x'
  1960.           Just generate RTL for a function instead of compiling it.
  1961.           Usually used with `r'.
  1962.  
  1963.     `j'
  1964.           Dump after first jump optimization, to `FILE.jump'.
  1965.  
  1966.     `s'
  1967.           Dump after CSE (including the jump optimization that sometimes
  1968.           follows CSE), to `FILE.cse'.
  1969.  
  1970.     `L'
  1971.           Dump after loop optimization, to `FILE.loop'.
  1972.  
  1973.     `t'
  1974.           Dump after the second CSE pass (including the jump
  1975.           optimization that sometimes follows CSE), to `FILE.cse2'.
  1976.  
  1977.     `f'
  1978.           Dump after flow analysis, to `FILE.flow'.
  1979.  
  1980.     `c'
  1981.           Dump after instruction combination, to the file
  1982.           `FILE.combine'.
  1983.  
  1984.     `S'
  1985.           Dump after the first instruction scheduling pass, to
  1986.           `FILE.sched'.
  1987.  
  1988.     `l'
  1989.           Dump after local register allocation, to `FILE.lreg'.
  1990.  
  1991.     `g'
  1992.           Dump after global register allocation, to `FILE.greg'.
  1993.  
  1994.     `R'
  1995.           Dump after the second instruction scheduling pass, to
  1996.           `FILE.sched2'.
  1997.  
  1998.     `J'
  1999.           Dump after last jump optimization, to `FILE.jump2'.
  2000.  
  2001.     `d'
  2002.           Dump after delayed branch scheduling, to `FILE.dbr'.
  2003.  
  2004.     `k'
  2005.           Dump after conversion from registers to stack, to
  2006.           `FILE.stack'.
  2007.  
  2008.     `a'
  2009.           Produce all the dumps listed above.
  2010.  
  2011.     `m'
  2012.           Print statistics on memory usage, at the end of the run, to
  2013.           standard error.
  2014.  
  2015.     `p'
  2016.           Annotate the assembler output with a comment indicating which
  2017.           pattern and alternative was used.
  2018.  
  2019. `-fpretend-float'
  2020.      When running a cross-compiler, pretend that the target machine
  2021.      uses the same floating point format as the host machine.  This
  2022.      causes incorrect output of the actual floating constants, but the
  2023.      actual instruction sequence will probably be the same as GNU CC
  2024.      would make when running on the target machine.
  2025.  
  2026. `-save-temps'
  2027.      Store the usual "temporary" intermediate files permanently; place
  2028.      them in the current directory and name them based on the source
  2029.      file.  Thus, compiling `foo.c' with `-c -save-temps' would produce
  2030.      files `foo.i' and `foo.s', as well as `foo.o'.
  2031.  
  2032. `-print-libgcc-file-name'
  2033.      Print the full absolute name of the library file `libgcc.a' that
  2034.      would be used when linking--and don't do anything else.  With this
  2035.      option, GNU CC does not compile or link anything; it just prints
  2036.      the file name.
  2037.  
  2038.      This is useful when you use `-nostdlib' but you do want to link
  2039.      with `libgcc.a'.  You can do
  2040.  
  2041.           gcc -nostdlib FILES... `gcc -print-libgcc-file-name`
  2042.  
  2043. 
  2044. File: @.Distr.UsingGCC,  Node: Optimize Options,  Next: Preprocessor Options,  Prev: Debugging Options,  Up: Invoking GCC
  2045.  
  2046. Options That Control Optimization
  2047. =================================
  2048.  
  2049.    These options control various sorts of optimizations:
  2050.  
  2051. `-O'
  2052. `-O1'
  2053.      Optimize.  Optimizing compilation takes somewhat more time, and a
  2054.      lot more memory for a large function.
  2055.  
  2056.      Without `-O', the compiler's goal is to reduce the cost of
  2057.      compilation and to make debugging produce the expected results.
  2058.      Statements are independent: if you stop the program with a
  2059.      breakpoint between statements, you can then assign a new value to
  2060.      any variable or change the program counter to any other statement
  2061.      in the function and get exactly the results you would expect from
  2062.      the source code.
  2063.  
  2064.      Without `-O', only variables declared `register' are allocated in
  2065.      registers.  The resulting compiled code is a little worse than
  2066.      produced by PCC without `-O'.
  2067.  
  2068.      With `-O', the compiler tries to reduce code size and execution
  2069.      time.
  2070.  
  2071.      When `-O' is specified, the two options `-fthread-jumps' and
  2072.      `-fdelayed-branch' are turned on.  On some machines other flags may
  2073.      also be turned on.
  2074.  
  2075. `-O2'
  2076.      Optimize even more.  Nearly all supported optimizations that do not
  2077.      involve a space-speed tradeoff are performed.  As compared to `-O',
  2078.      this option increases both compilation time and the performance of
  2079.      the generated code.
  2080.  
  2081.      `-O2' turns on all optional optimizations except for loop unrolling
  2082.      and frame pointer elimination.
  2083.  
  2084. `-O0'
  2085.      Do not optimize.
  2086.  
  2087.      If you use multiple `-O' options, with or without level numbers,
  2088.      the last such option is the one that is effective.
  2089.  
  2090.    Options of the form `-fFLAG' specify machine-independent flags.
  2091. Most flags have both positive and negative forms; the negative form of
  2092. `-ffoo' would be `-fno-foo'.  In the table below, only one of the forms
  2093. is listed--the one which is not the default.  You can figure out the
  2094. other form by either removing `no-' or adding it.
  2095.  
  2096. `-ffloat-store'
  2097.      Do not store floating point variables in registers, and inhibit
  2098.      other options that might change whether a floating point value is
  2099.      taken from a register or memory.
  2100.  
  2101.      This option prevents undesirable excess precision on machines such
  2102.      as the 68000 where the floating registers (of the 68881) keep more
  2103.      precision than a `double' is supposed to have.  For most programs,
  2104.      the excess precision does only good, but a few programs rely on the
  2105.      precise definition of IEEE floating point.  Use `-ffloat-store' for
  2106.      such programs.
  2107.  
  2108. `-fno-default-inline'
  2109.      Do not make member functions inline by default merely because they
  2110.      are defined inside the class scope (C++ only).  Otherwise, when
  2111.      you specify `-O', member functions defined inside class scope are
  2112.      compiled inline by default; i.e., you don't need to add `inline'
  2113.      in front of the member function name.
  2114.  
  2115. `-fno-defer-pop'
  2116.      Always pop the arguments to each function call as soon as that
  2117.      function returns.  For machines which must pop arguments after a
  2118.      function call, the compiler normally lets arguments accumulate on
  2119.      the stack for several function calls and pops them all at once.
  2120.  
  2121. `-fforce-mem'
  2122.      Force memory operands to be copied into registers before doing
  2123.      arithmetic on them.  This may produce better code by making all
  2124.      memory references potential common subexpressions.  When they are
  2125.      not common subexpressions, instruction combination should
  2126.      eliminate the separate register-load.  I am interested in hearing
  2127.      about the difference this makes.
  2128.  
  2129. `-fforce-addr'
  2130.      Force memory address constants to be copied into registers before
  2131.      doing arithmetic on them.  This may produce better code just as
  2132.      `-fforce-mem' may.  I am interested in hearing about the
  2133.      difference this makes.
  2134.  
  2135. `-fomit-frame-pointer'
  2136.      Don't keep the frame pointer in a register for functions that
  2137.      don't need one.  This avoids the instructions to save, set up and
  2138.      restore frame pointers; it also makes an extra register available
  2139.      in many functions.  *It also makes debugging impossible on some
  2140.      machines.*
  2141.  
  2142.      On some machines, such as the Vax, this flag has no effect, because
  2143.      the standard calling sequence automatically handles the frame
  2144.      pointer and nothing is saved by pretending it doesn't exist.  The
  2145.      machine-description macro `FRAME_POINTER_REQUIRED' controls
  2146.      whether a target machine supports this flag.  *Note Register
  2147.      Usage: (gcc.info)Registers.
  2148.  
  2149. `-fno-inline'
  2150.      Don't pay attention to the `inline' keyword.  Normally this option
  2151.      is used to keep the compiler from expanding any functions inline.
  2152.      Note that if you are not optimizing, no functions can be expanded
  2153.      inline.
  2154.  
  2155. `-finline-functions'
  2156.      Integrate all simple functions into their callers.  The compiler
  2157.      heuristically decides which functions are simple enough to be worth
  2158.      integrating in this way.
  2159.  
  2160.      If all calls to a given function are integrated, and the function
  2161.      is declared `static', then the function is normally not output as
  2162.      assembler code in its own right.
  2163.  
  2164. `-fkeep-inline-functions'
  2165.      Even if all calls to a given function are integrated, and the
  2166.      function is declared `static', nevertheless output a separate
  2167.      run-time callable version of the function.
  2168.  
  2169. `-fno-function-cse'
  2170.      Do not put function addresses in registers; make each instruction
  2171.      that calls a constant function contain the function's address
  2172.      explicitly.
  2173.  
  2174.      This option results in less efficient code, but some strange hacks
  2175.      that alter the assembler output may be confused by the
  2176.      optimizations performed when this option is not used.
  2177.  
  2178. `-ffast-math'
  2179.      This option allows GCC to violate some ANSI or IEEE rules and/or
  2180.      specifications in the interest of optimizing code for speed.  For
  2181.      example, it allows the compiler to assume arguments to the `sqrt'
  2182.      function are non-negative numbers.
  2183.  
  2184.      This option should never be turned on by any `-O' option since it
  2185.      can result in incorrect output for programs which depend on an
  2186.      exact implementation of IEEE or ANSI rules/specifications for math
  2187.      functions.
  2188.  
  2189.    The following options control specific optimizations.  The `-O2'
  2190. option turns on all of these optimizations except `-funroll-loops' and
  2191. `-funroll-all-loops'.  On most machines, the `-O' option turns on the
  2192. `-fthread-jumps' and `-fdelayed-branch' options, but specific machines
  2193. may handle it differently.
  2194.  
  2195.    You can use the following flags in the rare cases when "fine-tuning"
  2196. of optimizations to be performed is desired.
  2197.  
  2198. `-fstrength-reduce'
  2199.      Perform the optimizations of loop strength reduction and
  2200.      elimination of iteration variables.
  2201.  
  2202. `-fthread-jumps'
  2203.      Perform optimizations where we check to see if a jump branches to a
  2204.      location where another comparison subsumed by the first is found.
  2205.      If so, the first branch is redirected to either the destination of
  2206.      the second branch or a point immediately following it, depending
  2207.      on whether the condition is known to be true or false.
  2208.  
  2209. `-fcse-follow-jumps'
  2210.      In common subexpression elimination, scan through jump instructions
  2211.      when the target of the jump is not reached by any other path.  For
  2212.      example, when CSE encounters an `if' statement with an `else'
  2213.      clause, CSE will follow the jump when the condition tested is
  2214.      false.
  2215.  
  2216. `-fcse-skip-blocks'
  2217.      This is similar to `-fcse-follow-jumps', but causes CSE to follow
  2218.      jumps which conditionally skip over blocks.  When CSE encounters a
  2219.      simple `if' statement with no else clause, `-fcse-skip-blocks'
  2220.      causes CSE to follow the jump around the body of the `if'.
  2221.  
  2222. `-frerun-cse-after-loop'
  2223.      Re-run common subexpression elimination after loop optimizations
  2224.      has been performed.
  2225.  
  2226. `-fexpensive-optimizations'
  2227.      Perform a number of minor optimizations that are relatively
  2228.      expensive.
  2229.  
  2230. `-fdelayed-branch'
  2231.      If supported for the target machine, attempt to reorder
  2232.      instructions to exploit instruction slots available after delayed
  2233.      branch instructions.
  2234.  
  2235. `-fschedule-insns'
  2236.      If supported for the target machine, attempt to reorder
  2237.      instructions to eliminate execution stalls due to required data
  2238.      being unavailable.  This helps machines that have slow floating
  2239.      point or memory load instructions by allowing other instructions
  2240.      to be issued until the result of the load or floating point
  2241.      instruction is required.
  2242.  
  2243. `-fschedule-insns2'
  2244.      Similar to `-fschedule-insns', but requests an additional pass of
  2245.      instruction scheduling after register allocation has been done.
  2246.      This is especially useful on machines with a relatively small
  2247.      number of registers and where memory load instructions take more
  2248.      than one cycle.
  2249.  
  2250. `-fcaller-saves'
  2251.      Enable values to be allocated in registers that will be clobbered
  2252.      by function calls, by emitting extra instructions to save and
  2253.      restore the registers around such calls.  Such allocation is done
  2254.      only when it seems to result in better code than would otherwise
  2255.      be produced.
  2256.  
  2257.      This option is enabled by default on certain machines, usually
  2258.      those which have no call-preserved registers to use instead.
  2259.  
  2260. `-funroll-loops'
  2261.      Perform the optimization of loop unrolling.  This is only done for
  2262.      loops whose number of iterations can be determined at compile time
  2263.      or run time.  `-funroll-loop' implies both `-fstrength-reduce' and
  2264.      `-frerun-cse-after-loop'.
  2265.  
  2266. `-funroll-all-loops'
  2267.      Perform the optimization of loop unrolling.  This is done for all
  2268.      loops and usually makes programs run more slowly.
  2269.      `-funroll-all-loops' implies `-fstrength-reduce' as well as
  2270.      `-frerun-cse-after-loop'.
  2271.  
  2272. `-fno-peephole'
  2273.      Disable any machine-specific peephole optimizations.
  2274.  
  2275. 
  2276. File: @.Distr.UsingGCC,  Node: Preprocessor Options,  Next: Assembler Options,  Prev: Optimize Options,  Up: Invoking GCC
  2277.  
  2278. Options Controlling the Preprocessor
  2279. ====================================
  2280.  
  2281.    These options control the C preprocessor, which is run on each C
  2282. source file before actual compilation.
  2283.  
  2284.    If you use the `-E' option, nothing is done except preprocessing.
  2285. Some of these options make sense only together with `-E' because they
  2286. cause the preprocessor output to be unsuitable for actual compilation.
  2287.  
  2288. `-include FILE'
  2289.      Process FILE as input before processing the regular input file.
  2290.      In effect, the contents of FILE are compiled first.  Any `-D' and
  2291.      `-U' options on the command line are always processed before
  2292.      `-include FILE', regardless of the order in which they are
  2293.      written.  All the `-include' and `-imacros' options are processed
  2294.      in the order in which they are written.
  2295.  
  2296. `-imacros FILE'
  2297.      Process FILE as input, discarding the resulting output, before
  2298.      processing the regular input file.  Because the output generated
  2299.      from FILE is discarded, the only effect of `-imacros FILE' is to
  2300.      make the macros defined in FILE available for use in the main
  2301.      input.
  2302.  
  2303.      Any `-D' and `-U' options on the command line are always processed
  2304.      before `-imacros FILE', regardless of the order in which they are
  2305.      written.  All the `-include' and `-imacros' options are processed
  2306.      in the order in which they are written.
  2307.  
  2308. `-idirafter DIR'
  2309.      Add the directory DIR to the second include path.  The directories
  2310.      on the second include path are searched when a header file is not
  2311.      found in any of the directories in the main include path (the one
  2312.      that `-I' adds to).
  2313.  
  2314. `-iprefix PREFIX'
  2315.      Specify PREFIX as the prefix for subsequent `-iwithprefix' options.
  2316.  
  2317. `-iwithprefix DIR'
  2318.      Add a directory to the second include path.  The directory's name
  2319.      is made by concatenating PREFIX and DIR, where PREFIX was
  2320.      specified previously with `-iprefix'.
  2321.  
  2322. `-nostdinc'
  2323.      Do not search the standard system directories for header files.
  2324.      Only the directories you have specified with `-I' options (and the
  2325.      current directory, if appropriate) are searched.  *Note Directory
  2326.      Options::, for information on `-I'.
  2327.  
  2328.      By using both `-nostdinc' and `-I-', you can limit the include-file
  2329.      search path to only those directories you specify explicitly.
  2330.  
  2331. `-undef'
  2332.      Do not predefine any nonstandard macros.  (Including architecture
  2333.      flags).
  2334.  
  2335. `-E'
  2336.      Run only the C preprocessor.  Preprocess all the C source files
  2337.      specified and output the results to standard output or to the
  2338.      specified output file.
  2339.  
  2340. `-C'
  2341.      Tell the preprocessor not to discard comments.  Used with the `-E'
  2342.      option.
  2343.  
  2344. `-P'
  2345.      Tell the preprocessor not to generate `#line' commands.  Used with
  2346.      the `-E' option.
  2347.  
  2348. `-M'
  2349.      Tell the preprocessor to output a rule suitable for `make'
  2350.      describing the dependencies of each object file.  For each source
  2351.      file, the preprocessor outputs one `make'-rule whose target is the
  2352.      object file name for that source file and whose dependencies are
  2353.      all the `#include' header files it uses.  This rule may be a
  2354.      single line or may be continued with `\'-newline if it is long.
  2355.      The list of rules is printed on standard output instead of the
  2356.      preprocessed C program.
  2357.  
  2358.      `-M' implies `-E'.
  2359.  
  2360.      Another way to specify output of a `make' rule is by setting the
  2361.      environment variable `DEPENDENCIES_OUTPUT' (*note Environment
  2362.      Variables::.).
  2363.  
  2364. `-MM'
  2365.      Like `-M' but the output mentions only the user header files
  2366.      included with `#include "FILE"'.  System header files included
  2367.      with `#include <FILE>' are omitted.
  2368.  
  2369. `-MD'
  2370.      Like `-M' but the dependency information is written to files with
  2371.      names made by replacing `.o' with `.d' at the end of the output
  2372.      file names.  This is in addition to compiling the input files as
  2373.      specified--`-MD' does not inhibit ordinary compilation the way
  2374.      `-M' does.
  2375.  
  2376.      The Mach utility `md' can be used to merge the `.d' files into a
  2377.      single dependency file suitable for using with the `make' command.
  2378.  
  2379. `-MMD'
  2380.      Like `-MD' except mention only user header files, not system
  2381.      header files.
  2382.  
  2383. `-H'
  2384.      Print the name of each header file used, in addition to other
  2385.      normal activities.
  2386.  
  2387. `-AQUESTION(ANSWER)'
  2388.      Assert the answer ANSWER for QUESTION, in case it is tested with a
  2389.      preprocessor conditional such as `#if #QUESTION(ANSWER)'.  `-A-'
  2390.      disables the standard assertions that normally describe the target
  2391.      machine.
  2392.  
  2393. `-DMACRO'
  2394.      Define macro MACRO with the string `1' as its definition.
  2395.  
  2396. `-DMACRO=DEFN'
  2397.      Define macro MACRO as DEFN.  All instances of `-D' on the command
  2398.      line are processed before any `-U' options.
  2399.  
  2400. `-UMACRO'
  2401.      Undefine macro MACRO.  `-U' options are evaluated after all `-D'
  2402.      options, but before any `-include' and `-imacros' options.
  2403.  
  2404. `-dM'
  2405.      Tell the preprocessor to output only a list of the macro
  2406.      definitions that are in effect at the end of preprocessing.  Used
  2407.      with the `-E' option.
  2408.  
  2409. `-dD'
  2410.      Tell the preprocessing to pass all macro definitions into the
  2411.      output, in their proper sequence in the rest of the output.
  2412.  
  2413. `-dN'
  2414.      Like `-dD' except that the macro arguments and contents are
  2415.      omitted.  Only `#define NAME' is included in the output.
  2416.  
  2417. `-trigraphs'
  2418.      Support ANSI C trigraphs.  You don't want to know about this
  2419.      brain-damage.  The `-ansi' option also has this effect.
  2420.  
  2421. 
  2422. File: @.Distr.UsingGCC,  Node: Assembler Options,  Next: Link Options,  Prev: Preprocessor Options,  Up: Invoking GCC
  2423.  
  2424. Passing Options to the Assembler
  2425. ================================
  2426.  
  2427. `-Wa,OPTION'
  2428.      Pass OPTION as an option to the assembler.  If OPTION contains
  2429.      commas, it is split into multiple options at the commas.
  2430.  
  2431. 
  2432. File: @.Distr.UsingGCC,  Node: Link Options,  Next: Directory Options,  Prev: Assembler Options,  Up: Invoking GCC
  2433.  
  2434. Options for Linking
  2435. ===================
  2436.  
  2437.    These options come into play when the compiler links object files
  2438. into an executable output file.  They are meaningless if the compiler is
  2439. not doing a link step.
  2440.  
  2441. `OBJECT-FILE-NAME'
  2442.      A file name that does not end in a special recognized suffix is
  2443.      considered to name an object file or library.  (Object files are
  2444.      distinguished from libraries by the linker according to the file
  2445.      contents.)  If linking is done, these object files are used as
  2446.      input to the linker.
  2447.  
  2448. `-c'
  2449. `-S'
  2450. `-E'
  2451.      If any of these options is used, then the linker is not run, and
  2452.      object file names should not be used as arguments.  *Note Overall
  2453.      Options::.
  2454.  
  2455. `-lLIBRARY'
  2456.      Search the library named LIBRARY when linking.
  2457.  
  2458.      It makes a difference where in the command you write this option;
  2459.      the linker searches processes libraries and object files in the
  2460.      order they are specified.  Thus, `foo.o -lz bar.o' searches
  2461.      library `z' after file `foo.o' but before `bar.o'.  If `bar.o'
  2462.      refers to functions in `z', those functions may not be loaded.
  2463.  
  2464.      The linker searches a standard list of directories for the library,
  2465.      which is actually a file named `libLIBRARY.a'.  The linker then
  2466.      uses this file as if it had been specified precisely by name.
  2467.  
  2468.      The directories searched include several standard system
  2469.      directories plus any that you specify with `-L'.
  2470.  
  2471.      Normally the files found this way are library files--archive files
  2472.      whose members are object files.  The linker handles an archive
  2473.      file by scanning through it for members which define symbols that
  2474.      have so far been referenced but not defined.  But if the file that
  2475.      is found is an ordinary object file, it is linked in the usual
  2476.      fashion.  The only difference between using an `-l' option and
  2477.      specifying a file name is that `-l' surrounds LIBRARY with `lib'
  2478.      and `.a' and searches several directories.
  2479.  
  2480. `-lobjc'
  2481.      You need this special case of the `-l' option in order to link an
  2482.      Objective C program.
  2483.  
  2484. `-nostartfiles'
  2485.      Do not use the standard system startup files when linking.  The
  2486.      standard libraries are used normally.
  2487.  
  2488. `-nostdlib'
  2489.      Don't use the standard system libraries and startup files when
  2490.      linking.  Only the files you specify will be passed to the linker.
  2491.  
  2492. `-static'
  2493.      On systems that support dynamic linking, this prevents linking
  2494.      with the shared libraries.  On other systems, this option has no
  2495.      effect.
  2496.  
  2497. `-shared'
  2498.      Produce a shared object which can then be linked with other
  2499.      objects to form an executable.  Only a few systems support this
  2500.      option.
  2501.  
  2502. `-symbolic'
  2503.      Bind references to global symbols when building a shared object.
  2504.      Warn about any unresolved references (unless overridden by the
  2505.      link editor option `-Xlinker -z -Xlinker defs').  Only a few
  2506.      systems support this option.
  2507.  
  2508. `-Xlinker OPTION'
  2509.      Pass OPTION as an option to the linker.  You can use this to
  2510.      supply system-specific linker options which GNU CC does not know
  2511.      how to recognize.
  2512.  
  2513.      If you want to pass an option that takes an argument, you must use
  2514.      `-Xlinker' twice, once for the option and once for the argument.
  2515.      For example, to pass `-assert definitions', you must write
  2516.      `-Xlinker -assert -Xlinker definitions'.  It does not work to write
  2517.      `-Xlinker "-assert definitions"', because this passes the entire
  2518.      string as a single argument, which is not what the linker expects.
  2519.  
  2520. `-Wl,OPTION'
  2521.      Pass OPTION as an option to the linker.  If OPTION contains
  2522.      commas, it is split into multiple options at the commas.
  2523.  
  2524. `-u SYMBOL'
  2525.      Pretend the symbol SYMBOL is undefined, to force linking of
  2526.      library modules to define it.  You can use `-u' multiple times with
  2527.      different symbols to force loading of additional library modules.
  2528.  
  2529. 
  2530. File: @.Distr.UsingGCC,  Node: Directory Options,  Next: Target Options,  Prev: Link Options,  Up: Invoking GCC
  2531.  
  2532. Options for Directory Search
  2533. ============================
  2534.  
  2535.    These options specify directories to search for header files, for
  2536. libraries and for parts of the compiler:
  2537.  
  2538. `-IDIR'
  2539.      Append directory DIR to the list of directories searched for
  2540.      include files.
  2541.  
  2542. `-I-'
  2543.      Any directories you specify with `-I' options before the `-I-'
  2544.      option are searched only for the case of `#include "FILE"'; they
  2545.      are not searched for `#include <FILE>'.
  2546.  
  2547.      If additional directories are specified with `-I' options after
  2548.      the `-I-', these directories are searched for all `#include'
  2549.      directives.  (Ordinarily *all* `-I' directories are used this way.)
  2550.  
  2551.      In addition, the `-I-' option inhibits the use of the current
  2552.      directory (where the current input file came from) as the first
  2553.      search directory for `#include "FILE"'.  There is no way to
  2554.      override this effect of `-I-'.  With `-I.' you can specify
  2555.      searching the directory which was current when the compiler was
  2556.      invoked.  That is not exactly the same as what the preprocessor
  2557.      does by default, but it is often satisfactory.
  2558.  
  2559.      `-I-' does not inhibit the use of the standard system directories
  2560.      for header files.  Thus, `-I-' and `-nostdinc' are independent.
  2561.  
  2562. `-LDIR'
  2563.      Add directory DIR to the list of directories to be searched for
  2564.      `-l'.
  2565.  
  2566. `-BPREFIX'
  2567.      This option specifies where to find the executables, libraries and
  2568.      data files of the compiler itself.
  2569.  
  2570.      The compiler driver program runs one or more of the subprograms
  2571.      `cpp', `cc1', `as' and `ld'.  It tries PREFIX as a prefix for each
  2572.      program it tries to run, both with and without `MACHINE/VERSION/'
  2573.      (*note Target Options::.).
  2574.  
  2575.      For each subprogram to be run, the compiler driver first tries the
  2576.      `-B' prefix, if any.  If that name is not found, or if `-B' was
  2577.      not specified, the driver tries two standard prefixes, which are
  2578.      `/usr/lib/gcc/' and `/usr/local/lib/gcc-lib/'.  If neither of
  2579.      those results in a file name that is found, the unmodified program
  2580.      name is searched for using the directories specified in your
  2581.      `PATH' environment variable.
  2582.  
  2583.      `-B' prefixes that effectively specify directory names also apply
  2584.      to libraries in the linker, because the compiler translates these
  2585.      options into `-L' options for the linker.
  2586.  
  2587.      The run-time support file `libgcc.a' can also be searched for using
  2588.      the `-B' prefix, if needed.  If it is not found there, the two
  2589.      standard prefixes above are tried, and that is all.  The file is
  2590.      left out of the link if it is not found by those means.
  2591.  
  2592.      Another way to specify a prefix much like the `-B' prefix is to use
  2593.      the environment variable `GCC_EXEC_PREFIX'.  *Note Environment
  2594.      Variables::.
  2595.  
  2596. 
  2597. File: @.Distr.UsingGCC,  Node: Target Options,  Next: Submodel Options,  Prev: Directory Options,  Up: Invoking GCC
  2598.  
  2599. Specifying Target Machine and Compiler Version
  2600. ==============================================
  2601.  
  2602.    By default, GNU CC compiles code for the same type of machine that
  2603. you are using.  However, it can also be installed as a cross-compiler,
  2604. to compile for some other type of machine.  In fact, several different
  2605. configurations of GNU CC, for different target machines, can be
  2606. installed side by side.  Then you specify which one to use with the
  2607. `-b' option.
  2608.  
  2609.    In addition, older and newer versions of GNU CC can be installed side
  2610. by side.  One of them (probably the newest) will be the default, but
  2611. you may sometimes wish to use another.
  2612.  
  2613. `-b MACHINE'
  2614.      The argument MACHINE specifies the target machine for compilation.
  2615.      This is useful when you have installed GNU CC as a cross-compiler.
  2616.  
  2617.      The value to use for MACHINE is the same as was specified as the
  2618.      machine type when configuring GNU CC as a cross-compiler.  For
  2619.      example, if a cross-compiler was configured with `configure
  2620.      i386v', meaning to compile for an 80386 running System V, then you
  2621.      would specify `-b i386v' to run that cross compiler.
  2622.  
  2623.      When you do not specify `-b', it normally means to compile for the
  2624.      same type of machine that you are using.
  2625.  
  2626. `-V VERSION'
  2627.      The argument VERSION specifies which version of GNU CC to run.
  2628.      This is useful when multiple versions are installed.  For example,
  2629.      VERSION might be `2.0', meaning to run GNU CC version 2.0.
  2630.  
  2631.      The default version, when you do not specify `-V', is controlled
  2632.      by the way GNU CC is installed.  Normally, it will be a version
  2633.      that is recommended for general use.
  2634.  
  2635.    The `-b' and `-V' options actually work by controlling part of the
  2636. file name used for the executable files and libraries used for
  2637. compilation.  A given version of GNU CC, for a given target machine, is
  2638. normally kept in the directory `/usr/local/lib/gcc-lib/MACHINE/VERSION'.
  2639.  
  2640.    Thus, sites can customize the effect of `-b' or `-V' either by
  2641. changing the names of these directories or adding alternate names (or
  2642. symbolic links).  If in directory `/usr/local/lib/gcc-lib/' the file
  2643. `80386' is a link to the file `i386v', then `-b 80386' becomes an alias
  2644. for `-b i386v'.
  2645.  
  2646.    In one respect, the `-b' or `-V' do not completely change to a
  2647. different compiler: the top-level driver program `gcc' that you
  2648. originally invoked continues to run and invoke the other executables
  2649. (preprocessor, compiler per se, assembler and linker) that do the real
  2650. work.  However, since no real work is done in the driver program, it
  2651. usually does not matter that the driver program in use is not the one
  2652. for the specified target and version.
  2653.  
  2654.    The only way that the driver program depends on the target machine is
  2655. in the parsing and handling of special machine-specific options.
  2656. However, this is controlled by a file which is found, along with the
  2657. other executables, in the directory for the specified version and
  2658. target machine.  As a result, a single installed driver program adapts
  2659. to any specified target machine and compiler version.
  2660.  
  2661.    The driver program executable does control one significant thing,
  2662. however: the default version and target machine.  Therefore, you can
  2663. install different instances of the driver program, compiled for
  2664. different targets or versions, under different names.
  2665.  
  2666.    For example, if the driver for version 2.0 is installed as `ogcc'
  2667. and that for version 2.1 is installed as `gcc', then the command `gcc'
  2668. will use version 2.1 by default, while `ogcc' will use 2.0 by default.
  2669. However, you can choose either version with either command with the
  2670. `-V' option.
  2671.  
  2672. 
  2673. File: @.Distr.UsingGCC,  Node: Submodel Options,  Next: Code Gen Options,  Prev: Target Options,  Up: Invoking GCC
  2674.  
  2675. Hardware Models and Configurations
  2676. ==================================
  2677.  
  2678.    Earlier we discussed the standard option `-b' which chooses among
  2679. different installed compilers for completely different target machines,
  2680. such as Vax vs. 68000 vs. 80386.
  2681.  
  2682.    In addition, each of these target machine types can have its own
  2683. special options, starting with `-m', to choose among various hardware
  2684. models or configurations--for example, 68010 vs 68020, floating
  2685. coprocessor or none.  A single installed version of the compiler can
  2686. compile for any model or configuration, according to the options
  2687. specified.
  2688.  
  2689.    Some configurations of the compiler also support additional special
  2690. options, usually for compatibility with other compilers on the same
  2691. platform.
  2692.  
  2693. * Menu:
  2694.  
  2695. * M680x0 Options::
  2696. * VAX Options::
  2697. * SPARC Options::
  2698. * Convex Options::
  2699. * AMD29K Options::
  2700. * M88K Options::
  2701. * RS/6000 Options::
  2702. * RT Options::
  2703. * MIPS Options::
  2704. * i386 Options::
  2705. * HPPA Options::
  2706. * Intel 960 Options::
  2707. * DEC Alpha Options::
  2708. * System V Options::
  2709.  
  2710. 
  2711. File: @.Distr.UsingGCC,  Node: M680x0 Options,  Next: VAX Options,  Up: Submodel Options
  2712.  
  2713. M680x0 Options
  2714. --------------
  2715.  
  2716.    These are the `-m' options defined for the 68000 series.  The default
  2717. values for these options depends on which style of 68000 was selected
  2718. when the compiler was configured; the defaults for the most common
  2719. choices are given below.
  2720.  
  2721. `-m68000'
  2722. `-mc68000'
  2723.      Generate output for a 68000.  This is the default when the
  2724.      compiler is configured for 68000-based systems.
  2725.  
  2726. `-m68020'
  2727. `-mc68020'
  2728.      Generate output for a 68020.  This is the default when the
  2729.      compiler is configured for 68020-based systems.
  2730.  
  2731. `-m68881'
  2732.      Generate output containing 68881 instructions for floating point.
  2733.      This is the default for most 68020 systems unless `-nfp' was
  2734.      specified when the compiler was configured.
  2735.  
  2736. `-m68030'
  2737.      Generate output for a 68030.  This is the default when the
  2738.      compiler is configured for 68030-based systems.
  2739.  
  2740. `-m68040'
  2741.      Generate output for a 68040.  This is the default when the
  2742.      compiler is configured for 68040-based systems.
  2743.  
  2744. `-m68020-40'
  2745.      Generate output for a 68040, without using any of the new
  2746.      instructions.  This results in code which can run relatively
  2747.      efficiently on either a 68020/68881 or a 68030 or a 68040.
  2748.  
  2749. `-mfpa'
  2750.      Generate output containing Sun FPA instructions for floating point.
  2751.  
  2752. `-msoft-float'
  2753.      Generate output containing library calls for floating point.
  2754.      *Warning:* the requisite libraries are not part of GNU CC.
  2755.      Normally the facilities of the machine's usual C compiler are
  2756.      used, but this can't be done directly in cross-compilation.  You
  2757.      must make your own arrangements to provide suitable library
  2758.      functions for cross-compilation.
  2759.  
  2760. `-mshort'
  2761.      Consider type `int' to be 16 bits wide, like `short int'.
  2762.  
  2763. `-mnobitfield'
  2764.      Do not use the bit-field instructions.  The `-m68000' option
  2765.      implies `-mnobitfield'.
  2766.  
  2767. `-mbitfield'
  2768.      Do use the bit-field instructions.  The `-m68020' option implies
  2769.      `-mbitfield'.  This is the default if you use a configuration
  2770.      designed for a 68020.
  2771.  
  2772. `-mrtd'
  2773.      Use a different function-calling convention, in which functions
  2774.      that take a fixed number of arguments return with the `rtd'
  2775.      instruction, which pops their arguments while returning.  This
  2776.      saves one instruction in the caller since there is no need to pop
  2777.      the arguments there.
  2778.  
  2779.      This calling convention is incompatible with the one normally used
  2780.      on Unix, so you cannot use it if you need to call libraries
  2781.      compiled with the Unix compiler.
  2782.  
  2783.      Also, you must provide function prototypes for all functions that
  2784.      take variable numbers of arguments (including `printf'); otherwise
  2785.      incorrect code will be generated for calls to those functions.
  2786.  
  2787.      In addition, seriously incorrect code will result if you call a
  2788.      function with too many arguments.  (Normally, extra arguments are
  2789.      harmlessly ignored.)
  2790.  
  2791.      The `rtd' instruction is supported by the 68010 and 68020
  2792.      processors, but not by the 68000.
  2793.  
  2794. 
  2795. File: @.Distr.UsingGCC,  Node: VAX Options,  Next: SPARC Options,  Prev: M680x0 Options,  Up: Submodel Options
  2796.  
  2797. VAX Options
  2798. -----------
  2799.  
  2800.    These `-m' options are defined for the Vax:
  2801.  
  2802. `-munix'
  2803.      Do not output certain jump instructions (`aobleq' and so on) that
  2804.      the Unix assembler for the Vax cannot handle across long ranges.
  2805.  
  2806. `-mgnu'
  2807.      Do output those jump instructions, on the assumption that you will
  2808.      assemble with the GNU assembler.
  2809.  
  2810. `-mg'
  2811.      Output code for g-format floating point numbers instead of
  2812.      d-format.
  2813.  
  2814. 
  2815. File: @.Distr.UsingGCC,  Node: SPARC Options,  Next: Convex Options,  Prev: VAX Options,  Up: Submodel Options
  2816.  
  2817. SPARC Options
  2818. -------------
  2819.  
  2820.    These `-m' switches are supported on the SPARC:
  2821.  
  2822. `-mfpu'
  2823. `-mhard-float'
  2824.      Generate output containing floating point instructions.  This is
  2825.      the default.
  2826.  
  2827. `-mno-fpu'
  2828. `-msoft-float'
  2829.      Generate output containing library calls for floating point.
  2830.      *Warning:* there is no GNU floating-point library for SPARC.
  2831.      Normally the facilities of the machine's usual C compiler are
  2832.      used, but this cannot be done directly in cross-compilation.  You
  2833.      must make your own arrangements to provide suitable library
  2834.      functions for cross-compilation.
  2835.  
  2836.      `-msoft-float' changes the calling convention in the output file;
  2837.      therefore, it is only useful if you compile *all* of a program with
  2838.      this option.  In particular, you need to compile `libgcc.a', the
  2839.      library that comes with GNU CC, with `-msoft-float' in order for
  2840.      this to work.
  2841.  
  2842. `-mno-epilogue'
  2843. `-mepilogue'
  2844.      With `-mepilogue' (the default), the compiler always emits code for
  2845.      function exit at the end of each function.  Any function exit in
  2846.      the middle of the function (such as a return statement in C) will
  2847.      generate a jump to the exit code at the end of the function.
  2848.  
  2849.      With `-mno-epilogue', the compiler tries to emit exit code inline
  2850.      at every function exit.
  2851.  
  2852. `-mv8'
  2853. `-msparclite'
  2854.      These two options select variations on the SPARC architecture.
  2855.  
  2856.      By default (unless specifically configured for the Fujitsu
  2857.      SPARClite), GCC generates code for the v7 variant of the SPARC
  2858.      architecture.
  2859.  
  2860.      `-mv8' will give you SPARC v8 code.  The only difference from v7
  2861.      code is that the compiler emits the integer multiply and integer
  2862.      divide instructions which exist in SPARC v8 but not in SPARC v7.
  2863.  
  2864.      `-msparclite' will give you SPARClite code.  This adds the integer
  2865.      multiply, integer divide step and scan (`ffs') instructions which
  2866.      exist in SPARClite but not in SPARC v7.
  2867.  
  2868. 
  2869. File: @.Distr.UsingGCC,  Node: Convex Options,  Next: AMD29K Options,  Prev: SPARC Options,  Up: Submodel Options
  2870.  
  2871. Convex Options
  2872. --------------
  2873.  
  2874.    These `-m' options are defined for Convex:
  2875.  
  2876. `-mc1'
  2877.      Generate output for C1.  The code will run on any Convex machine.
  2878.      The preprocessor symbol `__convex__c1__' is defined.
  2879.  
  2880. `-mc2'
  2881.      Generate output for C2.  Uses instructions not available on C1.
  2882.      Scheduling and other optimizations are chosen for max performance
  2883.      on C2.  The preprocessor symbol `__convex_c2__' is defined.
  2884.  
  2885. `-mc32'
  2886.      Generate output for C32xx.  Uses instructions not available on C1.
  2887.      Scheduling and other optimizations are chosen for max performance
  2888.      on C32.  The preprocessor symbol `__convex_c32__' is defined.
  2889.  
  2890. `-mc34'
  2891.      Generate output for C34xx.  Uses instructions not available on C1.
  2892.      Scheduling and other optimizations are chosen for max performance
  2893.      on C34.  The preprocessor symbol `__convex_c34__' is defined.
  2894.  
  2895. `-mc38'
  2896.      Generate output for C38xx.  Uses instructions not available on C1.
  2897.      Scheduling and other optimizations are chosen for max performance
  2898.      on C38.  The preprocessor symbol `__convex_c38__' is defined.
  2899.  
  2900. `-margcount'
  2901.      Generate code which puts an argument count in the word preceding
  2902.      each argument list.  This is compatible with regular CC, and a few
  2903.      programs may need the argument count word.  GDB and other
  2904.      source-level debuggers do not need it; this info is in the symbol
  2905.      table.
  2906.  
  2907. `-mnoargcount'
  2908.      Omit the argument count word.  This is the default.
  2909.  
  2910. `-mvolatile-cache'
  2911.      Allow volatile references to be cached.  This is the default.
  2912.  
  2913. `-mvolatile-nocache'
  2914.      Volatile references bypass the data cache, going all the way to
  2915.      memory.  This is only needed for multi-processor code that does
  2916.      not use standard synchronization instructions.  Making
  2917.      non-volatile references to volatile locations will not necessarily
  2918.      work.
  2919.  
  2920. `-mlong32'
  2921.      Type long is 32 bits, the same as type int.  This is the default.
  2922.  
  2923. `-mlong64'
  2924.      Type long is 64 bits, the same as type long long.  This option is
  2925.      useless, because no library support exists for it.
  2926.  
  2927. 
  2928. File: @.Distr.UsingGCC,  Node: AMD29K Options,  Next: M88K Options,  Prev: Convex Options,  Up: Submodel Options
  2929.  
  2930. AMD29K Options
  2931. --------------
  2932.  
  2933.    These `-m' options are defined for the AMD Am29000:
  2934.  
  2935. `-mdw'
  2936.      Generate code that assumes the `DW' bit is set, i.e., that byte and
  2937.      halfword operations are directly supported by the hardware.  This
  2938.      is the default.
  2939.  
  2940. `-mnodw'
  2941.      Generate code that assumes the `DW' bit is not set.
  2942.  
  2943. `-mbw'
  2944.      Generate code that assumes the system supports byte and halfword
  2945.      write operations.  This is the default.
  2946.  
  2947. `-mnbw'
  2948.      Generate code that assumes the systems does not support byte and
  2949.      halfword write operations.  `-mnbw' implies `-mnodw'.
  2950.  
  2951. `-msmall'
  2952.      Use a small memory model that assumes that all function addresses
  2953.      are either within a single 256 KB segment or at an absolute
  2954.      address of less than 256k.  This allows the `call' instruction to
  2955.      be used instead of a `const', `consth', `calli' sequence.
  2956.  
  2957. `-mlarge'
  2958.      Do not assume that the `call' instruction can be used; this is the
  2959.      default.
  2960.  
  2961. `-m29050'
  2962.      Generate code for the Am29050.
  2963.  
  2964. `-m29000'
  2965.      Generate code for the Am29000.  This is the default.
  2966.  
  2967. `-mkernel-registers'
  2968.      Generate references to registers `gr64-gr95' instead of to
  2969.      registers `gr96-gr127'.  This option can be used when compiling
  2970.      kernel code that wants a set of global registers disjoint from
  2971.      that used by user-mode code.
  2972.  
  2973.      Note that when this option is used, register names in `-f' flags
  2974.      must use the normal, user-mode, names.
  2975.  
  2976. `-muser-registers'
  2977.      Use the normal set of global registers, `gr96-gr127'.  This is the
  2978.      default.
  2979.  
  2980. `-mstack-check'
  2981.      Insert a call to `__msp_check' after each stack adjustment.  This
  2982.      is often used for kernel code.
  2983.  
  2984. 
  2985. File: @.Distr.UsingGCC,  Node: M88K Options,  Next: RS/6000 Options,  Prev: AMD29K Options,  Up: Submodel Options
  2986.  
  2987. M88K Options
  2988. ------------
  2989.  
  2990.    These `-m' options are defined for Motorola 88k architectures:
  2991.  
  2992. `-m88000'
  2993.      Generate code that works well on both the m88100 and the m88110.
  2994.  
  2995. `-m88100'
  2996.      Generate code that works best for the m88100, but that also runs
  2997.      on the m88110.
  2998.  
  2999. `-m88110'
  3000.      Generate code that works best for the m88110, and may not run on
  3001.      the m88100.
  3002.  
  3003. `-mbig-pic'
  3004.      Obsolete option to be removed from the next revision.  Use `-fPIC'.
  3005.  
  3006. `-midentify-revision'
  3007.      Include an `ident' directive in the assembler output recording the
  3008.      source file name, compiler name and version, timestamp, and
  3009.      compilation flags used.
  3010.  
  3011. `-mno-underscores'
  3012.      In assembler output, emit symbol names without adding an underscore
  3013.      character at the beginning of each name.  The default is to use an
  3014.      underscore as prefix on each name.
  3015.  
  3016. `-mocs-debug-info'
  3017. `-mno-ocs-debug-info'
  3018.      Include (or omit) additional debugging information (about
  3019.      registers used in each stack frame) as specified in the 88open
  3020.      Object Compatibility Standard, "OCS".  This extra information
  3021.      allows debugging of code that has had the frame pointer
  3022.      eliminated.  The default for DG/UX, SVr4, and Delta 88 SVr3.2 is
  3023.      to include this information; other 88k configurations omit this
  3024.      information by default.
  3025.  
  3026. `-mocs-frame-position'
  3027.      When emitting COFF debugging information for automatic variables
  3028.      and parameters stored on the stack, use the offset from the
  3029.      canonical frame address, which is the stack pointer (register 31)
  3030.      on entry to the function.  The DG/UX, SVr4, Delta88 SVr3.2, and
  3031.      BCS configurations use `-mocs-frame-position'; other 88k
  3032.      configurations have the default `-mno-ocs-frame-position'.
  3033.  
  3034. `-mno-ocs-frame-position'
  3035.      When emitting COFF debugging information for automatic variables
  3036.      and parameters stored on the stack, use the offset from the frame
  3037.      pointer register (register 30).  When this option is in effect,
  3038.      the frame pointer is not eliminated when debugging information is
  3039.      selected by the -g switch.
  3040.  
  3041. `-moptimize-arg-area'
  3042. `-mno-optimize-arg-area'
  3043.      Control how function arguments are stored in stack frames.
  3044.      `-moptimize-arg-area' saves space by optimizing them, but this
  3045.      conflicts with the 88open specifications.  The opposite
  3046.      alternative, `-mno-optimize-arg-area', agrees with 88open
  3047.      standards.  By default GNU CC does not optimize the argument area.
  3048.  
  3049. `-mshort-data-NUM'
  3050.      Generate smaller data references by making them relative to `r0',
  3051.      which allows loading a value using a single instruction (rather
  3052.      than the usual two).  You control which data references are
  3053.      affected by specifying NUM with this option.  For example, if you
  3054.      specify `-mshort-data-512', then the data references affected are
  3055.      those involving displacements of less than 512 bytes.
  3056.      `-mshort-data-NUM' is not effective for NUM greater than 64k.
  3057.  
  3058. `-mserialize-volatile'
  3059. `-mno-serialize-volatile'
  3060.      Do, or do not, generate code to guarantee sequential consistency of
  3061.      volatile memory references.
  3062.  
  3063.      GNU CC always guarantees consistency by default, for the preferred
  3064.      processor submodel.  How this is done depends on the submodel.
  3065.  
  3066.      The m88100 processor does not reorder memory references and so
  3067.      always provides sequential consistency.  If you use `-m88100', GNU
  3068.      CC does not generate any special instructions for sequential
  3069.      consistency.
  3070.  
  3071.      The order of memory references made by the m88110 processor does
  3072.      not always match the order of the instructions requesting those
  3073.      references.  In particular, a load instruction may execute before
  3074.      a preceding store instruction.  Such reordering violates
  3075.      sequential consistency of volatile memory references, when there
  3076.      are multiple processors.  When you use `-m88000' or `-m88110', GNU
  3077.      CC generates special instructions when appropriate, to force
  3078.      execution in the proper order.
  3079.  
  3080.      The extra code generated to guarantee consistency may affect the
  3081.      performance of your application.  If you know that you can safely
  3082.      forgo this guarantee, you may use the option
  3083.      `-mno-serialize-volatile'.
  3084.  
  3085.      If you use the `-m88100' option but require sequential consistency
  3086.      when running on the m88110 processor, you should use
  3087.      `-mserialize-volatile'.
  3088.  
  3089. `-msvr4'
  3090. `-msvr3'
  3091.      Turn on (`-msvr4') or off (`-msvr3') compiler extensions related
  3092.      to System V release 4 (SVr4).  This controls the following:
  3093.  
  3094.        1. Which variant of the assembler syntax to emit (which you can
  3095.           select independently using `-mversion-03.00').
  3096.  
  3097.        2. `-msvr4' makes the C preprocessor recognize `#pragma weak'
  3098.           that is used on System V release 4.
  3099.  
  3100.        3. `-msvr4' makes GNU CC issue additional declaration directives
  3101.           used in SVr4.
  3102.  
  3103.      `-msvr3' is the default for all m88k configurations except the
  3104.      SVr4 configuration.
  3105.  
  3106. `-mversion-03.00'
  3107.      In the DG/UX configuration, there are two flavors of SVr4.  This
  3108.      option modifies `-msvr4' to select whether the hybrid-COFF or
  3109.      real-ELF flavor is used.  All other configurations ignore this
  3110.      option.
  3111.  
  3112. `-mno-check-zero-division'
  3113. `-mcheck-zero-division'
  3114.      Early models of the 88k architecture had problems with division by
  3115.      zero; in particular, many of them didn't trap.  Use these options
  3116.      to avoid including (or to include explicitly) additional code to
  3117.      detect division by zero and signal an exception.  All GNU CC
  3118.      configurations for the 88k use `-mcheck-zero-division' by default.
  3119.  
  3120. `-muse-div-instruction'
  3121.      Do not emit code to check both the divisor and dividend when doing
  3122.      signed integer division to see if either is negative, and adjust
  3123.      the signs so the divide is done using non-negative numbers.
  3124.      Instead, rely on the operating system to calculate the correct
  3125.      value when the `div' instruction traps.  This results in different
  3126.      behavior when the most negative number is divided by -1, but is
  3127.      useful when most or all signed integer divisions are done with
  3128.      positive numbers.
  3129.  
  3130. `-mtrap-large-shift'
  3131. `-mhandle-large-shift'
  3132.      Include code to detect bit-shifts of more than 31 bits;
  3133.      respectively, trap such shifts or emit code to handle them
  3134.      properly.  By default GNU CC makes no special provision for large
  3135.      bit shifts.
  3136.  
  3137. `-mwarn-passed-structs'
  3138.      Warn when a function passes a struct as an argument or result.
  3139.      Structure-passing conventions have changed during the evolution of
  3140.      the C language, and are often the source of portability problems.
  3141.      By default, GNU CC issues no such warning.
  3142.  
  3143. 
  3144. File: @.Distr.UsingGCC,  Node: RS/6000 Options,  Next: RT Options,  Prev: M88K Options,  Up: Submodel Options
  3145.  
  3146. IBM RS/6000 Options
  3147. -------------------
  3148.  
  3149.    Only one pair of `-m' options is defined for the IBM RS/6000:
  3150.  
  3151. `-mfp-in-toc'
  3152. `-mno-fp-in-toc'
  3153.      Control whether or not floating-point constants go in the Table of
  3154.      Contents (TOC), a table of all global variable and function
  3155.      addresses.  By default GNU CC puts floating-point constants there;
  3156.      if the TOC overflows, `-mno-fp-in-toc' will reduce the size of the
  3157.      TOC, which may avoid the overflow.
  3158.  
  3159. 
  3160. File: @.Distr.UsingGCC,  Node: RT Options,  Next: MIPS Options,  Prev: RS/6000 Options,  Up: Submodel Options
  3161.  
  3162. IBM RT Options
  3163. --------------
  3164.  
  3165.    These `-m' options are defined for the IBM RT PC:
  3166.  
  3167. `-min-line-mul'
  3168.      Use an in-line code sequence for integer multiplies.  This is the
  3169.      default.
  3170.  
  3171. `-mcall-lib-mul'
  3172.      Call `lmul$$' for integer multiples.
  3173.  
  3174. `-mfull-fp-blocks'
  3175.      Generate full-size floating point data blocks, including the
  3176.      minimum amount of scratch space recommended by IBM.  This is the
  3177.      default.
  3178.  
  3179. `-mminimum-fp-blocks'
  3180.      Do not include extra scratch space in floating point data blocks.
  3181.      This results in smaller code, but slower execution, since scratch
  3182.      space must be allocated dynamically.
  3183.  
  3184. `-mfp-arg-in-fpregs'
  3185.      Use a calling sequence incompatible with the IBM calling
  3186.      convention in which floating point arguments are passed in
  3187.      floating point registers.  Note that `varargs.h' and `stdargs.h'
  3188.      will not work with floating point operands if this option is
  3189.      specified.
  3190.  
  3191. `-mfp-arg-in-gregs'
  3192.      Use the normal calling convention for floating point arguments.
  3193.      This is the default.
  3194.  
  3195. `-mhc-struct-return'
  3196.      Return structures of more than one word in memory, rather than in a
  3197.      register.  This provides compatibility with the MetaWare HighC (hc)
  3198.      compiler.  Use the option `-fpcc-struct-return' for compatibility
  3199.      with the Portable C Compiler (pcc).
  3200.  
  3201. `-mnohc-struct-return'
  3202.      Return some structures of more than one word in registers, when
  3203.      convenient.  This is the default.  For compatibility with the
  3204.      IBM-supplied compilers, use the option `-fpcc-struct-return' or the
  3205.      option `-mhc-struct-return'.
  3206.  
  3207. 
  3208. File: @.Distr.UsingGCC,  Node: MIPS Options,  Next: i386 Options,  Prev: RT Options,  Up: Submodel Options
  3209.  
  3210. MIPS Options
  3211. ------------
  3212.  
  3213.    These `-m' options are defined for the MIPS family of computers:
  3214.  
  3215. `-mcpu=CPU TYPE'
  3216.      Assume the defaults for the machine type CPU TYPE when scheduling
  3217.      instructions.  The default CPU TYPE is `default', which picks the
  3218.      longest cycles times for any of the machines, in order that the
  3219.      code run at reasonable rates on all MIPS cpu's.  Other choices for
  3220.      CPU TYPE are `r2000', `r3000', `r4000', and `r6000'.  While
  3221.      picking a specific CPU TYPE will schedule things appropriately for
  3222.      that particular chip, the compiler will not generate any code that
  3223.      does not meet level 1 of the MIPS ISA (instruction set
  3224.      architecture) without the `-mips2' or `-mips3' switches being used.
  3225.  
  3226. `-mips2'
  3227.      Issue instructions from level 2 of the MIPS ISA (branch likely,
  3228.      square root instructions).  The `-mcpu=r4000' or `-mcpu=r6000'
  3229.      switch must be used in conjunction with `-mips2'.
  3230.  
  3231. `-mips3'
  3232.      Issue instructions from level 3 of the MIPS ISA (64 bit
  3233.      instructions).  You must use the `-mcpu=r4000' switch along with
  3234.      `-mips3'.
  3235.  
  3236. `-mint64'
  3237. `-mlong64'
  3238. `-mlonglong128'
  3239.      These options don't work at present.
  3240.  
  3241. `-mmips-as'
  3242.      Generate code for the MIPS assembler, and invoke `mips-tfile' to
  3243.      add normal debug information.  This is the default for all
  3244.      platforms except for the OSF/1 reference platform, using the
  3245.      OSF/rose object format.  If the either of the `-gstabs' or
  3246.      `-gstabs+' switches are used, the `mips-tfile' program will
  3247.      encapsulate the stabs within MIPS ECOFF.
  3248.  
  3249. `-mgas'
  3250.      Generate code for the GNU assembler.  This is the default on the
  3251.      OSF/1 reference platform, using the OSF/rose object format.
  3252.  
  3253. `-mrnames'
  3254. `-mno-rnames'
  3255.      The `-mrnames' switch says to output code using the MIPS software
  3256.      names for the registers, instead of the hardware names (ie, A0
  3257.      instead of $4).  The GNU assembler does not support the `-mrnames'
  3258.      switch, and the MIPS assembler will be instructed to run the MIPS
  3259.      C preprocessor over the source file.  The `-mno-rnames' switch is
  3260.      default.
  3261.  
  3262. `-mgpopt'
  3263. `-mno-gpopt'
  3264.      The `-mgpopt' switch says to write all of the data declarations
  3265.      before the instructions in the text section, this allows the MIPS
  3266.      assembler to generate one word memory references instead of using
  3267.      two words for short global or static data items.  This is on by
  3268.      default if optimization is selected.
  3269.  
  3270. `-mstats'
  3271. `-mno-stats'
  3272.      For each non-inline function processed, the `-mstats' switch
  3273.      causes the compiler to emit one line to the standard error file to
  3274.      print statistics about the program (number of registers saved,
  3275.      stack size, etc.).
  3276.  
  3277. `-mmemcpy'
  3278. `-mno-memcpy'
  3279.      The `-mmemcpy' switch makes all block moves call the appropriate
  3280.      string function (`memcpy' or `bcopy') instead of possibly
  3281.      generating inline code.
  3282.  
  3283. `-mmips-tfile'
  3284. `-mno-mips-tfile'
  3285.      The `-mno-mips-tfile' switch causes the compiler not postprocess
  3286.      the object file with the `mips-tfile' program, after the MIPS
  3287.      assembler has generated it to add debug support.  If `mips-tfile'
  3288.      is not run, then no local variables will be available to the
  3289.      debugger.  In addition, `stage2' and `stage3' objects will have
  3290.      the temporary file names passed to the assembler embedded in the
  3291.      object file, which means the objects will not compare the same.
  3292.      The `-mno-mips-tfile' switch should only be used when there are
  3293.      bugs in the `mips-tfile' program that prevents compilation.
  3294.  
  3295. `-msoft-float'
  3296.      Generate output containing library calls for floating point.
  3297.      *Warning:* the requisite libraries are not part of GNU CC.
  3298.      Normally the facilities of the machine's usual C compiler are
  3299.      used, but this can't be done directly in cross-compilation.  You
  3300.      must make your own arrangements to provide suitable library
  3301.      functions for cross-compilation.
  3302.  
  3303. `-mhard-float'
  3304.      Generate output containing floating point instructions.  This is
  3305.      the default if you use the unmodified sources.
  3306.  
  3307. `-mfp64'
  3308.      Assume that the FR bit in the status word is on, and that there
  3309.      are 32 64-bit floating point registers, instead of 32 32-bit
  3310.      floating point registers.  You must also specify the `-mcpu=r4000'
  3311.      and `-mips3' switches.
  3312.  
  3313. `-mfp32'
  3314.      Assume that there are 32 32-bit floating point registers.  This is
  3315.      the default.
  3316.  
  3317. `-mabicalls'
  3318. `-mno-abicalls'
  3319.      Emit (or do not emit) the pseudo operations `.abicalls',
  3320.      `.cpload', and `.cprestore' that some System V.4 ports use for
  3321.      position independent code.
  3322.  
  3323. `-mlong-calls'
  3324. `-mlong-calls'
  3325.      Do all calls with the `JALR' instruction, which requires loading
  3326.      up a function's address into a register before the call.  You need
  3327.      to use this switch, if you call outside of the current 512
  3328.      megabyte segment to functions that are not through pointers.
  3329.  
  3330. `-mhalf-pic'
  3331. `-mno-half-pic'
  3332.      Put pointers to extern references into the data section and load
  3333.      them up, rather than put the references in the text section.
  3334.  
  3335. `-G NUM'
  3336.      Put global and static items less than or equal to NUM bytes into
  3337.      the small data or bss sections instead of the normal data or bss
  3338.      section.  This allows the assembler to emit one word memory
  3339.      reference instructions based on the global pointer (GP or $28),
  3340.      instead of the normal two words used.  By default, NUM is 8 when
  3341.      the MIPS assembler is used, and 0 when the GNU assembler is used.
  3342.      The `-G NUM' switch is also passed to the assembler and linker.
  3343.      All modules should be compiled with the same `-G NUM' value.
  3344.  
  3345. `-nocpp'
  3346.      Tell the MIPS assembler to not run it's preprocessor over user
  3347.      assembler files (with a `.s' suffix) when assembling them.
  3348.  
  3349. 
  3350. File: @.Distr.UsingGCC,  Node: i386 Options,  Next: HPPA Options,  Prev: MIPS Options,  Up: Submodel Options
  3351.  
  3352. Intel 386 Options
  3353. -----------------
  3354.  
  3355.    These `-m' options are defined for the i386 family of computers:
  3356.  
  3357. `-m486'
  3358. `-mno-486'
  3359.      Control whether or not code is optimized for a 486 instead of an
  3360.      386.  Code generated for an 486 will run on a 386 and vice versa.
  3361.  
  3362. `-msoft-float'
  3363.      Generate output containing library calls for floating point.
  3364.      *Warning:* the requisite libraries are not part of GNU CC.
  3365.      Normally the facilities of the machine's usual C compiler are
  3366.      used, but this can't be done directly in cross-compilation.  You
  3367.      must make your own arrangements to provide suitable library
  3368.      functions for cross-compilation.
  3369.  
  3370.      On machines where a function returns floating point results in the
  3371.      80387 register stack, some floating point opcodes may be emitted
  3372.      even if `-msoft-float' is used.
  3373.  
  3374. `-mno-fp-ret-in-387'
  3375.      Do not use the FPU registers for return values of functions.
  3376.  
  3377.      The usual calling convention has functions return values of types
  3378.      `float' and `double' in an FPU register, even if there is no FPU.
  3379.      The idea is that the operating system should emulate an FPU.
  3380.  
  3381.      The option `-mno-fp-ret-in-387' causes such values to be returned
  3382.      in ordinary CPU registers instead.
  3383.  
  3384. 
  3385. File: @.Distr.UsingGCC,  Node: HPPA Options,  Next: Intel 960 Options,  Prev: i386 Options,  Up: Submodel Options
  3386.  
  3387. HPPA Options
  3388. ------------
  3389.  
  3390.    These `-m' options are defined for the HPPA family of computers:
  3391.  
  3392. `-mpa-risc-1-0'
  3393.      Generate code for a PA 1.0 processor.
  3394.  
  3395. `-mpa-risc-1-1'
  3396.      Generate code for a PA 1.1 processor.
  3397.  
  3398. `-mkernel'
  3399.      Generate code which is suitable for use in kernels.  Specifically,
  3400.      avoid `add' instructions in which one of the arguments is the DP
  3401.      register; generate `addil' instructions instead.  This avoids a
  3402.      rather serious bug in the HP-UX linker.
  3403.  
  3404. `-mshared-libs'
  3405.      Generate code that can be linked against HP-UX shared libraries.
  3406.      This option is not fully function yet, and is not on by default
  3407.      for any PA target.  Using this option can cause incorrect code to
  3408.      be generated by the compiler.
  3409.  
  3410. `-mno-shared-libs'
  3411.      Don't generate code that will be linked against shared libraries.
  3412.      This is the default for all PA targets.
  3413.  
  3414. `-mlong-calls'
  3415.      Generate code which allows calls to functions greater than 256k
  3416.      away from the caller when the caller and callee are in the same
  3417.      source file.  Do not turn this option on unless code refuses to
  3418.      link with "branch out of range errors" from the linker.
  3419.  
  3420. `-mdisable-fpregs'
  3421.      Prevent floating point registers from being used in any manner.
  3422.      This is necessary for compiling kernels which perform lazy context
  3423.      switching of floating point registers.  If you use this option and
  3424.      attempt to perform floating point operations, the compiler will
  3425.      abort.
  3426.  
  3427. `-mdisable-indexing'
  3428.      Prevent the compiler from using indexing address modes.  This
  3429.      avoids some rather obscure problems when compiling MIG generated
  3430.      code under MACH.
  3431.  
  3432. `-mtrailing-colon'
  3433.      Add a colon to the end of label definitions (for ELF assemblers).
  3434.  
  3435. 
  3436. File: @.Distr.UsingGCC,  Node: Intel 960 Options,  Next: DEC Alpha Options,  Prev: HPPA Options,  Up: Submodel Options
  3437.  
  3438. Intel 960 Options
  3439. -----------------
  3440.  
  3441.    These `-m' options are defined for the Intel 960 implementations:
  3442.  
  3443. `-mCPU TYPE'
  3444.      Assume the defaults for the machine type CPU TYPE for some of the
  3445.      other options, including instruction scheduling, floating point
  3446.      support, and addressing modes.  The choices for CPU TYPE are `ka',
  3447.      `kb', `mc', `ca', `cf', `sa', and `sb'.  The default is `kb'.
  3448.  
  3449. `-mnumerics'
  3450. `-msoft-float'
  3451.      The `-mnumerics' option indicates that the processor does support
  3452.      floating-point instructions.  The `-msoft-float' option indicates
  3453.      that floating-point support should not be assumed.
  3454.  
  3455. `-mleaf-procedures'
  3456. `-mno-leaf-procedures'
  3457.      Do (or do not) attempt to alter leaf procedures to be callable
  3458.      with the `bal' instruction as well as `call'.  This will result in
  3459.      more efficient code for explicit calls when the `bal' instruction
  3460.      can be substituted by the assembler or linker, but less efficient
  3461.      code in other cases, such as calls via function pointers, or using
  3462.      a linker that doesn't support this optimization.
  3463.  
  3464. `-mtail-call'
  3465. `-mno-tail-call'
  3466.      Do (or do not) make additional attempts (beyond those of the
  3467.      machine-independent portions of the compiler) to optimize
  3468.      tail-recursive calls into branches.  You may not want to do this
  3469.      because the detection of cases where this is not valid is not
  3470.      totally complete.  The default is `-mno-tail-call'.
  3471.  
  3472. `-mcomplex-addr'
  3473. `-mno-complex-addr'
  3474.      Assume (or do not assume) that the use of a complex addressing
  3475.      mode is a win on this implementation of the i960.  Complex
  3476.      addressing modes may not be worthwhile on the K-series, but they
  3477.      definitely are on the C-series.  The default is currently
  3478.      `-mcomplex-addr' for all processors except the CB and CC.
  3479.  
  3480. `-mcode-align'
  3481. `-mno-code-align'
  3482.      Align code to 8-byte boundaries for faster fetching (or don't
  3483.      bother).  Currently turned on by default for C-series
  3484.      implementations only.
  3485.  
  3486. `-mic-compat'
  3487. `-mic2.0-compat'
  3488. `-mic3.0-compat'
  3489.      Enable compatibility with iC960 v2.0 or v3.0.
  3490.  
  3491. `-masm-compat'
  3492. `-mintel-asm'
  3493.      Enable compatibility with the iC960 assembler.
  3494.  
  3495. `-mstrict-align'
  3496. `-mno-strict-align'
  3497.      Do not permit (do permit) unaligned accesses.
  3498.  
  3499. `-mold-align'
  3500.      Enable structure-alignment compatibility with Intel's gcc release
  3501.      version 1.3 (based on gcc 1.37).  Currently this is buggy in that
  3502.      `#pragma align 1' is always assumed as well, and cannot be turned
  3503.      off.
  3504.  
  3505. 
  3506. File: @.Distr.UsingGCC,  Node: DEC Alpha Options,  Next: System V Options,  Prev: Intel 960 Options,  Up: Submodel Options
  3507.  
  3508. DEC Alpha Options
  3509. -----------------
  3510.  
  3511.    These `-m' options are defined for the DEC Alpha implementations:
  3512.  
  3513. `-mno-soft-float'
  3514. `-msoft-float'
  3515.      Use (do not use) the hardware floating-point instructions for
  3516.      floating-point operations.  When `-msoft-float' is specified,
  3517.      functions in `libgcc1.c' will be used to perform floating-point
  3518.      operations.  Unless they are replaced by routines that emulate the
  3519.      floating-point operations, or compiled in such a way as to call
  3520.      such emulations routines, these routines will issue floating-point
  3521.      operations.   If you are compiling for an Alpha without
  3522.      floating-point operations, you must ensure that the library is
  3523.      built so as not to call them.
  3524.  
  3525.      Note that Alpha implementations without floating-point operations
  3526.      are required to have floating-point registers.
  3527.  
  3528. `-mfp-reg'
  3529. `-mno-fp-regs'
  3530.      Generate code that uses (does not use) the floating-point register
  3531.      set.  `-mno-fp-regs' implies `-msoft-float'.  If the floating-point
  3532.      register set is not used, floating point operands are passed in
  3533.      integer registers as if they were integers and floating-point
  3534.      results are passed in $0 instead of $f0.  This is a non-standard
  3535.      calling sequence, so any function with a floating-point argument
  3536.      or return value called by code compiled with `-mno-fp-regs' must
  3537.      also be compiled with that option.
  3538.  
  3539.      A typical use of this option is building a kernel that does not
  3540.      use, and hence need not save and restore, any floating-point
  3541.      registers.
  3542.  
  3543. 
  3544. File: @.Distr.UsingGCC,  Node: System V Options,  Prev: DEC Alpha Options,  Up: Submodel Options
  3545.  
  3546. Options for System V
  3547. --------------------
  3548.  
  3549.    These additional options are available on System V Release 4 for
  3550. compatibility with other compilers on those systems:
  3551.  
  3552. `-Qy'
  3553.      Identify the versions of each tool used by the compiler, in a
  3554.      `.ident' assembler directive in the output.
  3555.  
  3556. `-Qn'
  3557.      Refrain from adding `.ident' directives to the output file (this is
  3558.      the default).
  3559.  
  3560. `-YP,DIRS'
  3561.      Search the directories DIRS, and no others, for libraries
  3562.      specified with `-l'.
  3563.  
  3564. `-Ym,DIR'
  3565.      Look in the directory DIR to find the M4 preprocessor.  The
  3566.      assembler uses this option.
  3567.  
  3568. 
  3569. File: @.Distr.UsingGCC,  Node: Code Gen Options,  Next: Environment Variables,  Prev: Submodel Options,  Up: Invoking GCC
  3570.  
  3571. Options for Code Generation Conventions
  3572. =======================================
  3573.  
  3574.    These machine-independent options control the interface conventions
  3575. used in code generation.
  3576.  
  3577.    Most of them have both positive and negative forms; the negative form
  3578. of `-ffoo' would be `-fno-foo'.  In the table below, only one of the
  3579. forms is listed--the one which is not the default.  You can figure out
  3580. the other form by either removing `no-' or adding it.
  3581.  
  3582. `-fpcc-struct-return'
  3583.      Return "short" `struct' and `union' values in memory like longer
  3584.      ones, rather than in registers.  This convention is less
  3585.      efficient, but it has the advantage of allowing intercallability
  3586.      between GNU CC-compiled files and files compiled with other
  3587.      compilers.
  3588.  
  3589.      The precise convention for returning structures in memory depends
  3590.      on the target configuration macros.
  3591.  
  3592.      Short structures and unions are those whose size and alignment
  3593.      match that of some integer type.
  3594.  
  3595. `-freg-struct-return'
  3596.      Use the convention that `struct' and `union' values are returned
  3597.      in registers when possible.  This is more efficient for small
  3598.      structures than `-fpcc-struct-return'.
  3599.  
  3600.      If you specify neither `-fpcc-struct-return' nor its contrary
  3601.      `-freg-struct-return', GNU CC defaults to whichever convention is
  3602.      standard for the target.  If there is no standard convention, GNU
  3603.      CC defaults to `-fpcc-struct-return', except on targets where GNU
  3604.      CC is the principal compiler.  In those cases, we can choose the
  3605.      standard, and we chose the more efficient register return
  3606.      alternative.
  3607.  
  3608. `-fshort-enums'
  3609.      Allocate to an `enum' type only as many bytes as it needs for the
  3610.      declared range of possible values.  Specifically, the `enum' type
  3611.      will be equivalent to the smallest integer type which has enough
  3612.      room.
  3613.  
  3614. `-fshort-double'
  3615.      Use the same size for `double' as for `float'.
  3616.  
  3617. `-fshared-data'
  3618.      Requests that the data and non-`const' variables of this
  3619.      compilation be shared data rather than private data.  The
  3620.      distinction makes sense only on certain operating systems, where
  3621.      shared data is shared between processes running the same program,
  3622.      while private data exists in one copy per process.
  3623.  
  3624. `-fno-common'
  3625.      Allocate even uninitialized global variables in the bss section of
  3626.      the object file, rather than generating them as common blocks.
  3627.      This has the effect that if the same variable is declared (without
  3628.      `extern') in two different compilations, you will get an error
  3629.      when you link them.  The only reason this might be useful is if
  3630.      you wish to verify that the program will work on other systems
  3631.      which always work this way.
  3632.  
  3633. `-fno-ident'
  3634.      Ignore the `#ident' directive.
  3635.  
  3636. `-fno-gnu-linker'
  3637.      Do not output global initializations (such as C++ constructors and
  3638.      destructors) in the form used by the GNU linker (on systems where
  3639.      the GNU linker is the standard method of handling them).  Use this
  3640.      option when you want to use a non-GNU linker, which also requires
  3641.      using the `collect2' program to make sure the system linker
  3642.      includes constructors and destructors.  (`collect2' is included in
  3643.      the GNU CC distribution.)  For systems which *must* use
  3644.      `collect2', the compiler driver `gcc' is configured to do this
  3645.      automatically.
  3646.  
  3647. `-finhibit-size-directive'
  3648.      Don't output a `.size' assembler directive, or anything else that
  3649.      would cause trouble if the function is split in the middle, and the
  3650.      two halves are placed at locations far apart in memory.  This
  3651.      option is used when compiling `crtstuff.c'; you should not need to
  3652.      use it for anything else.
  3653.  
  3654. `-fverbose-asm'
  3655.      Put extra commentary information in the generated assembly code to
  3656.      make it more readable.  This option is generally only of use to
  3657.      those who actually need to read the generated assembly code
  3658.      (perhaps while debugging the compiler itself).
  3659.  
  3660. `-fvolatile'
  3661.      Consider all memory references through pointers to be volatile.
  3662.  
  3663. `-fvolatile-global'
  3664.      Consider all memory references to extern and global data items to
  3665.      be volatile.
  3666.  
  3667. `-fpic'
  3668.      Generate position-independent code (PIC) suitable for use in a
  3669.      shared library, if supported for the target machine.  Such code
  3670.      accesses all constant addresses through a global offset table
  3671.      (GOT).  If the GOT size for the linked executable exceeds a
  3672.      machine-specific maximum size, you get an error message from the
  3673.      linker indicating that `-fpic' does not work; in that case,
  3674.      recompile with `-fPIC' instead.  (These maximums are 16k on the
  3675.      m88k, 8k on the Sparc, and 32k on the m68k and RS/6000.  The 386
  3676.      has no such limit.)
  3677.  
  3678.      Position-independent code requires special support, and therefore
  3679.      works only on certain machines.  For the 386, GNU CC supports PIC
  3680.      for System V but not for the Sun 386i.  Code generated for the IBM
  3681.      RS/6000 is always position-independent.
  3682.  
  3683.      The GNU assembler does not fully support PIC.  Currently, you must
  3684.      use some other assembler in order for PIC to work.  We would
  3685.      welcome volunteers to upgrade GAS to handle this; the first part
  3686.      of the job is to figure out what the assembler must do differently.
  3687.  
  3688. `-fPIC'
  3689.      If supported for the target machine, emit position-independent
  3690.      code, suitable for dynamic linking and avoiding any limit on the
  3691.      size of the global offset table.  This option makes a difference
  3692.      on the m68k, m88k and the Sparc.
  3693.  
  3694.      Position-independent code requires special support, and therefore
  3695.      works only on certain machines.
  3696.  
  3697. `-ffixed-REG'
  3698.      Treat the register named REG as a fixed register; generated code
  3699.      should never refer to it (except perhaps as a stack pointer, frame
  3700.      pointer or in some other fixed role).
  3701.  
  3702.      REG must be the name of a register.  The register names accepted
  3703.      are machine-specific and are defined in the `REGISTER_NAMES' macro
  3704.      in the machine description macro file.
  3705.  
  3706.      This flag does not have a negative form, because it specifies a
  3707.      three-way choice.
  3708.  
  3709. `-fcall-used-REG'
  3710.      Treat the register named REG as an allocatable register that is
  3711.      clobbered by function calls.  It may be allocated for temporaries
  3712.      or variables that do not live across a call.  Functions compiled
  3713.      this way will not save and restore the register REG.
  3714.  
  3715.      Use of this flag for a register that has a fixed pervasive role in
  3716.      the machine's execution model, such as the stack pointer or frame
  3717.      pointer, will produce disastrous results.
  3718.  
  3719.      This flag does not have a negative form, because it specifies a
  3720.      three-way choice.
  3721.  
  3722. `-fcall-saved-REG'
  3723.      Treat the register named REG as an allocatable register saved by
  3724.      functions.  It may be allocated even for temporaries or variables
  3725.      that live across a call.  Functions compiled this way will save
  3726.      and restore the register REG if they use it.
  3727.  
  3728.      Use of this flag for a register that has a fixed pervasive role in
  3729.      the machine's execution model, such as the stack pointer or frame
  3730.      pointer, will produce disastrous results.
  3731.  
  3732.      A different sort of disaster will result from the use of this flag
  3733.      for a register in which function values may be returned.
  3734.  
  3735.      This flag does not have a negative form, because it specifies a
  3736.      three-way choice.
  3737.  
  3738. `+e0'
  3739. `+e1'
  3740.      Control whether virtual function definitions in classes are used to
  3741.      generate code, or only to define interfaces for their callers.
  3742.      (C++ only).
  3743.  
  3744.      These options are provided for compatibility with `cfront' 1.x
  3745.      usage; the recommended alternative GNU C++ usage is in flux.
  3746.      *Note Declarations and Definitions in One Header: C++ Interface.
  3747.  
  3748.      With `+e0', virtual function definitions in classes are declared
  3749.      `extern'; the declaration is used only as an interface
  3750.      specification, not to generate code for the virtual functions (in
  3751.      this compilation).
  3752.  
  3753.      With `+e1', G++ actually generates the code implementing virtual
  3754.      functions defined in the code, and makes them publicly visible.
  3755.  
  3756. 
  3757. File: @.Distr.UsingGCC,  Node: Environment Variables,  Next: Running Protoize,  Prev: Code Gen Options,  Up: Invoking GCC
  3758.  
  3759. Environment Variables Affecting GNU CC
  3760. ======================================
  3761.  
  3762.    This section describes several environment variables that affect how
  3763. GNU CC operates.  They work by specifying directories or prefixes to use
  3764. when searching for various kinds of files.
  3765.  
  3766.    Note that you can also specify places to search using options such as
  3767. `-B', `-I' and `-L' (*note Directory Options::.).  These take
  3768. precedence over places specified using environment variables, which in
  3769. turn take precedence over those specified by the configuration of GNU
  3770. CC.
  3771.  
  3772. `TMPDIR'
  3773.      If `TMPDIR' is set, it specifies the directory to use for temporary
  3774.      files.  GNU CC uses temporary files to hold the output of one
  3775.      stage of compilation which is to be used as input to the next
  3776.      stage: for example, the output of the preprocessor, which is the
  3777.      input to the compiler proper.
  3778.  
  3779. `GCC_EXEC_PREFIX'
  3780.      If `GCC_EXEC_PREFIX' is set, it specifies a prefix to use in the
  3781.      names of the subprograms executed by the compiler.  No slash is
  3782.      added when this prefix is combined with the name of a subprogram,
  3783.      but you can specify a prefix that ends with a slash if you wish.
  3784.  
  3785.      If GNU CC cannot find the subprogram using the specified prefix, it
  3786.      tries looking in the usual places for the subprogram.
  3787.  
  3788.      Other prefixes specified with `-B' take precedence over this
  3789.      prefix.
  3790.  
  3791.      This prefix is also used for finding files such as `crt0.o' that
  3792.      are used for linking.
  3793.  
  3794.      In addition, the prefix is used in an unusual way in finding the
  3795.      directories to search for header files.  For each of the standard
  3796.      directories whose name normally begins with
  3797.      `/usr/local/lib/gcc-lib' (more precisely, with the value of
  3798.      `GCC_INCLUDE_DIR'), GNU CC tries replacing that beginning with the
  3799.      specified prefix to produce an alternate directory name.  Thus,
  3800.      with `-Bfoo/', GNU CC will search `foo/bar' where it would
  3801.      normally search `/usr/local/lib/bar'.  These alternate directories
  3802.      are searched first; the standard directories come next.
  3803.  
  3804. `COMPILER_PATH'
  3805.      The value of `COMPILER_PATH' is a colon-separated list of
  3806.      directories, much like `PATH'.  GNU CC tries the directories thus
  3807.      specified when searching for subprograms, if it can't find the
  3808.      subprograms using `GCC_EXEC_PREFIX'.
  3809.  
  3810. `LIBRARY_PATH'
  3811.      The value of `LIBRARY_PATH' is a colon-separated list of
  3812.      directories, much like `PATH'.  GNU CC tries the directories thus
  3813.      specified when searching for special linker files, if it can't
  3814.      find them using `GCC_EXEC_PREFIX'.  Linking using GNU CC also uses
  3815.      these directories when searching for ordinary libraries for the
  3816.      `-l' option (but directories specified with `-L' come first).
  3817.  
  3818. `C_INCLUDE_PATH'
  3819. `CPLUS_INCLUDE_PATH'
  3820. `OBJC_INCLUDE_PATH'
  3821.      These environment variables pertain to particular languages.  Each
  3822.      variable's value is a colon-separated list of directories, much
  3823.      like `PATH'.  When GNU CC searches for header files, it tries the
  3824.      directories listed in the variable for the language you are using,
  3825.      after the directories specified with `-I' but before the standard
  3826.      header file directories.
  3827.  
  3828. `DEPENDENCIES_OUTPUT'
  3829.      If this variable is set, its value specifies how to output
  3830.      dependencies for Make based on the header files processed by the
  3831.      compiler.  This output looks much like the output from the `-M'
  3832.      option (*note Preprocessor Options::.), but it goes to a separate
  3833.      file, and is in addition to the usual results of compilation.
  3834.  
  3835.      The value of `DEPENDENCIES_OUTPUT' can be just a file name, in
  3836.      which case the Make rules are written to that file, guessing the
  3837.      target name from the source file name.  Or the value can have the
  3838.      form `FILE TARGET', in which case the rules are written to file
  3839.      FILE using TARGET as the target name.
  3840.  
  3841. 
  3842. File: @.Distr.UsingGCC,  Node: Running Protoize,  Prev: Environment Variables,  Up: Invoking GCC
  3843.  
  3844. Running Protoize
  3845. ================
  3846.  
  3847.    The program `protoize' is an optional part of GNU C.  You can use it
  3848. to add prototypes to a program, thus converting the program to ANSI C
  3849. in one respect.  The companion program `unprotoize' does the reverse:
  3850. it removes argument types from any prototypes that are found.
  3851.  
  3852.    When you run these programs, you must specify a set of source files
  3853. as command line arguments.  The conversion programs start out by
  3854. compiling these files to see what functions they define.  The
  3855. information gathered about a file FOO is saved in a file named `FOO.X'.
  3856.  
  3857.    After scanning comes actual conversion.  The specified files are all
  3858. eligible to be converted; any files they include (whether sources or
  3859. just headers) are eligible as well.
  3860.  
  3861.    But not all the eligible files are converted.  By default,
  3862. `protoize' and `unprotoize' convert only source and header files in the
  3863. current directory.  You can specify additional directories whose files
  3864. should be converted with the `-d DIRECTORY' option.  You can also
  3865. specify particular files to exclude with the `-x FILE' option.  A file
  3866. is converted if it is eligible, its directory name matches one of the
  3867. specified directory names, and its name within the directory has not
  3868. been excluded.
  3869.  
  3870.    Basic conversion with `protoize' consists of rewriting most function
  3871. definitions and function declarations to specify the types of the
  3872. arguments.  The only ones not rewritten are those for varargs functions.
  3873.  
  3874.    `protoize' optionally inserts prototype declarations at the
  3875. beginning of the source file, to make them available for any calls that
  3876. precede the function's definition.  Or it can insert prototype
  3877. declarations with block scope in the blocks where undeclared functions
  3878. are called.
  3879.  
  3880.    Basic conversion with `unprotoize' consists of rewriting most
  3881. function declarations to remove any argument types, and rewriting
  3882. function definitions to the old-style pre-ANSI form.
  3883.  
  3884.    Both conversion programs print a warning for any function
  3885. declaration or definition that they can't convert.  You can suppress
  3886. these warnings with `-q'.
  3887.  
  3888.    The output from `protoize' or `unprotoize' replaces the original
  3889. source file.  The original file is renamed to a name ending with
  3890. `.save'.  If the `.save' file already exists, then the source file is
  3891. simply discarded.
  3892.  
  3893.    `protoize' and `unprotoize' both depend on GNU CC itself to scan the
  3894. program and collect information about the functions it uses.  So
  3895. neither of these programs will work until GNU CC is installed.
  3896.  
  3897.    Here is a table of the options you can use with `protoize' and
  3898. `unprotoize'.  Each option works with both programs unless otherwise
  3899. stated.
  3900.  
  3901. `-B DIRECTORY'
  3902.      Look for the file `SYSCALLS.c.X' in DIRECTORY, instead of the
  3903.      usual directory (normally `/usr/local/lib').  This file contains
  3904.      prototype information about standard system functions.  This option
  3905.      applies only to `protoize'.
  3906.  
  3907. `-c COMPILATION-OPTIONS'
  3908.      Use  COMPILATION-OPTIONS as the options when running `gcc' to
  3909.      produce the `.X' files.  The special option `-aux-info' is always
  3910.      passed in addition, to tell `gcc' to write a `.X' file.
  3911.  
  3912.      Note that the compilation options must be given as a single
  3913.      argument to `protoize' or `unprotoize'.  If you want to specify
  3914.      several `gcc' options, you must quote the entire set of
  3915.      compilation options to make them a single word in the shell.
  3916.  
  3917.      There are certain `gcc' arguments that you cannot use, because they
  3918.      would produce the wrong kind of output.  These include `-g', `-O',
  3919.      `-c', `-S', and `-o' If you include these in the
  3920.      COMPILATION-OPTIONS, they are ignored.
  3921.  
  3922. `-C'
  3923.      Rename files to end in `.C' instead of `.c'.  This is convenient
  3924.      if you are converting a C program to C++.  This option applies
  3925.      only to `protoize'.
  3926.  
  3927. `-g'
  3928.      Add explicit global declarations.  This means inserting explicit
  3929.      declarations at the beginning of each source file for each function
  3930.      that is called in the file and was not declared.  These
  3931.      declarations precede the first function definition that contains a
  3932.      call to an undeclared function.  This option applies only to
  3933.      `protoize'.
  3934.  
  3935. `-i STRING'
  3936.      Indent old-style parameter declarations with the string STRING.
  3937.      This option applies only to `protoize'.
  3938.  
  3939.      `unprotoize' converts prototyped function definitions to old-style
  3940.      function definitions, where the arguments are declared between the
  3941.      argument list and the initial `{'.  By default, `unprotoize' uses
  3942.      five spaces as the indentation.  If you want to indent with just
  3943.      one space instead, use `-i " "'.
  3944.  
  3945. `-k'
  3946.      Keep the `.X' files.  Normally, they are deleted after conversion
  3947.      is finished.
  3948.  
  3949. `-l'
  3950.      Add explicit local declarations.  `protoize' with `-l' inserts a
  3951.      prototype declaration for each function in each block which calls
  3952.      the function without any declaration.  This option applies only to
  3953.      `protoize'.
  3954.  
  3955. `-n'
  3956.      Make no real changes.  This mode just prints information about the
  3957.      conversions that would have been done without `-n'.
  3958.  
  3959. `-N'
  3960.      Make no `.save' files.  The original files are simply deleted.
  3961.      Use this option with caution.
  3962.  
  3963. `-p PROGRAM'
  3964.      Use the program PROGRAM as the compiler.  Normally, the name `gcc'
  3965.      is used.
  3966.  
  3967. `-q'
  3968.      Work quietly.  Most warnings are suppressed.
  3969.  
  3970. `-v'
  3971.      Print the version number, just like `-v' for `gcc'.
  3972.  
  3973.    If you need special compiler options to compile one of your program's
  3974. source files, then you should generate that file's `.X' file specially,
  3975. by running `gcc' on that source file with the appropriate options and
  3976. the option `-aux-info'.  Then run `protoize' on the entire set of
  3977. files.  `protoize' will use the existing `.X' file because it is newer
  3978. than the source file.  For example:
  3979.  
  3980.      gcc -Dfoo=bar file1.c -aux-info
  3981.      protoize *.c
  3982.  
  3983. You need to include the special files along with the rest in the
  3984. `protoize' command, even though their `.X' files already exist, because
  3985. otherwise they won't get converted.
  3986.  
  3987.    *Note Protoize Caveats::, for more information on how to use
  3988. `protoize' successfully.
  3989.  
  3990. 
  3991. File: @.Distr.UsingGCC,  Node: Installation,  Next: C Extensions,  Prev: Invoking GCC,  Up: Top
  3992.  
  3993. Installing GNU CC
  3994. *****************
  3995.  
  3996.    Here is the procedure for installing GNU CC on a Unix system.
  3997.  
  3998. * Menu:
  3999.  
  4000. * Other Dir::     Compiling in a separate directory (not where the source is).
  4001. * Cross-Compiler::   Building and installing a cross-compiler.
  4002. * PA Install::    See below for installation on the HP Precision Architecture.
  4003. * Sun Install::   See below for installation on the Sun.
  4004. * 3b1 Install::   See below for installation on the 3b1.
  4005. * Unos Install::  See below for installation on Unos (from CRDS).
  4006. * VMS Install::   See below for installation on VMS.
  4007. * WE32K Install:: See below for installation on the 3b* aside from the 3b1.
  4008. * MIPS Install::  See below for installation on the MIPS Architecture.
  4009. * Collect2::      How `collect2' works; how it finds `ld'.
  4010. * Header Dirs::   Understanding the standard header file directories.
  4011.  
  4012.    You cannot install GNU C by itself on MSDOS; it will not compile
  4013. under any MSDOS compiler except itself.  You need to get the complete
  4014. compilation package DJGPP, which includes binaries as well as sources,
  4015. and includes all the necessary compilation tools and libraries.
  4016.  
  4017.   1. If you have built GNU CC previously in the same directory for a
  4018.      different target machine, do `make distclean' to delete all files
  4019.      that might be invalid.  One of the files this deletes is
  4020.      `Makefile'; if `make distclean' complains that `Makefile' does not
  4021.      exist, it probably means that the directory is already suitably
  4022.      clean.
  4023.  
  4024.   2. On a System V release 4 system, make sure `/usr/bin' precedes
  4025.      `/usr/ucb' in `PATH'.  The `cc' command in `/usr/ucb' uses
  4026.      libraries which have bugs.
  4027.  
  4028.   3. Specify the host and target machine configurations.  You do this by
  4029.      running the file `configure' with appropriate arguments.
  4030.  
  4031.      If you are building a compiler to produce code for the machine it
  4032.      runs on, specify just one machine type, with the `--target'
  4033.      option; the host type will default to be the same as the target.
  4034.      (For information on building a cross-compiler, see *Note
  4035.      Cross-Compiler::.)  Here is an example:
  4036.  
  4037.           configure --target=sparc-sun-sunos4.1
  4038.  
  4039.      If you run `configure' without specifying configuration arguments,
  4040.      `configure' tries to guess the type of host you are on, and uses
  4041.      that configuration type for both host and target.  So you don't
  4042.      need to specify a configuration, for building a native compiler,
  4043.      unless `configure' cannot figure out what your configuration is.
  4044.  
  4045.      A configuration name may be canonical or it may be more or less
  4046.      abbreviated.
  4047.  
  4048.      A canonical configuration name has three parts, separated by
  4049.      dashes.  It looks like this: `CPU-COMPANY-SYSTEM'.  (The three
  4050.      parts may themselves contain dashes; `configure' can figure out
  4051.      which dashes serve which purpose.)  For example,
  4052.      `m68k-sun-sunos4.1' specifies a Sun 3.
  4053.  
  4054.      You can also replace parts of the configuration by nicknames or
  4055.      aliases.  For example, `sun3' stands for `m68k-sun', so
  4056.      `sun3-sunos4.1' is another way to specify a Sun 3.  You can also
  4057.      use simply `sun3-sunos', since the version of SunOS is assumed by
  4058.      default to be version 4.  `sun3-bsd' also works, since `configure'
  4059.      knows that the only BSD variant on a Sun 3 is SunOS.
  4060.  
  4061.      You can specify a version number after any of the system types,
  4062.      and some of the CPU types.  In most cases, the version is
  4063.      irrelevant, and will be ignored.  So you might as well specify the
  4064.      version if you know it.
  4065.  
  4066.      Here are the possible CPU types:
  4067.  
  4068.           a29k, alpha, arm, cN, clipper, elxsi, h8300, hppa1.0, hppa1.1,
  4069.           i370, i386, i486, i860, i960, m68000, m68k, m88k, mips,
  4070.           ns32k, pyramid, romp, rs6000, sh, sparc, sparclite, vax,
  4071.           we32k.
  4072.  
  4073.      Here are the recognized company names.  As you can see, customary
  4074.      abbreviations are used rather than the longer official names.
  4075.  
  4076.           alliant, altos, apollo, att, bull, cbm, convergent, convex,
  4077.           crds, dec, dg, dolphin, elxsi, encore, harris, hitachi, hp,
  4078.           ibm, intergraph, isi, mips, motorola, ncr, next, ns, omron,
  4079.           plexus, sequent, sgi, sony, sun, tti, unicom.
  4080.  
  4081.      The company name is meaningful only to disambiguate when the rest
  4082.      of the information supplied is insufficient.  You can omit it,
  4083.      writing just `CPU-SYSTEM', if it is not needed.  For example,
  4084.      `vax-ultrix4.2' is equivalent to `vax-dec-ultrix4.2'.
  4085.  
  4086.      Here is a list of system types:
  4087.  
  4088.           aix, acis, aos, bsd, clix, ctix, dgux, dynix, genix, hpux,
  4089.           isc, linux, luna, lynxos, mach, minix, newsos, osf, osfrose,
  4090.           riscos, sco, solaris, sunos, sysv, ultrix, unos, vms.
  4091.  
  4092.      You can omit the system type; then `configure' guesses the
  4093.      operating system from the CPU and company.
  4094.  
  4095.      You can add a version number to the system type; this may or may
  4096.      not make a difference.  For example, you can write `bsd4.3' or
  4097.      `bsd4.4' to distinguish versions of BSD.  In practice, the version
  4098.      number is most needed for `sysv3' and `sysv4', which are often
  4099.      treated differently.
  4100.  
  4101.      If you specify an impossible combination such as `i860-dg-vms',
  4102.      then you may get an error message from `configure', or it may
  4103.      ignore part of the information and do the best it can with the
  4104.      rest.  `configure' always prints the canonical name for the
  4105.      alternative that it used.
  4106.  
  4107.      Often a particular model of machine has a name.  Many machine
  4108.      names are recognized as aliases for CPU/company combinations.
  4109.      Thus, the machine name `sun3', mentioned above, is an alias for
  4110.      `m68k-sun'.  Sometimes we accept a company name as a machine name,
  4111.      when the name is popularly used for a particular machine.  Here is
  4112.      a table of the known machine names:
  4113.  
  4114.           3300, 3b1, 3bN, 7300, altos3068, altos, apollo68, att-7300,
  4115.           balance, convex-cN, crds, decstation-3100, decstation, delta,
  4116.           encore, fx2800, gmicro, hp7NN, hp8NN, hp9k2NN, hp9k3NN,
  4117.           hp9k7NN, hp9k8NN, iris4d, iris, isi68, m3230, magnum, merlin,
  4118.           miniframe, mmax, news-3600, news800, news, next, pbd, pc532,
  4119.           pmax, ps2, risc-news, rtpc, sun2, sun386i, sun386, sun3,
  4120.           sun4, symmetry, tower-32, tower.
  4121.  
  4122.      Remember that a machine name specifies both the cpu type and the
  4123.      company name.
  4124.  
  4125.      There are four additional options you can specify independently to
  4126.      describe variant hardware and software configurations.  These are
  4127.      `--with-gnu-as', `--with-gnu-ld', `--with-stabs' and `--nfp'.
  4128.  
  4129.     `--with-gnu-as'
  4130.           If you will use GNU CC with the GNU assembler (GAS), you
  4131.           should declare this by using the `--with-gnu-as' option when
  4132.           you run `configure'.
  4133.  
  4134.           Using this option does not install GAS.  It only modifies the
  4135.           output of GNU CC to work with GAS.  Building and installing
  4136.           GAS is up to you.
  4137.  
  4138.           Conversely, if you *do not* wish to use GAS and do not specify
  4139.           `--with-gnu-as' when building GNU CC, it is up to you to make
  4140.           sure that GAS is not installed.  GNU CC searches for a
  4141.           program named `as' in various directories; if the program it
  4142.           finds is GAS, then it runs GAS.  If you are not sure where
  4143.           GNU CC finds the assembler it is using, try specifying `-v'
  4144.           when you run it.
  4145.  
  4146.           The systems where it makes a difference whether you use GAS
  4147.           are
  4148.           `hppa1.0-ANY-ANY', `hppa1.1-ANY-ANY', `i386-ANY-sysv',
  4149.           `i386-ANY-isc',
  4150.           `i860-ANY-bsd', `m68k-bull-sysv', `m68k-hp-hpux',
  4151.           `m68k-sony-bsd',
  4152.           `m68k-altos-sysv', `m68000-hp-hpux', `m68000-att-sysv', and
  4153.           `mips-ANY').  On any other system, `--with-gnu-as' has no
  4154.           effect.
  4155.  
  4156.           On the systems listed above (except for the HP-PA and for ISC
  4157.           on the 386), if you use GAS, you should also use the GNU
  4158.           linker (and specify `--with-gnu-ld').
  4159.  
  4160.     `--with-gnu-ld'
  4161.           Specify the option `--with-gnu-ld' if you plan to use the GNU
  4162.           linker with GNU CC.
  4163.  
  4164.           This option does not cause the GNU linker to be installed; it
  4165.           just modifies the behavior of GNU CC to work with the GNU
  4166.           linker.  Specifically, it inhibits the installation of
  4167.           `collect2', a program which otherwise serves as a front-end
  4168.           for the system's linker on most configurations.
  4169.  
  4170.     `--with-stabs'
  4171.           On MIPS based systems and on Alphas, you must specify whether
  4172.           you want GNU CC to create the normal ECOFF debugging format,
  4173.           or to use BSD-style stabs passed through the ECOFF symbol
  4174.           table.  The normal ECOFF debug format cannot fully handle
  4175.           languages other than C.  BSD stabs format can handle other
  4176.           languages, but it only works with the GNU debugger GDB.
  4177.  
  4178.           Normally, GNU CC uses the ECOFF debugging format by default;
  4179.           if you prefer BSD stabs, specify `--with-stabs' when you
  4180.           configure GNU CC.
  4181.  
  4182.           No matter which default you choose when you configure GNU CC,
  4183.           the user can use the `-gcoff' and `-gstabs+' options to
  4184.           specify explicitly the debug format for a particular
  4185.           compilation.
  4186.  
  4187.           `--with-stabs' is meaningful on the ISC system on the 386,
  4188.           also, if `--with-gas' is used.  It selects use of stabs
  4189.           debugging information embedded in COFF output.  This kind of
  4190.           debugging information supports C++ well; ordinary COFF
  4191.           debugging information does not.
  4192.  
  4193.     `--nfp'
  4194.           On certain systems, you must specify whether the machine has
  4195.           a floating point unit.  These systems include
  4196.           `m68k-sun-sunosN' and `m68k-isi-bsd'.  On any other system,
  4197.           `--nfp' currently has no effect, though perhaps there are
  4198.           other systems where it could usefully make a difference.
  4199.  
  4200.      If you want to install your own homemade configuration files, you
  4201.      can use `local' as the company name to access them.  If you use
  4202.      configuration `CPU-local', the configuration name without the cpu
  4203.      prefix is used to form the configuration file names.
  4204.  
  4205.      Thus, if you specify `m68k-local', configuration uses files
  4206.      `local.md', `local.h', `local.c', `xm-local.h', `t-local', and
  4207.      `x-local', all in the directory `config/m68k'.
  4208.  
  4209.      Here is a list of configurations that have special treatment or
  4210.      special things you must know:
  4211.  
  4212.     `alpha-*-osf1'
  4213.           Systems using processors that implement the DEC Alpha
  4214.           architecture and are running the OSF/1 operating system, for
  4215.           example the DEC Alpha AXP systems.  (VMS on the Alpha is not
  4216.           currently supported by GNU CC.)
  4217.  
  4218.           Objective C and C++ do not yet work on the Alpha.  We hope to
  4219.           support C++ in version 2.6.
  4220.  
  4221.           GNU CC writes a `.verstamp' directive to the assembler output
  4222.           file unless it is built as a cross-compiler.  It gets the
  4223.           version to use from the system header file
  4224.           `/usr/include/stamp.h'.  If you install a new version of
  4225.           OSF/1, you should rebuild GCC to pick up the new version
  4226.           stamp.
  4227.  
  4228.           Note that since the Alpha is a 64-bit architecture,
  4229.           cross-compilers from 32-bit machines will not generate as
  4230.           efficient code as that generated when the compiler is running
  4231.           on a 64-bit machine because many optimizations that depend on
  4232.           being able to represent a word on the target in an integral
  4233.           value on the host cannot be performed.  Building
  4234.           cross-compilers on the Alpha for 32-bit machines has only
  4235.           been tested in a few cases and may not work properly.
  4236.  
  4237.           `make compare' may fail on some versions of OSF/1 unless you
  4238.           add `-save-temps' to `CFLAGS'.  The same problem occurs on
  4239.           Irix version 5.1.1.  On these systems, the name of the
  4240.           assembler input file is stored in the object file, and that
  4241.           makes comparison fail if it differs between the `stage1' and
  4242.           `stage2' compilations.  The option `-save-temps' forces a
  4243.           fixed name to be used for the assembler input file, instead
  4244.           of a randomly chosen name in `/tmp'.
  4245.  
  4246.           GNU CC now supports both the native (ECOFF) debugging format
  4247.           used by DBX and GDB and an encapsulated STABS format for use
  4248.           only with GDB.  See the discussion of the `--with-stabs'
  4249.           option of `configure' above for more information on these
  4250.           formats and how to select them.
  4251.  
  4252.           There is a bug in DEC's assembler that produces incorrect
  4253.           line numbers for ECOFF format when the `.align' directive is
  4254.           used.  To work around this problem, GNU CC will not emit such
  4255.           alignment directives even if optimization is being performed
  4256.           if it is writing ECOFF format debugging information.
  4257.           Unfortunately, this has the very undesirable side-effect that
  4258.           code addresses when `-O' is specified are different depending
  4259.           on whether or not `-g' is also specified.
  4260.  
  4261.           To avoid this behavior, specify `-gstabs+' and use GDB
  4262.           instead of DBX.  DEC is now aware of this problem with the
  4263.           assembler and hopes to provide a fix shortly.
  4264.  
  4265.     `a29k'
  4266.           AMD Am29k-family processors.  These are normally used in
  4267.           embedded applications.  There are no standard Unix
  4268.           configurations.  This configuration corresponds to AMD's
  4269.           standard calling sequence and binary interface and is
  4270.           compatible with other 29k tools.
  4271.  
  4272.           You may need to make a variant of the file `a29k.h' for your
  4273.           particular configuration.
  4274.  
  4275.     `a29k-*-bsd'
  4276.           AMD Am29050 used in a system running a variant of BSD Unix.
  4277.  
  4278.     `elxsi-elxsi-bsd'
  4279.           The Elxsi's C compiler has known limitations that prevent it
  4280.           from compiling GNU C.  Please contact `mrs@cygnus.com' for
  4281.           more details.
  4282.  
  4283.     `hppa*-*-*'
  4284.           Using GAS is highly recommended for all HP-PA configurations.
  4285.           See *Note PA Install:: for the special procedures needed to
  4286.           compile GNU CC for the HP-PA.
  4287.  
  4288.     `i386-*-sco'
  4289.           Compilation with RCC is recommended.  Also, it may be a good
  4290.           idea to link with GNU malloc instead of the malloc that comes
  4291.           with the system.
  4292.  
  4293.     `i386-*-sco3.2.4'
  4294.           Use this configuration for SCO release 3.2 version 4.
  4295.  
  4296.     `i386-*-isc'
  4297.           It may be good idea to link with GNU malloc instead of the
  4298.           malloc that comes with the system.
  4299.  
  4300.     `i386-*-esix'
  4301.           It may be good idea to link with GNU malloc instead of the
  4302.           malloc that comes with the system.
  4303.  
  4304.     `i386-ibm-aix'
  4305.           You need to use GAS version 2.1 or later, and and LD from GNU
  4306.           binutils version 2.2 or later.
  4307.  
  4308.     `i386-sequent'
  4309.           Go to the Berkeley universe before compiling.  In addition,
  4310.           you probably need to create a file named `string.h'
  4311.           containing just one line: `#include <strings.h>'.
  4312.  
  4313.     `i386-sun-sunos4'
  4314.           You may find that you need another version of GNU CC to begin
  4315.           bootstrapping with, since the current version when built with
  4316.           the system's own compiler seems to get an infinite loop
  4317.           compiling part of `libgcc2.c'.  GNU CC version 2 compiled
  4318.           with GNU CC (any version) seems not to have this problem.
  4319.  
  4320.     `i860-intel-osf1'
  4321.           This is the Paragon.  If you have version 1.0 of the
  4322.           operating system, see *Note Installation Problems::, for
  4323.           special things you need to do to compensate for peculiarities
  4324.           in the system.
  4325.  
  4326.     `m68000-att'
  4327.           AT&T 3b1, a.k.a. 7300 PC.  Special procedures are needed to
  4328.           compile GNU CC with this machine's standard C compiler, due
  4329.           to bugs in that compiler.  *Note 3b1 Install::.  You can
  4330.           bootstrap it more easily with previous versions of GNU CC if
  4331.           you have them.
  4332.  
  4333.     `m68000-hp-bsd'
  4334.           HP 9000 series 200 running BSD.  Note that the C compiler
  4335.           that comes with this system cannot compile GNU CC; contact
  4336.           `law@cs.utah.edu' to get binaries of GNU CC for bootstrapping.
  4337.  
  4338.     `m68k-altos'
  4339.           Altos 3068.  You must use the GNU assembler, linker and
  4340.           debugger.  Also, you must fix a kernel bug.  Details in the
  4341.           file `README.ALTOS'.
  4342.  
  4343.     `m68k-bull-sysv'
  4344.           Bull DPX/2 series 200 and 300 with BOS-2.00.45 up to
  4345.           BOS-2.01. GNU CC works either with native assembler or GNU
  4346.           assembler. You can use GNU assembler with native coff
  4347.           generation by providing `--gas' to the configure script or
  4348.           use GNU assembler with dbx-in-coff encapsulation by providing
  4349.           `--gas --stabs'. For any problem with native assembler or for
  4350.           availability of the DPX/2 port of GAS, contact
  4351.           `F.Pierresteguy@frcl.bull.fr'.
  4352.  
  4353.     `m68k-hp-hpux'
  4354.           HP 9000 series 300 or 400 running HP-UX.  HP-UX version 8.0
  4355.           has a bug in the assembler that prevents compilation of GNU
  4356.           CC.  To fix it, get patch PHCO_0800 from HP.
  4357.  
  4358.           In addition, `--gas' does not currently work with this
  4359.           configuration.  Changes in HP-UX have broken the library
  4360.           conversion tool and the linker.
  4361.  
  4362.     `m68k-sun'
  4363.           Sun 3.  We do not provide a configuration file to use the Sun
  4364.           FPA by default, because programs that establish signal
  4365.           handlers for floating point traps inherently cannot work with
  4366.           the FPA.
  4367.  
  4368.     `m88k-*-svr3'
  4369.           Motorola m88k running the AT&T/Unisoft/Motorola V.3 reference
  4370.           port.  These systems tend to use the Green Hills C, revision
  4371.           1.8.5, as the standard C compiler.  There are apparently bugs
  4372.           in this compiler that result in object files differences
  4373.           between stage 2 and stage 3.  If this happens, make the stage
  4374.           4 compiler and compare it to the stage 3 compiler.  If the
  4375.           stage 3 and stage 4 object files are identical, this suggests
  4376.           you encountered a problem with the standard C compiler; the
  4377.           stage 3 and 4 compilers may be usable.
  4378.  
  4379.           It is best, however, to use an older version of GNU CC for
  4380.           bootstrapping if you have one.
  4381.  
  4382.     `m88k-*-dgux'
  4383.           Motorola m88k running DG/UX.  To build native or cross
  4384.           compilers on DG/UX, you must first change to the 88open BCS
  4385.           software development environment.  This is done by issuing
  4386.           this command:
  4387.  
  4388.                eval `sde-target m88kbcs`
  4389.  
  4390.     `m88k-tektronix-sysv3'
  4391.           Tektronix XD88 running UTekV 3.2e.  Do not turn on
  4392.           optimization while building stage1 if you bootstrap with the
  4393.           buggy Green Hills compiler.  Also, The bundled LAI System V
  4394.           NFS is buggy so if you build in an NFS mounted directory,
  4395.           start from a fresh reboot, or avoid NFS all together.
  4396.           Otherwise you may have trouble getting clean comparisons
  4397.           between stages.
  4398.  
  4399.     `mips-mips-bsd'
  4400.           MIPS machines running the MIPS operating system in BSD mode.
  4401.           It's possible that some old versions of the system lack the
  4402.           functions `memcpy', `memcmp', and `memset'.  If your system
  4403.           lacks these, you must remove or undo the definition of
  4404.           `TARGET_MEM_FUNCTIONS' in `mips-bsd.h'.
  4405.  
  4406.     `mips-sgi-*'
  4407.           Silicon Graphics MIPS machines running IRIX.  In order to
  4408.           compile GCC on an SGI the "c.hdr.lib" option must be
  4409.           installed from the CD-ROM supplied from Silicon Graphics.
  4410.           This is found on the 2nd CD in release 4.0.1.
  4411.  
  4412.     `mips-sony-sysv'
  4413.           Sony MIPS NEWS.  This works in NEWSOS 5.0.1, but not in 5.0.2
  4414.           (which uses ELF instead of COFF).  Support for 5.0.2 will
  4415.           probably be provided soon by volunteers.  In particular, the
  4416.           linker does not like the code generated by GCC when shared
  4417.           libraries are linked in.
  4418.  
  4419.     `ns32k-encore'
  4420.           Encore ns32000 system.  Encore systems are supported only
  4421.           under BSD.
  4422.  
  4423.     `ns32k-*-genix'
  4424.           National Semiconductor ns32000 system.  Genix has bugs in
  4425.           `alloca' and `malloc'; you must get the compiled versions of
  4426.           these from GNU Emacs.
  4427.  
  4428.     `ns32k-sequent'
  4429.           Go to the Berkeley universe before compiling.  In addition,
  4430.           you probably need to create a file named `string.h'
  4431.           containing just one line: `#include <strings.h>'.
  4432.  
  4433.     `ns32k-utek'
  4434.           UTEK ns32000 system ("merlin").  The C compiler that comes
  4435.           with this system cannot compile GNU CC; contact
  4436.           `tektronix!reed!mason' to get binaries of GNU CC for
  4437.           bootstrapping.
  4438.  
  4439.     `romp-*-aos'
  4440.     `romp-*-mach'
  4441.           The only operating systems supported for the IBM RT PC are
  4442.           AOS and MACH.  GNU CC does not support AIX running on the RT.
  4443.           We recommend you compile GNU CC with an earlier version of
  4444.           itself; if you compile GNU CC with `hc', the Metaware
  4445.           compiler, it will work, but you will get mismatches between
  4446.           the stage 2 and stage 3 compilers in various files.  These
  4447.           errors are minor differences in some floating-point constants
  4448.           and can be safely ignored; the stage 3 compiler is correct.
  4449.  
  4450.     `rs6000-*-aix'
  4451.           *Read the file `README.RS6000' for information on how to get
  4452.           a fix for problems in the IBM assembler that interfere with
  4453.           GNU CC.* You must either obtain the new assembler or avoid
  4454.           using the `-g' switch.  Note that `Makefile.in' uses `-g' by
  4455.           default when compiling `libgcc2.c'.
  4456.  
  4457.           The PowerPC and POWER2 architectures are now supported, but
  4458.           have not been extensively tested due to lack of appropriate
  4459.           systems.  Only AIX is supported on the PowerPC.
  4460.  
  4461.           Objective C does not work on this architecture.
  4462.  
  4463.           XLC version 1.3.0.0 will miscompile `jump.c'.  XLC version
  4464.           1.3.0.1 or later fixes this problem.  We do not yet have a
  4465.           PTF number for this fix.
  4466.  
  4467.     `vax-dec-ultrix'
  4468.           Don't try compiling with Vax C (`vcc').  It produces
  4469.           incorrect code in some cases (for example, when `alloca' is
  4470.           used).
  4471.  
  4472.           Meanwhile, compiling `cp-parse.c' with pcc does not work
  4473.           because of an internal table size limitation in that
  4474.           compiler.  To avoid this problem, compile just the GNU C
  4475.           compiler first, and use it to recompile building all the
  4476.           languages that you want to run.
  4477.  
  4478.      Here we spell out what files will be set up by `configure'.
  4479.      Normally you need not be concerned with these files.
  4480.  
  4481.         * A symbolic link named `config.h' is made to the top-level
  4482.           config file for the machine you plan to run the compiler on
  4483.           (*note The Configuration File: (gcc.info)Config.).  This file
  4484.           is responsible for defining information about the host
  4485.           machine.  It includes `tm.h'.
  4486.  
  4487.           The top-level config file is located in the subdirectory
  4488.           `config'.  Its name is always `xm-SOMETHING.h'; usually
  4489.           `xm-MACHINE.h', but there are some exceptions.
  4490.  
  4491.           If your system does not support symbolic links, you might
  4492.           want to set up `config.h' to contain a `#include' command
  4493.           which refers to the appropriate file.
  4494.  
  4495.         * A symbolic link named `tconfig.h' is made to the top-level
  4496.           config file for your target machine.  This is used for
  4497.           compiling certain programs to run on that machine.
  4498.  
  4499.         * A symbolic link named `tm.h' is made to the
  4500.           machine-description macro file for your target machine.  It
  4501.           should be in the subdirectory `config' and its name is often
  4502.           `MACHINE.h'.
  4503.  
  4504.         * A symbolic link named `md' will be made to the machine
  4505.           description pattern file.  It should be in the `config'
  4506.           subdirectory and its name should be `MACHINE.md'; but MACHINE
  4507.           is often not the same as the name used in the `tm.h' file
  4508.           because the `md' files are more general.
  4509.  
  4510.         * A symbolic link named `aux-output.c' will be made to the
  4511.           output subroutine file for your machine.  It should be in the
  4512.           `config' subdirectory and its name should be `MACHINE.c'.
  4513.  
  4514.         * The command file `configure' also constructs the file
  4515.           `Makefile' by adding some text to the template file
  4516.           `Makefile.in'.  The additional text comes from files in the
  4517.           `config' directory, named `t-TARGET' and `x-HOST'.  If these
  4518.           files do not exist, it means nothing needs to be added for a
  4519.           given target or host.
  4520.  
  4521.   4. The standard directory for installing GNU CC is `/usr/local/lib'.
  4522.      If you want to install its files somewhere else, specify
  4523.      `--prefix=DIR' when you run `configure'.  Here DIR is a directory
  4524.      name to use instead of `/usr/local' for all purposes with one
  4525.      exception: the directory `/usr/local/include' is searched for
  4526.      header files no matter where you install the compiler.
  4527.  
  4528.   5. Specify `--local-prefix=DIR' if you want the compiler to search
  4529.      directory `DIR/include' for header files *instead* of
  4530.      `/usr/local/include'.  (This is for systems that have different
  4531.      conventions for where to put site-specific things.)
  4532.  
  4533.      Unless you have a convention other than `/usr/local' for
  4534.      site-specific files, it is a bad idea to specify `--local-prefix'.
  4535.  
  4536.   6. Make sure the Bison parser generator is installed.  (This is
  4537.      unnecessary if the Bison output files `c-parse.c' and `cexp.c' are
  4538.      more recent than `c-parse.y' and `cexp.y' and you do not plan to
  4539.      change the `.y' files.)
  4540.  
  4541.      Bison versions older than Sept 8, 1988 will produce incorrect
  4542.      output for `c-parse.c'.
  4543.  
  4544.   7. If you have chosen a configuration for GNU CC which requires other
  4545.      GNU tools (such as GAS or the GNU linker) instead of the standard
  4546.      system tools, install the required tools in the build directory
  4547.      under the names `as', `ld' or whatever is appropriate.  This will
  4548.      enable the compiler to find the proper tools for compilation of
  4549.      the program `enquire'.
  4550.  
  4551.      Alternatively, you can do subsequent compilation using a value of
  4552.      the `PATH' environment variable such that the necessary GNU tools
  4553.      come before the standard system tools.
  4554.  
  4555.   8. Build the compiler.  Just type `make LANGUAGES=c' in the compiler
  4556.      directory.
  4557.  
  4558.      `LANGUAGES=c' specifies that only the C compiler should be
  4559.      compiled.  The makefile normally builds compilers for all the
  4560.      supported languages; currently, C, C++ and Objective C.  However,
  4561.      C is the only language that is sure to work when you build with
  4562.      other non-GNU C compilers.  In addition, building anything but C
  4563.      at this stage is a waste of time.
  4564.  
  4565.      In general, you can specify the languages to build by typing the
  4566.      argument `LANGUAGES="LIST"', where LIST is one or more words from
  4567.      the list `c', `c++', and `objective-c'.
  4568.  
  4569.      Ignore any warnings you may see about "statement not reached" in
  4570.      `insn-emit.c'; they are normal.  Also, warnings about "unknown
  4571.      escape sequence" are normal in `genopinit.c' and perhaps some
  4572.      other files.  Any other compilation errors may represent bugs in
  4573.      the port to your machine or operating system, and should be
  4574.      investigated and reported (*note Bugs::.).
  4575.  
  4576.      Some commercial compilers fail to compile GNU CC because they have
  4577.      bugs or limitations.  For example, the Microsoft compiler is said
  4578.      to run out of macro space.  Some Ultrix compilers run out of
  4579.      expression space; then you need to break up the statement where
  4580.      the problem happens.
  4581.  
  4582.      If you are building with a previous GNU C compiler, do not use
  4583.      `CC=gcc' on the make command or by editing the Makefile.  Instead,
  4584.      use a full pathname to specify the compiler, such as
  4585.      `CC=/usr/local/bin/gcc'.  This is because make might execute the
  4586.      `gcc' in the current directory before all of the compiler
  4587.      components have been built.
  4588.  
  4589.   9. If you are building a cross-compiler, stop here.  *Note
  4590.      Cross-Compiler::.
  4591.  
  4592.  10. Move the first-stage object files and executables into a
  4593.      subdirectory with this command:
  4594.  
  4595.           make stage1
  4596.  
  4597.      The files are moved into a subdirectory named `stage1'.  Once
  4598.      installation is complete, you may wish to delete these files with
  4599.      `rm -r stage1'.
  4600.  
  4601.  11. If you have chosen a configuration for GNU CC which requires other
  4602.      GNU tools (such as GAS or the GNU linker) instead of the standard
  4603.      system tools, install the required tools in the `stage1'
  4604.      subdirectory under the names `as', `ld' or whatever is
  4605.      appropriate.  This will enable the stage 1 compiler to find the
  4606.      proper tools in the following stage.
  4607.  
  4608.      Alternatively, you can do subsequent compilation using a value of
  4609.      the `PATH' environment variable such that the necessary GNU tools
  4610.      come before the standard system tools.
  4611.  
  4612.  12. Recompile the compiler with itself, with this command:
  4613.  
  4614.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O"
  4615.  
  4616.      This is called making the stage 2 compiler.
  4617.  
  4618.      The command shown above builds compilers for all the supported
  4619.      languages.  If you don't want them all, you can specify the
  4620.      languages to build by typing the argument `LANGUAGES="LIST"'.  LIST
  4621.      should contain one or more words from the list `c', `c++',
  4622.      `objective-c', and `proto'.  Separate the words with spaces.
  4623.      `proto' stands for the programs `protoize' and `unprotoize'; they
  4624.      are not a separate language, but you use `LANGUAGES' to enable or
  4625.      disable their installation.
  4626.  
  4627.      If you are going to build the stage 3 compiler, then you might
  4628.      want to build only the C language in stage 2.
  4629.  
  4630.      Once you have built the stage 2 compiler, if you are short of disk
  4631.      space, you can delete the subdirectory `stage1'.
  4632.  
  4633.      On a 68000 or 68020 system lacking floating point hardware, unless
  4634.      you have selected a `tm.h' file that expects by default that there
  4635.      is no such hardware, do this instead:
  4636.  
  4637.           make CC="stage1/xgcc -Bstage1/" CFLAGS="-g -O -msoft-float"
  4638.  
  4639.  13. If you wish to test the compiler by compiling it with itself one
  4640.      more time, install any other necessary GNU tools (such as GAS or
  4641.      the GNU linker) in the `stage2' subdirectory as you did in the
  4642.      `stage1' subdirectory, then do this:
  4643.  
  4644.           make stage2
  4645.           make CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  4646.  
  4647.      This is called making the stage 3 compiler.  Aside from the `-B'
  4648.      option, the compiler options should be the same as when you made
  4649.      the stage 2 compiler.  But the `LANGUAGES' option need not be the
  4650.      same.  The command shown above builds compilers for all the
  4651.      supported languages; if you don't want them all, you can specify
  4652.      the languages to build by typing the argument `LANGUAGES="LIST"',
  4653.      as described above.
  4654.  
  4655.      Then compare the latest object files with the stage 2 object
  4656.      files--they ought to be identical, aside from time stamps (if any).
  4657.  
  4658.      On some systems, meaningful comparison of object files is
  4659.      impossible; they always appear "different."  This is currently
  4660.      true on Solaris and probably on all systems that use ELF object
  4661.      file format.  Some other systems where this is so are listed below.
  4662.  
  4663.      Use this command to compare the files:
  4664.  
  4665.           make compare
  4666.  
  4667.      This will mention any object files that differ between stage 2 and
  4668.      stage 3.  Any difference, no matter how innocuous, indicates that
  4669.      the stage 2 compiler has compiled GNU CC incorrectly, and is
  4670.      therefore a potentially serious bug which you should investigate
  4671.      and report (*note Bugs::.).
  4672.  
  4673.      If your system does not put time stamps in the object files, then
  4674.      this is a faster way to compare them (using the Bourne shell):
  4675.  
  4676.           for file in *.o; do
  4677.           cmp $file stage2/$file
  4678.           done
  4679.  
  4680.      If you have built the compiler with the `-mno-mips-tfile' option on
  4681.      MIPS machines, you will not be able to compare the files.
  4682.  
  4683.      The Alpha stores file names of internal temporary files in the
  4684.      object files and `make compare' does not know how to ignore them,
  4685.      so normally you cannot compare on the Alpha.  However, if you use
  4686.      the `-save-temps' option when compiling *both* stage 2 and stage
  4687.      3, this causes the same file names to be used in both stages; then
  4688.      you can do the comparison.
  4689.  
  4690.  14. Build the Objective C library (if you have built the Objective C
  4691.      compiler).  Here is the command to do this:
  4692.  
  4693.           make objc-runtime CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  4694.  
  4695.  15. Install the compiler driver, the compiler's passes and run-time
  4696.      support with `make install'.  Use the same value for `CC',
  4697.      `CFLAGS' and `LANGUAGES' that you used when compiling the files
  4698.      that are being installed.  One reason this is necessary is that
  4699.      some versions of Make have bugs and recompile files gratuitously
  4700.      when you do this step.  If you use the same variable values, those
  4701.      files will be recompiled properly.
  4702.  
  4703.      For example, if you have built the stage 2 compiler, you can use
  4704.      the following command:
  4705.  
  4706.           make install CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O" LANGUAGES="LIST"
  4707.  
  4708.      This copies the files `cc1', `cpp' and `libgcc.a' to files `cc1',
  4709.      `cpp' and `libgcc.a' in the directory
  4710.      `/usr/local/lib/gcc-lib/TARGET/VERSION', which is where the
  4711.      compiler driver program looks for them.  Here TARGET is the target
  4712.      machine type specified when you ran `configure', and VERSION is
  4713.      the version number of GNU CC.  This naming scheme permits various
  4714.      versions and/or cross-compilers to coexist.
  4715.  
  4716.      This also copies the driver program `xgcc' into
  4717.      `/usr/local/bin/gcc', so that it appears in typical execution
  4718.      search paths.
  4719.  
  4720.      On some systems, this command causes recompilation of some files.
  4721.      This is usually due to bugs in `make'.  You should either ignore
  4722.      this problem, or use GNU Make.
  4723.  
  4724.      *Warning: there is a bug in `alloca' in the Sun library.  To avoid
  4725.      this bug, be sure to install the executables of GNU CC that were
  4726.      compiled by GNU CC.  (That is, the executables from stage 2 or 3,
  4727.      not stage 1.)  They use `alloca' as a built-in function and never
  4728.      the one in the library.*
  4729.  
  4730.      (It is usually better to install GNU CC executables from stage 2
  4731.      or 3, since they usually run faster than the ones compiled with
  4732.      some other compiler.)
  4733.  
  4734.  16. Install the Objective C library (if you are installing the
  4735.      Objective C compiler).  Here is the command to do this:
  4736.  
  4737.           make install-libobjc CC="stage2/xgcc -Bstage2/" CFLAGS="-g -O"
  4738.  
  4739.  17. If you're going to use C++, it's likely that you need to also
  4740.      install the libg++ distribution.  It should be available from the
  4741.      same place where you got the GNU C distribution.  Just as GNU C
  4742.      does not distribute a C runtime library, it also does not include
  4743.      a C++ run-time library.  All I/O functionality, special class
  4744.      libraries, etc., are available in the libg++ distribution.
  4745.  
  4746. 
  4747. File: @.Distr.UsingGCC,  Node: Other Dir,  Next: Cross-Compiler,  Up: Installation
  4748.  
  4749. Compilation in a Separate Directory
  4750. ===================================
  4751.  
  4752.    If you wish to build the object files and executables in a directory
  4753. other than the one containing the source files, here is what you must
  4754. do differently:
  4755.  
  4756.   1. Make sure you have a version of Make that supports the `VPATH'
  4757.      feature.  (GNU Make supports it, as do Make versions on most BSD
  4758.      systems.)
  4759.  
  4760.   2. If you have ever run `configure' in the source directory, you must
  4761.      undo the configuration.  Do this by running:
  4762.  
  4763.           make distclean
  4764.  
  4765.   3. Go to the directory in which you want to build the compiler before
  4766.      running `configure':
  4767.  
  4768.           mkdir gcc-sun3
  4769.           cd gcc-sun3
  4770.  
  4771.      On systems that do not support symbolic links, this directory must
  4772.      be on the same file system as the source code directory.
  4773.  
  4774.   4. Specify where to find `configure' when you run it:
  4775.  
  4776.           ../gcc/configure ...
  4777.  
  4778.      This also tells `configure' where to find the compiler sources;
  4779.      `configure' takes the directory from the file name that was used to
  4780.      invoke it.  But if you want to be sure, you can specify the source
  4781.      directory with the `--srcdir' option, like this:
  4782.  
  4783.           ../gcc/configure --srcdir=../gcc sun3
  4784.  
  4785.      The directory you specify with `--srcdir' need not be the same as
  4786.      the one that `configure' is found in.
  4787.  
  4788.    Now, you can run `make' in that directory.  You need not repeat the
  4789. configuration steps shown above, when ordinary source files change.  You
  4790. must, however, run `configure' again when the configuration files
  4791. change, if your system does not support symbolic links.
  4792.  
  4793. 
  4794. File: @.Distr.UsingGCC,  Node: Cross-Compiler,  Next: PA Install,  Prev: Other Dir,  Up: Installation
  4795.  
  4796. Building and Installing a Cross-Compiler
  4797. ========================================
  4798.  
  4799.    GNU CC can function as a cross-compiler for many machines, but not
  4800. all.
  4801.  
  4802.    * Cross-compilers for the Mips as target using the Mips assembler
  4803.      currently do not work, because the auxiliary programs
  4804.      `mips-tdump.c' and `mips-tfile.c' can't be compiled on anything
  4805.      but a Mips.  It does work to cross compile for a Mips if you use
  4806.      the GNU assembler and linker.
  4807.  
  4808.    * Cross-compilers between machines with different floating point
  4809.      formats have not all been made to work.  GNU CC now has a floating
  4810.      point emulator with which these can work, but each target machine
  4811.      description needs to be updated to take advantage of it.
  4812.  
  4813.    * Cross-compilation between machines of different word sizes has not
  4814.      really been addressed yet.
  4815.  
  4816.    Since GNU CC generates assembler code, you probably need a
  4817. cross-assembler that GNU CC can run, in order to produce object files.
  4818. If you want to link on other than the target machine, you need a
  4819. cross-linker as well.  You also need header files and libraries suitable
  4820. for the target machine that you can install on the host machine.
  4821.  
  4822. * Menu:
  4823.  
  4824. * Steps of Cross::      Using a cross-compiler involves several steps
  4825.                           that may be carried out on different machines.
  4826. * Configure Cross::     Configuring a cross-compiler.
  4827. * Tools and Libraries:: Where to put the linker and assembler, and the C library.
  4828. * Cross Headers::       Finding and installing header files
  4829.                           for a cross-compiler.
  4830. * Cross Runtime::       Supplying arithmetic runtime routines (`libgcc1.a').
  4831. * Build Cross::         Actually compiling the cross-compiler.
  4832.  
  4833. 
  4834. File: @.Distr.UsingGCC,  Node: Steps of Cross,  Next: Configure Cross,  Up: Cross-Compiler
  4835.  
  4836. Steps of Cross-Compilation
  4837. --------------------------
  4838.  
  4839.    To compile and run a program using a cross-compiler involves several
  4840. steps:
  4841.  
  4842.    * Run the cross-compiler on the host machine to produce assembler
  4843.      files for the target machine.  This requires header files for the
  4844.      target machine.
  4845.  
  4846.    * Assemble the files produced by the cross-compiler.  You can do this
  4847.      either with an assembler on the target machine, or with a
  4848.      cross-assembler on the host machine.
  4849.  
  4850.    * Link those files to make an executable.  You can do this either
  4851.      with a linker on the target machine, or with a cross-linker on the
  4852.      host machine.  Whichever machine you use, you need libraries and
  4853.      certain startup files (typically `crt....o') for the target
  4854.      machine.
  4855.  
  4856.    It is most convenient to do all of these steps on the same host
  4857. machine, since then you can do it all with a single invocation of GNU
  4858. CC.  This requires a suitable cross-assembler and cross-linker.  For
  4859. some targets, the GNU assembler and linker are available.
  4860.  
  4861. 
  4862. File: @.Distr.UsingGCC,  Node: Configure Cross,  Next: Tools and Libraries,  Prev: Steps of Cross,  Up: Cross-Compiler
  4863.  
  4864. Configuring a Cross-Compiler
  4865. ----------------------------
  4866.  
  4867.    To build GNU CC as a cross-compiler, you start out by running
  4868. `configure'.  You must specify two different configurations, the host
  4869. and the target.  Use the `--host=HOST' option for the host and
  4870. `--target=TARGET' to specify the target type.  For example, here is how
  4871. to configure for a cross-compiler that runs on a hypothetical Intel 386
  4872. system and produces code for an HP 68030 system running BSD:
  4873.  
  4874.      configure --target=m68k-hp-bsd4.3 --host=i386-bozotheclone-bsd4.3
  4875.  
  4876. 
  4877. File: @.Distr.UsingGCC,  Node: Tools and Libraries,  Next: Cross Headers,  Prev: Configure Cross,  Up: Cross-Compiler
  4878.  
  4879. Tools and Libraries for a Cross-Compiler
  4880. ----------------------------------------
  4881.  
  4882.    If you have a cross-assembler and cross-linker available, you should
  4883. install them now.  Put them in the directory `/usr/local/TARGET/bin'.
  4884. Here is a table of the tools you should put in this directory:
  4885.  
  4886. `as'
  4887.      This should be the cross-assembler.
  4888.  
  4889. `ld'
  4890.      This should be the cross-linker.
  4891.  
  4892. `ar'
  4893.      This should be the cross-archiver: a program which can manipulate
  4894.      archive files (linker libraries) in the target machine's format.
  4895.  
  4896. `ranlib'
  4897.      This should be a program to construct a symbol table in an archive
  4898.      file.
  4899.  
  4900.    The installation of GNU CC will find these programs in that
  4901. directory, and copy or link them to the proper place to for the
  4902. cross-compiler to find them when run later.
  4903.  
  4904.    The easiest way to provide these files is to build the Binutils
  4905. package and GAS.  Configure them with the same `--host' and `--target'
  4906. options that you use for configuring GNU CC, then build and install
  4907. them.  They install their executables automatically into the proper
  4908. directory.  Alas, they do not support all the targets that GNU CC
  4909. supports.
  4910.  
  4911.    If you want to install libraries to use with the cross-compiler,
  4912. such as a standard C library, put them in the directory
  4913. `/usr/local/TARGET/lib'; installation of GNU CC copies all all the
  4914. files in that subdirectory into the proper place for GNU CC to find
  4915. them and link with them.  Here's an example of copying some libraries
  4916. from a target machine:
  4917.  
  4918.      ftp TARGET-MACHINE
  4919.      lcd /usr/local/TARGET/lib
  4920.      cd /lib
  4921.      get libc.a
  4922.      cd /usr/lib
  4923.      get libg.a
  4924.      get libm.a
  4925.      quit
  4926.  
  4927. The precise set of libraries you'll need, and their locations on the
  4928. target machine, vary depending on its operating system.
  4929.  
  4930.    Many targets require "start files" such as `crt0.o' and `crtn.o'
  4931. which are linked into each executable; these too should be placed in
  4932. `/usr/local/TARGET/lib'.  There may be several alternatives for
  4933. `crt0.o', for use with profiling or other compilation options.  Check
  4934. your target's definition of `STARTFILE_SPEC' to find out what start
  4935. files it uses.  Here's an example of copying these files from a target
  4936. machine:
  4937.  
  4938.      ftp TARGET-MACHINE
  4939.      lcd /usr/local/TARGET/lib
  4940.      prompt
  4941.      cd /lib
  4942.      mget *crt*.o
  4943.      cd /usr/lib
  4944.      mget *crt*.o
  4945.      quit
  4946.  
  4947. 
  4948. File: @.Distr.UsingGCC,  Node: Cross Runtime,  Next: Build Cross,  Prev: Cross Headers,  Up: Cross-Compiler
  4949.  
  4950. `libgcc.a' and Cross-Compilers
  4951. ------------------------------
  4952.  
  4953.    Code compiled by GNU CC uses certain runtime support functions
  4954. implicitly.  Some of these functions can be compiled successfully with
  4955. GNU CC itself, but a few cannot be.  These problem functions are in the
  4956. source file `libgcc1.c'; the library made from them is called
  4957. `libgcc1.a'.
  4958.  
  4959.    When you build a native compiler, these functions are compiled with
  4960. some other compiler-the one that you use for bootstrapping GNU CC.
  4961. Presumably it knows how to open code these operations, or else knows how
  4962. to call the run-time emulation facilities that the machine comes with.
  4963. But this approach doesn't work for building a cross-compiler.  The
  4964. compiler that you use for building knows about the host system, not the
  4965. target system.
  4966.  
  4967.    So, when you build a cross-compiler you have to supply a suitable
  4968. library `libgcc1.a' that does the job it is expected to do.
  4969.  
  4970.    To compile `libgcc1.c' with the cross-compiler itself does not work.
  4971. The functions in this file are supposed to implement arithmetic
  4972. operations that GNU CC does not know how to open code, for your target
  4973. machine.  If these functions are compiled with GNU CC itself, they will
  4974. compile into infinite recursion.
  4975.  
  4976.    On any given target, most of these functions are not needed.  If GNU
  4977. CC can open code an arithmetic operation, it will not call these
  4978. functions to perform the operation.  It is possible that on your target
  4979. machine, none of these functions is needed.  If so, you can supply an
  4980. empty library as `libgcc1.a'.
  4981.  
  4982.    Many targets need library support only for multiplication and
  4983. division.  If you are linking with a library that contains functions for
  4984. multiplication and division, you can tell GNU CC to call them directly
  4985. by defining the macros `MULSI3_LIBCALL', and the like.  These macros
  4986. need to be defined in the target description macro file.  For some
  4987. targets, they are defined already.  This may be sufficient to avoid the
  4988. need for libgcc1.a; if so, you can supply an empty library.
  4989.  
  4990.    Some targets do not have floating point instructions; they need other
  4991. functions in `libgcc1.a', which do floating arithmetic.  Recent
  4992. versions of GNU CC have a file which emulates floating point.  With a
  4993. certain amount of work, you should be able to construct a floating
  4994. point emulator that can be used as `libgcc1.a'.  Perhaps future
  4995. versions will contain code to do this automatically and conveniently.
  4996. That depends on whether someone wants to implement it.
  4997.  
  4998.    If your target system has another C compiler, you can configure GNU
  4999. CC as a native compiler on that machine, build just `libgcc1.a' with
  5000. `make libgcc1.a' on that machine, and use the resulting file with the
  5001. cross-compiler.  To do this, execute the following on the target
  5002. machine:
  5003.  
  5004.      cd TARGET-BUILD-DIR
  5005.      configure --host=sparc --target=sun3
  5006.      make libgcc1.a
  5007.  
  5008. And then this on the host machine:
  5009.  
  5010.      ftp TARGET-MACHINE
  5011.      binary
  5012.      cd TARGET-BUILD-DIR
  5013.      get libgcc1.a
  5014.      quit
  5015.  
  5016.    Another way to provide the functions you need in `libgcc1.a' is to
  5017. define the appropriate `perform_...' macros for those functions.  If
  5018. these definitions do not use the C arithmetic operators that they are
  5019. meant to implement, you should be able to compile them with the
  5020. cross-compiler you are building.  (If these definitions already exist
  5021. for your target file, then you are all set.)
  5022.  
  5023.    To build `libgcc1.a' using the perform macros, use
  5024. `LIBGCC1=libgcc1.a OLDCC=./xgcc' when building the compiler.
  5025. Otherwise, you should place your replacement library under the name
  5026. `libgcc1.a' in the directory in which you will build the
  5027. cross-compiler, before you run `make'.
  5028.  
  5029. 
  5030. File: @.Distr.UsingGCC,  Node: Cross Headers,  Next: Cross Runtime,  Prev: Tools and Libraries,  Up: Cross-Compiler
  5031.  
  5032. Cross-Compilers and Header Files
  5033. --------------------------------
  5034.  
  5035.    If you are cross-compiling a standalone program or a program for an
  5036. embedded system, then you may not need any header files except the few
  5037. that are part of GNU CC (and those of your program).  However, if you
  5038. intend to link your program with a standard C library such as `libc.a',
  5039. then you probably need to compile with the header files that go with
  5040. the library you use.
  5041.  
  5042.    The GNU C compiler does not come with these files, because (1) they
  5043. are system-specific, and (2) they belong in a C library, not in a
  5044. compiler.
  5045.  
  5046.    If the GNU C library supports your target machine, then you can get
  5047. the header files from there (assuming you actually use the GNU library
  5048. when you link your program).
  5049.  
  5050.    If your target machine comes with a C compiler, it probably comes
  5051. with suitable header files also.  If you make these files accessible
  5052. from the host machine, the cross-compiler can use them also.
  5053.  
  5054.    Otherwise, you're on your own in finding header files to use when
  5055. cross-compiling.
  5056.  
  5057.    When you have found suitable header files, put them in
  5058. `/usr/local/TARGET/include', before building the cross compiler.  Then
  5059. installation will run fixincludes properly and install the corrected
  5060. versions of the header files where the compiler will use them.
  5061.  
  5062.    Provide the header files before you build the cross-compiler, because
  5063. the build stage actually runs the cross-compiler to produce parts of
  5064. `libgcc.a'.  (These are the parts that *can* be compiled with GNU CC.)
  5065. Some of them need suitable header files.
  5066.  
  5067.    Here's an example showing how to copy the header files from a target
  5068. machine.  On the target machine, do this:
  5069.  
  5070.      (cd /usr/include; tar cf - .) > tarfile
  5071.  
  5072.    Then, on the host machine, do this:
  5073.  
  5074.      ftp TARGET-MACHINE
  5075.      lcd /usr/local/TARGET/include
  5076.      get tarfile
  5077.      quit
  5078.      tar xf tarfile
  5079.  
  5080. 
  5081. File: @.Distr.UsingGCC,  Node: Build Cross,  Prev: Cross Runtime,  Up: Cross-Compiler
  5082.  
  5083. Actually Building the Cross-Compiler
  5084. ------------------------------------
  5085.  
  5086.    Now you can proceed just as for compiling a single-machine compiler
  5087. through the step of building stage 1.  If you have not provided some
  5088. sort of `libgcc1.a', then compilation will give up at the point where
  5089. it needs that file, printing a suitable error message.  If you do
  5090. provide `libgcc1.a', then building the compiler will automatically
  5091. compile and link a test program called `cross-test'; if you get errors
  5092. in the linking, it means that not all of the necessary routines in
  5093. `libgcc1.a' are available.
  5094.  
  5095.    If you are making a cross-compiler for an embedded system, and there
  5096. is no `stdio.h' header for it, then the compilation of `enquire' will
  5097. probably fail.  The job of `enquire' is to run on the target machine
  5098. and figure out by experiment the nature of its floating point
  5099. representation.  `enquire' records its findings in the header file
  5100. `float.h'.  If you can't produce this file by running `enquire' on the
  5101. target machine, then you will need to come up with a suitable `float.h'
  5102. in some other way (or else, avoid using it in your programs).
  5103.  
  5104.    Do not try to build stage 2 for a cross-compiler.  It doesn't work to
  5105. rebuild GNU CC as a cross-compiler using the cross-compiler, because
  5106. that would produce a program that runs on the target machine, not on the
  5107. host.  For example, if you compile a 386-to-68030 cross-compiler with
  5108. itself, the result will not be right either for the 386 (because it was
  5109. compiled into 68030 code) or for the 68030 (because it was configured
  5110. for a 386 as the host).  If you want to compile GNU CC into 68030 code,
  5111. whether you compile it on a 68030 or with a cross-compiler on a 386, you
  5112. must specify a 68030 as the host when you configure it.
  5113.  
  5114.    To install the cross-compiler, use `make install', as usual.
  5115.  
  5116. 
  5117. File: @.Distr.UsingGCC,  Node: PA Install,  Next: Sun Install,  Prev: Cross-Compiler,  Up: Installation
  5118.  
  5119. Installing on the HP Precision Architecture
  5120. ===========================================
  5121.  
  5122.    There are two variants of this CPU, called 1.0 and 1.1, which have
  5123. different machine descriptions.  You must use the right one for your
  5124. machine.  All 7NN machines and 8N7 machines use 1.1, while all other
  5125. 8NN machines use 1.0.
  5126.  
  5127.    The easiest way to handle this problem is to use `configure hpNNN'
  5128. or `configure hpNNN-hpux', where NNN is the model number of the
  5129. machine.  Then `configure' will figure out if the machine is a 1.0 or
  5130. 1.1.  Use `uname -a' to find out the model number of your machine.
  5131.  
  5132.    `-g' does not work on HP-UX, since that system uses a peculiar
  5133. debugging format which GNU CC does not know about.  There are
  5134. preliminary versions of GAS and GDB for the HP-PA which do work with
  5135. GNU CC for debugging.  You can get them by anonymous ftp from
  5136. `jaguar.cs.utah.edu' `dist' subdirectory.  You would need to install
  5137. GAS in the file
  5138.  
  5139.      /usr/local/lib/gcc-lib/CONFIGURATION/GCCVERSION/as
  5140.  
  5141. where CONFIGURATION is the configuration name (perhaps `hpNNN-hpux')
  5142. and GCCVERSION is the GNU CC version number.  Do this *before* starting
  5143. the build process, otherwise you will get errors from the HPUX
  5144. assembler while building `libgcc2.a'.  The command
  5145.  
  5146.      make install-dir
  5147.  
  5148. will create the necessary directory hierarchy so you can install GAS
  5149. before building GCC.
  5150.  
  5151.    If you obtained GAS before October 6, 1992 it is highly recommended
  5152. you get a new one to avoid several bugs which have been discovered
  5153. recently.
  5154.  
  5155.    To enable debugging, configure GNU CC with the `--gas' option before
  5156. building.
  5157.  
  5158.    It has been reported that GNU CC produces invalid assembly code for
  5159. 1.1 machines running HP-UX 8.02 when using the HP assembler.  Typically
  5160. the errors look like this:
  5161.      as: bug.s @line#15 [err#1060]
  5162.        Argument 0 or 2 in FARG upper
  5163.               - lookahead = ARGW1=FR,RTNVAL=GR
  5164.      as: foo.s @line#28 [err#1060]
  5165.        Argument 0 or 2 in FARG upper
  5166.               - lookahead = ARGW1=FR
  5167.  
  5168.    You can check the version of HP-UX you are running by executing the
  5169. command `uname -r'.   If you are indeed running HP-UX 8.02 on a PA and
  5170. using the HP assembler then configure GCC with "hpNNN-hpux8.02".
  5171.  
  5172. 
  5173. File: @.Distr.UsingGCC,  Node: Sun Install,  Next: 3b1 Install,  Prev: PA Install,  Up: Installation
  5174.  
  5175. Installing GNU CC on the Sun
  5176. ============================
  5177.  
  5178.    On Solaris (version 2.1), do not use the linker or other tools in
  5179. `/usr/ucb' to build GNU CC.  Use `/usr/ccs/bin'.
  5180.  
  5181.    Make sure the environment variable `FLOAT_OPTION' is not set when
  5182. you compile `libgcc.a'.  If this option were set to `f68881' when
  5183. `libgcc.a' is compiled, the resulting code would demand to be linked
  5184. with a special startup file and would not link properly without special
  5185. pains.
  5186.  
  5187.    The GNU compiler does not really support the Super SPARC processor
  5188. that is used in SPARC Station 10 and similar class machines.  You can
  5189. get code that runs by specifying `sparc' as the cpu type; however, its
  5190. performance is not very good, and may vary widely according to the
  5191. compiler version and optimization options used.  This is because the
  5192. instruction scheduling parameters designed for the Sparc are not correct
  5193. for the Super SPARC.  Implementing scheduling parameters for the Super
  5194. SPARC might be a good project for someone who is willing to learn a
  5195. great deal about instruction scheduling in GNU CC.
  5196.  
  5197.    There is a bug in `alloca' in certain versions of the Sun library.
  5198. To avoid this bug, install the binaries of GNU CC that were compiled by
  5199. GNU CC.  They use `alloca' as a built-in function and never the one in
  5200. the library.
  5201.  
  5202.    Some versions of the Sun compiler crash when compiling GNU CC.  The
  5203. problem is a segmentation fault in cpp.  This problem seems to be due to
  5204. the bulk of data in the environment variables.  You may be able to avoid
  5205. it by using the following command to compile GNU CC with Sun CC:
  5206.  
  5207.      make CC="TERMCAP=x OBJS=x LIBFUNCS=x STAGESTUFF=x cc"
  5208.  
  5209. 
  5210. File: @.Distr.UsingGCC,  Node: 3b1 Install,  Next: Unos Install,  Prev: Sun Install,  Up: Installation
  5211.  
  5212. Installing GNU CC on the 3b1
  5213. ============================
  5214.  
  5215.    Installing GNU CC on the 3b1 is difficult if you do not already have
  5216. GNU CC running, due to bugs in the installed C compiler.  However, the
  5217. following procedure might work.  We are unable to test it.
  5218.  
  5219.   1. Comment out the `#include "config.h"' line on line 37 of `cccp.c'
  5220.      and do `make cpp'.  This makes a preliminary version of GNU cpp.
  5221.  
  5222.   2. Save the old `/lib/cpp' and copy the preliminary GNU cpp to that
  5223.      file name.
  5224.  
  5225.   3. Undo your change in `cccp.c', or reinstall the original version,
  5226.      and do `make cpp' again.
  5227.  
  5228.   4. Copy this final version of GNU cpp into `/lib/cpp'.
  5229.  
  5230.   5. Replace every occurrence of `obstack_free' in the file `tree.c'
  5231.      with `_obstack_free'.
  5232.  
  5233.   6. Run `make' to get the first-stage GNU CC.
  5234.  
  5235.   7. Reinstall the original version of `/lib/cpp'.
  5236.  
  5237.   8. Now you can compile GNU CC with itself and install it in the normal
  5238.      fashion.
  5239.  
  5240. 
  5241. File: @.Distr.UsingGCC,  Node: Unos Install,  Next: VMS Install,  Prev: 3b1 Install,  Up: Installation
  5242.  
  5243. Installing GNU CC on Unos
  5244. =========================
  5245.  
  5246.    Use `configure unos' for building on Unos.
  5247.  
  5248.    The Unos assembler is named `casm' instead of `as'.  For some
  5249. strange reason linking `/bin/as' to `/bin/casm' changes the behavior,
  5250. and does not work.  So, when installing GNU CC, you should install the
  5251. following script as `as' in the subdirectory where the passes of GCC
  5252. are installed:
  5253.  
  5254.      #!/bin/sh
  5255.      casm $*
  5256.  
  5257.    The default Unos library is named `libunos.a' instead of `libc.a'.
  5258. To allow GNU CC to function, either change all references to `-lc' in
  5259. `gcc.c' to `-lunos' or link `/lib/libc.a' to `/lib/libunos.a'.
  5260.  
  5261.    When compiling GNU CC with the standard compiler, to overcome bugs in
  5262. the support of `alloca', do not use `-O' when making stage 2.  Then use
  5263. the stage 2 compiler with `-O' to make the stage 3 compiler.  This
  5264. compiler will have the same characteristics as the usual stage 2
  5265. compiler on other systems.  Use it to make a stage 4 compiler and
  5266. compare that with stage 3 to verify proper compilation.
  5267.  
  5268.    (Perhaps simply defining `ALLOCA' in `x-crds' as described in the
  5269. comments there will make the above paragraph superfluous.  Please
  5270. inform us of whether this works.)
  5271.  
  5272.    Unos uses memory segmentation instead of demand paging, so you will
  5273. need a lot of memory.  5 Mb is barely enough if no other tasks are
  5274. running.  If linking `cc1' fails, try putting the object files into a
  5275. library and linking from that library.
  5276.  
  5277. 
  5278. File: @.Distr.UsingGCC,  Node: VMS Install,  Next: WE32K Install,  Prev: Unos Install,  Up: Installation
  5279.  
  5280. Installing GNU CC on VMS
  5281. ========================
  5282.  
  5283.    The VMS version of GNU CC is distributed in a backup saveset
  5284. containing both source code and precompiled binaries.
  5285.  
  5286.    To install the `gcc' command so you can use the compiler easily, in
  5287. the same manner as you use the VMS C compiler, you must install the VMS
  5288. CLD file for GNU CC as follows:
  5289.  
  5290.   1. Define the VMS logical names `GNU_CC' and `GNU_CC_INCLUDE' to
  5291.      point to the directories where the GNU CC executables
  5292.      (`gcc-cpp.exe', `gcc-cc1.exe', etc.) and the C include files are
  5293.      kept respectively.  This should be done with the commands:
  5294.  
  5295.           $ assign /system /translation=concealed -
  5296.             disk:[gcc.] gnu_cc
  5297.           $ assign /system /translation=concealed -
  5298.             disk:[gcc.include.] gnu_cc_include
  5299.  
  5300.      with the appropriate disk and directory names.  These commands can
  5301.      be placed in your system startup file so they will be executed
  5302.      whenever the machine is rebooted.  You may, if you choose, do this
  5303.      via the `GCC_INSTALL.COM' script in the `[GCC]' directory.
  5304.  
  5305.   2. Install the `GCC' command with the command line:
  5306.  
  5307.           $ set command /table=sys$common:[syslib]dcltables -
  5308.             /output=sys$common:[syslib]dcltables gnu_cc:[000000]gcc
  5309.           $ install replace sys$common:[syslib]dcltables
  5310.  
  5311.   3. To install the help file, do the following:
  5312.  
  5313.           $ library/help sys$library:helplib.hlb gcc.hlp
  5314.  
  5315.      Now you can invoke the compiler with a command like `gcc /verbose
  5316.      file.c', which is equivalent to the command `gcc -v -c file.c' in
  5317.      Unix.
  5318.  
  5319.    If you wish to use GNU C++ you must first install GNU CC, and then
  5320. perform the following steps:
  5321.  
  5322.   1. Define the VMS logical name `GNU_GXX_INCLUDE' to point to the
  5323.      directory where the preprocessor will search for the C++ header
  5324.      files.  This can be done with the command:
  5325.  
  5326.           $ assign /system /translation=concealed -
  5327.             disk:[gcc.gxx_include.] gnu_gxx_include
  5328.  
  5329.      with the appropriate disk and directory name.  If you are going to
  5330.      be using libg++, this is where the libg++ install procedure will
  5331.      install the libg++ header files.
  5332.  
  5333.   2. Obtain the file `gcc-cc1plus.exe', and place this in the same
  5334.      directory that `gcc-cc1.exe' is kept.
  5335.  
  5336.      The GNU C++ compiler can be invoked with a command like `gcc /plus
  5337.      /verbose file.cc', which is equivalent to the command `g++ -v -c
  5338.      file.cc' in Unix.
  5339.  
  5340.    We try to put corresponding binaries and sources on the VMS
  5341. distribution tape.  But sometimes the binaries will be from an older
  5342. version than the sources, because we don't always have time to update
  5343. them.  (Use the `/version' option to determine the version number of
  5344. the binaries and compare it with the source file `version.c' to tell
  5345. whether this is so.)  In this case, you should use the binaries you get
  5346. to recompile the sources.  If you must recompile, here is how:
  5347.  
  5348.   1. Execute the command procedure `vmsconfig.com' to set up the files
  5349.      `tm.h', `config.h', `aux-output.c', and `md.', and to create files
  5350.      `tconfig.h' and `hconfig.h'.  This procedure also creates several
  5351.      linker option files used by `make-cc1.com' and a data file used by
  5352.      `make-l2.com'.
  5353.  
  5354.           $ @vmsconfig.com
  5355.  
  5356.   2. Setup the logical names and command tables as defined above.  In
  5357.      addition, define the VMS logical name `GNU_BISON' to point at the
  5358.      to the directories where the Bison executable is kept.  This
  5359.      should be done with the command:
  5360.  
  5361.           $ assign /system /translation=concealed -
  5362.             disk:[bison.] gnu_bison
  5363.  
  5364.      You may, if you choose, use the `INSTALL_BISON.COM' script in the
  5365.      `[BISON]' directory.
  5366.  
  5367.   3. Install the `BISON' command with the command line:
  5368.  
  5369.           $ set command /table=sys$common:[syslib]dcltables -
  5370.             /output=sys$common:[syslib]dcltables -
  5371.             gnu_bison:[000000]bison
  5372.           $ install replace sys$common:[syslib]dcltables
  5373.  
  5374.   4. Type `@make-gcc' to recompile everything (alternatively, submit
  5375.      the file `make-gcc.com' to a batch queue).  If you wish to build
  5376.      the GNU C++ compiler as well as the GNU CC compiler, you must
  5377.      first edit `make-gcc.com' and follow the instructions that appear
  5378.      in the comments.
  5379.  
  5380.   5. In order to use GCC, you need a library of functions which GCC
  5381.      compiled code will call to perform certain tasks, and these
  5382.      functions are defined in the file `libgcc2.c'.  To compile this
  5383.      you should use the command procedure `make-l2.com', which will
  5384.      generate the library `libgcc2.olb'.  `libgcc2.olb' should be built
  5385.      using the compiler built from the same distribution that
  5386.      `libgcc2.c' came from, and `make-gcc.com' will automatically do
  5387.      all of this for you.
  5388.  
  5389.      To install the library, use the following commands:
  5390.  
  5391.           $ library gnu_cc:[000000]gcclib/delete=(new,eprintf)
  5392.           $ library gnu_cc:[000000]gcclib/delete=L_*
  5393.           $ library libgcc2/extract=*/output=libgcc2.obj
  5394.           $ library gnu_cc:[000000]gcclib libgcc2.obj
  5395.  
  5396.      The first command simply removes old modules that will be replaced
  5397.      with modules from `libgcc2' under different module names.  The
  5398.      modules `new' and `eprintf' may not actually be present in your
  5399.      `gcclib.olb'--if the VMS librarian complains about those modules
  5400.      not being present, simply ignore the message and continue on with
  5401.      the next command.  The second command removes the modules that
  5402.      came from the previous version of the library `libgcc2.c'.
  5403.  
  5404.      Whenever you update the compiler on your system, you should also
  5405.      update the library with the above procedure.
  5406.  
  5407.   6. You may wish to build GCC in such a way that no files are written
  5408.      to the directory where the source files reside.  An example would
  5409.      be the when the source files are on a read-only disk.  In these
  5410.      cases, execute the following DCL commands (substituting your
  5411.      actual path names):
  5412.  
  5413.           $ assign dua0:[gcc.build_dir.]/translation=concealed, -
  5414.                    dua1:[gcc.source_dir.]/translation=concealed  gcc_build
  5415.           $ set default gcc_build:[000000]
  5416.  
  5417.      where the directory `dua1:[gcc.source_dir]' contains the source
  5418.      code, and the directory `dua0:[gcc.build_dir]' is meant to contain
  5419.      all of the generated object files and executables.  Once you have
  5420.      done this, you can proceed building GCC as described above.  (Keep
  5421.      in mind that `gcc_build' is a rooted logical name, and thus the
  5422.      device names in each element of the search list must be an actual
  5423.      physical device name rather than another rooted logical name).
  5424.  
  5425.   7. *If you are building GNU CC with a previous version of GNU CC, you
  5426.      also should check to see that you have the newest version of the
  5427.      assembler*.  In particular, GNU CC version 2 treats global constant
  5428.      variables slightly differently from GNU CC version 1, and GAS
  5429.      version 1.38.1 does not have the patches required to work with GCC
  5430.      version 2.  If you use GAS 1.38.1, then `extern const' variables
  5431.      will not have the read-only bit set, and the linker will generate
  5432.      warning messages about mismatched psect attributes for these
  5433.      variables.  These warning messages are merely a nuisance, and can
  5434.      safely be ignored.
  5435.  
  5436.      If you are compiling with a version of GNU CC older than 1.33,
  5437.      specify `/DEFINE=("inline=")' as an option in all the
  5438.      compilations.  This requires editing all the `gcc' commands in
  5439.      `make-cc1.com'.  (The older versions had problems supporting
  5440.      `inline'.)  Once you have a working 1.33 or newer GNU CC, you can
  5441.      change this file back.
  5442.  
  5443.   8. If you want to build GNU CC with the VAX C compiler, you will need
  5444.      to make minor changes in `make-cccp.com' and `make-cc1.com' to
  5445.      choose alternate definitions of `CC', `CFLAGS', and `LIBS'.  See
  5446.      comments in those files.  However, you must also have a working
  5447.      version of the GNU assembler (GNU as, aka GAS) as it is used as
  5448.      the back-end for GNU CC to produce binary object modules and is
  5449.      not included in the GNU CC sources.  GAS is also needed to compile
  5450.      `libgcc2' in order to build `gcclib' (see above); `make-l2.com'
  5451.      expects to be able to find it operational in
  5452.      `gnu_cc:[000000]gnu-as.exe'.
  5453.  
  5454.      To use GNU CC on VMS, you need the VMS driver programs `gcc.exe',
  5455.      `gcc.com', and `gcc.cld'.  They are distributed with the VMS
  5456.      binaries (`gcc-vms') rather than the GNU CC sources.  GAS is also
  5457.      included in `gcc-vms', as is Bison.
  5458.  
  5459.      Once you have successfully built GNU CC with VAX C, you should use
  5460.      the resulting compiler to rebuild itself.  Before doing this, be
  5461.      sure to restore the `CC', `CFLAGS', and `LIBS' definitions in
  5462.      `make-cccp.com' and `make-cc1.com'.  The second generation
  5463.      compiler will be able to take advantage of many optimizations that
  5464.      must be suppressed when building with other compilers.
  5465.  
  5466.    Under previous versions of GNU CC, the generated code would
  5467. occasionally give strange results when linked with the sharable
  5468. `VAXCRTL' library.  Now this should work.
  5469.  
  5470.    Even with this version, however, GNU CC itself should not be linked
  5471. with the sharable `VAXCRTL'.  The version of `qsort' in `VAXCRTL' has a
  5472. bug (known to be present in VMS versions V4.6 through V5.5) which
  5473. causes the compiler to fail.
  5474.  
  5475.    The executables are generated by `make-cc1.com' and `make-cccp.com'
  5476. use the object library version of `VAXCRTL' in order to make use of the
  5477. `qsort' routine in `gcclib.olb'.  If you wish to link the compiler
  5478. executables with the shareable image version of `VAXCRTL', you should
  5479. edit the file `tm.h' (created by `vmsconfig.com') to define the macro
  5480. `QSORT_WORKAROUND'.
  5481.  
  5482.    `QSORT_WORKAROUND' is always defined when GNU CC is compiled with
  5483. VAX C, to avoid a problem in case `gcclib.olb' is not yet available.
  5484.  
  5485. 
  5486. File: @.Distr.UsingGCC,  Node: WE32K Install,  Next: MIPS Install,  Prev: VMS Install,  Up: Installation
  5487.  
  5488. Installing GNU CC on the WE32K
  5489. ==============================
  5490.  
  5491.    These computers are also known as the 3b2, 3b5, 3b20 and other
  5492. similar names.  (However, the 3b1 is actually a 68000; see *Note 3b1
  5493. Install::.)
  5494.  
  5495.    Don't use `-g' when compiling with the system's compiler.  The
  5496. system's linker seems to be unable to handle such a large program with
  5497. debugging information.
  5498.  
  5499.    The system's compiler runs out of capacity when compiling `stmt.c'
  5500. in GNU CC.  You can work around this by building `cpp' in GNU CC first,
  5501. then use that instead of the system's preprocessor with the system's C
  5502. compiler to compile `stmt.c'.  Here is how:
  5503.  
  5504.      mv /lib/cpp /lib/cpp.att
  5505.      cp cpp /lib/cpp.gnu
  5506.      echo '/lib/cpp.gnu -traditional ${1+"$@"}' > /lib/cpp
  5507.      chmod +x /lib/cpp
  5508.  
  5509.    The system's compiler produces bad code for some of the GNU CC
  5510. optimization files.  So you must build the stage 2 compiler without
  5511. optimization.  Then build a stage 3 compiler with optimization.  That
  5512. executable should work.  Here are the necessary commands:
  5513.  
  5514.      make LANGUAGES=c CC=stage1/xgcc CFLAGS="-Bstage1/ -g"
  5515.      make stage2
  5516.      make CC=stage2/xgcc CFLAGS="-Bstage2/ -g -O"
  5517.  
  5518.    You may need to raise the ULIMIT setting to build a C++ compiler, as
  5519. the file `cc1plus' is larger than one megabyte.
  5520.  
  5521. 
  5522. File: @.Distr.UsingGCC,  Node: MIPS Install,  Next: Collect2,  Prev: WE32K Install,  Up: Installation
  5523.  
  5524. Installing GNU CC on the MIPS
  5525. =============================
  5526.  
  5527.    See *Note Installation:: about whether to use either of the options
  5528. `--with-stabs' or `--with-gnu-as'.
  5529.  
  5530.    The MIPS C compiler needs to be told to increase its table size for
  5531. switch statements with the `-Wf,-XNg1500' option in order to compile
  5532. `cp-parse.c'.  If you use the `-O2' optimization option, you also need
  5533. to use `-Olimit 3000'.  Both of these options are automatically
  5534. generated in the `Makefile' that the shell script `configure' builds.
  5535. If you override the `CC' make variable and use the MIPS compilers, you
  5536. may need to add `-Wf,-XNg1500 -Olimit 3000'.
  5537.  
  5538.    MIPS computers running RISC-OS can support four different
  5539. personalities: default, BSD 4.3, System V.3, and System V.4 (older
  5540. versions of RISC-OS don't support V.4).  To configure GCC for these
  5541. platforms use the following configurations:
  5542.  
  5543. `mips-mips-riscos`rev''
  5544.      Default configuration for RISC-OS, revision `rev'.
  5545.  
  5546. `mips-mips-riscos`rev'bsd'
  5547.      BSD 4.3 configuration for RISC-OS, revision `rev'.
  5548.  
  5549. `mips-mips-riscos`rev'sysv4'
  5550.      System V.4 configuration for RISC-OS, revision `rev'.
  5551.  
  5552. `mips-mips-riscos`rev'sysv'
  5553.      System V.3 configuration for RISC-OS, revision `rev'.
  5554.  
  5555.    The revision `rev' mentioned above is the revision of RISC-OS to
  5556. use.  You must reconfigure GCC when going from a RISC-OS revision 4 to
  5557. RISC-OS revision 5.  This has the effect of avoiding a linker bug (see
  5558. *Note Installation Problems:: for more details).
  5559.  
  5560.    DECstations can support three different personalities: Ultrix, DEC
  5561. OSF/1, and OSF/rose.  To configure GCC for these platforms use the
  5562. following configurations:
  5563.  
  5564. `decstation-ultrix'
  5565.      Ultrix configuration.
  5566.  
  5567. `decstation-osf1'
  5568.      Dec's version of OSF/1.
  5569.  
  5570. `decstation-osfrose'
  5571.      Open Software Foundation reference port of OSF/1 which uses the
  5572.      OSF/rose object file format instead of ECOFF.  Normally, you would
  5573.      not select this configuration.
  5574.  
  5575.    On Irix version 4.0.5F, and perhaps on some other versions as well,
  5576. there is an assembler bug that reorders instructions incorrectly.  To
  5577. work around it, specify the target configuration `mips-sgi-irix4loser'.
  5578. This configuration inhibits assembler optimization.
  5579.  
  5580.    You can turn off assembler optimization in a compiler configured with
  5581. target `mips-sgi-irix4' using the `-noasmopt' option.  This compiler
  5582. option passes the option `-O0' to the assembler, to inhibit reordering.
  5583.  
  5584.    The `-noasmopt' option can be useful for testing whether a problem
  5585. is due to erroneous assembler reordering.  Even if a problem does not go
  5586. away with `-noasmopt', it may still be due to assembler
  5587. reordering--perhaps GNU CC itself was miscompiled as a result.
  5588.  
  5589.    We know this is inconvenient, but it's the best that can be done at
  5590. the last minute.
  5591.  
  5592. 
  5593. File: @.Distr.UsingGCC,  Node: Collect2,  Next: Header Dirs,  Prev: MIPS Install,  Up: Installation
  5594.  
  5595. `collect2'
  5596. ==========
  5597.  
  5598.    Many target systems do not have support in the assembler and linker
  5599. for "constructors"--initialization functions to be called before the
  5600. official "start" of `main'.  On such systems, GNU CC uses a utility
  5601. called `collect2' to arrange to call these functions at start time.
  5602.  
  5603.    The program `collect2' works by linking the program once and looking
  5604. through the linker output file for symbols with particular names
  5605. indicating they are constructor functions.  If it finds any, it creates
  5606. a new temporary `.c' file containing a table of them, compiles it, and
  5607. links the program a second time including that file.
  5608.  
  5609.    The actual calls to the constructors are carried out by a subroutine
  5610. called `__main', which is called (automatically) at the beginning of
  5611. the body of `main' (provided `main' was compiled with GNU CC).
  5612.  
  5613.    The program `collect2' is installed as `ld' in the directory where
  5614. the passes of the compiler are installed.  When `collect2' needs to
  5615. find the *real* `ld', it tries the following file names:
  5616.  
  5617.    * `gld' in the directories listed in the compiler's search
  5618.      directories.
  5619.  
  5620.    * `gld' in the directories listed in the environment variable `PATH'.
  5621.  
  5622.    * `real-ld' in the compiler's search directories.
  5623.  
  5624.    * `real-ld' in `PATH'.
  5625.  
  5626.    * `ld' in `PATH'.
  5627.  
  5628.    "The compiler's search directories" means all the directories where
  5629. `gcc' searches for passes of the compiler.  This includes directories
  5630. that you specify with `-B'.
  5631.  
  5632.    Cross-compilers search a little differently:
  5633.  
  5634.    * `gld' in the compiler's search directories.
  5635.  
  5636.    * `TARGET-gld' in `PATH'.
  5637.  
  5638.    * `real-ld' in the compiler's search directories.
  5639.  
  5640.    * `TARGET-real-ld' in `PATH'.
  5641.  
  5642.    * `TARGET-ld' in `PATH'.
  5643.  
  5644.    `collect2' does not search for `ld' using the compiler's search
  5645. directories, because if it did, it would find itself--not the real
  5646. `ld'--and this could lead to infinite recursion.  However, the
  5647. directory where `collect2' is installed might happen to be in `PATH'.
  5648. That could lead `collect2' to invoke itself anyway.  when looking for
  5649. `ld'.
  5650.  
  5651.    To prevent this, `collect2' explicitly avoids running `ld' using the
  5652. file name under which `collect2' itself was invoked.  In fact, it
  5653. remembers up to two such names--in case one copy of `collect2' finds
  5654. another copy (or version) of `collect2' installed as `ld' in a second
  5655. place in the search path.
  5656.  
  5657.    If two file names to avoid are not sufficient, you may still
  5658. encounter an infinite recursion of `collect2' processes.  When this
  5659. happens.  check all the files installed as `ld' in any of the
  5660. directories searched, and straighten out the situation.
  5661.  
  5662.    (In a future version, we will probably change `collect2' to avoid
  5663. any reinvocation of a file from which any parent `collect2' was run.)
  5664.  
  5665. 
  5666. File: @.Distr.UsingGCC,  Node: Header Dirs,  Prev: Collect2,  Up: Installation
  5667.  
  5668. Standard Header File Directories
  5669. ================================
  5670.  
  5671.    `GCC_INCLUDE_DIR' means the same thing for native and cross.  It is
  5672. where GNU CC stores its private include files, and also where GNU CC
  5673. stores the fixed include files.  A cross compiled GNU CC runs
  5674. `fixincludes' on the header files in `$(tooldir)/include'.  (If the
  5675. cross compilation header files need to be fixed, they must be installed
  5676. before GNU CC is built.  If the cross compilation header files are
  5677. already suitable for ANSI C and GNU CC, nothing special need be done).
  5678.  
  5679.    `GPLUS_INCLUDE_DIR' means the same thing for native and cross.  It
  5680. is where `g++' looks first for header files.  `libg++' installs only
  5681. target independent header files in that directory.
  5682.  
  5683.    `LOCAL_INCLUDE_DIR' is used only for a native compiler.  It is
  5684. normally `/usr/local/include'.  GNU CC searches this directory so that
  5685. users can install header files in `/usr/local/include'.
  5686.  
  5687.    `CROSS_INCLUDE_DIR' is used only for a cross compiler.  GNU CC
  5688. doesn't install anything there.
  5689.  
  5690.    `TOOL_INCLUDE_DIR' is used for both native and cross compilers.  It
  5691. is the place for other packages to install header files that GNU CC will
  5692. use.  For a cross-compiler, this is the equivalent of `/usr/include'.
  5693. When you build a cross-compiler, `fixincludes' processes any header
  5694. files in this directory.
  5695.  
  5696. 
  5697. File: @.Distr.UsingGCC,  Node: C Extensions,  Next: C++ Extensions,  Prev: Installation,  Up: Top
  5698.  
  5699. Extensions to the C Language Family
  5700. ***********************************
  5701.  
  5702.    GNU C provides several language features not found in ANSI standard
  5703. C.  (The `-pedantic' option directs GNU CC to print a warning message if
  5704. any of these features is used.)  To test for the availability of these
  5705. features in conditional compilation, check for a predefined macro
  5706. `__GNUC__', which is always defined under GNU CC.
  5707.  
  5708.    These extensions are available in C and in the languages derived from
  5709. it, C++ and Objective C.  *Note Extensions to the C++ Language: C++
  5710. Extensions, for extensions that apply *only* to C++.
  5711.  
  5712. * Menu:
  5713.  
  5714. * Statement Exprs::     Putting statements and declarations inside expressions.
  5715. * Local Labels::        Labels local to a statement-expression.
  5716. * Labels as Values::    Getting pointers to labels, and computed gotos.
  5717. * Nested Functions::    As in Algol and Pascal, lexical scoping of functions.
  5718. * Constructing Calls::    Dispatching a call to another function.
  5719. * Naming Types::        Giving a name to the type of some expression.
  5720. * Typeof::              `typeof': referring to the type of an expression.
  5721. * Lvalues::             Using `?:', `,' and casts in lvalues.
  5722. * Conditionals::        Omitting the middle operand of a `?:' expression.
  5723. * Long Long::        Double-word integers--`long long int'.
  5724. * Zero Length::         Zero-length arrays.
  5725. * Variable Length::     Arrays whose length is computed at run time.
  5726. * Macro Varargs::    Macros with variable number of arguments.
  5727. * Subscripting::        Any array can be subscripted, even if not an lvalue.
  5728. * Pointer Arith::       Arithmetic on `void'-pointers and function pointers.
  5729. * Initializers::        Non-constant initializers.
  5730. * Constructors::        Constructor expressions give structures, unions
  5731.                          or arrays as values.
  5732. * Labeled Elements::    Labeling elements of initializers.
  5733. * Cast to Union::       Casting to union type from any member of the union.
  5734. * Case Ranges::        `case 1 ... 9' and such.
  5735. * Function Attributes:: Declaring that functions have no side effects,
  5736.                          or that they can never return.
  5737. * Function Prototypes:: Prototype declarations and old-style definitions.
  5738. * Dollar Signs::        Dollar sign is allowed in identifiers.
  5739. * Character Escapes::   `\e' stands for the character ESC.
  5740. * Variable Attributes::    Specifying attributes of variables.
  5741. * Alignment::           Inquiring about the alignment of a type or variable.
  5742. * Inline::              Defining inline functions (as fast as macros).
  5743. * Extended Asm::        Assembler instructions with C expressions as operands.
  5744.                          (With them you can define "built-in" functions.)
  5745. * Constraints::         Constraints for asm operands
  5746. * Asm Labels::          Specifying the assembler name to use for a C symbol.
  5747. * Explicit Reg Vars::   Defining variables residing in specified registers.
  5748. * Alternate Keywords::  `__const__', `__asm__', etc., for header files.
  5749. * Incomplete Enums::    `enum foo;', with details to follow.
  5750. * Function Names::    Printable strings which are the name of the current
  5751.              function.
  5752.  
  5753. 
  5754. File: @.Distr.UsingGCC,  Node: Statement Exprs,  Next: Local Labels,  Up: C Extensions
  5755.  
  5756. Statements and Declarations in Expressions
  5757. ==========================================
  5758.  
  5759.    A compound statement enclosed in parentheses may appear as an
  5760. expression in GNU C.  This allows you to use loops, switches, and local
  5761. variables within an expression.
  5762.  
  5763.    Recall that a compound statement is a sequence of statements
  5764. surrounded by braces; in this construct, parentheses go around the
  5765. braces.  For example:
  5766.  
  5767.      ({ int y = foo (); int z;
  5768.         if (y > 0) z = y;
  5769.         else z = - y;
  5770.         z; })
  5771.  
  5772. is a valid (though slightly more complex than necessary) expression for
  5773. the absolute value of `foo ()'.
  5774.  
  5775.    The last thing in the compound statement should be an expression
  5776. followed by a semicolon; the value of this subexpression serves as the
  5777. value of the entire construct.  (If you use some other kind of statement
  5778. last within the braces, the construct has type `void', and thus
  5779. effectively no value.)
  5780.  
  5781.    This feature is especially useful in making macro definitions "safe"
  5782. (so that they evaluate each operand exactly once).  For example, the
  5783. "maximum" function is commonly defined as a macro in standard C as
  5784. follows:
  5785.  
  5786.      #define max(a,b) ((a) > (b) ? (a) : (b))
  5787.  
  5788. But this definition computes either A or B twice, with bad results if
  5789. the operand has side effects.  In GNU C, if you know the type of the
  5790. operands (here let's assume `int'), you can define the macro safely as
  5791. follows:
  5792.  
  5793.      #define maxint(a,b) \
  5794.        ({int _a = (a), _b = (b); _a > _b ? _a : _b; })
  5795.  
  5796.    Embedded statements are not allowed in constant expressions, such as
  5797. the value of an enumeration constant, the width of a bit field, or the
  5798. initial value of a static variable.
  5799.  
  5800.    If you don't know the type of the operand, you can still do this,
  5801. but you must use `typeof' (*note Typeof::.) or type naming (*note
  5802. Naming Types::.).
  5803.  
  5804. 
  5805. File: @.Distr.UsingGCC,  Node: Local Labels,  Next: Labels as Values,  Prev: Statement Exprs,  Up: C Extensions
  5806.  
  5807. Locally Declared Labels
  5808. =======================
  5809.  
  5810.    Each statement expression is a scope in which "local labels" can be
  5811. declared.  A local label is simply an identifier; you can jump to it
  5812. with an ordinary `goto' statement, but only from within the statement
  5813. expression it belongs to.
  5814.  
  5815.    A local label declaration looks like this:
  5816.  
  5817.      __label__ LABEL;
  5818.  
  5819. or
  5820.  
  5821.      __label__ LABEL1, LABEL2, ...;
  5822.  
  5823.    Local label declarations must come at the beginning of the statement
  5824. expression, right after the `({', before any ordinary declarations.
  5825.  
  5826.    The label declaration defines the label *name*, but does not define
  5827. the label itself.  You must do this in the usual way, with `LABEL:',
  5828. within the statements of the statement expression.
  5829.  
  5830.    The local label feature is useful because statement expressions are
  5831. often used in macros.  If the macro contains nested loops, a `goto' can
  5832. be useful for breaking out of them.  However, an ordinary label whose
  5833. scope is the whole function cannot be used: if the macro can be
  5834. expanded several times in one function, the label will be multiply
  5835. defined in that function.  A local label avoids this problem.  For
  5836. example:
  5837.  
  5838.      #define SEARCH(array, target)                     \
  5839.      ({                                               \
  5840.        __label__ found;                                \
  5841.        typeof (target) _SEARCH_target = (target);      \
  5842.        typeof (*(array)) *_SEARCH_array = (array);     \
  5843.        int i, j;                                       \
  5844.        int value;                                      \
  5845.        for (i = 0; i < max; i++)                       \
  5846.          for (j = 0; j < max; j++)                     \
  5847.            if (_SEARCH_array[i][j] == _SEARCH_target)  \
  5848.              { value = i; goto found; }              \
  5849.        value = -1;                                     \
  5850.       found:                                           \
  5851.        value;                                          \
  5852.      })
  5853.  
  5854. 
  5855. File: @.Distr.UsingGCC,  Node: Labels as Values,  Next: Nested Functions,  Prev: Local Labels,  Up: C Extensions
  5856.  
  5857. Labels as Values
  5858. ================
  5859.  
  5860.    You can get the address of a label defined in the current function
  5861. (or a containing function) with the unary operator `&&'.  The value has
  5862. type `void *'.  This value is a constant and can be used wherever a
  5863. constant of that type is valid.  For example:
  5864.  
  5865.      void *ptr;
  5866.      ...
  5867.      ptr = &&foo;
  5868.  
  5869.    To use these values, you need to be able to jump to one.  This is
  5870. done with the computed goto statement(1), `goto *EXP;'.  For example,
  5871.  
  5872.      goto *ptr;
  5873.  
  5874. Any expression of type `void *' is allowed.
  5875.  
  5876.    One way of using these constants is in initializing a static array
  5877. that will serve as a jump table:
  5878.  
  5879.      static void *array[] = { &&foo, &&bar, &&hack };
  5880.  
  5881.    Then you can select a label with indexing, like this:
  5882.  
  5883.      goto *array[i];
  5884.  
  5885. Note that this does not check whether the subscript is in bounds--array
  5886. indexing in C never does that.
  5887.  
  5888.    Such an array of label values serves a purpose much like that of the
  5889. `switch' statement.  The `switch' statement is cleaner, so use that
  5890. rather than an array unless the problem does not fit a `switch'
  5891. statement very well.
  5892.  
  5893.    Another use of label values is in an interpreter for threaded code.
  5894. The labels within the interpreter function can be stored in the
  5895. threaded code for super-fast dispatching.
  5896.  
  5897.    You can use this mechanism to jump to code in a different function.
  5898. If you do that, totally unpredictable things will happen.  The best way
  5899. to avoid this is to store the label address only in automatic variables
  5900. and never pass it as an argument.
  5901.  
  5902.    ---------- Footnotes ----------
  5903.  
  5904.    (1)  The analogous feature in Fortran is called an assigned goto,
  5905. but that name seems inappropriate in C, where one can do more than
  5906. simply store label addresses in label variables.
  5907.  
  5908. 
  5909. File: @.Distr.UsingGCC,  Node: Nested Functions,  Next: Constructing Calls,  Prev: Labels as Values,  Up: C Extensions
  5910.  
  5911. Nested Functions
  5912. ================
  5913.  
  5914.    A "nested function" is a function defined inside another function.
  5915. (Nested functions are not supported for GNU C++.)  The nested function's
  5916. name is local to the block where it is defined.  For example, here we
  5917. define a nested function named `square', and call it twice:
  5918.  
  5919.      foo (double a, double b)
  5920.      {
  5921.        double square (double z) { return z * z; }
  5922.      
  5923.        return square (a) + square (b);
  5924.      }
  5925.  
  5926.    The nested function can access all the variables of the containing
  5927. function that are visible at the point of its definition.  This is
  5928. called "lexical scoping".  For example, here we show a nested function
  5929. which uses an inherited variable named `offset':
  5930.  
  5931.      bar (int *array, int offset, int size)
  5932.      {
  5933.        int access (int *array, int index)
  5934.          { return array[index + offset]; }
  5935.        int i;
  5936.        ...
  5937.        for (i = 0; i < size; i++)
  5938.          ... access (array, i) ...
  5939.      }
  5940.  
  5941.    Nested function definitions are permitted within functions in the
  5942. places where variable definitions are allowed; that is, in any block,
  5943. before the first statement in the block.
  5944.  
  5945.    It is possible to call the nested function from outside the scope of
  5946. its name by storing its address or passing the address to another
  5947. function:
  5948.  
  5949.      hack (int *array, int size)
  5950.      {
  5951.        void store (int index, int value)
  5952.          { array[index] = value; }
  5953.      
  5954.        intermediate (store, size);
  5955.      }
  5956.  
  5957.    Here, the function `intermediate' receives the address of `store' as
  5958. an argument.  If `intermediate' calls `store', the arguments given to
  5959. `store' are used to store into `array'.  But this technique works only
  5960. so long as the containing function (`hack', in this example) does not
  5961. exit.  If you try to call the nested function through its address after
  5962. the containing function has exited, all hell will break loose.
  5963.  
  5964.    GNU CC implements taking the address of a nested function using a
  5965. technique called "trampolines".  A paper describing them is available
  5966. from `maya.idiap.ch' in directory `pub/tmb', file `usenix88-lexic.ps.Z'.
  5967.  
  5968.    A nested function can jump to a label inherited from a containing
  5969. function, provided the label was explicitly declared in the containing
  5970. function (*note Local Labels::.).  Such a jump returns instantly to the
  5971. containing function, exiting the nested function which did the `goto'
  5972. and any intermediate functions as well.  Here is an example:
  5973.  
  5974.      bar (int *array, int offset, int size)
  5975.      {
  5976.        __label__ failure;
  5977.        int access (int *array, int index)
  5978.          {
  5979.            if (index > size)
  5980.              goto failure;
  5981.            return array[index + offset];
  5982.          }
  5983.        int i;
  5984.        ...
  5985.        for (i = 0; i < size; i++)
  5986.          ... access (array, i) ...
  5987.        ...
  5988.        return 0;
  5989.      
  5990.       /* Control comes here from `access'
  5991.          if it detects an error.  */
  5992.       failure:
  5993.        return -1;
  5994.      }
  5995.  
  5996.    A nested function always has internal linkage.  Declaring one with
  5997. `extern' is erroneous.  If you need to declare the nested function
  5998. before its definition, use `auto' (which is otherwise meaningless for
  5999. function declarations).
  6000.  
  6001.      bar (int *array, int offset, int size)
  6002.      {
  6003.        __label__ failure;
  6004.        auto int access (int *, int);
  6005.        ...
  6006.        int access (int *array, int index)
  6007.          {
  6008.            if (index > size)
  6009.              goto failure;
  6010.            return array[index + offset];
  6011.          }
  6012.        ...
  6013.      }
  6014.  
  6015. 
  6016. File: @.Distr.UsingGCC,  Node: Constructing Calls,  Next: Naming Types,  Prev: Nested Functions,  Up: C Extensions
  6017.  
  6018. Constructing Function Calls
  6019. ===========================
  6020.  
  6021.    Using the built-in functions described below, you can record the
  6022. arguments a function received, and call another function with the same
  6023. arguments, without knowing the number or types of the arguments.
  6024.  
  6025.    You can also record the return value of that function call, and
  6026. later return that value, without knowing what data type the function
  6027. tried to return (as long as your caller expects that data type).
  6028.  
  6029. `__builtin_apply_args ()'
  6030.      This built-in function returns a pointer of type `void *' to data
  6031.      describing how to perform a call with the same arguments as were
  6032.      passed to the current function.
  6033.  
  6034.      The function saves the arg pointer register, structure value
  6035.      address, and all registers that might be used to pass arguments to
  6036.      a function into a block of memory allocated on the stack.  Then it
  6037.      returns the address of that block.
  6038.  
  6039. `__builtin_apply (FUNCTION, ARGUMENTS, SIZE)'
  6040.      This built-in function invokes FUNCTION (type `void (*)()') with a
  6041.      copy of the parameters described by ARGUMENTS (type `void *') and
  6042.      SIZE (type `int').
  6043.  
  6044.      The value of ARGUMENTS should be the value returned by
  6045.      `__builtin_apply_args'.  The argument SIZE specifies the size of
  6046.      the stack argument data, in bytes.
  6047.  
  6048.      This function returns a pointer of type `void *' to data describing
  6049.      how to return whatever value was returned by FUNCTION.  The data
  6050.      is saved in a block of memory allocated on the stack.
  6051.  
  6052.      It is not always simple to compute the proper value for SIZE.  The
  6053.      value is used by `__builtin_apply' to compute the amount of data
  6054.      that should be pushed on the stack and copied from the incoming
  6055.      argument area.
  6056.  
  6057. `__builtin_return (RESULT)'
  6058.      This built-in function returns the value described by RESULT from
  6059.      the containing function.  You should specify, for RESULT, a value
  6060.      returned by `__builtin_apply'.
  6061.  
  6062. 
  6063. File: @.Distr.UsingGCC,  Node: Naming Types,  Next: Typeof,  Prev: Constructing Calls,  Up: C Extensions
  6064.  
  6065. Naming an Expression's Type
  6066. ===========================
  6067.  
  6068.    You can give a name to the type of an expression using a `typedef'
  6069. declaration with an initializer.  Here is how to define NAME as a type
  6070. name for the type of EXP:
  6071.  
  6072.      typedef NAME = EXP;
  6073.  
  6074.    This is useful in conjunction with the statements-within-expressions
  6075. feature.  Here is how the two together can be used to define a safe
  6076. "maximum" macro that operates on any arithmetic type:
  6077.  
  6078.      #define max(a,b) \
  6079.        ({typedef _ta = (a), _tb = (b);  \
  6080.          _ta _a = (a); _tb _b = (b);     \
  6081.          _a > _b ? _a : _b; })
  6082.  
  6083.    The reason for using names that start with underscores for the local
  6084. variables is to avoid conflicts with variable names that occur within
  6085. the expressions that are substituted for `a' and `b'.  Eventually we
  6086. hope to design a new form of declaration syntax that allows you to
  6087. declare variables whose scopes start only after their initializers;
  6088. this will be a more reliable way to prevent such conflicts.
  6089.  
  6090. 
  6091. File: @.Distr.UsingGCC,  Node: Typeof,  Next: Lvalues,  Prev: Naming Types,  Up: C Extensions
  6092.  
  6093. Referring to a Type with `typeof'
  6094. =================================
  6095.  
  6096.    Another way to refer to the type of an expression is with `typeof'.
  6097. The syntax of using of this keyword looks like `sizeof', but the
  6098. construct acts semantically like a type name defined with `typedef'.
  6099.  
  6100.    There are two ways of writing the argument to `typeof': with an
  6101. expression or with a type.  Here is an example with an expression:
  6102.  
  6103.      typeof (x[0](1))
  6104.  
  6105. This assumes that `x' is an array of functions; the type described is
  6106. that of the values of the functions.
  6107.  
  6108.    Here is an example with a typename as the argument:
  6109.  
  6110.      typeof (int *)
  6111.  
  6112. Here the type described is that of pointers to `int'.
  6113.  
  6114.    If you are writing a header file that must work when included in
  6115. ANSI C programs, write `__typeof__' instead of `typeof'.  *Note
  6116. Alternate Keywords::.
  6117.  
  6118.    A `typeof'-construct can be used anywhere a typedef name could be
  6119. used.  For example, you can use it in a declaration, in a cast, or
  6120. inside of `sizeof' or `typeof'.
  6121.  
  6122.    * This declares `y' with the type of what `x' points to.
  6123.  
  6124.           typeof (*x) y;
  6125.  
  6126.    * This declares `y' as an array of such values.
  6127.  
  6128.           typeof (*x) y[4];
  6129.  
  6130.    * This declares `y' as an array of pointers to characters:
  6131.  
  6132.           typeof (typeof (char *)[4]) y;
  6133.  
  6134.      It is equivalent to the following traditional C declaration:
  6135.  
  6136.           char *y[4];
  6137.  
  6138.      To see the meaning of the declaration using `typeof', and why it
  6139.      might be a useful way to write, let's rewrite it with these macros:
  6140.  
  6141.           #define pointer(T)  typeof(T *)
  6142.           #define array(T, N) typeof(T [N])
  6143.  
  6144.      Now the declaration can be rewritten this way:
  6145.  
  6146.           array (pointer (char), 4) y;
  6147.  
  6148.      Thus, `array (pointer (char), 4)' is the type of arrays of 4
  6149.      pointers to `char'.
  6150.  
  6151. 
  6152. File: @.Distr.UsingGCC,  Node: Lvalues,  Next: Conditionals,  Prev: Typeof,  Up: C Extensions
  6153.  
  6154. Generalized Lvalues
  6155. ===================
  6156.  
  6157.    Compound expressions, conditional expressions and casts are allowed
  6158. as lvalues provided their operands are lvalues.  This means that you
  6159. can take their addresses or store values into them.
  6160.  
  6161.    For example, a compound expression can be assigned, provided the last
  6162. expression in the sequence is an lvalue.  These two expressions are
  6163. equivalent:
  6164.  
  6165.      (a, b) += 5
  6166.      a, (b += 5)
  6167.  
  6168.    Similarly, the address of the compound expression can be taken.
  6169. These two expressions are equivalent:
  6170.  
  6171.      &(a, b)
  6172.      a, &b
  6173.  
  6174.    A conditional expression is a valid lvalue if its type is not void
  6175. and the true and false branches are both valid lvalues.  For example,
  6176. these two expressions are equivalent:
  6177.  
  6178.      (a ? b : c) = 5
  6179.      (a ? b = 5 : (c = 5))
  6180.  
  6181.    A cast is a valid lvalue if its operand is an lvalue.  A simple
  6182. assignment whose left-hand side is a cast works by converting the
  6183. right-hand side first to the specified type, then to the type of the
  6184. inner left-hand side expression.  After this is stored, the value is
  6185. converted back to the specified type to become the value of the
  6186. assignment.  Thus, if `a' has type `char *', the following two
  6187. expressions are equivalent:
  6188.  
  6189.      (int)a = 5
  6190.      (int)(a = (char *)(int)5)
  6191.  
  6192.    An assignment-with-arithmetic operation such as `+=' applied to a
  6193. cast performs the arithmetic using the type resulting from the cast,
  6194. and then continues as in the previous case.  Therefore, these two
  6195. expressions are equivalent:
  6196.  
  6197.      (int)a += 5
  6198.      (int)(a = (char *)(int) ((int)a + 5))
  6199.  
  6200.    You cannot take the address of an lvalue cast, because the use of its
  6201. address would not work out coherently.  Suppose that `&(int)f' were
  6202. permitted, where `f' has type `float'.  Then the following statement
  6203. would try to store an integer bit-pattern where a floating point number
  6204. belongs:
  6205.  
  6206.      *&(int)f = 1;
  6207.  
  6208.    This is quite different from what `(int)f = 1' would do--that would
  6209. convert 1 to floating point and store it.  Rather than cause this
  6210. inconsistency, we think it is better to prohibit use of `&' on a cast.
  6211.  
  6212.    If you really do want an `int *' pointer with the address of `f',
  6213. you can simply write `(int *)&f'.
  6214.  
  6215. 
  6216. File: @.Distr.UsingGCC,  Node: Conditionals,  Next: Long Long,  Prev: Lvalues,  Up: C Extensions
  6217.  
  6218. Conditionals with Omitted Operands
  6219. ==================================
  6220.  
  6221.    The middle operand in a conditional expression may be omitted.  Then
  6222. if the first operand is nonzero, its value is the value of the
  6223. conditional expression.
  6224.  
  6225.    Therefore, the expression
  6226.  
  6227.      x ? : y
  6228.  
  6229. has the value of `x' if that is nonzero; otherwise, the value of `y'.
  6230.  
  6231.    This example is perfectly equivalent to
  6232.  
  6233.      x ? x : y
  6234.  
  6235. In this simple case, the ability to omit the middle operand is not
  6236. especially useful.  When it becomes useful is when the first operand
  6237. does, or may (if it is a macro argument), contain a side effect.  Then
  6238. repeating the operand in the middle would perform the side effect
  6239. twice.  Omitting the middle operand uses the value already computed
  6240. without the undesirable effects of recomputing it.
  6241.  
  6242. 
  6243. File: @.Distr.UsingGCC,  Node: Long Long,  Next: Zero Length,  Prev: Conditionals,  Up: C Extensions
  6244.  
  6245. Double-Word Integers
  6246. ====================
  6247.  
  6248.    GNU C supports data types for integers that are twice as long as
  6249. `long int'.  Simp