home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / g / gcc / !GCC / !ReadMe < prev    next >
Encoding:
Text File  |  1993-09-26  |  11.8 KB  |  330 lines

  1.                         GNU C/C++ compilers
  2.                         ===================
  3.  
  4.  
  5.  
  6. 0.      Introduction
  7.  
  8.  
  9. This file (sort of) documents the Simon Callan port of the GNU C/C++
  10. compilers to the Archimedes, running RISC-OS 2 / 3. For copyright details
  11. and sources, see !Help.
  12.  
  13. This is the first beta release, and should be followed by later, improved
  14. versions. Already an early version of a new code generator has a higher
  15. Dhrystone rating than norcroft
  16.  
  17. GCC requires requires around 3Meg of free RAM and a hard disc, but it will
  18. generally work with !Virtual, with a few problems (see bugs).
  19.  
  20. This is a binary distribution only and consists of the following packages :
  21.  
  22. !GCC - Non-specific files, documentation, etc.
  23.         !Help           General help and copy-right
  24.         !ReadMe         This file.
  25.         !Boot
  26.         !Run
  27.         !Sprites
  28.         Docs.*          Various GNU documents.
  29.  
  30. GCC - GNU C/C++ compiler
  31.         gcc             Front end to the compiler.
  32.         cpp             C preprocessor.
  33.         cc1             C compiler.
  34.         cc1plus         C++ compiler.
  35.         o.gcc           GCC specific library routines.
  36.         h.varargs       GCC varargs routines.
  37.  
  38. Compiler support files
  39.         as              Assembler.
  40.         ld              Front end to link
  41.  
  42. UnixLib
  43.         UnixLib         Unix compatible run-time library (binaries only).
  44.  
  45.  
  46.  
  47. 1.      Installation
  48.  
  49.  
  50. The (default) installation of GCC is relatively simple :
  51.  
  52. *       Copy this directory, and its files, onto your hard disc.
  53. *       Amend Run$Path so it includes the !Gcc.bin subdirectory.
  54. *       Set Unix$Path so it points to the !Gcc.UnixLib subdirectory
  55. *       Set GCC$Path so it points to the !Gcc.gcc subdirectory
  56. *       Set GPP$path so it points to the!Gcc.gpp subdirectory (Note this is
  57.         deliberately empty at the moment)
  58. *       Set UnixFS$/tmp so it points to the !Scrap directory (or any
  59.         suitable scrap directory ).
  60.  
  61. If you uncomment the lines in !GCC.!Boot and ensure that this is run during
  62. your boot up procedure, everything will be set-up as required.
  63.  
  64. Note, there is no linker supplied, but DRLink, available at various servers
  65. (HENSA, newcastle etc) will succesfully link the supplied version of
  66. UnixLib.
  67.  
  68. This completes installation, and GCC may be used simply by running 'gcc'.
  69.  
  70.  
  71.  
  72. 2.      Using GCC
  73.  
  74.  
  75. GCC uses the same assumptions as norcroft CC, with C sources held in the
  76. '.c' subdirectory and header files held in the '.h' subdirectory, with C++
  77. sources held in the '.cc' subdirectoy. By default, GCC will compile,
  78. assemble and link the supplied sources.
  79.  
  80. For most of the details for using GCC see the file invoke_texi.
  81.  
  82.  
  83. 2.1     RISC-OS specific features.
  84.  
  85. *       AMU
  86.  
  87. This version of GCC supports the dynamic dependencies feature in the version
  88. of AMU supplied with desktop C. To automatically update the dependencies
  89. during compilation, include the '-acorn-make' flag in the command line. This
  90. will generate the !Depend file that AMU uses.
  91.  
  92. *       Norcroft Stubs / ANSILib
  93.  
  94. By default, GCC uses the the UnixLib header and library files supplied,
  95. though the norcroft files can be used. To do this you need the following
  96. command lines options :
  97.  
  98.         -nostdinc       Do not use the UnixLib headers.
  99.         -nostdlib       Do not link again Unixlib / gcc
  100.         -IGCC:          Get GCC specific include files.
  101.         -IC:            Get header files from the C: path
  102.         -lC:o.stubs     Link against Stubs - you can also use AnsiLib
  103.         -lGCC:o.gcc     Link against gcc
  104.  
  105. If you are compiling C++ programs, and linking them against the norcroft
  106. libraries, rather than UnixLib, the source file that contains the main()
  107. function must be compiled by the GNU compiler, rather than Norcroft CC.
  108.  
  109. *       LD
  110.  
  111. LD is a front end to Link, which converts the LD as generated by gcc to the
  112. Acorn Link format.
  113.  
  114. LD only recognises a few options, the rest are passed directly through to
  115. Link. LD also attempts to convert Unix format names to RISC-OS format.
  116.  
  117. The options that LD recognises are :
  118.  
  119. ¤       -L <dir>
  120. This specifies a directory / path that LD is to use when searching for
  121. libraries. <dir> must be either a path (i.e gcc:, etc), or it must be a
  122. valid Unix / RISC OS directory name, ending in either '/' or '.'.
  123. Directories are searched in the order that they are specified.
  124.  
  125. ¤       -l <file>
  126. This specifies the name of a library file which LD will search the library
  127. directories for. This may either be a complete filename (i.e C:o.stubs) or
  128. just the leaf name, in which case, LD will search though the specified
  129. library directories for the file o.<file>.
  130.  
  131. The sequence '-Lgcc: -LC: -lgcc -lstubs' will cause LD to look for the files
  132. gcc:o.gcc, c:o.gcc, gcc:o.stubs and c:o.stubs, taking the first gcc and
  133. stubs files that it finds.
  134.  
  135. LD does not recognise any other unix commands, therefore the other LD
  136. options documented in invoke_tex should not be used. Acorn link options can
  137. be passed from GCC to link using -Wl and -XLinker options.
  138.  
  139. LD requires that the linker be named 'link', even if you are using DRLink.
  140. The linker must be in the default run-path, as LD does not handle the -B
  141. command.
  142.  
  143. *       Interworking with Norcroft cc
  144.  
  145. Code compiled with GCC can be linked with code produced by the Norcroft CC
  146. compiler, with no problems. Note, if you are inter-mixing C and C++ code and
  147. linking against the supplied UnixLib library, there is no need for the
  148. main() function to be compiled by gcc - the UnixLib / gcc runtime libraries
  149. automatically handle the calling of global constructors. See Norcroft Stubs
  150. / ANSILib for details of using the norcroft libraries with C++.
  151.  
  152. *       Predefines
  153.  
  154. The following preprocessor constants are defined for GCC:
  155.         arm, __arm, __arm__
  156.         riscos, __riscos, __riscos__
  157.         __GNUC__
  158.  
  159. However, the predefined 'riscos' clashes with a variable used in UnixLib,
  160. and therefore this will automatically be undefined again, unless you disable
  161. the standard set of include files by using the switch '-nostdinc'.
  162.  
  163. *       RISC OS specific switches
  164.  
  165. The following RISC OS specific switches are recognised
  166. -acorn-make
  167.         The compiler is being run under AMU, and therefore should generate
  168.         the !Depend file for AMU's dynamic dependencies.
  169.  
  170. -mno-apcs
  171.         Do not use APCS-R calling specification
  172.  
  173. -nno-function-name
  174.         Do not embed function names in object code.
  175.  
  176. -mfpa
  177.         Object code is intended to run using the floating point accelerator,
  178.         rather than fpe, therefore pay attention to scheduling of
  179.         instructions. [NYI]
  180.  
  181. -mno-stack-check
  182.         Do not use CLIB stack checking.
  183.  
  184. *       Search paths
  185.  
  186. The search paths for GCC are as follows and searched in the specified order.
  187.         GPP$Path        for C++ only
  188.         GCC$Path        GCC specific include files.
  189.         Unix$Path
  190.  
  191. *       <varargs.h>
  192.  
  193. The versions of <varargs.h> supplied with Norcroft and UnixLib are not
  194. compatible with GCC, you will have to use the GNU version. For the supplied
  195. UnixLib, this is done automatically, but if you are using other libraries,
  196. you need to include the GCC include directory in the search path, BEFORE the
  197. library include path. i.e. -IGCC: -IC:. This does not apply to <stdargs.h>.
  198.  
  199. *       Wimpslot
  200.  
  201. Due to the structure of the stack under UnixLib, GCC is not able to extend
  202. its wimpslot, and therefore you will have to set it to the required size
  203. from the start (around 2.5 - 3 meg is usualy enough).
  204.  
  205.  
  206. 2.2     Feature not yet implemented
  207.  
  208. *       debugging data
  209.  
  210. There is as yet, no debugging data generated by gcc. Therefore, DDT can only
  211. be used for object level debugging, not source level.
  212.  
  213. Actualy, gcc does generate the debugging data, but !as cannot do anything
  214. with it, therefore the data is commented out.
  215.  
  216. *       Throwback
  217.  
  218. Errors are currently output only to the screen. Later versions will support
  219. Throwback
  220.  
  221.  
  222.  
  223. 3       Implementation details
  224.  
  225.  
  226. *       compilers
  227.  
  228. The supplied C/C++ compilers are the stage 1 compilers, produced by norcroft
  229. CC, as these are significantly smaller and faster than those produced by the
  230. current version of GCC.
  231.  
  232. *       C++ global constructors / destructors
  233.  
  234. For most Unix based C++ compilers, there is a separate stage to the linking
  235. process called collect2, which separates out the global constructors and
  236. destructors for C++. The RISC-OS C++ compiler uses the named area feature so
  237. that the linker groups all the function addresses together, and brackets
  238. them with the required data.
  239.  
  240. The function addresses are placed into the areas 'C++$$constructor2' and
  241. 'C++$$destructor2'. If there are functions that must be called before /
  242. after the function calls, their addresses should be put into the areas
  243. 'C++$$constructor1' / 'C++$$destructor1' and 'C++$$constructor3' /
  244. 'C++$$destructor3' respectively.
  245.  
  246. *       Stack checking
  247.  
  248. This version of GCC fully supports APCS-R stack checking, therefore there is
  249. no need to set the size of the stack chunk when using Stubs / ANSILib.
  250.  
  251. *       Libraries
  252.  
  253. When separately linking C++ executables with global constructors, the gcc
  254. library requires some routines from the main run-time library. Therefore,
  255. the gcc library must be placed before the main run-time library in the
  256. command line or, if using DRLink, the -rescan command should be given..
  257.  
  258. *       UnixLib
  259.  
  260. The version of UnixLib that is shipped with GCC is based on version 3.6c,
  261. with minor bug fixes and C++ specific features. It has also been re-worked,
  262. so that DRLink version 0.24 can be used with this version of Unixlib. Note,
  263. there is a bug in DRLink which will generally prevent it working with other
  264. versions of UnixLib.
  265.  
  266.  
  267.  
  268. 4.      Known Bugs / Problems
  269.  
  270.  
  271. There is a problem with UnixLib, which affects the running of AMU - if one
  272. compilation fails, with a non-zero return code, subsequent compilations
  273. during the same AMU run also fail. I believe this to be due to UnixLib not
  274. correctly setting / resetting some data.
  275.  
  276. Occasionaly, GCC gets stuck with cc1 (I think) always returning an exit code
  277. of 1, and causing all subsequent compilations to fail. Pressing f12,
  278. followed by return appears to clear this problem. This is just another
  279. aspect of the AMU problem, but it tends to be more annoying, as it extend
  280. past the end of one AMU run to th next.
  281.  
  282. Unixlib also has a problem dealing with includes of filenames of the form
  283. "sys.fcntl.h" - Use "sys/fcntl.h" instead. This is more portable, anyway,
  284. and should not cause major problems.
  285.  
  286. When used with !Virtual (version 0.37), gcc occasionally freezes the
  287. computer with the interrupts working (ie. the mouse moves and caps lock
  288. changes), but nothing else works. The computer has to be reset using the
  289. reset button, and it has twice damaged the frespace map on my hard disc. I
  290. think this is a bug in GCC/ UnixLib, but again I'm not sure.
  291.  
  292.  
  293.  
  294. 5.      Acknowledgements, sources and other bits
  295.  
  296.  
  297. *       Acknowledgements
  298.  
  299. As with all large programs, thanks go to various people for the help and
  300. assistance that they have given me. These are :
  301.  
  302.         Michael Ben-Gershon, for most (if not all) of the hard work involved
  303. in the ARM backend.
  304.  
  305.         Niklas Röjemo, for the assembler.
  306.  
  307.         Huw Rogers, for Unixlib.
  308.  
  309. *       Sources
  310.  
  311. The standard sources for !as (version 1.21) and UnixLib (3.6c) are freely
  312. available from various FTP servers (HENSA, newcastle, Stuttgart etc.),
  313. though some changes have been made to both of these. Those made to UnixLib
  314. have been passed on to Huw Rogers, and may be released in the future. The
  315. !as changes are only needed for certain esoteric checks when making GCC, and
  316. I doubt that anyone would notice the difference.
  317.  
  318. If you want the complete sources, your best action is to obtain the standard
  319. sources to Gcc / UnixLib / !as, and send me a floppy for the diffs that I
  320. have made - otherwise you will have to send me a LOT of floppies.
  321.  
  322.  
  323.  
  324. 5.      Undocumented Features (sic)
  325.  
  326.  
  327. Probably hundreds of the little swines !
  328. Come on, you can not honestly expect me to document undocumented features,
  329. can you? Anyway, wouldn't a documented, undocumented feature be an oxymoron?
  330.