home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / c / c_pl_lib / Gcc_Inst / text0000.txt < prev   
Encoding:
Text File  |  1993-06-24  |  13.6 KB  |  414 lines

  1. OK, for those of you who find the installation notes hard to
  2. read: here is my translation of the 'ReadMe' file. Note: this
  3. is a quick translation, it is not perfect. I have changed some
  4. things and added a few lines.
  5.  
  6. Loek Frederiks (llfs7@fel.tno.nl / loek@nt.el.utwente.nl)
  7.  
  8. -------- HERE IT COMES --------
  9.  
  10. GCC for RISC OS
  11. ---------------
  12.  
  13. 0. Installation
  14.    ------------
  15.  
  16. The installation consists of:
  17.  
  18.   1. RUN$Path must be extended with the directory name, which contains the
  19.      GNU C executables. You can also copy them to your library directory.
  20.  
  21.   2. Set the variable CPATH. This variable should contain the directories,
  22.      which contain the header files. For instance:
  23.  
  24.      Set CPATH IDEFS::IDEDisc4.$.DesktopC.Clib
  25.  
  26.      CPATH can contain more than one directory name by using ';' seperators.
  27.   
  28.      For instance:
  29.  
  30.      If your header files are in $.clib.1.h and $.clib.2.h, CPATH must be
  31.      set as follows:
  32.  
  33.      Set CPATH $.clib.1;$.clib.2
  34.     
  35.      You may also want to set the variables:
  36.  
  37.      C_INCLUDE_PATH
  38.      CPLUS_INCLUDE_PATH
  39.      OBJC_INCLUDE_PATH
  40.      OBJCPLUS_INLCUDE_PATH
  41.  
  42.      CPLUS_INCLUDE_PATH and OBJCPLUS_INCLUDE_PATH will be only used during
  43.      compiling c++ sources.
  44.  
  45.   3. You may have to convert Stubs und RISC_OSlib.
  46.  
  47.   4. You must set the variable mulib$Path to the FULL directory name where
  48.      the risclib libraries can be found (e.g. stubsmu and oslib_mu). For
  49.      instance:
  50.  
  51.      Set mulib$path IDEFS::IDEDisc4.$.Temp.GNU-CC.gcc2-3-3.risclib.
  52.  
  53.      The libraries can be found by calling Libraries mulib:stubsmu and
  54.      mulib:oslib_mu
  55.  
  56.   5. The documentation can be found in the 'doc' directory.
  57.  
  58. 1. Prefixes in filenames
  59.    ---------------------
  60.  
  61. Unix expects, in contrary to RISC OS, that files types such as .c .o .cc
  62. are used as extension to the filename (e.g. myfile.c). GCC uses also all
  63. file names in this format. In order to behave correctly under RISC OS,
  64. GCC moves the file type extension to the start of the filename. For instance
  65. 'GCC sample.c' will be 'GCC c.sample'. Note: 'irgend.sample.c' will be
  66. 'c.irgend.sample'. GCC uses these extensions in order to find out the
  67. file type. 
  68.  
  69. The extensions have the following meaning:
  70.  
  71.  .c              C Source
  72.  .cc, .cxx, .C   C++ Source (Note: only .cc can be used with RISC OS)
  73.  .m              objective-C Source (not yet supported)
  74.  .o              object file
  75.  .h              header file
  76.  .i              pre-processed file (cpp output)
  77.  .ii             pre-processed C++ file
  78.  .s              assembler source
  79.  .S              assembler source (needs pre-processing)
  80.  
  81. 2. Options for GCC
  82.    ---------------
  83.  
  84. An exact explanation of the compiler options are given in the file 'invoke'
  85. in the doc directory. Most options are just like with other C compilers.
  86. You must not forget to use the -O or -O2 (optimizing) option. Without these
  87. options you will get less efficient code.
  88.  
  89. Machine dependent options:
  90.  
  91.  -mno-apsc            use the C-call convention for functions.
  92.  -mcoproc             Coprocessor is available (due to code optimizing,
  93.                       works also without one)
  94.  -mpoke-function-name function names for post mortem debugger in code
  95.  
  96. 3. Include files
  97.    -------------
  98.  
  99. For the include files is also the prefix-notation for file typen used. In
  100. the source code can the suffix-notation be used. The pre-processor converts
  101. these file names to prefix notation and recognizes the Unix directory paths.
  102. For instance /usr/include/sys/times.h becomes $.usr.include.sys.h.times,
  103. ../my-header.h becomes ^.h.my-header. The compiler recognizes only the
  104. file extensions .h und .c.
  105.  
  106. Search order for include files:
  107.  
  108.   1. current directory or the directories, which have been entered using
  109.      the -I option 
  110.   2. the directories, which are given by CPATH.
  111.   3. the directories given by C_INCLUDE_PATH (Standard C),
  112.      CPLUS_INCLUDE_PATH (C++), OBJC_INCLUDE_PATH (Objective C) or
  113.      OBJCPLUS_INLCUDE_PATH (Objective C++)
  114.  
  115. The 'environment variables' may contain more directories (by using the
  116. ';' character as seperator). The Unix notation may also be used. However,
  117. different from RISC OS, the '.' or '/' character may not be the last
  118. character in direcory name (the Pre-Processor will do this for you). Also
  119. the '.h' must not be used in the path name.
  120.  
  121. 4. Linker
  122.    ------
  123.  
  124. The linker must be called separately from the compiler (you must also
  125. use the -c option). In order to get 'absolute' code the linker must be
  126. called as follows:
  127.  
  128.  mulink -F -a32768 -osample -C o.sample1 o.sample2 mulib:stubsmu
  129.  settype sample absolute
  130.  
  131. Explanation:
  132.  
  133. mulib$path contains the directory name where 'stubsmu' can be found.
  134.  
  135.  -F       first object file must always be linked (only , when referenced).
  136.           If stubsmu is linked, this option is not particulary necessary,
  137.           because stubsmu has set the Obligatory-Link-Flag (will always be
  138.           linked) and contains a reference to 'main'.
  139.  -a32768  Absolute code with execution address &8000.
  140.  -osample sample will be the output file (Note: no spaces)
  141.  -C       only the code, without header, publics, relocs.
  142.  
  143. If the -a and -C options are not used, a object-file will be produced.
  144.  
  145. Further options:
  146.  
  147.  -x          a list of symbols, moduls and their addresses (e.g. offsets)
  148.              will be given.
  149.  
  150.  -+          link C++ - code. The linker will search for symbol names in a
  151.              C++ fashion and if they could not be found, they are converted
  152.              into standard-C name. For instance:
  153.  
  154.              printf( "%d", 10 )
  155.      
  156.              generates in C++ a assembler call:
  157.           
  158.              ... bl printf__FPci
  159.  
  160.              If a symbol printf__FPci exists, the linker will generate a call
  161.              to this symbol. Otherwise (with the -+ option) the name printf
  162.              will be used (without __F...).
  163.  
  164.  -$<suffix>  the characters, which in C++ symbol names is used between
  165.              the 'normal' name of the function and the type. Default: __F.
  166.  -u       do not print a liste of undefined externals
  167.  
  168. All other options are ignored by RISC OS version (have no meaning).
  169.  
  170. Stubs MUST be linked before the RISC_OSlib is linked. The file which
  171. contains the function main MUST be linked first. In other cases the
  172. order of the object files doesn't matter. Objects which are not referenced
  173. by none of the other object files are simply ignored. For instance:
  174.  
  175.  mulink -F o.sample1 o.sample2 mulib:stubsmu
  176.  
  177. o.sample2 will not be linked, if neither in mulib:stubsmu nor in o.sample1
  178. a function or variable from o.sample1 is referenced.
  179.  
  180. If Stubs are linked, the following message could be printed:
  181.  
  182.  unresolved external(s)
  183.    '__root_stack_size' in module 'Stub$$Code'
  184.    '__RelocCode' in module 'Stub$$Code'
  185.  
  186. Both references are in AOF-files as 'weak binding' defined and don't have
  187. to be declared. Applications will be linked correctly.
  188.  
  189. If the RISC_OSlib is linked, the following message is printed:
  190.  
  191.  warning: double defined public variable(s):
  192.  
  193. Simply ignore this :-)
  194.  
  195. 5. AOFConvert
  196.    ----------
  197.  
  198. AOFConvert is a utility which converts object files in AOF-Format into
  199. the MUPROS format.
  200.  
  201. You have to use it as follows:
  202.  
  203.  AOFConvert -l -osample o.sample
  204.  
  205. The option -l suppresses all warnings (which are not interesting). During
  206. some circumstances you will also have to use the -O option. Then will the
  207. converted object ALWAYS be linked (if it is used somewhere in conjunction
  208. with MULINK, even if no reference is fullfilled).
  209.  
  210. 6. Assembler
  211.    ---------
  212.  
  213. If you like to use the assembler, you are referred to the tex file (in the
  214. doc directory) and the RISC OS PRM's. The assembler is called by using:
  215.  
  216.  as -o o.sample s.sample
  217.         
  218. A object file in MUPROS format will be generated. Note: assembler
  219. instructions must be lower case. Register names may be upper case or
  220. lower case. ARM/MUPROS specific pseudo-instructions:
  221.  
  222.  .objname <name>       the just assembled object will be called
  223.                        <name> (Default: Dateiname)
  224.  .segid <name>         the segment ID becomes <name> (Default: 'code')
  225.  .segattr <'RO'|'RW'>  Read-only or Read-Write Segment (Default: 'RW')
  226.  
  227. At the moment the assembler does not support separate code, data and null
  228. initialised segments (.text, .data, .bss), these will be assembled in
  229. different files.
  230.  
  231. An example of a assembler source code is risclib.s.div-fast. More examples
  232. can be generated using GCC -O -S ...
  233.  
  234. A full list of the assembler instructions (from the source code):
  235.  
  236. /* format of the assembler string :
  237.    
  238.    %<bitfield>r         print as an ARM register
  239.    %<bitfield>f         print a floating point constant if >7 else an
  240.                         fp register
  241.    %c                   print condition code (always bits 28-31)
  242.    %P                   print floating point precision in arithmetic insn
  243.    %Q                   print floating point precision in ldf/stf insn
  244.    %R                   print floating point rounding mode
  245.    %<bitnum>'c          print specified char iff bit is one
  246.    %<bitnum>-<len>'c    print specified char iff bit is one and length of
  247.                         command after c is at least len
  248.    %<bitnum>`c          print specified char iff bit is zero
  249.    %<bitnum>?ab         print a if bit is one else print b
  250.    %p                   print 'p' iff bits 12-15 are 15
  251.    %o                   print operand2 (immediate or register + shift)
  252.    %a                   print address for ldr/str instruction
  253.    %b                   print branch destination
  254.    %A                   print address for ldc/stc/ldf/stf instruction
  255.    %m                   print register mask for ldm/stm instruction
  256.    %s                   print bits 0-23 as swi number/name
  257.    %L                   print ldm type (fd, ea and the like ...)
  258.    %S                   print stm type
  259.    %r                   print adr operand
  260.  
  261. /* ARM instructions */
  262.  
  263. "mul%c%20's %16-19r,%0-3r,%8-11r",
  264. "mla%c%20's %16-19r,%0-3r,%8-11r,%12-15r",
  265. "and%c%20's %12-15r,%16-19r,%o",
  266. "eor%c%20's %12-15r,%16-19r,%o",
  267. "sub%c%20's %12-15r,%16-19r,%o",
  268. "rsb%c%20's %12-15r,%16-19r,%o",
  269. "add%c%20's %12-15r,%16-19r,%o",
  270. "adr%c%20's %12-15r,%r",
  271. "adc%c%20's %12-15r,%16-19r,%o",
  272. "sbc%c%20's %12-15r,%16-19r,%o",
  273. "rsc%c%20's %12-15r,%16-19r,%o",
  274. "tst%c%p %16-19r,%o",
  275. "teq%c%p %16-19r,%o",
  276. "cmp%c%p %16-19r,%o",
  277. "cmn%c%p %16-19r,%o",
  278. "orr%c%20's %12-15r,%16-19r,%o",
  279. "mov%c%20's %12-15r,%o",
  280. "bic%c%20's %12-15r,%16-19r,%o",
  281. "mvn%c%20's %12-15r,%o",
  282. "str%c%22'b %12-15r,%a",
  283. "ldr%c%22'b %12-15r,%a",
  284. "stm%c%S %16-19r%21'!,%m",
  285. "ldm%c%L %16-19r%21'!,%m%22'^",
  286. "b%24-2'l%c%24'l %b",
  287. "swi%c %s",
  288.  
  289. /* Floating point coprocessor instructions */
  290.  
  291. "adf%c%P%R %12-14f,%16-18f,%0-3f",
  292. "muf%c%P%R %12-14f,%16-18f,%0-3f",
  293. "suf%c%P%R %12-14f,%16-18f,%0-3f",
  294. "rsf%c%P%R %12-14f,%16-18f,%0-3f",
  295. "dvf%c%P%R %12-14f,%16-18f,%0-3f",
  296. "rdf%c%P%R %12-14f,%16-18f,%0-3f",
  297. "pow%c%P%R %12-14f,%16-18f,%0-3f",
  298. "rpw%c%P%R %12-14f,%16-18f,%0-3f",
  299. "rmf%c%P%R %12-14f,%16-18f,%0-3f",
  300. "fml%c%P%R %12-14f,%16-18f,%0-3f",
  301. "fdv%c%P%R %12-14f,%16-18f,%0-3f",
  302. "frd%c%P%R %12-14f,%16-18f,%0-3f",
  303. "pol%c%P%R %12-14f,%16-18f,%0-3f",
  304. "mvf%c%P%R %12-14f,%0-3f",
  305. "mnf%c%P%R %12-14f,%0-3f",
  306. "abs%c%P%R %12-14f,%0-3f",
  307. "rnd%c%P%R %12-14f,%0-3f",
  308. "sqt%c%P%R %12-14f,%0-3f",
  309. "log%c%P%R %12-14f,%0-3f",
  310. "lgn%c%P%R %12-14f,%0-3f",
  311. "exp%c%P%R %12-14f,%0-3f",
  312. "sin%c%P%R %12-14f,%0-3f",
  313. "cos%c%P%R %12-14f,%0-3f",
  314. "tan%c%P%R %12-14f,%0-3f",
  315. "asn%c%P%R %12-14f,%0-3f",
  316. "acs%c%P%R %12-14f,%0-3f",
  317. "atn%c%P%R %12-14f,%0-3f",
  318. "flt%c%P%R %16-18f,%12-15r",
  319. "fix%c%P%R %12-15r,%0-2f",
  320. "wfs%c %12-15r",
  321. "rfs%c %12-15r",
  322. "wfc%c %12-15r",
  323. "rfc%c %12-15r",
  324. "cmf%c %16-18f,%0-3f",
  325. "cnf%c %16-18f,%0-3f",
  326. "cmfe%c %16-18f,%0-3f",
  327. "cnfe%c %16-18f,%0-3f",
  328. "stf%c%Q %12-14f,%A",
  329. "ldf%c%Q %12-14f,%A",
  330.  
  331. 6. Stubs / RISC_OSlib
  332.    ------------------
  333.  
  334. With the GNU C/C++ compiler, you should have also the converted versions
  335. of Stubs and RISC_OSlib (stubsmu and oslib_mu in the directory risclib).
  336. If this is not the case, you can generate these libraries by executing
  337. the Obey file risclib.makelibs.
  338.  
  339. Again: link Stubs always before RISC_OSlib.
  340.  
  341. 7. Your own libraries
  342.    ------------------
  343.  
  344. Libraries are constructed as follows:
  345.  
  346.   1. compile single modules
  347.   2. put the objects in one file (e.g. using fappend)
  348.  
  349. BTW:
  350.  
  351.   mulink .... o.sample1 o.sample2
  352.  
  353. is exactly the same as:
  354.  
  355.   fappend o.sample1 o.sample2
  356.   mulink .... o.sample1
  357.                      
  358. Note: if someone has written a number of functions or classes, which 
  359. are very interesting: PLEASE let also other people use them. If this is
  360. the case, contact me. I will try to distribute them. I hope, other people
  361. will respond. 
  362.  
  363. 8. Objective C
  364.    -----------
  365.  
  366. The current RISC OS version of GNU C/C++ does not support objective C.
  367. If you have a need for this, please contact me.
  368.  
  369. 9. "Support"
  370.    ---------
  371.                
  372. In many mailboxes you will find discussions about GNU C/C++. If you
  373. have access to Internet, for instance UUCP-News, you can read the newsgroup
  374. gnu.g++... For RISC OS specific problems I can be contacted at:
  375.  
  376. Thomas Aeby
  377. Graeffet 406
  378. 1735 Giffers
  379. Schweiz
  380. Tel. 037 38 16 00
  381. EMail aeby@uropax.contrib.de
  382.  
  383. 10. Source code
  384.     -----------
  385.  
  386. All source code of the compiler and the assembler are available from
  387. the address above.
  388.  
  389. 11. Floating point arithmetic
  390.     -------------------------
  391.  
  392. Floating point arithmetic can be used. However, is not very well tested.
  393.  
  394. 12. Memory
  395.     ------
  396.  
  397. In order to compile C++ programs, you will need more than 2Mb free memory
  398. (task slot). Standard C uses less memory, but you will still need about
  399. 1-1.2 Mb. Error messages like 'virtual memory exhausted' mean lack of
  400. memory.
  401.  
  402. NOTE: gcc will not work under Virtual (by Nick Smith), because gcc
  403. calls the preprocessor and the 'real' compiler using the 'system' call.
  404. A solution is on its way.
  405.  
  406. 13. Debugger
  407.     --------
  408.  
  409. Sorry, is not supported. On assembler level, you can (of course) make use
  410. of both !DDT and Debug. Source-Level-Debugging' is not supported.
  411.  
  412.  
  413.  
  414.