home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / zip / gnu / gccdocs.lzh / GCCDOCS / GCCMAN.TXT next >
Text File  |  1991-07-08  |  91KB  |  1,916 lines

  1.                                 
  2.                                 
  3.                                 
  4.                                 
  5.                       GCC for the Atari ST
  6.                                 
  7.                                 
  8.                                 
  9.             Using the GNU C Compiler on the Atari ST
  10.                                 
  11.                                 
  12.                       by Frank Ridderbusch
  13.                                 
  14.                      1.  Draft March 9, 1990
  15.                                 
  16.                                 
  17.    Copyright _1988, 1989, 1990 Free Software Foundation, Inc.
  18.                                 
  19.      Permission is granted to make and distribute verbatim copies
  20. of this  manual provided the copyright notice and this permission
  21. notice are  preserved on  all copies.   Permission  is granted to
  22. copy and  distribute modified  versions of  this manual under the
  23. conditions for  verbatim copying,  provided also that the section
  24. entitled GNU  CC General Public License is included exactly as in
  25. the original, and provided that the entire resulting derived work
  26. is distributed  under the  terms of a permission notice identical
  27. to this  one.   Permission is  granted  to  copy  and  distribute
  28. translations of  this manual  into another  language,  under  the
  29. above conditions  for modified  versions, except that the section
  30. entitled GNU CC General Public License and this permission notice
  31. may be  included in  translations approved  by the  Free Software
  32. Foundation instead of in the original English.
  33.      
  34.                          PUBLIC LICENSE
  35.                                 
  36.      The license  agreements of  most software companies keep you
  37. at the mercy of those companies.  By contrast, our general public
  38. license is  intended to  give everyone the right to share GNU CC.
  39. To make sure that you get the rights we want you to have, we need
  40. to make  restrictions that forbid anyone to deny you these rights
  41. or to  ask you  to surrender  the rights.    Hence  this  license
  42. agreement.   Specifically, we want to make sure that you have the
  43. right to give away copies of GNU CC, that you receive source code
  44. or else  can get it if you want it, that you can change GNU CC or
  45. use pieces  of it in new free programs, and that you know you can
  46. do these  things.  To make sure that everyone has such rights, we
  47. have to  forbid you  to deprive anyone else of these rights.  For
  48. example, if  you distribute  copies of  GNU CC, you must give the
  49. recipients all the rights that you have.  You must make sure that
  50. they, too, receive or can get the source code.  And you must tell
  51. them their rights.
  52.      
  53.      Also, for  our own  protection, we  must make  certain  that
  54. everyone finds  out that there is no warranty for GNU CC.  If GNU
  55. CC is  modified by  someone else  and  passed  on,  we  want  its
  56. recipients  to   know  that   what  they  have  is  not  what  we
  57. distributed, so  that any  problems introduced by others will not
  58. reflect on our reputation.
  59.      
  60.      Therefore  we   (Richard  Stallman  and  the  Free  Software
  61. Foundation, Inc.)  make the  following terms  which say  what you
  62. must do to be allowed to distribute or change GNU CC.
  63.      
  64.                         COPYING POLICIES
  65.                                 
  66. 1.   You may copy and distribute verbatim copies of GNU CC source
  67.      code as you receive it, in any medium, provided that you
  68.      conspicuously and appropriately publish on each copy a valid
  69.      copyright notice Copyright _1988 Free Software Foundation,
  70.      Inc.  (or with whatever year  is appropriate); keep intact
  71.      the notices on all files that refer to this License
  72.      Agreement and to the absence of any warranty; and give any
  73.      other recipients of the GNU CC program a copy of this
  74.      License Agreement along with the program.  You may charge a
  75.      distribution fee for the physical act of transferring a
  76.      copy.
  77.  
  78. 2.   You may modify your copy or copies of GNU CC or any portion
  79.      of it, and copy and distribute such modifications under the
  80.      terms of Paragraph 1 above, provided that you also do the
  81.      following:
  82.  
  83.      1.   cause the modified files to carry prominent notices
  84.           stating that you changed the files and the date of any
  85.           change; and
  86.      
  87.      2.   cause the whole of any work that you distribute or
  88.           publish, that in whole or in part contains or is a
  89.           derivative of GNU CC or any part thereof, to be
  90.           licensed at no charge to all third parties on terms
  91.           identical to those contained in this License Agreement
  92.           (except that you may choose to grant more extensive
  93.           warranty protection to some or all third parties, at
  94.           your option).
  95.      
  96.      3.   You may charge a distribution fee for the physical act
  97.           of transferring a copy, and you may at your option
  98.           offer warranty protection in exchange for a fee.  Mere
  99.           aggregation of another unrelated program with this
  100.           program (or its derivative) on a volume of a storage or
  101.           distribution medium does not bring the other program
  102.           under the scope of these terms.
  103.      
  104. 3.   You may copy and distribute GNU CC (or a portion or
  105.      derivative of it, under Paragraph 2)  in object code or
  106.      executable form under the terms of Paragraphs 1 and 2 above
  107.      provided that  you also do one of the following:
  108.  
  109.      1.   accompany it with the complete corresponding machine-
  110.           readable source code, which must be distributed under
  111.           the terms of Paragraphs 1 and 2 above; or,
  112.      
  113.      2.   accompany it with a written offer, valid for at least
  114.           three years, to give any third party free (except for a
  115.           nominal shipping charge) a complete machine-readable
  116.           copy of the corresponding source code, to be
  117.           distributed under the terms of Paragraphs 1 and 2
  118.           above; or,
  119.      
  120.      3.   accompany it with the information you received as to
  121.           where the corresponding source code may be obtained.
  122.           (This alternative is allowed only for noncommercial
  123.           distribution and only if you received the program in
  124.           object code or executable form alone.)  For an
  125.           executable file, complete source code means all the
  126.           source code for all modules it contains; but, as a
  127.           special exception, it need not include source code for
  128.           modules which are standard libraries that accompany the
  129.           operating system on which the executable file runs.
  130.      
  131. 4.   You may not copy, sublicense, distribute or transfer GNU CC
  132.      except as expressly provided under this License Agreement.
  133.      Any attempt otherwise to copy, sublicense, distribute or
  134.      transfer GNU CC is void and your rights to use the program
  135.      under this License agreement shall be automatically
  136.      terminated.  However, parties who have received computer
  137.      software programs from you with this License Agreement will
  138.      not have their licenses terminated so long as such parties
  139.      remain in full compliance.
  140.  
  141. 5.   If you wish to incorporate parts of GNU CC into other free
  142.      programs whose distribution conditions are different, write
  143.      to the Free Software Foundation at 675 Mass Ave, Cambridge,
  144.      MA 02139.  We have not yet worked out a simple rule that can
  145.      be stated here, but we will often permit this.  We will be
  146.      guided by the two goals of preserving the free status of all
  147.      derivatives of our free software and of promoting the
  148.      sharing and reuse of software.
  149.  
  150.      Your comments  and suggestions  about our licensing policies
  151. and our  software are  welcome!  Please contact the Free Software
  152. Foundation, Inc.,  675 Mass  Ave, Cambridge,  MA 02139,  or  call
  153. (617) 876-3296.
  154.      
  155.                            NO WARRANTY
  156.                                 
  157.      BECAUSE GNU  CC IS  LICENSED  FREE  OF  CHARGE,  WE  PROVIDE
  158. ABSOLUTELY NO  WARRANTY, TO  THE EXTENT  PERMITTED BY  APPLICABLE
  159. STATE LAW.    EXCEPT  WHEN  OTHERWISE  STATED  IN  WRITING,  FREE
  160. SOFTWARE FOUNDATION,  INC, RICHARD  M.    STALLMAN  AND/OR  OTHER
  161. PARTIES PROVIDE  GNU CC  "AS IS"  WITHOUT WARRANTY  OF ANY  KIND,
  162. EITHER EXPRESSED  OR IMPLIED,  INCLUDING, BUT NOT LIMITED TO, THE
  163. IMPLIED  WARRANTIES   OF  MERCHANTABILITY   AND  FITNESS   FOR  A
  164. PARTICULAR PURPOSE.   THE  ENTIRE RISK  AS  TO  THE  QUALITY  AND
  165. PERFORMANCE OF  GNU  CC  IS  WITH  YOU.    SHOULD  GNU  CC  PROVE
  166. DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR
  167. OR CORRECTION.
  168.      
  169.      IN NO  EVENT UNLESS  REQUIRED BY APPLICABLE LAW WILL RICHARD
  170. M.   STALLMAN, THE  FREE SOFTWARE  FOUNDATION, INC.,  AND/OR  ANY
  171. OTHER PARTY  WHO MAY  MODIFY AND REDISTRIBUTE GNU CC AS PERMITTED
  172. ABOVE, BE  LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS,
  173. LOST  MONIES,  OR  OTHER  SPECIAL,  INCIDENTAL  OR  CONSEQUENTIAL
  174. DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE (INCLUDING BUT
  175. NOT LIMITED  TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
  176. LOSSES SUSTAINED  BY THIRD PARTIES OR A FAILURE OF THE PROGRAM TO
  177. OPERATE WITH  ANY OTHER  PROGRAMS) GNU  CC, EVEN IF YOU HAVE BEEN
  178. ADVISED OF  THE POSSIBILITY  OF SUCH DAMAGES, OR FOR ANY CLAIM BY
  179. ANY OTHER PARTY.
  180.      
  181.                      Contributors to GNU CC
  182.                                 
  183.      In addition to Richard Stallman, several people have written
  184. parts of GNU CC.
  185.      
  186.      The idea  of using  RTL and  some of  the optimization ideas
  187. came from  the U.  of Arizona Portable Optimizer, written by Jack
  188. Davidson and  Christopher Fraser.   See  "Register Allocation and
  189. Exhaustive  Peephole   Optimization",   Software   Practice   and
  190. Experience 14 (9), Sept.  1984, 857-866.
  191.      
  192.      Paul Rubin wrote most of the preprocessor.
  193.      
  194.      Leonard Tower  wrote parts of the parser, RTL generator, RTL
  195. definitions, and of the Vax machine description.
  196.      
  197.      Ted Lemon wrote parts of the RTL reader and printer.
  198.      
  199.      Jim Wilson  implemented loop  strength  reduction  and  some
  200. other loop optimizations.
  201.      
  202.      Nobuyuki Hikichi  of Software  Research  Associates,  Tokyo,
  203. contributed the support for the SONY NEWS machine.
  204.      
  205.      Charles LaBrec  contributed the  support for  the Integrated
  206. Solutions 68020 system.
  207.      
  208.      Michael Tiemann  of MCC wrote most of the description of the
  209. National Semiconductor  32000 series cpu.  He also wrote the code
  210. for inline  function  integration  and  for  the  SPARC  cpu  and
  211. Motorola 88000 cpu and part of the Sun FPA support.
  212.      
  213.      Jan Stein  of the Chalmers Computer Society provided support
  214. for Genix, as well as part of the 32000 machine description.
  215.      
  216.      Randy Smith finished the Sun FPA support.
  217.      
  218.      Robert  Brown  implemented  the  support  for  Encore  32000
  219. systems.
  220.      
  221.      David Kashtan  of SRI  adapted GNU  CC to  the  Vomit-Making
  222. System.
  223.      
  224.      Alex Crain provided changes for the 3b1.
  225.      
  226.      Greg Satz and Chris Hanson assisted in making GNU CC work on
  227. HP-UX for the 9000 series 300.
  228.      
  229.      William Schelter  did most  of the  work on  the Intel 80386
  230. support.
  231.      
  232.      Christopher Smith did the port for Convex machines.
  233.      
  234.      Paul Petersen  wrote the machine description for the Alliant
  235. FX/8.
  236.      
  237.      The following  people contributed  specially to  the version
  238. for the Atari ST.
  239.      
  240.      John R. Dunning did the original port to the Atari ST.
  241.      
  242.      Jwahar R.  Bammi improved  the port.   Jwahar Bammi and Eric
  243. Smith put together and maintain the current libraries.  The Atari
  244. ST port  has greatly  benefited from  contributions and  ideas of
  245. Edgar Roeder,  Dale Schumacher,  Kai-Uwe Bloem, Allan Pratt, John
  246. Dunning, Henry  Spencer and  many enthusiastic users in the Atari
  247. community.
  248.      
  249.      Frank Ridderbusch compiled the manual for the Atari ST.
  250.      
  251.                           Introduction
  252.                                 
  253.      This manual  documents how  to install  and run  the  GNU  C
  254. compiler on  the Atari ST.  It does not give an introduction in C
  255. or M68000  assembler.   There is enough material on both subjects
  256. available.   The user who is familiar with a C compiler that runs
  257. on a  U**x system  should have  no trouble  at all  getting GNU C
  258. running on  the Atari ST.  This manual was compiled from existing
  259. GNU manuals  and various bits and pieces from John R. Dunning and
  260. Jwahar R. Bammi.
  261.      
  262.      The sections  that describe  the  compiler  driver  and  the
  263. preprocessor are  nearly  verbatim  copies  of  sections  in  the
  264. respective manuals.   The original manuals (Using and Porting GNU
  265. CC and The C Preprocessor), were written by Richard M. Stallmann.
  266. I modified  these sections  by removing  material which described
  267. features of  GNU C  for systems like Vaxen or Suns.  To keep this
  268. manual resonably  compact, I  extracted only  the sections, which
  269. describe the  supported command options (and predefined macros in
  270. case of  the preprocessor).   If  the user  is interested  in the
  271. extensions and  details which are implemented in GNU C, he has to
  272. refer to the original manuals.  Whether all described options are
  273. usefull on the Atari has yet to be decided.
  274.      
  275.      The facts  which are  presented in the assembler and utility
  276. sections are  mostly derived  from the  sources of  the repective
  277. programs (from a cross compiler kit by J. R. Bammi based on GNU C
  278. 1.31), which  were available to me.  Other facts were gathered by
  279. trial and error, so these sections may be a bit shaky.
  280.      
  281.      Please send  any comments,  corrections, etc  concering this
  282. manual to:
  283.      
  284. Snail:         Frank Ridderbusch
  285.           Sander Str. 17
  286.           4790 Paderborn, West Germany
  287.  
  288. Email:    BIX: fridder
  289.  
  290. UUCP:     !USA ...!unido!nixpbe!ridderbusch.pad
  291.           !USA:...!uunet!philabs!linus!nixbur!ridderbusch.pad
  292.  
  293.                        1.  Installing GCC
  294.                                 
  295.      The  compressed   archive  of  the  GNU  C  compiler  binary
  296. distribution contains the common executables of the GNU compiler.
  297. That means  the compiler driver (gcc.ttp), the preprocessor (gcc-
  298. cpp.ttp), the main body (gcc-cc1.ttp), the assembler (gcc-as.ttp)
  299. and the  linker (gcc-ld.ttp).   It  also contains  the  following
  300. support programs:
  301.      1.   gcc-ar.ttp is the object library maintainer.
  302.      2.   gdb.ttp is the GNU debugger modified for the Atari ST.
  303.           John Dunning did the port to the Atari.
  304.      3.   sym-ld.ttp creates the symbol file needed with gdb.
  305.      4.   gcc-nm.ttp prints the symbols of a GNU archive or
  306.           object file.
  307.      5.   cnm.ttp prints the symbol table of a GEMDOS executable.
  308.      6.   fixstk.ttp & printstk.ttp are used to modify and print
  309.           the current stack size of an executable.
  310.      7.   toglclr.ttp allows TOS 1.4 users to toggle the clear
  311.           above BSS to end of TPA flag for the GEMDOS loader.
  312.      8.   gnu.g is a sample file for the GULAM PD shell.
  313.      9.   COPYING explains your rights and responsibilities as a
  314.           GNU user.
  315.      10.  readme & readme.st are notes from Jwahar R.  Bammi and
  316.           John R. Dunning.
  317.      
  318.      All the  executables should go in \gnu\bin on your gnu disk,
  319. or wherever  the environment variable GCCEXEC will point at.  The
  320. executables assume  that you're  running an approprate shell, one
  321. that will  pass command  line arguements  using either  the  Mark
  322. Williams or  Atari conventions.   Gulam  and Master  are two such
  323. shells, Gemini  a german  alternate shareware desktop also works.
  324. Other CLI's may also work.  The compiler driver gcc.ttp should be
  325. in the  search PATH  of your  shell.   The next step is to define
  326. GCCEXEC.   gcc.ttp uses this variable to locate the preprocessor,
  327. compiler,  assembler   and  the   linker.    GCCEXEC  contains  a
  328. device\dir\partial-pathname.     Assuming  you   also   put   the
  329. executables in  the directory  c:\gnu\bin, GCCEXEC  would contain
  330. c:\gnu\bin\gcc-.   The value  is the same as you would specify in
  331. the -B option to the compiler driver.
  332.      
  333.      Then you  should define  a variable  called  TEMP.    During
  334. compilation the  ouput of  the various  stages is kept here.  The
  335. variable must  not contain  a trailing  backslash.   If you  have
  336. enough memory, TEMP should point to a ramdisk.
  337.      
  338.      The next  thing to  do is  to install  the libraries.    The
  339. distributed archive should contain the following libraries:
  340.      
  341.      1.   README the obvious.
  342.      2.   crt0.o is the startup module.
  343.      3.   gcrt0.o is the startup module for profiling runs.
  344.           Automatically selected by the compiler driver when you
  345.           specify the -pg option.
  346.      4.   gnu.olb & gnu16.olb are the standard libraries, the
  347.           usual libc on other systems.
  348.      5.   curses.olb & curses16.olb are ports of the BSD curses.
  349.      6.   gem.olb & gem16.olb contain the Atari ST Aes/Vdi
  350.           bindings.
  351.      7.   iio.olb & iio16.olb contain the integer only printf and
  352.           scanf functions.
  353.      8.   pml.olb & pml16.olb are the portable math libraries.
  354.      9.   widget.olb & widget16.olb are a small widget set based
  355.           on curses
  356.      
  357.      All these  libraries go into a subdirectory described by the
  358. environment variable  GNULIB.    Again  this  variable  must  not
  359. contain a  trailing backslash.   Staying  with the above example,
  360. I've set the variable to c:\gnu\lib.  The libraries, which have a
  361. 16 in  their names  were compiled  with the -mshort option.  This
  362. makes integers the same size as shorts.
  363.      
  364.      The last  bit to  install are  the header  files.   They are
  365. contained in an archive of their own.  The preprocessor now knows
  366. about the  variable GNUINC.   Earlier  version had  to use  the -
  367. Iprefix option,  to get  to the  header files.   According to the
  368. above  examples,   the  files  would  be  put  in  the  directory
  369. c:\gnu\include.  GNUINC has to be set accordingly.
  370.      
  371.      With earlier  versions of  GNU CC it was only allowed to put
  372. one path  into the  variables GNULIB and GNUINC.  GCC 1.37 allows
  373. you  to  put  several  paths  into  these  variables,  which  are
  374. separated by  either a "," or a ";".  All the mentioned paths are
  375. searched in order to locate a specific file.  However the startup
  376. modules crt0.o  or gcrt0.o  are only  looked  for  in  the  first
  377. directory specified  in GNULIB.  If the preprocessor can't find a
  378. include file  in one  of the  directories specified by GNUINC, it
  379. will also search the paths listed in GNULIB.
  380.      
  381.      The programs  which come  with  the  GCC  distribution  also
  382. understand filenames  which use the slash (/) as a separator.  If
  383. Gulam is  your favorite  CLI you  will stick  to the backslashes,
  384. since  you   otherwise  lose   the  feature   of   command   line
  385. completition.
  386.      
  387.      If you  are using Gulam, you can define aliases to reach the
  388. executables under more common names:
  389.      
  390.      alias cc c:\gnu\bin\gcc.ttp
  391.      alias ar c:\gnu\bin\gcc-ar.ttp
  392.      alias as c:\gnu\bin\gcc-as.ttp
  393.      
  394.      Now you  should be  able to  say cc foo.c -o foo.ttp and the
  395. obvious thing  should happen.  If you still have trouble, compare
  396. your settings  with the  ones from the sample file gulam.g.  That
  397. should give you the right idea.
  398.      
  399.      One additional note to Gulam.  crt0.o is currently set up to
  400. understand the  MWC convention  of  passing  long  command  lines
  401. (execpt it  doesn't look  into the _io_vector part).  Gulam users
  402. should set  env_style mw,  if you want to give long command lines
  403. to gcc.ttp.
  404.      
  405.                        Memory Requirements
  406.                                 
  407.      GCC loves  memory.   A lot.   It  loves to build structures.
  408. Lots of  them.  All versions of GCC run in 1 MB of memory, but to
  409. get compile  any real programs at least 2 MB are recommended.  In
  410. versions before 1.37 the gcc-cc1.ttp had 1/2 meg stack, and needs
  411. it  for  compiling  large  files  with  optimization  turned  on.
  412. Happily, it  doesn't need  all that  stack for  smaller files, or
  413. even big files without the -O option, so it should be feasible to
  414. make a compiler with a smaller stack (with fixstk.ttp).
  415.      
  416.      GCC version  1.37 uses another scheme for memory allocation.
  417. The  programs   gcc-cpp.ttp  and   gcc-cc1.ttp  are   setup   for
  418. _stksize==1L.   This means,  that  an  executable  will  use  all
  419. available memory, doing mallocs from an internal heap (as opposed
  420. to the system heap via Malloc), with SP initially set at the top,
  421. and the  heap starting  just above  the BSS.   So if the compiler
  422. runs out  of memory, you probably need more memory (or get rid of
  423. accessories, tsr's etc and try).
  424.      
  425.                2.  Controlling the Compiler Driver
  426.                                 
  427.      The GNU  C compiler uses a command syntax much like the U**x
  428. C compiler.   The  gcc.ttp program accepts options and file names
  429. as operands.   Multiple single-letter options may not be grouped:
  430. -dr is very different from -d -r.
  431.      
  432.      When you  invoke GNU  CC, it  normally  does  preprocessing,
  433. compilation, assembly  and linking.   File  names which end in .c
  434. are taken as C source to be preprocessed and compiled; file names
  435. ending in  .i are  taken as  preprocessor output  to be compiled;
  436. compiler output  files plus  any input files with names ending in
  437. .s are assembled; then the resulting object files, plus any other
  438. input files, are linked together to produce an executable.
  439.      
  440.      Command options  allow  you  to  stop  this  process  at  an
  441. intermediate stage.
  442.      
  443.      For example, the -c option says not to run the linker.  Then
  444. the output consists of object files output by the assembler.
  445.      
  446.      Other  command  options  are  passed  on  to  one  stage  of
  447. processing.  Some options control the preprocessor and others the
  448. compiler itself.   Yet  other options  control the  assembler and
  449. linker; these are not documented here, but you rarely need to use
  450. any of them.
  451.      
  452.      Here are  the options  to control  the  overall  compilation
  453. process, including  those that  say whether  to link,  whether to
  454. assemble, and so on.
  455.      
  456. -o file   Place output in file file.  This applies regardless to
  457.      whatever sort of output is being produced, whether it be an
  458.      executable file, an object file, an assembler file or
  459.      preprocessed C code.  If -o is not specified, the default is
  460.      to put an executable file in a.out, the object file source.c
  461.      in source.o, an assembler file in source.s, and preprocessed
  462.      C on standard output.
  463.  
  464. -c   Compile or assemble the source files, but do not link.
  465.      Produce object files with names made by replacing .c or .s
  466.      with .o at the end of the input file names.  Do nothing at
  467.      all for object files specified as input.
  468.  
  469. -S   Compile into assembler code but do not assemble.  The
  470.      assembler output file name is made by replacing .c with .s
  471.      at the end of the input file name.  Do nothing at all for
  472.      assembler source files or object files specified as input.
  473.  
  474. -E   Run only the C preprocessor.  Preprocess all the C source
  475.      files specified and output theresults to standard output.
  476.  
  477. -v   Compiler driver program prints the commands it executes as
  478.      it runs the preprocessor, compiler proper, assembler and
  479.      linker.  Some of these are directed to print their own
  480.      version numbers.
  481.  
  482. -s   The executable is stripped from the DRI compatible symbol
  483.      table.  Certain symbolic debuggers like sid.prg work with
  484.      this symbol table.  Also the programs printstk.ttp and
  485.      fixstk.ttp (See see chapter 5 [The Utilities], page 36, for
  486.      more info) lookup the symbol _stksize in this table.
  487.  
  488. -Bprefix  Compiler driver program tries prefix as a prefix for
  489.           each program it tries to run.  These programs are gcc-
  490.           cpp.ttp, gcc-cc1.ttp, gcc-as.ttp and gcc-ld.ttp.  For
  491.           each subprogram to be run, the compiler driver first
  492.           tries the -B prefix, if any.  If that name is not
  493.           found, or if -B was not specified, the driver tries two
  494.           standard prefixes, which are /usr/lib/gcc- and
  495.           /usr/local/lib/gcc-.  If neither of those results in a
  496.           file name that is found, the unmodified program name is
  497.           searched for using the directories specified in your
  498.           PATH environment variable.  The run-time support file
  499.           gnu.olb is also searched for using the -B prefix, if
  500.           needed.  If it is not found there, the two standard
  501.           prefixes above are tried, and that is all.  The file is
  502.           left out of the link if it is not found by those means.
  503.           Most of the time, on most machines, you can do without
  504.           it.  You can get a similar result from the environment
  505.           variable GCCEXEC.  If it is defined, its value is used
  506.           as a prefix in the same way.  If both the "-B" option
  507.           and the GCCEXEC variable are present, the -B option is
  508.           used first and the environment variable value second.
  509.  
  510.      These options control the details of C compilation itself.
  511.      
  512. -ansi     Support all ANSI standard C programs.  This turns off
  513.      certain features of GNU C that are incompatible with ANSI C,
  514.      such as the asm, inline and typeof keywords, and predefined
  515.      macros such as unix and vax that identify the type of system
  516.      you are using.  It also enables the undesirable and rarely
  517.      used ANSI trigraph feature.  The -ansi option does not cause
  518.      non-ANSI programs to be rejected gratuitously.  For that, -
  519.      pedantic is required in addition to -ansi.  The macro
  520.      __STRICT_ANSI__ is predefined when the -ansi option is used.
  521.      Some header files may notice this macro and refrain from
  522.      declaring certain functions or defining certain macros that
  523.      the ANSI standard doesn't call for; this is to avoid
  524.      interfering with any programs that might use these names for
  525.      other things.
  526.  
  527. -traditional   Attempt to support some aspects of traditional C
  528.           compilers.  Specifically:
  529.  
  530.           1.   All extern declarations take effect globally even
  531.                if they are written inside of a function
  532.                definition.  This includes implicit declarations
  533.                of functions.
  534.           
  535.           2.   The keywords typeof, inline, signed, const and
  536.                volatile are not recognized.
  537.           
  538.           3.   Comparisons between pointers and integers are
  539.                always allowed.
  540.           
  541.           4.   Integer types unsigned short and unsigned char
  542.                promote to unsigned int.
  543.           
  544.           5.   Out-of-range floating point literals are not an
  545.                error.
  546.           
  547.           6.   All automatic variables not declared register are
  548.                preserved by longjmp.  Ordinarily, GNU C follows
  549.                ANSI C: automatic variables not declared volatile
  550.                may be clobbered.
  551.           
  552.           7.   In the preprocessor, comments convert to nothing
  553.                at all, rather than to a space.  This allows
  554.                traditional token concatenation.
  555.           
  556.           8.   In the preprocessor, macro arguments are
  557.                recognized within string constants in a macro
  558.                definition (and their values are stringified,
  559.                though without additional quote marks, when they
  560.                appear in such a context).  The preprocessor
  561.                always considers a string constant to end at a
  562.                newline.
  563.           
  564.           9.   The predefined macro __STDC__ is not defined when
  565.                you use -traditional, but __GNUC__ is (since the
  566.                GNU extensions which __GNUC__ indicates are not
  567.                affected by -traditional).  If you need to write
  568.                header files that work differently depending on
  569.                whether -traditional is in use, by testing both of
  570.                these predefined macros you can distinguish four
  571.                situations: GNU C, traditional GNU C, other ANSI C
  572.                compilers, and other old C compilers.
  573.           
  574. -O   Optimize.  Optimizing compilation takes somewhat more time,
  575.      and a lot more memory for a large function.  Without -O, the
  576.      compiler's goal is to reduce the cost of compilation and to
  577.      make debugging produce the expected results.  Statements are
  578.      independent:  if you stop the program with a breakpoint
  579.      between statements, you can then assign a new value to any
  580.      variable or change the program counter to any other
  581.      statement in the function and get exactly the results you
  582.      would expect from the source code.  Without -O, only
  583.      variables declared register are allocated in registers.  The
  584.      resulting compiled code is a little worse than produced by
  585.      PCC without -O.  With -O, the compiler tries to reduce code
  586.      size and execution time.  Some of the -f options described
  587.      below turn specific kinds of optimization on or off.
  588.  
  589. -g   Produce debugging information in the operating system's
  590.      native format (for DBX or SDB).  GDB also can work with this
  591.      debugging information.  Unlike most other C compilers, GNU
  592.      CC allows you to use -g with -O.  The shortcuts taken by
  593.      optimized code may occasionally produce surprising results:
  594.      some variables you declared may not exist at all; flow of
  595.      control may briefly move where you did not expect it; some
  596.      statements may not be executed because they compute constant
  597.      results or their values were already at hand; some
  598.      statements may execute in different places because they were
  599.      moved out of loops.  Nevertheless it proves possible to
  600.      debug optimized output.  This makes it reasonable to use the
  601.      optimizer for programs that  might have bugs.
  602.  
  603. -gg  Produce debugging information in GDB's own format.  This
  604.      requires the GNU assembler and linker in order to work.
  605.  
  606. -w   Inhibit all warning messages.
  607.  
  608. -W   Print extra warning messages for these events:
  609.      An automatic variable is used without first being
  610.      initialized.  These warnings are possible only in optimizing
  611.      compilation, because they require data flow information that
  612.      is computed only when optimizing.  They occur only for
  613.      variables that are candidates for register allocation.
  614.      Therefore, they do not occur for a variable that is declared
  615.      volatile, or whose address is taken, or whose size is other
  616.      than 1, 2, 4 or 8 bytes.  Also, they do not occur for
  617.      structures, unions or arrays, even when they are in
  618.      registers.  Note that there may be no warning about a
  619.      variable that is used only to compute a value that itself is
  620.      never used, because such computations may be deleted by the
  621.      flow analysis pass before the warnings are printed.  These
  622.      warnings are made optional because GNU CC is not smart
  623.      enough to see all the reasons why the code might be correct
  624.      despite appearing to have an error.  Here is one example of
  625.      how this can happen:
  626.           int x;
  627.           switch (y)
  628.                case 1: x = 1;
  629.           break;
  630.                case 2: x = 4;
  631.           break;
  632.                case 3: x = 5;
  633.           "
  634.           foo (x);
  635.           "
  636.      If the value of y is always 1, 2 or 3, then x is always
  637.      initialized, but GNU CC doesn't know this.  Here is another
  638.      common case:
  639.           int save_y;
  640.           if (change_y) save_y = y, y = new_y;
  641.           "
  642.           if (change_y) y = save_y;
  643.           "
  644.      This has not a bug because save_y is used only if it is set.
  645.      Some spurious warnings can be avoided if you declare as
  646.      volatile all the functions you use that never return.  A
  647.      nonvolatile automatic variable might be changed by a call to
  648.      longjmp.  These warnings as well are possible only in
  649.      optimizing compilation.  The compiler sees only the calls to
  650.      setjmp.  It cannot know where longjmp will be called; in
  651.      fact, a signal handler could call it at any point in the
  652.      code.  As a result, you may get a warning even when there is
  653.      in fact no problem because longjmp cannot in fact be called
  654.      at the place which would cause a problem.
  655.      A function can return either with or without a value.
  656.      (Falling off the end of the function body is considered
  657.      returning without a value.)  For example, this function
  658.      would inspire such a warning:
  659.           foo (a)
  660.           if (a > 0)
  661.           return a;
  662.      Spurious warnings can occur because GNU CC does not realize
  663.      that certain functions (including abort and longjmp) will
  664.      never return.  An expression-statement contains no side
  665.      effects.  In the future, other useful warnings may also be
  666.      enabled by this option.
  667.      
  668. -Wimplicit     Warn whenever a function is implicitly declared.
  669.  
  670. -Wreturn-type  Warn whenever a function is defined with a return-
  671.           type that defaults to int.  Also warn about any return
  672.           statement with no return-value in a function whose
  673.           return-type is not void.
  674.  
  675. -Wunused  Warn whenever a local variable is unused aside from its
  676.           declaration, and whenever a function is declared static
  677.           but never defined.
  678.  
  679. -Wcomment Warn whenever a comment-start sequence /* appears in a
  680.           comment.
  681.  
  682. -Wall     All of the above -W options combined.
  683.  
  684. -Wwrite-strings     Give string constants the type const
  685.                char[length] so that copying the address of one
  686.                into a non-const char * pointer will get a
  687.                warning.  These warnings will help you find at
  688.                compile time code that can try to write into a
  689.                string constant, but only if you have been very
  690.                careful about using const in declarations and
  691.                prototypes.  Otherwise, it will just be a
  692.                nuisance; this is why we did not make -Wall
  693.                request these warnings.
  694.  
  695. -p   Generate extra code to write profile information suitable
  696.      for the analysis program prof.
  697.  
  698. -pg  Generate extra code to write profile information suitable
  699.      for the analysis program gprof.
  700.  
  701. -llibrary Search a standard list of directories for a library
  702.           named library, which is actually a file named
  703.           $GNULIB\library.olb.  The linker uses this file as if
  704.           it had been specified precisely by name.  The
  705.           directories searched include several standard system
  706.           directories plus any that you specify with -L.
  707.           Normally the files found this way are library files and
  708.           archive files whose members are object files.  The
  709.           linker handles an archive file by scanning through it
  710.           for members which define symbols that have so far been
  711.           referenced but not defined.  But if the file that is
  712.           found is an ordinary object file, it is linked in the
  713.           usual fashion.  The only difference between using an -l
  714.           option and specifying a file name is that -l searches
  715.           several directories.
  716.  
  717. -Ldir     Add directory dir to the list of directories to be
  718.      searched for -l.
  719.  
  720. -nostdlib Don't use the standard system libraries and startup
  721.           files when linking.  Only the files you specify (plus
  722.           gnulib) will be passed to the linker.
  723.  
  724. -mmachinespec  Machine-dependent option specifying something
  725.                about the type of target machine.  These options
  726.                are defined by the macro TARGET_SWITCHES in the
  727.                machine description.  The default for the options
  728.                is also defined by that macro, which enables you
  729.                to change the defaults.  These are the -m options
  730.                defined in the 68000 machine description:
  731.                -m68000 & -mc68000  Generate output for a 68000.
  732.                                    This is the default on the
  733.                                    Atari ST.
  734.                -m68020 & -mc68020  Generate output for a 68020
  735.                                    (rather than a 68000).
  736.                -m68881   Generate output containing 68881
  737.                          instructions for floating point.
  738.                
  739. -msoft-float   Generate output containing library calls for
  740.           floating point.  This is the default on the Atari ST.
  741.  
  742. -mshort   Consider type int to be 16 bits wide, like short int
  743.           and causes the macro __MSHORT__ to be defined.  Using
  744.           this option also causes the library library16.olb to be
  745.           linked.  (Also see section 3.2 [Predefined Macros],
  746.           page 24, for more info)
  747.  
  748. -mnobitfield   Do not use the bit-field instructions.  -m68000
  749.           implies -mnobitfield.  This is the default on the Atari
  750.           ST.
  751.  
  752. -mbitfield     Do use the bit-field instructions.  -m68020
  753.           implies -mbitfield.
  754.  
  755. -mrtd     Use a different function-calling convention, in which
  756.      functions that take a fixed number of arguments return with
  757.      the rtd instruction, which pops their arguments while
  758.      returning.  This saves one instruction in the caller since
  759.      there is no need to pop the arguments there.  This calling
  760.      convention is incompatible with the one normally used on
  761.      U**x, so you cannot use it if you need to call libraries
  762.      compiled with the  U**x compiler.  Also, you must provide
  763.      function prototypes for all functions that take variable
  764.      numbers of arguments (including printf); otherwise incorrect
  765.      code will be generated for calls to those functions.  In
  766.      addition, seriously incorrect code will result if you call a
  767.      function with too many arguments.  (Normally, extra
  768.      arguments are harmlessly ignored.)  The rtd instruction is
  769.      supported by the 68010 and 68020 processors, but  not by the
  770.      68000.
  771.  
  772. -fflag    Specify machine-independent flags.  Most flags have
  773.      both positive and negative forms; the negative form of -ffoo
  774.      would be -fno-foo.  In the table below, only one of the
  775.      forms is listed--the one which is not the default.  You can
  776.      figure out the other form by either removing no- or adding
  777.      it.
  778.  
  779. -ffloat-store  Do not store floating-point variables in
  780.           registers.  This prevents undesirable excess precision
  781.           on machines such as the 68000 where the floating
  782.           registers (of the 68881) keep more precision than a
  783.           double is supposed to have.  For most programs, the
  784.           excess precision does only good, but a few programs
  785.           rely on the precise definition of IEEE floating point.
  786.           Use -ffloat-store for such programs.
  787.  
  788. -fno-asm  Do not recognize asm, inline or typeof as a keyword.
  789.           These words may then be used as identifiers.
  790.  
  791. -fno-defer-pop Always pop the arguments to each function call as
  792.           soon as that function returns.  Normally the compiler
  793.           (when optimizing) lets arguments accumulate on the
  794.           stack for several function calls and pops them all at
  795.           once.
  796.  
  797. -fstrength-reduce   Perform the optimizations of loop strength
  798.                reduction and elimination of iteration variables.
  799.  
  800. -fcombine-regs Allow the combine pass to combine an instruction
  801.                that copies one register into another.  This might
  802.                or might not produce better code when used in
  803.                addition to -O.  I am interested in hearing about
  804.                the difference this makes.
  805.  
  806. -fforce-mem    Force memory operands to be copied into registers
  807.           before doing arithmetic on them.  This may produce
  808.           better code by making all memory references potential
  809.           common subexpressions.  When they are not common
  810.           subexpressions, instruction combination should
  811.           eliminate the separate register-load.  I am interested
  812.           in hearing about the difference this makes.
  813.  
  814. -fforce-addr   Force memory address constants to be copied into
  815.           registers before doing arithmetic on them.  This may
  816.           produce better code just as -fforce-mem may.
  817.  
  818. -fomit-frame-pointer     Don't keep the frame pointer in a
  819.                register for functions that don't need one.  This
  820.                avoids the instructions to save, set up and
  821.                restore frame pointers; it also makes an extra
  822.                register available in many functions.  It also
  823.                makes debugging impossible.  On some machines,
  824.                such as the Vax, this flag has no effect, because
  825.                the standard calling sequence automatically
  826.                handles the frame pointer and nothing  is saved by
  827.                pretending it doesn't exist.  The machine-
  828.                description macro FRAME_POINTER_REQUIRED controls
  829.                whether a target machine supports this flag.
  830.  
  831. -finline-functions  Integrate all simple functions into their
  832.                callers.  The compiler heuristically decides which
  833.                functions are simple enough to be worth
  834.                integrating in this way.  If all calls to a given
  835.                function are integrated, and the function is
  836.                declared static, then the function is normally not
  837.                output as assembler code in its own right.
  838.  
  839. -fkeep-inline-functions  Even if all calls to a given function
  840.                     are integrated, and the function is  declared
  841.                     static, nevertheless output a separate run-
  842.                     time callable version of the function.
  843.  
  844. -fwritable-strings  Store string constants in the writable data
  845.                segment and don't uniquize them.  This is for
  846.                compatibility with old programs which assume they
  847.                can write into string constants.  Writing into
  848.                string constants is a very bad idea; "constants"
  849.                should be constant.
  850.  
  851. -fcond-mismatch     Allow conditional expressions with mismatched
  852.                types in the second and third arguments.  The
  853.                value of such an expression is void.
  854.  
  855. -fno-function-cse   Do not put function addresses in registers;
  856.                make each instruction that calls a constant
  857.                function contain the function's address
  858.                explicitly.  This option results in less efficient
  859.                code, but some strange hacks that alter the
  860.                assembler output may be confused by the
  861.                optimizations performed when this option is not
  862.                used.
  863.  
  864. -fvolatile     Consider all memory references through pointers to
  865.           be volatile.
  866.  
  867. -fshared-data  Requests that the data and non-const variables of
  868.           this compilation be shared data rather than private
  869.           data.  The distinction makes sense only on certain
  870.           operating systems, where shared data is shared between
  871.           processes running the same program, while private data
  872.           exists in one copy per process.
  873.  
  874. -funsigned-char     Let the type char be the unsigned, like
  875.                unsigned char.  Each kind of machine has a default
  876.                for what char should be.  It is either like
  877.                unsigned char by default or like signed char by
  878.                default.  (Actually, at present, the default is
  879.                always signed.)  The type char is always a
  880.                distinct type from either signed char or unsigned
  881.                char, even though its behavior is always just like
  882.                one of those two.  Note that this is equivalent to
  883.                -fno-signed-char, which is the negative  form of -
  884.                fsigned-char.
  885.  
  886. -fsigned-char  Let the type char be signed, like signed char.
  887.           Note that this is equivalent to -fno-unsigned-char,
  888.           which is the negative form of -funsigned-char.
  889.  
  890. -ffixed-reg    Treat the register named reg as a fixed register;
  891.           generated code should never refer to it (except perhaps
  892.           as a stack pointer, frame pointer or in some other
  893.           fixed role).  Reg must be the name of a register.  The
  894.           register names accepted are machine-specific and are
  895.           defined in the REGISTER_NAMES macro in the machine
  896.           description macro file.  This flag does not have a
  897.           negative form, because it specifies a three-way
  898.           choice.
  899.  
  900. -fcall-used-reg     Treat the register named reg as an
  901.           allocatable register that is clobbered by function
  902.           calls.  It may be allocated for temporaries or
  903.           variables that do not  live across a call.  Functions
  904.           compiled this way will not save and restore the
  905.           register reg.  Use of this flag for a register that has
  906.           a fixed pervasive role in the machine's execution
  907.           model, such as the stack pointer or frame pointer, will
  908.           produce disastrous results.  This flag does not have a
  909.           negative form, because it specifies a three-way choice.
  910.  
  911. -fcall-saved-reg    Treat the register named reg as an
  912.                allocatable register saved by functions.  It may
  913.                be allocated even for temporaries or variables
  914.                that live across a call.  Functions compiled this
  915.                way will save and restore the register reg if they
  916.                use it.  Use of this flag for a register that has
  917.                a fixed pervasive role in the machine's execution
  918.                model, such as the stack pointer or frame pointer,
  919.                will produce disastrous results.  A different sort
  920.                of disaster will result from the use of this flag
  921.                for a register in which function values may be
  922.                returned.  This flag does not have a negative
  923.                form, because it specifies a three-way choice.
  924.  
  925. -pedantic Issue all the warnings demanded by strict ANSI standard
  926.           C; reject all programs that use forbidden extensions.
  927.           Valid ANSI standard C programs should compile properly
  928.           with or without this option (though a rare few will
  929.           require "-ansi').  However, without this option,
  930.           certain GNU extensions and traditional C features are
  931.           supported as well.  With this option, they are
  932.           rejected.  There is no reason to use this option; it
  933.           exists only to satisfy pedants.
  934.  
  935.      These options  control the  C preprocessor,  which is run on
  936. each C  source file before actual compilation.  If you use the -E
  937. option, nothing  is done  except C  preprocessing.  Some of these
  938. options make  sense only  together with  -E because  they request
  939. preprocessor output that is not suitable for actual compilation.
  940.      
  941. -C   Tell the preprocessor not to discard comments.  Used with
  942.      the "-E" option.
  943.  
  944. -Idir     Search directory dir for include files.
  945.  
  946. -I-  Any directories specified with -I options before the -I-
  947.      option are searched only for the case of #include "file";
  948.      they are not searched for #include <file>.  If additional
  949.      directories are specified with -I options after the -I-,
  950.      these directories are searched for all #include directives.
  951.      (Ordinarily all -I directories are used this way.)  In
  952.      addition, the -I- option inhibits the use of the current
  953.      directory as the first search directory for #include "file".
  954.      Therefore, the current directory is searched only if it  is
  955.      requested explicitly with -I..  Specifying both -I- and -I
  956.      allows you to control precisely which directories are
  957.      searched before the current one and which are searched
  958.      after.
  959.  
  960. -nostdinc Do not search the standard system directories for
  961.           header files.  Only the directories you have specified
  962.           with -I options (and the current directory, if
  963.           appropriate) are searched.  Between -nostdinc and -I-,
  964.           you can eliminate all directories from the search path
  965.           except those you specify.
  966.  
  967. -M   Tell the preprocessor to output a rule suitable for make
  968.      describing the dependencies of each source file.  For each
  969.      source file, the preprocessor outputs one make-rule whose
  970.      target is the object file name for that source file and
  971.      whose dependencies are all the files #included in it.  This
  972.      rule may be a single line or may be continued with \-newline
  973.      if it is long.  -M implies -E.
  974.  
  975. -MM  Like -M but the output mentions only the user-header files
  976.      included with #include "file".  System header files included
  977.      with #include <file> are omitted.  -MM implies -E.
  978.  
  979. -Dmacro   Define macro macro with the empty string as its
  980.           definition.
  981.  
  982. -Dmacro=defn   Define macro macro as defn.
  983.  
  984. -Umacro   Undefine macro macro.
  985.  
  986. -T   Support ANSI C trigraphs.  You don't want to know about this
  987.      brain-damage.  The -ansi option also has this effect.
  988.  
  989.                       3.  The Preprocessor
  990.                                 
  991. 3.1  Invoking the C Preprocessor
  992.  
  993.      Most often when you use the C preprocessor you will not have
  994. to invoke it explicitly: the C compiler will do so automatically.
  995. However, the preprocessor is sometimes useful individually.
  996.      
  997.      The C  preprocessor expects  two file  names  as  arguments,
  998. infile and  outfile.  The preprocessor reads infile together with
  999. any other  files it  specifies with  #include.   All  the  output
  1000. generated by the combined input files is written in outfile.
  1001.      
  1002.      Either infile  or outfile may be -, which as infile means to
  1003. read from  standard input  and  as  outfile  means  to  write  to
  1004. standard output.   Also,  if  outfile  or  both  file  names  are
  1005. omitted, the  standard output and standard input are used for the
  1006. omitted file names.
  1007.      
  1008.      Here is  a table  of  command  options  accepted  by  the  C
  1009. preprocessor.   Most of them can also be given when compiling a C
  1010. program; they  are passed along automatically to the preprocessor
  1011. when it is invoked by the compiler.
  1012.      
  1013. -P   Inhibit generation of #-lines with line-number information
  1014.      in the output from the preprocessor.  This might be useful
  1015.      when running the preprocessor on something that is not C
  1016.      code and will be sent to a program which might be confused
  1017.      by the #-lines
  1018.  
  1019. -C   Do not discard comments: pass them through to the output
  1020.      file.  Comments appearing in arguments of a macro call will
  1021.      be copied to the output before the expansion of the macro
  1022.      call.
  1023.  
  1024. -T   Process ANSI standard trigraph sequences.  These are three-
  1025.      character sequences, all starting with ??, that are defined
  1026.      by ANSI C to stand for single characters.  For example, ??/
  1027.      stands for /, so ??/n is a character constant for Newline.
  1028.      Strictly speaking, the GNU C preprocessor does not support
  1029.      all programs in ANSI Standard C unless -T is used, but if
  1030.      you ever notice the difference it will be with relief.  You
  1031.      don't want to know any more about trigraphs.
  1032.  
  1033. -pedantic Issue warnings required by the ANSI C standard in
  1034.           certain cases such as when text other than a comment
  1035.           follows #else or #endif.
  1036.  
  1037. -I directory   Add the directory directory to the end of the list
  1038.           of directories to be searched for header files.  This
  1039.           can be used to override a system header file,
  1040.           substituting your own version, since these directories
  1041.           are searched before the system header file directories.
  1042.           If you use more than one -I option, the directories are
  1043.           scanned in left-to-right order;  the standard system
  1044.           directories come after.
  1045.  
  1046. -I-  Any directories specified with -I options before the -I-
  1047.      option are searched only for the case of #include "file";
  1048.      they are not searched for #include <file>.  If additional
  1049.      directories are specified with -I options after the -I-,
  1050.      these directories are searched for all #include directives.
  1051.      In addition, the -I- option inhibits the use of the current
  1052.      directory as the first search directory for #include "file".
  1053.      Therefore, the current directory is searched only if it is
  1054.      requested explicitly with -I..  Specifying both -I- and -I.
  1055.      allows you to control precisely which directories are
  1056.      searched before the current one and which are searched
  1057.      after.
  1058.  
  1059. -nostdinc Do not search the standard system directories for
  1060.           header files.  Only the directories you have specified
  1061.           with -I options (and the current directory, if
  1062.           appropriate) are searched.
  1063.  
  1064. D name    Predefine name as a macro, with definition 1.
  1065.  
  1066. -D name=definition  Predefine name as a macro, with definition
  1067.                definition.  There are no restrictions on the
  1068.                contents of definition, but if you are invoking
  1069.                the preprocessor from a shell or shell-like
  1070.                program you may need to use the shell's quoting
  1071.                syntax to protect characters such as spaces that
  1072.                have a meaning in the shell syntax.
  1073.  
  1074. -U name   Do not predefine name.  If both -U and -D are specified
  1075.           for one name, the -U beats the -D and the name is not
  1076.           predefined.
  1077.  
  1078. -undef    Do not predefine any nonstandard macros.
  1079.  
  1080. -d   Instead of outputting the result of preprocessing, output a
  1081.      list of #define commands for all the macros defined during
  1082.      the execution of the preprocessor.
  1083.  
  1084. -M   Instead of outputting the result of preprocessing, output a
  1085.      rule suitable for make describing the dependencies of the
  1086.      main source file.  The preprocessor outputs one make rule
  1087.      containing the object file name for that source file, a
  1088.      colon, and the names of all the included files.  If there
  1089.      are many included files then the rule is split into several
  1090.      lines using \-newline.  This feature is used in automatic
  1091.      updating of makefiles.
  1092.  
  1093. -MM  Like -M but mention only the files included with #include
  1094.      "file".  System header files included with #include <file>
  1095.      are omitted.
  1096.  
  1097. -i file   Process file as input, discarding the resulting output,
  1098.      before processing the regular input file.  Because the
  1099.      output generated from file is discarded, the only effect of
  1100.      -i file is to make the macros defined in file available for
  1101.      use in the main input.
  1102.  
  1103. 3.2  Predefined Macros
  1104.  
  1105.      The standard  predefined macros  are available with the same
  1106. meanings regardless  of the  machine or operating system on which
  1107. you are  using GNU  C.  Their names all start and end with double
  1108. underscores.     Those  preceding  __GNUC__  in  this  table  are
  1109. standardized by ANSI C; the rest are GNU C extensions.
  1110.      
  1111. __FILE__ This macro expands to the name of the current input
  1112.           file, in the form of a C String constant.
  1113.  
  1114. __LINE__ This macro expands to the current input line number, in
  1115.           the form of a decimal integer constant.  While we call
  1116.           it a predefined macro, it's a pretty strange macro,
  1117.           since its "definition" changes with each new line of
  1118.           source code.  This and __FILE__ are useful in
  1119.           generating an error message to report an inconsistency
  1120.           detected by the program; the message can state the
  1121.           source line at which the inconsistency was detected.
  1122.           For example, fprintf (stderr, "Internal error: negative
  1123.           string length ""%d at %s, line %d.",length, __FILE__,
  1124.           __LINE__);  A #include command changes the expansions
  1125.           of __FILE__ and __LINE__ to correspond to the included
  1126.           file.  At the end of that file, when processing resumes
  1127.           on the input file that contained the #include command,
  1128.           the expansions of __FILE__ and __LINE__ revert to the
  1129.           values they had before the #include (but __LINE__ is
  1130.           then incremented by one as processing moves to the line
  1131.           after the #include).  The expansions of both __FILE__
  1132.           and __LINE__ are altered if a #line command is used.
  1133.  
  1134. __DATE__ This macro expands to a string constant that describes
  1135.           the date on which the preprocessor is being run.  The
  1136.           string constant contains eleven characters and looks
  1137.           like "Jan 29 1987" or "Apr 1 1905".
  1138.  
  1139. __TIME__ This macro expands to a string constant that describes
  1140.           the time at which the preprocessor is being run.  The
  1141.           string constant contains eight characters and looks
  1142.           like "23:59:01".
  1143.  
  1144. __STDC__ This macro expands to the constant 1, to signify that
  1145.           this is ANSI Standard C.  (Whether that is actually
  1146.           true depends on what C compiler will operate on the
  1147.           output from the preprocessor.)
  1148.  
  1149. __GNUC__ This macro is defined if and only if this is GNU C.
  1150.           This macro is defined only when the entire GNU C
  1151.           compiler is in use; if you invoke the preprocessor
  1152.           directly, __GNUC__ is undefined.
  1153.  
  1154. __STRICT_ANSI__     This macro is defined if and only if the -
  1155.                ansi switch was specified when GNU C was invoked.
  1156.                Its definition is the null string.  This macro
  1157.                exists primarily to direct certain GNU header
  1158.                files not to define certain traditional U**x
  1159.                constructs which are  incompatible with ANSI C.
  1160.  
  1161. __VERSION__    This macro expands to a string which describes the
  1162.                version number of GNU C.  The string is normally a
  1163.                sequence of decimal numbers separated by periods,
  1164.                such as "1.18".  The only reasonable use of this
  1165.                macro is to incorporate it into a string constant.
  1166.  
  1167. __OPTIMIZE__   This macro is defined in optimizing compilations.
  1168.                It causes certain GNU header files to define
  1169.                alternative macro definitions for some system
  1170.                library functions.  It is unwise to refer to or
  1171.                test the definition of this macro unless you make
  1172.                very sure that programs will execute with the same
  1173.                effect regardless.
  1174.  
  1175. __CHAR_UNSIGNED__   This macro is defined if and only if the data
  1176.                     type char is unsigned on the target machine.
  1177.                     It exists to cause the standard header file
  1178.                     limit.h to work correctly.  It is bad
  1179.                     practice to refer to this macro yourself;
  1180.                     instead, refer to the standard macros defined
  1181.                     in limit.h.
  1182.  
  1183. __MSHORT__     This macro is defined, if gcc.ttp is invoked with
  1184.                     the -mshort option, which causes integers to
  1185.                     be 16 bit.  Please carefully examine the
  1186.                     prototypes in the #include <> headers for
  1187.                     types before using -mshort.
  1188.  
  1189.      Apart from  the above  listed macros, there are usually some
  1190. more to  to indicate  what type  of system and machine is in use.
  1191. For example  unix is normally defined on all U**x systems.  Other
  1192. macros decribe  more or  less the type of CPU the system runs on.
  1193. GNU CC for the Atari ST has the following macros predefined:
  1194.      
  1195.      atarist
  1196.      gem
  1197.      m68k
  1198.      
  1199.      Please keep  in mind,  that these macros are only defined if
  1200. the preprocessor is invoked from the compiler driver gcc.ttp.
  1201.      
  1202.      These predefined  symbols are not only nonstandard, they are
  1203. contrary to  the ANSI  standard because  their names do not start
  1204. with underscores.   However,  the GNU  C  preprocessor  would  be
  1205. useless if  it did not predefine the same names that are normally
  1206. predefined on  the system and machine you are using.  Even system
  1207. header  files  check  the  predefined  names  and  will  generate
  1208. incorrect declarations  if they  do not  find the  names that are
  1209. expected.
  1210.      
  1211.      The -ansi  option which requests complete support for ANSI C
  1212. inhibits the definition of these predefined symbols.
  1213.      
  1214.                    4.  The GNU Assembler (GAS)
  1215.                                 
  1216.      Most of  the time  you will  be programming in C.  But there
  1217. may  certain  situations,  where  it  is  feasible  to  write  in
  1218. assembler.   Time is usually a main reason to dive into assembler
  1219. programming, when  you have to squeeze the last redundant machine
  1220. cycle out  of your routine, to meet certain time limits.  Another
  1221. reason might  be, that  you have  to do very low level stuff like
  1222. fiddling with bits in the registers of a peripheral chip.
  1223.      
  1224.      If  you   already  have   some   experience   in   assembler
  1225. programming, you might miss the feature of creating macros.  This
  1226. is  not  really  a  lack  given  the  fact,  that  the  assembler
  1227. originated from an U**x environment.  Under this operating system
  1228. there is  a tools  for nearly  every purpose.  If you were in the
  1229. need of  an extensive macros facility, you would use the M4 macro
  1230. processor.   A public  domain version  of the  M4 macro processor
  1231. exists.   It should  be no  problem to  port it to the Atari with
  1232. GCC.   For some macro processing tasks you just as well use the C
  1233. preprocessor.  What I personally miss is the ability to produce a
  1234. listing.
  1235.      
  1236. 4.1  Invoking the Assembler
  1237.  
  1238.      gcc-as.ttp supports the following command line options.  The
  1239. output is written to "a.out" by default.
  1240.      
  1241. -G   assembles the debugging information the C compiler included
  1242.      into the output.  Without this flag the debugging
  1243.      information is otherwise discarded.
  1244.  
  1245. -L   Normaly all labels, that start with a L are discarded and
  1246.      don't show up as symbols in the object code module.  They
  1247.      are local to that assembler module.  If the -L option is
  1248.      given, all local labels will be included in the object code
  1249.      module.
  1250.  
  1251. -m68000, -m68010, -m68020     These options modify the behavior
  1252.                          of assembler in respect of the used CPU.
  1253.                          The M68020, for example, allows relative
  1254.                          branches with 32-bit offset.
  1255.  
  1256. -ofilename     writes the output to filename instead of a.out.
  1257.  
  1258. -R   The information, which normally would be assembled into the
  1259.      data section of the program, is moved into the text section.
  1260.  
  1261. -v   displays the version of the assembler.
  1262.  
  1263. -W   suppresses all warning messages.
  1264.  
  1265. 4.2  Syntax
  1266.  
  1267.      The assembler  uses a  slightly modified syntax from the one
  1268. you might  know  from  other  68000  assemblers,  which  use  the
  1269. original Motorola  syntax.  The next sections try to describe the
  1270. syntax GAS uses.
  1271.      
  1272.      The most  obvious differences are the missing period (.) and
  1273. the usage  of the at sign (@).  The original Motorola syntax uses
  1274. the period  to separate the size modifier (b, w, l) from the main
  1275. instruction.   In Motorola syntax one would write move.l #1,d0 to
  1276. move a  long word  with value  1 into  register d0.  With GAS you
  1277. simple write  movel #1,d0.   The @ is used to mark an indirection
  1278. equivalent to  the Motorola  parentheses.  To move a long word of
  1279. value 1  to the location addressed by a0, you have to write movel
  1280. #1,a0@.   The equivalent instruction expressed in Motorola syntax
  1281. is move.l #1,(a0).  The # indicates immediate data in both cases.
  1282.      
  1283. Register Names and Addressing Modes
  1284.  
  1285.      The register  mnemonics are d0-d7 for the data registers and
  1286. a0-a7 or  sp for  address register  and the stack pointer.  pc is
  1287. the program  counter, sr  the status  register, ccr the condition
  1288. code register and usp the user stack pointer.
  1289.      
  1290.      The following  table shows the operands GAS can parse.  (The
  1291. first part part describes the used abreviations.  The second part
  1292. shows the addressing modes with a equivalent C expression.)
  1293.      
  1294.      numb:     an 8 bit number
  1295.      
  1296.      numw:     a 16 bit number
  1297.      
  1298.      numl:     a 32 bit number
  1299.      
  1300.      dreg:     data register 0: :7:
  1301.      
  1302.      reg: address or data register
  1303.      
  1304.      areg:     address register 0: :7:
  1305.      
  1306.      apc: address register or PC
  1307.      
  1308.      num: a 16 or 32 bit number
  1309.      
  1310.      num2:     a 16 or 32 bit number
  1311.      
  1312.      sz:  w or l, if omitted, l is assumed.
  1313.      
  1314.      scale:    1 2 4 or 8.  If omitted, 1 is assumed.
  1315.      
  1316.      Immediate Data
  1317.           #num  --> NUM Dataor
  1318.      
  1319.      Address Register Direct
  1320.           dreg  --> dreg areg  --> areg
  1321.      
  1322.      Address Register Indirect
  1323.           areg@-->*(areg)
  1324.      
  1325.      Address Register Indirect with Postincrement or Predecrement
  1326.           areg@+-->*(areg++)
  1327.           areg@--->*(--areg)
  1328.      
  1329.      Address Register (or PC) Indirect with Displacement
  1330.           apc@(numw)-->*(apc+numw)
  1331.      
  1332.      Address Register (or PC) Indirect with Index (8-Bit
  1333.           Displacement) (M68020 only)
  1334.           apc@(num,reg:sz:scale)-->*(apc+num+reg*scale)
  1335.           apc@(reg:sz:scale)-->same with num=0
  1336.      
  1337.      Memory Indirect Postindexed (M68020 only)
  1338.           apc@(num)@(num2,reg:sz:scale)--
  1339.           >*(*(apc+num)+num2+reg*scale)
  1340.           apc@(num)@(reg:sz:scale)-->same with num2=0
  1341.           apc@(num)@(num2)-->*(*(apc+num)+num2)
  1342.           (previous mode without an index reg)
  1343.      
  1344.      Memory Indirect Preindexed (M68020 only)
  1345.           apc@(num,reg:sz:scale)@(num2)--
  1346.           >*(*(apc+num+reg*scale)+num2)
  1347.           apc@(reg:sz:scale)@(num2)-->same with num=0
  1348.      
  1349.      Absolute Addressnum
  1350.           sz-->*(num)num-->*(num)
  1351.           (sz L assumed)
  1352.      
  1353. Labels and Identifiers
  1354.  
  1355.      User defined  identifiers are  basically defined by the same
  1356. rules as  C identifiers.   They  may contain  the digits 0-9, the
  1357. letters A-zand  the underscore  and must  not start with a digit.
  1358. Identifiers, which  end with  : are  labels.   A special  form of
  1359. labels starts  with a  L or consists of only a digit.  Both types
  1360. are local  labels, which disappear, when the assembly is complete
  1361. (unless the  -L option  was specified).   They  can't be  used to
  1362. resolve external  references.  The L type label are referenced by
  1363. their name,  just as any other label.  The digit type labels form
  1364. a special  kind of  local labels.    You  might  also  call  them
  1365. temporary labels.   They  are especially  useful when you have to
  1366. create small  loops, which  poll a  peripheral or  fill a  memory
  1367. area.  They are referenced by appending either a f, for a forward
  1368. reference, or  a b, for a backward reference, to the digit.  Lets
  1369. look at  the following  example, which  is used to split a memory
  1370. area starting  at 0x80000.   All  data on  an even  addresses  is
  1371. copied to  the area  starting  at  0x70000;  all  data  from  odd
  1372. addresses goes to the area starting at 0x78000.
  1373.      
  1374.      start:
  1375.      lea  0x80000,a0
  1376.      lea  0x70000,a1
  1377.      lea  0x78000,a2
  1378.      movel     #0x7fff,d5
  1379.      0:   _ label 0 is defined
  1380.      moveb     a0@+,a1@+
  1381.      moveb     a0@+,a2@+
  1382.      dbra d5,0b     _ reference of label 0
  1383.      
  1384.      The label  0 is  referenced 3  lines later  by 0b, since the
  1385. reference is  backward.  You can use the label 0 again at a later
  1386. time to  construct more  such loops.  Since this temporary labels
  1387. are restricted  to one  digit  in  length,  you  can  only  build
  1388. constructs, which use 10 temporary labels at the same time.
  1389.      
  1390. Comments
  1391.  
  1392.      The above  example also shows, that comments start with a _.
  1393. # is  also used  to mark  a comments.   The  C compiler  and  the
  1394. preprocessor generate lines that start with a #.
  1395.      
  1396. Numerical and String Constants
  1397.  
  1398.      Numerical values  are given the same way as in a C programs.
  1399. By default  number are  taken to be decimal.  A leading 0 denotes
  1400. an octal  and a  0x a  hexadecimal value.  Floating point numbers
  1401. start with a 0f.  The optional exponent starts with a e or E.
  1402.      
  1403.      String constants  are equivalent  to C  defined.   They  are
  1404. enclosed in  "s.  Some special character constants are defined by
  1405. \ and a following letter.  These characters are possible:
  1406.      
  1407.      \b   Backspace      Code 0x08
  1408.      \t   Tab            Code 0x09
  1409.      \n   Line Feed      Code 0x0a
  1410.      \f   Form Feed      Code 0x0c
  1411.      \r   Carriage Return     Code 0x0d
  1412.      \\   Backslash
  1413.      \"   Double Quote itself
  1414.      \num where num is a octal number with up to 3 digits
  1415.           specifying the character code.
  1416.      
  1417. Assignments and Operators
  1418.  
  1419.      An = is used to assign a value to a Symbol.
  1420.      
  1421.      Lexp_frame = 8
  1422.      
  1423.      This is  equivalent to  the equ  directive other  assemblers
  1424. use.
  1425.      
  1426.      GAS    supports     addition    (+),     subtraction    (-),
  1427. multiplication(*), division (/), rigth shift (>), left shift (<),
  1428. and (&),  or (_), not (!), xor (^) and modulo (%) in expressions.
  1429. The order of precedence is:
  1430.      lowest    0    operand, (expression)
  1431.           1    + -
  1432.           2    & ^ ! _
  1433.           3    * / % < >
  1434.      
  1435.      Parentheses are used to coerce the order of evaluation.
  1436.      
  1437. Segments, Location Counters and Labels
  1438.  
  1439.      A program  written in  assembly language  may be broken into
  1440. three different  segments;  the  TEXT,  DATA  and  BSS  sections.
  1441. Pseudo opcodes  are used  to switch  between the  sections.   The
  1442. assembler maintains  a location counter for each segment.  When a
  1443. label is  used in the assembler input, it is assigned the current
  1444. value of  the active  location counter.   The location counter is
  1445. incremented with  every byte,  that the  assembler outputs.   GAS
  1446. actually allows  you to  have more than one TEXT or DATA segment.
  1447. This is  so to ease code generation by high level compilers.  The
  1448. assembler concatenates  the different sections in the end to form
  1449. continuous regions  of TEXT  and/or DATA.   When  you do assembly
  1450. programming by  hand you  would stick to the pseudo obcodes .text
  1451. or .data,  which use  text or  data  segment  with  number  0  by
  1452. default.
  1453.      
  1454. Types
  1455.  
  1456.      Symbol and labels can be of one of three types.  A symbol is
  1457. absolute; when  it's  values  is  known  at  assembly  time.    A
  1458. assignment like  "Lexp_frame =  8" gives  the symbol "Lexp_frame"
  1459. the absolute  value 8.   A  symbol or  label, which  contains  an
  1460. offset from  the beginning  of a  section, is called relocatable.
  1461. The actual  value of this symbol can only be determined after the
  1462. linking process  or when  the program  is running in memory.  The
  1463. third type  of symbols are undefined externals.  The actual value
  1464. of this symbol is defined in an other program.
  1465.  
  1466.      When  different  types  of  symbols  are  combined  to  form
  1467. expressions the  following rules  apply: (abs  = absolute,  rel =
  1468. relocatable, ext = undefined external)
  1469.      
  1470.      abs + abs => abs
  1471.      abs + rel = rel + abs => rel
  1472.      abs + ext = ext + abs => ext
  1473.      abs - abs => abs
  1474.      rel - abs => rel
  1475.      ext - abs => ext
  1476.      rel - rel => abs
  1477.      
  1478.      (makes only  sense, when  both  relocatable  expression  are
  1479. relative to same segment)
  1480.      All  other  possible  operators  are  only  useful  to  form
  1481. expressions with absolute values or symbols.
  1482.      
  1483. 4.3  Supported Pseudo Opcodes (Directives)
  1484.  
  1485.      All pseudo  opcodes start  with a  period  (.).    They  are
  1486. followed  by  0,  1  or  more  expressions  separated  by  commas
  1487. (depending on  the directive).   The  following table  omits  the
  1488. pseudo opcodes,  which include  special information for debugging
  1489. purposes (for GDB).
  1490.      
  1491. .abort    aborts the assembly on the point.
  1492.  
  1493. .align integer aligns the current segment in size to integer
  1494.           power of 2.  The maximum value of integer is 15.  The
  1495.           lines
  1496.                .text
  1497.                some code
  1498.                .align 10 _ 2^10 = 1024
  1499.                .data
  1500.                some more code
  1501.                .align 10 _ 2^10 = 1024
  1502.           will create text and data sections, which both have the
  1503.           size 1024, although the actual code, that goes into the
  1504.           sections may be smaller.
  1505.  
  1506. .ascii string[,string,]  includes the string('s) in the assembly
  1507.                output.
  1508.  
  1509. .asciz string[,string,]  This directive is the same as above, but
  1510.                additionally appends a 0 character to the string.
  1511.  
  1512. .byte expr[,expr,]  puts consecutive bytes with value expr into
  1513.                the output.
  1514.  
  1515. .comm identifier,integer creates a common area of integer bytes
  1516.                     in the current segment, which is referenced
  1517.                     by identifier.  The identifier is visible
  1518.                     from the outside of the module.  It can
  1519.                     therefore be used to resolve external
  1520.                     reference from other modules.
  1521.  
  1522. .data [integer]     switches to DATA section integer.  If integer
  1523.                is omitted, data section 0 is selected.
  1524.  
  1525. .desc     this sets the n_desc field in the symbol table.  it is
  1526.      used to manupulate debugging information in the object file.
  1527.  
  1528. .double double[,double,] puts consecutive doubles with value
  1529.                     double into the output.
  1530.  
  1531. .even     sets the location counter of the current segment to the
  1532.      next even value.
  1533.  
  1534. .file .line    If a file is assembled which was generated by a
  1535.           compiler or preprocessed by the C preprocessor, the
  1536.           input may contain lines like # 132 stdio.h.  These
  1537.           lines are changed by the assembler to the form .line
  1538.           132.
  1539.  
  1540. .file     stdio.h
  1541.  
  1542. .fill count,size,expr    puts count areas with size into the
  1543.                output.  Each area contains the value expr.  Size
  1544.                may be an even number upto or equal to 8.  The
  1545.                line .fill 3, 4, 0xa5a would put the following
  1546.                byte sequence in the output 00 00 0a 5a _ 00 00 0a
  1547.                5a _ 00 00 0a 5a
  1548.  
  1549. .float float[,float,]    puts consecutive floats with value float
  1550.                into the output.
  1551.  
  1552. .globl identifier[,identifier,]    When labels or identifiers are
  1553.                     assigned, they are only locally defined.  The
  1554.                     .globl directive gives identifier external
  1555.                     scope.  The label can therefore be used to
  1556.                     resolve external references from other
  1557.                     modules.  Identifiers don't have to be
  1558.                     assigned in the current module, but can be
  1559.                     defined in another module.
  1560.  
  1561. .int expr[,expr,]   puts consecutive integers (32 bit) with value
  1562.                expr into the output.
  1563.  
  1564. .lcomm identifier,integer     is basically the same as .comm,
  1565.                     except that area is allocated in the BSS
  1566.                     segment.  The scope of identifier is only
  1567.                     local (only visible in the module, where it
  1568.                     is defined).
  1569.  
  1570. .long expr[,expr,]  same as int.
  1571.  
  1572. .lsym identifier,expr    sets the local identifier to the value
  1573.                of expr.  The identifier is referenced by
  1574.                preceeding it with a "L'.  (Lidentifier)
  1575.  
  1576. .octa .quad    bignums are specified using this construct.  The
  1577.           usual octal, hex or decimal conventions may be used.
  1578.  
  1579. .org expr sets the location counter of the current segment to
  1580.           expr.
  1581.  
  1582. .set identifier,expr     sets identifier to the value of expr.
  1583.                If identifier is not explicitly marked external by
  1584.                the .globl directive, is has only local scope.
  1585.  
  1586. .short expr[,expr,] puts consecutive shorts (16 bit) with value
  1587.                expr into the output.
  1588.  
  1589. .space count, expr  puts count consecutive number of bytes with
  1590.                value expr into the output.  The line.space 5,3 is
  1591.                equivalent to.byte 3, 3, 3, 3, 3.  The space
  1592.                directive is a special form of the fill directive.
  1593.  
  1594. .text [integer]     switches to TEXT section integer.  If integer
  1595.           is omitted, text section 0 is selected.
  1596.  
  1597. .word expr[,expr,]  same as .short.
  1598.  
  1599.                         5.  The Utilities
  1600.                                 
  1601.      This chapter  describes the  programs, which  don't actually
  1602. convert the  source code  into object  code, but  instead combine
  1603. several object  code modules  to a  runnable program or an object
  1604. code library.   Other  programs  can  be  used  to  print  symbol
  1605. information from  either the  object code or the executable.  The
  1606. last group of utility programs modify the executables in terms of
  1607. memory usage and startup time.
  1608.      
  1609. 5.1  The Linker gcc-ld.ttp
  1610.  
  1611.      A  linker  combines  several  object  modules  and  extracts
  1612. modules from  a library  to produce  a runnable  program.  During
  1613. this  process  all  undefined  symbol  references  are  resolved.
  1614. Additionally all  sections from  the object modules, which belong
  1615. to either  the TEXT, DATA or BSS are moved to the correct program
  1616. segment.   For example, all areas of all the object code modules,
  1617. which have  the type  TEXT, are  moved to  form  one  large  TEXT
  1618. section.  The same applies to the DATA and BSS sections.
  1619.      
  1620.      Most  of   the  time   you  don't  have  invoke  the  linker
  1621. explicitly.   The compiler  driver does  the job for you.  But in
  1622. case you have to, the general syntax is:
  1623.      
  1624.      gcc-ld [options] $GNULIB\crt0.o file.o -llibrary
  1625.      
  1626.      or
  1627.      
  1628.      gcc-ld [options] $GNULIB\crt0.o @varlinkfile -llibrary
  1629.      
  1630.      The above  syntax assumes  that the  executable is  produced
  1631. from C  source code,  which normally makes it necessary to link a
  1632. startup module  and a  library.   If an  executable from  a  self
  1633. contained assembler  text is  to be  created, the  startup module
  1634. crt0.o and  the library  might be  missing.  gcc-ld.ttp creates a
  1635. file a.out  by default.  The linker also appends a DRI compatible
  1636. symbol table to the executable.  The second command line from the
  1637. above examples  uses the  character @  to indicate  a file, which
  1638. contains a  list of  all object  modules to  be linked.   This is
  1639. especially useful, if you have a large bunch of modules to form a
  1640. program and  the command  line would  otherwise be  too short  to
  1641. specify all names.
  1642.      
  1643.      gcc-ld.ttp supports the following command line options.
  1644.      
  1645. -llibrary Search library to satisfy unresolved references.  The
  1646.           environment variable GNULIB is used to locate the
  1647.           library.  GNULIB contains a comma or semi-colon
  1648.           separated list of paths, each path without a trailing
  1649.           slash or backslash.
  1650.  
  1651. -Ldirectory    Includes directory in the searchpath to locate a
  1652.           library.
  1653.  
  1654. -M   During the linking process extensive information about the
  1655.      encountered symbols is displayed.
  1656.  
  1657. -ofilename   The resulting output of the linking process is
  1658.           written to filename instead to a.out.
  1659.  
  1660. -s   prevents the linker from attaching a DRI compatible symbol
  1661.           table to the executable.  This symbol table is only of
  1662.           limited use, since the symbol name is restricted to
  1663.           eight characters in length.  Actually you have only
  1664.           seven valid characters, since the C compiler preceeds
  1665.           every symbol it generates with an underscore.
  1666.  
  1667. -t   During the linking process the files loaded and the modules
  1668.           extracted from a library are displayed.
  1669.  
  1670. -x   This option discards all local symbols from the DRI symbol
  1671.      table.  All global symbols   are left in place.
  1672.  
  1673. 5.2  sym-ld.ttp
  1674.  
  1675.      sym-ld.ttp is  a special  version of  the linker.   Its sole
  1676. purpose is  to create  a special  symbol file  used  by  the  GNU
  1677. debugger.   The following  example shows  the usage.   ($  is the
  1678. prompt of a CLI, * is the GDB prompt, # marks a comment)
  1679.      
  1680.      $gcc -c -gg foo.c
  1681.      $gcc -o foo.prg foo.o
  1682.      $sym-ld  -r -o foo.sym $(GNULIB)\crt0.o foo.o -lgnugdb  (or
  1683.           -lgdb)
  1684.      $gdb
  1685.      *exec-file foo.prg
  1686.      *symbol-file foo.sym
  1687.      *run
  1688.      *<start doing gdb commands here>
  1689.      *q
  1690.      $# back
  1691.      
  1692.      Note the  line in  the example, where sym-ld.ttp is invoked.
  1693. A library  gnugdb.olb is used to create the symbol file.  This is
  1694. just like  the normal library gnu.olb except that is was compiled
  1695. with the  -gg option.   If  you don't  have this library, use the
  1696. normal library  ("-lgnu').   In this  case you  can't single step
  1697. through library functions at the source level.
  1698.      
  1699. 5.3  The Archiver gcc-ar.ttp
  1700.  
  1701.      The archiver's main purpose is to make things in programming
  1702. life easier.   The  archiver combines several object modules into
  1703. one large library.  At a later time the linker will then retrieve
  1704. the modules  needed to  resolve  all  references.    Without  the
  1705. library you  would have  to supply  all modules  by hand  on  the
  1706. command line  or the  linker would have to search through all the
  1707. files to  resolve the  references (The  library gnu.olb  contains
  1708. around 150 modules).
  1709.      
  1710.      The general syntax for invoking gcc-ar.ttp is:
  1711.      
  1712.      gcc-ar option [position] library [module]
  1713.      
  1714.      The option  specifies the  action to be taken on the library
  1715. or a  module of that library.  option also includes modifiers for
  1716. the action.   The  optional position  argument is a member of the
  1717. library.  It is used, to mark a specific position in the library;
  1718. an add  operation would  than place  a new module before or after
  1719. that position.   The  next argument  specifies the  library.  The
  1720. recommended naming convention for the creation of a new libraries
  1721. is library.olb.   If  you don't use this convention, the compiler
  1722. driver gcc.ttp will have trouble finding them.  Module is usually
  1723. an object code file generated by the compiler.
  1724.      
  1725.      gcc-ar.ttp supports  the following command line options.  If
  1726. you don't use a position the named module is appended or moved to
  1727. the end of the library
  1728.      
  1729.      a    The add, replace or move operation should place the
  1730.           module after position.
  1731.      b    The add, replace or move operation should place the
  1732.           module before position.
  1733.      c    If the specified library does not exist, it is silently
  1734.           created.  Without this option gcc-ar.ttp would give you
  1735.           a notice, that it created a new library.
  1736.      d    deletes module from the library.
  1737.      i    This is the same as option b.
  1738.      l    This option is ignored.
  1739.      m    Move a member around inside the library.
  1740.      o    preserves the modification time of a module, that is
  1741.           extracted from the library.
  1742.      p    This option pipes the specified module directly to
  1743.           <stdout>.
  1744.      q    A quick append is performed.
  1745.      r    causes module to be replaced.  If the named module is
  1746.           not already present, it is appended.  This is also the
  1747.           default action, when no option is given.
  1748.      s    creates member in the library called __.SYMDEF, which
  1749.           contains the table of contents of global symbols in the
  1750.           archive.  This table is used by the linker to quickly
  1751.           extract a module defining a symbol.  This feature of
  1752.           gcc-ar eliminates the need for a ranlib utility
  1753.           commonly found on U**x systems.
  1754.      t    lists the members, that are currently in the library.
  1755.           If the option v is also given, additional information
  1756.           about file permissions, user- and group-id's and last
  1757.           modification date of the members are displayed.  Of
  1758.           course, file permissions and user- and group-id's don't
  1759.           make much sense on the Atari ST.
  1760.      u    If this option is given, an existing module in the
  1761.           library is only replaced, if the modification time of
  1762.           the new module is newer than the modification time of
  1763.           the one already in the library.
  1764.      v    gives you some addtional information depending on the
  1765.           operation that is performed.
  1766.      x    Extract module from the library.
  1767.      
  1768. 5.3  Listing Symbols
  1769.  
  1770.      There are  two programs available for printing symbols; each
  1771. for symbols  of a different kind.  gcc-nm.ttp list symbols in GNU
  1772. object files  and object libraries.  cnm.ttp lists symbols from a
  1773. DRI compatible symbol table attached to an executable.
  1774.      
  1775.      gcc-nm.ttp
  1776.      
  1777.      The output of gcc-nm.ttp looks like the following sample:
  1778.      
  1779.      00000870  b    _Lbss
  1780.      U    _alloca
  1781.      000003b4  t    _glob_dir_to_array
  1782.      00000532  T    _glob_filename
  1783.      00000248  T    _glob_vector
  1784.      U    _malloc
  1785.      0000086c  D    _noglob_dot_filenames
  1786.      U    _opendir
  1787.      U    _readdir
  1788.      00000000  t    gcc_compiled.
  1789.      
  1790.      The first  column displays  the  relative  address  of  that
  1791. symbol in  the object  file.   If  the  symbol  has  the  type  U
  1792. (undefined external)  the space  in left  blank.  The next column
  1793. shows the type of the symbol.  In general, symbols, which have an
  1794. external scope  (visible for other object module) are marked with
  1795. an uppercase letter.  Symbols, which are local to the object file
  1796. are marked  with lowercase  letters.   The following  letters are
  1797. possible:
  1798.      
  1799. C    marks variables which are defined in that source module, but
  1800.      not initialized.  A declaration like int variable; would
  1801.      create a line marked with a C.  The first column would show
  1802.      the size of that variable in bytes instead of the relative
  1803.      address in the object module.  b variables, which are
  1804.      declared withstatic int variable; are displayed with a b.
  1805.  
  1806. D    marks variables, which are initialized at declaration time.
  1807.      A declaration likeint variable = 1;  would show as a line
  1808.      with a D in it.  d Variables which are initialized at
  1809.      declaration time declared are displayed with a d.  A
  1810.      declaration likestatic int variable = 1;  would create a
  1811.      line marked with a d.
  1812.  
  1813. t,T  mark text (in other words: actual program code).  Functions
  1814.      in your C source, which have the storage class static, would
  1815.      be display with a t.  All other functions in that source
  1816.      module, which are visible to other modules, would show up
  1817.      with a T.
  1818.  
  1819. U    All functions which are defined in other modules and
  1820.      referenced in this module, are   displayed with a "U'.
  1821.  
  1822.      The last column shows the symbol name.
  1823.      
  1824.      gcc-nm.ttp supports the following command line options.
  1825.      
  1826. -a   In case a file is compiled with the -g or -gg option,
  1827.      special information for debugging purposes is included in
  1828.      the object code.  This information is listed by supplying
  1829.      the -a option.
  1830.  
  1831. -g   This option restricts the output to include only symbols,
  1832.      which have an external scope.
  1833.  
  1834. -n   Without any options the output is sorted in ascii order.  By
  1835.      supplying the -n, the listing is sorted in numerical order
  1836.      by the addresses in first column.
  1837.  
  1838. -o   If this option is given, every output line is preceeded by a
  1839.      filename in the form file:, naming the file in which the
  1840.      symbol appears.  If the file to be listed, is an archive,
  1841.      the line begins in the form library(member):.
  1842.  
  1843. -p   The symbols are listed in the order as they appear in the
  1844.      object code module.
  1845.  
  1846. -r   The output is sorted in reverse ascii order.
  1847.  
  1848. -s   Archives may contain a special member called __.SYMDEF.
  1849.      Don't ask me about its purpose.  Anyway, using this option
  1850.      shows the content of this member.
  1851.  
  1852. -u   Only undefined symbols are listed.
  1853.  
  1854.      cnm.ttp
  1855.      
  1856.      cnm.ttp  prints   the  symbols  which  are  attached  to  an
  1857. executable.
  1858.      
  1859. 5.4  Modifying the Executables
  1860.  
  1861.      The programs  which are  described in the following sections
  1862. can be  used to  modify an  already existing executable, but this
  1863. only works  under the  assumption that  the symbol table is still
  1864. attached to the executable.  So if you want to modifiy the memory
  1865. usage of  a  program  at  a  later  time,  you  should  keep  the
  1866. unstripped executables around.
  1867.      
  1868.      printstk.ttp
  1869.      
  1870.      printstk.ttp prints  the current stacksize of an exectuable.
  1871. It does  this by  looking up  the symbol  _stksize in  the symbol
  1872. table portion  of the  file and  than prints  the values  of  the
  1873. location where _stksize points to.  The usage is:
  1874.      
  1875.      printstk [filename]
  1876.      
  1877.      If filename  is no specified it defaults to gcc-cc1.ttp.  If
  1878. printstk.ttp is  used on  some of  the  executables  of  the  GCC
  1879. distribution, you  should see a value of -1, which means that all
  1880. available memory  is used  by  the  program  (at  least  for  the
  1881. programs gcc-cpp.ttp and gcc-cc1.ttp).
  1882.      
  1883.      fixstk.ttp
  1884.      
  1885.      fixstk.ttp works  basicly the  same way as printstk.ttp, but
  1886. lets you  modify the  value at  the location _stksize.  The usage
  1887. is:
  1888.      
  1889.      fixstk size [filename]
  1890.      
  1891.      size is  the stacksize  in Bytes,  KBytes  or  MBytes.    To
  1892. specify size  in Kbytes  or Mbytes,  append a  K or  an M  to the
  1893. integer number.
  1894.      
  1895.      fixstk 128K gcc-as.ttp
  1896.      
  1897.      sets the stacksize of gcc-as.ttp to 128 Kbytes.
  1898.      
  1899.      toglclr.ttp
  1900.      
  1901.      When TOS  launches an application, it clears all memory from
  1902. above the  BBS to  the end of the TPA.  With earlier TOS versions
  1903. (pre TOS  1.4) this  could take  quite a  considerable amount  of
  1904. time.   The clearing  algorithm was improved during the different
  1905. TOS releases, but it is still used, although most of the existing
  1906. programs don't  need a  cleared memory.   Well,  most is not all;
  1907. therefore for compatibilty's sake the feature will stay in place.
  1908.      
  1909.      With TOS  1.4 you  can keep  the gemdos loader from clearing
  1910. all memory.   The  least significant  bit of  the long  word with
  1911. offset 0x16  in the  program header  is used to determine whether
  1912. the memory  should be  cleared or  not.   Setting this  bit to  1
  1913. prevents the loader from clearing all memory.  toglclr.ttp serves
  1914. exactly that purpose, namely toggling this bit.
  1915.  
  1916.