home *** CD-ROM | disk | FTP | other *** search
- The GNU C compiler
-
-
- 0. Introduction
-
- This file (sort of) documents the Nick Burrett port of
- GNU C version 2.7.2 (RISC OS backend 1.0.5) for RISC OS versions 2 or 3.
- For copyright details and sources see !Intro, COPYING and COPYINGLIB.
-
- GCC (as the compiler is generally known) requires approximately 3 Mb
- of free RAM and a hard disc. !Virtual is compatible with GCC and so large
- C sources can be compiled on small machines.
-
- This is a binary distribution only and consists of the following packages :
-
- !GCC - Non-specific files, documentation, etc.
- !Intro General help and copy-right
- !ReadMe This file.
- !Boot
- !Run
- !Sprites
- docs.gcc-faq The RISC OS GCC FAQ document
- docs.gccuser The GNU C/C++ users manual - MakeInfo version
-
-
- GCC - GNU C compiler
- bin.gcc Front end to the C compiler.
- bin.cpp C preprocessor.
- bin.cc1 C compiler.
- gcc.o.libgcc GCC runtime library routines.
- gcc.h GCC runtime library headers
-
- Compiler support files
- as Assembler.
- ld Front end to link
-
- The compiler sources (about 27Mb) can be obtained from the sites listed at
- the end of !Intro.
-
- 1. Installation
-
- To install GCC onto a hard disc, just merge all the archives together.
- Running !gcc will setup Run$Path to automatically search for the compiler
- tools.
-
- If you wish to separate the distribution, the files in !gcc.bin should be
- copied so that they are in your run path, while GCC$Path and GPP$Path should
- point to where the GCC and GPP directories are respectively.
-
- Note, there is no linker or run-time library supplied, but DRLink and
- Unixlib 3.6e, available at various servers (HENSA, etc) are useable with
- GCC. This completes installation, and GCC may be used simply by typing
- 'gcc' at the CLI prompt.
-
- 2. Using GCC
-
- GCC uses the same assumptions as Norcroft C, with C sources held in the
- '.c' subdirectory and header files held in the '.h' subdirectory. By
- default, GCC will compile assemble and link the named sources.
-
- For most of the details for using GCC see the file Docs.gccuser.
-
- 2.1 RISC-OS specific features.
-
- * AMU
-
- This version of GCC supports the dynamic dependencies feature in the version
- of AMU supplied with desktop C. To automatically update the dependencies
- during compilation, include the '-mamu' switch in the command line. This
- will generate the !Depend file that AMU uses.
-
- * Norcroft Stubs / ANSILib
-
- By default, GCC uses the the UnixLib header and library files supplied,
- though the Norcroft files can be used. To do this you need the following
- command lines options :
-
- -nostdinc Do not use the UnixLib headers.
- -nostdlib Do not link again Unixlib / gcc
- -IGCC: Get GCC specific include files.
- -IC: Get header files from the C: path
- -lC:o.stubs Link against Stubs - you can also use -lC:o.AnsiLib
- to link with AnsiLib.
- -lGCC:o.gcc Link against gcc
-
- If you wish to link against the Shared C Library, the switch -mstubs will
- perform the above sequence.
-
-
- * LD
-
- LD is a front end to Link, which converts the LD as generated by gcc to the
- Acorn Link format. LD only recognises a few options, the rest are passed
- directly through to Link. LD also attempts to convert Unix format names to
- RISC OS format. The options that LD recognises are :
-
- -L <dir>
- This specifies a directory / path that LD is to use when searching
- for libraries. <dir> must be either a path (i.e gcc:, etc), or it
- must be a valid Unix / RISC OS directory name, ending in either '/'
- or '.'. Directories are searched in the order that they are
- specified.
-
- -l <file>
- This specifies the name of a library file which LD will search the
- library directories for. This may either be a complete filename (i.e
- C:o.stubs) or just the leaf name, in which case, LD will search
- though the specified library directories for the file o.<file>.
-
- The sequence '-Lgcc: -LC: -lgcc -lstubs' will cause LD to look for the files
- gcc:o.gcc, c:o.gcc, gcc:o.stubs and c:o.stubs, taking the first gcc and
- stubs files that it finds.
-
- LD does not recognise any other unix commands, therefore the other LD
- options documented in invoke_tex should not be used. Acorn link options can
- be passed from GCC to link using -Wl and -XLinker options.
-
- LD requires that the linker be named 'link', even if you are using DRLink.
- The linker must be in the default run-path, as LD does not handle the -B
- command.
-
- * Interworking with Norcroft cc
-
- Code compiled with GCC can be linked with code produced by the Norcroft CC
- compiler, and probably other APCS-R conformant compilers, with no problems.
-
- Experience has showed that there are minor incompatibilities between
- Norcroft C and GCC in the way structures are implemented. However, these
- incompatibilities are very minor and should not affect the general user.
-
- * Predefines
-
- The following preprocessor constants are defined for GCC:
- 'arm', '__arm', '__arm__', 'riscos', '__riscos,' '__riscos__' and
- '__GNUC__'.
-
- * RISC OS specific switches
-
- The following RISC OS specific switches are recognised
-
- * -mapcs, -mapcs-frame
- target for ARM Procedure Call Standard stack frames.
- * -mpoke-function-name
- place the name of the current function before the start of the function
- to allow the post mortem debugger to print a readable backtrace.
- Using it's opposite will reduce code size by about 3.5%.
- * -mfpe
- prevents instruction scheduling of floating point instructions since it
- increases compile time and the benefits acheived make no difference through
- the FPE.
- * -mapcs-32
- target the APCS-32 bit standard. Condition flags are assumed to be corrupted
- by function calls in this mode.
- * -mapcs-stack-check
- provide explicit stack checking on entry to each function which allocates
- temporary variables on the stack.
- * -mapcs-strict
- make the compiler conform strictly to the APCS even in the cases where
- stack frames do not need to be set up.
- * -msoft-float
- cause the compile to assume all floating point instructions are missing
- (and there is no emulator either), therefore generating function calls
- instead.
- * -mhard-float
- the opposite of -msoft-float
- * -mshort-load-bytes, -mno-short-load-words
- if the MMU traps unaligned word accesses, shorts must be loaded
- byte-at-a-time so this flag should be set.
-
- RISC OS specific options
-
- * -munique-areas
- generate each function in its own individual code area giving the linker
- extra chance to remove unused functions from the resulting binary.
- * -mthrowback
- send errors to a text editor capable of receiving 'throwbacks'.
- * -mstubs
- compiles to target SharedCLibrary and tells the linker to link with
- stubs instead of UnixLib.
- * -munixlib
- tell the linker to target UnixLib instead of the SharedCLibrary
- * -mdepend
- Generate the file !Depend which contains a list of all the source
- files that the produced object depend on. This is intended for use
- with amu, which edit the makefile to include these after the
- '# Dynamic Dependencies' line.
-
- * Search paths
-
- The default search paths for GCC are as follows and searched in the
- specified order.
- GCC$Path GCC specific include files.
- Unix$Path Unixlib header files.
-
- * <varargs.h>, <assert.h>, <stdarg.h>
-
- GCC supplies it's own versions of these header files since they are not
- compatible with the headers supplied with Norcroft C and UnixLib. However,
- this feature is invisible to the user.
-
- * Wimpslot
-
- Due to the structure of the stack under UnixLib, GCC is not able to extend
- its wimpslot, and therefore you will have to set it to the required size
- from the start (around 2.7 - 3.4 Mb is usually enough).
-
- 2.2 Feature not yet implemented
-
- * debugging data
-
- There is, as yet, no debugging data generated by gcc. Therefore, DDT can
- only be used for object level debugging, not source level. Note, this is
- very difficult to implement so don't expect anything special in the near
- and most probably distant future.
-
- * Throwback
-
- Throwback is supported, but only by the compilers. The C preprocessor does
- not support it because I didn't really see the point.
-
-
- 3 Implementation details
-
- * compilers
-
- The supplied C compiler is a stage 3 compiler (as it should be).
-
- * Stack checking
-
- This version of GCC fully supports APCS-R stack checking, therefore there is
- no need to set the size of the stack chunk when using Stubs / ANSILib.
-
- * Libraries
-
- When separately linking C++ executables with global constructors, the gcc
- library requires some routines from the main run-time library. Therefore,
- the gcc library must be placed before the main run-time library in the
- command line or, if using DRLink, the -rescan command should be given..
-
-
- 4. Known bugs / Problems
-
- This is a list of all the known (by me) bugs and problems in
- GCC 2.7.2 (ARM/RISCOS v1.0.5)
-
- Bug 1:
- Sometimes when memory is tight, the machine will completely freeze i.e. caps
- lock light doesn't work.
-
- Preventative actions:
- Try and allocate some more memory or use Virtual Memory.
-
- Nick B: I believe this bug to now be fixed but have not been able to prove
- it by time of release.
-
- ================================================================================
-
- Bug 2:
- Statements of the form #include "dir.file.h" do not work correctly - Unixlib
- does not convert this to dir.h.file
-
- Reported by: Simon Callan
-
- Preventative actions:
- Use "dir/file.h" instead. This is more portable, anyway, and should not
- cause major problems.
-
- ================================================================================
-
- 5. Acknowledgements, sources and other bits
-
- * Acknowledgements
-
- As with all large programs, thanks go to various people for the help and
- assistance that they have given me. These are :
-
- Simon Callan
- For the changes to gcc to enable it's use with an AOF assembler instead
- of an 'a.out' format one. Basically, a lot of other help for which this
- port would never have been realised.
-
- Richard Earnshaw
- For the small, but quite significant, help and advice provided with
- the RISC OS port.
-
- Peter Burwood
- Generally commenting on my code; spotting some difficult bugs; optimising
- code I couldn't be botherd to optimise; suggesting improvements; testing
- my changes; the work he helped provide on solving dynamic allocation
- and lots of other stuff too numerous to mention. Responsible for moving
- forward the GCC release date by a few months.
-
- Niklas Röjemo
- For writing the backend assembler 'as' and allowing me to contain it
- within this distribution.
-
- Jochen Scharrlach
- Provided the GCC-FAQ, supplied with this distribution and available
- elsewhere.
-
- * Sources
-
- The location of the relevant sources are described at the end of the !Intro
- file.
-