Content / Index
Compilation with OSK GCC Port (Gnu C Compiler)
There are 3 different ways :
- Using a makefile
- Using hmake.txt with hmake
- Using the command file to compile a single .cc file : /h0/home/cc/oskbat/ccs
In the OS-9-Computer there should be a line in file /h0/SYS as :
CC,CC,0.0,128,/h0/CMDS,/h0/HOME/CC,mshell -e=/h0/sys/errmsg
Then in /h0/HOME/CC there should be a file .login which prepares :
- Using a makefile (supported until 2000)
- Using hmake.txt with hmake (supported from 2001)
- Using the command file to compile a single .cc file : /h0/home/cc/oskbat/ccs
and then to link the file /h0/home/cc/oskbat/lnk
This must be performed from a mshell, never from shell nor tci.
Example of file /h0/home/cc/oskbat/ccs :
gcc2 -Wall -I/h0/GCC258/DEFS/GCC2 -I/h0/GCC258/DEFS/GPP2 \
-I/h0/HOME/CC/INCLUDE -T/r0 -m68040 -O2 \
$(P0).cc -c -o OS9/$(P0).r
Example of file /h0/home/cc/oskbat/lnk :
gcc2 #12 OS9/$(P0).r -g -v -++lib -L/h0/GCC258/LIB \
-l/h0/HOME/CC/OS9/lq.l -l/h0/LIB/mpzlib.l \
-l/h0/LIB/net.l -o /h0/home/cc/cmds/$(P0)
Hint: gcc shows usage of all switches when invoked gcc2 -?
Usage: gcc2 {options} {files} {options}
Options: (Do not concatenate single letter options)
Control compile stages
-c not run linker
-o68 (use -optasm instead!)
-optasm use assembly optimizer (o68 or opt68k)
-ucc use UltraC utilities (opt68k,r68,l68)
-S only compile source files
-E only preprocess source files
-M only print dependencies
-MM like -M except mention only user header files
-MD like -M except information is written to a <name>.d file
-MMD like -MD except mention only user header files
-pipe connect preprocessor and compiler via pipe
-debug not execute but only print command to execute
-v print version and commands to execute
-Q not quiet mode
-BPREFIX use PREFIX for commands
-bPREFIX use machine dependent PREFIX for commands and libraries
-LDIR search DIR for library files
-TDIR specify DIR of temp files
-FPROGsSIZEpPRIOo[OPT]x[XPROG] fork PROG with OPTions, additional stack SIZE
and PRIOrity, use XPROG to replace PROG in its stage
(PROG is one of : cccp2 cc2 cc2plus o68 opt68k r68
r68020 collect l68)
Output
-o FILE output to FILE
-x put executable file into default execution directory
-col do not delete collector output file
Warning
-W issue warnings
-Wall issue all warnings mentioned below
-WCASE CASE is one of
aggregate-return cast-align cast-qual comment
conversion error format id-clash-LEN enum-clash
implicit import inline missing-prototypes nested-externs
parentheses pointer-arith redundant-decls return-type
shadow strict-prototypes switch traditional trigraphs
uninitialized unused write-strings char-subscripts
-w inhibit all warnings
Portability
-ansi support ANSI standard
-traditional try to imitate traditional C compiler
-pedantic support pedantic ANSI standard
-pedantic-errors like -pedantic, but errors instead of warnings
-uwlibs compile/link for/with original clib instead of gclib
-ucclibs compile/link C for/with UltraC libraries instead of gclib
(see also -muccmode)
-ucclibs+ compile/link C++ for/with UltraC libraries
Preprocessor
-DMACRO[=DEF] define MACRO (by DEF)
-UMACRO undefine MACRO
-dM tell cccp2 to output only a list of the macro definitions
that are in effect at the end of preprocessing
-dD tell cccp2 to pass all macro definitions into the output
-dN like -dD execpt that macro args and contents are omitted
-H print the name of each header file used
-IDIR search include file in DIR
-I- dir specified by the -Idir before -I- applies to only user
include files
-iFILE get only #define's in FILE
-nostdinc do not use standard directory of include files
-C include comments in preprocessor output
-traditional-cpp try to imitate traditional cpp
-trigraphs support ANSI trigraphs
Compiler
-O0,1,2 optimize
-a enable basic block profiler
-gg or -gsrcdbg generate debug code for srcdbg
-mMACHINESPEC MACHINESPEC is one of
(c)68000 (c)68020 (c)68030 (c)68040 (c)68020-40
(c)68040-only cpu32 68881 soft-float (no)short
(no)bitfield (no)com (no)rtd (no)remote (no)stack-check
(no)gss (no)long-calls (no)regparm (no)stdstack-check
(no)uccmode (no)uccasm use-argptr dynamic-stack
-fFLAG FLAG is one of
Optimization :
caller-saves cse-follow-jumps cse-skip-blocks
delayed-branch expensive-optimizations fast-math
float-store force-addr force-mem inline-functions
keep-inline-functions no-defer-pop no-function-cse
no-inline no-peephole omit-frame-pointer
rerun-cse-after-loop schedule-insns schedule-insns2
strength-reduce thread-jumps unroll-all-loops
unroll-loops elide-constructors memoize-lookups
no-default-inline
Language :
cond-mismatch no-asm no-builtin signed-bitfields
signed-char unsigned-bitfields unsigned-char
writable-strings all-virtual dollars-in-identifiers
enum-int-equiv no-strict-prototype this-is-variable
Code Generation :
call-saved-REG call-used-REG fixed-REG
inhibit-size-directive nonnull-objects no-common
no-ident short-enums short-double volatile
volatile-global shared-data
pcc-struct-return reg-struct-return
Warning :
syntax-only
Debugging :
pretend-float
-dLETTERS dump debug info in various stages. LETTER is one of
y r j s L f c l g J d m
Assembler
-ob optimize branch sizing
Linker
-lFILE use library FILE
-nocol assume there are no con-/de-structors
-nostdlib do not use any standard library files and startup file
-g generate symboltable module
-cio (use -ctrap instead !)
-ctrap use cio/csl trap handler
-j inhibit to make jump table
-ghost output ghost module
-s SIZE specify additional stack SIZE of output module
-e NUMBER specify edition NUMBER of output module
-n NAME specify output module NAME
-P HEX specify permission of output module in HEX
-A FILE use alternate cstart FILE
-++lib link libgppXXX.l and libiostreamXXX.l
Adapted to OS-9/68k by Stephan Paschedag