view docs/ccguide/phases.appendix @ 1331:0a3500c747de

Fixed ANOTHER bug
author boisy
date Sun, 07 Sep 2003 00:53:51 +0000
parents db5f03aa3544
children
line wrap: on
line source

<appendix>
<title>Compiler Phase Command Lines</title>
<para>
This appendix describes the command lines and options for the
individual compiler phases. Each phase of the compiler may be
executed separately. The following information describes the
options available to each phase.
</para>

<section><title>cc1 &amp; cc2 (C executives)</title>
<cmdsynopsis>
  <command>cc</command>
  <arg>options</arg>
  <arg rep="repeat" choice="plain"><replaceable>file</replaceable></arg>
  <arg>options</arg>
</cmdsynopsis>
<para>
Recognized file suffixes:
</para>
<informaltable frame="none">
<tgroup cols="2">
<colspec colwidth="0.9in"/>
<colspec colwidth="3.0in"/>
<tbody>
<row>
    <entry>.c</entry>
    <entry>C source file</entry>
</row>
<row>
    <entry>.a</entry>
    <entry>Assembly language source file</entry>
</row>
<row>
    <entry>.r</entry>
    <entry>Relocatable module format file</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
Recognized options: (UPPER and lower case is equiv.)
</para>
<informaltable frame="none">
<tgroup cols="2">
<colspec colwidth="0.9in"/>
<colspec colwidth="3.0in"/>
<tbody>
<row>
    <entry>-a</entry>
    <entry>Suppress assembly. Leave output in ".a" file.</entry>
</row>
<row>
    <entry>-e=n</entry>
    <entry>Edition number (n) is supplied to c.prep for
    inclusion in module psect and/or to c.link for
    inclusion as the edition number of the linked
    module.</entry>
</row>
<row>
    <entry>-o</entry>
    <entry>Inhibits assembly code optimizer pass.</entry>
</row>
<row>
    <entry>-p</entry>
    <entry>Invoke compiler function profiler.</entry>
</row>
<row>
    <entry>-r</entry>
    <entry>Suppress link step. Leave output in ".r" file.</entry>
</row>
<row>
    <entry>-m=<replaceable>size</replaceable></entry>
    <entry>Size in pages (in kbytes if followed by a K) of
additional memory the linker should allocate to
object module.</entry>
</row>
<row>
    <entry>-l=<replaceable>path</replaceable></entry>
    <entry>Library file for linker to search before the standard library.</entry>
</row>
<row>
    <entry>-f=<replaceable>path</replaceable></entry>
    <entry>Override other output naming. Module name (in
object module) is the last name in the pathlist.
-f is not allowed with -a or -r.</entry>
</row>
<row>
    <entry>-c</entry>
    <entry>Output comments in assembly language code.</entry>
</row>
<row>
    <entry>-s</entry>
    <entry>Suppress generation of stack-checking code.</entry>
</row>
<row>
    <entry>-d<replaceable>NAME</replaceable></entry>
    <entry>Is equivalent to #define <replaceable>NAME</replaceable> 1 in the
preprocessor. -d<replaceable>NAME</replaceable>=<replaceable>STRING</replaceable>
is equivalent
to #define <replaceable>NAME</replaceable> <replaceable>STRING</replaceable>.</entry>
</row>
<row>
    <entry>-n=<replaceable>name</replaceable></entry>
    <entry>output module name. <replaceable>name</replaceable> is used to override
    the -f default output name.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
CC1 only:
</para>
<informaltable frame="none">
<tgroup cols="2">
<colspec colwidth="0.9in"/>
<colspec colwidth="3.0in"/>
<tbody>
<row>
    <entry>-x</entry>
    <entry>Create, but do not execute c.com command file.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
CC2 only:
</para>
<informaltable frame="none">
<tgroup cols="2">
<colspec colwidth="0.9in"/>
<colspec colwidth="3.0in"/>
<tbody>
<row>
    <entry>-q</entry>
    <entry>Quiet mode. Suppress echo of file names.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</section>

<section><title>c.prep (C macro preprocessor)</title>
<cmdsynopsis>
  <command>c.prep</command>
  <arg>options</arg>
  <arg choice="plain"><replaceable>path</replaceable></arg>
  <arg>options</arg>
</cmdsynopsis>
<para>
<replaceable>path</replaceable> is read as input. C.prep causes c.comp to generate
psect directive with last element of pathlist and _c as the
psect name. If <replaceable>path</replaceable> is /d0/myprog.c, psect name is myprog_c.
Output is always to stdout.
</para>
<para>
Recognized options:
</para>
<informaltable frame="none">
<tgroup cols="2">
<colspec colwidth="0.9in"/>
<colspec colwidth="3.0in"/>
<tbody>
<row>
    <entry>-l</entry>
    <entry>Cause c.comp to copy source lines to assembly output as comments.</entry>
</row>
<row>
    <entry>-E=<replaceable>n</replaceable></entry>
    <entry></entry>
</row>
<row>
    <entry>-e=<replaceable>n</replaceable></entry>
    <entry>Use <replaceable>n</replaceable> as psect edition number.</entry>
</row>
<row>
    <entry>-D<replaceable>NAME</replaceable></entry>
    <entry>Same as described above for cc1/cc2.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</section>

<section><title>c.comp (One-pass compiler)</title>
<cmdsynopsis>
  <command>c.comp</command>
  <arg>options</arg>
  <arg><replaceable>file</replaceable></arg>
  <arg>options</arg>
</cmdsynopsis>
<para>
If <replaceable>file</replaceable> is not present, c.comp will read stdin. Input text
need not be c.prep output, but no preprocessor directives are
recognized (#include, #define, macros etc.). Output assembly
code is normally to stdout. Error message output is always
written to stdout.
</para>
<para>
Recognized options:
</para>
<informaltable frame="none">
<tgroup cols="2">
<colspec colwidth="0.9in"/>
<colspec colwidth="3.0in"/>
<tbody>
<row>
    <entry>-s</entry>
    <entry>Suppress generation of stack checking code.</entry>
</row>
<row>
    <entry>-p</entry>
    <entry>Generate profile code.</entry>
</row>
<row>
    <entry>-o=<replaceable>path</replaceable></entry>
    <entry>Write assembly output to <replaceable>path</replaceable>.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</section>

<section><title>c.pass (Pass One/Two of Two-pass Compiler)</title>
<cmdsynopsis>
  <command>c.pass1</command>
  <arg>options</arg>
  <arg><replaceable>file</replaceable></arg>
  <arg>options</arg>
</cmdsynopsis>
<cmdsynopsis>
  <command>c.pass2</command>
  <arg>options</arg>
  <arg><replaceable>file</replaceable></arg>
  <arg>options</arg>
</cmdsynopsis>
<para>
Command line and options are the same as c.comp. If the
options given to c.pass1 are not given to c.pass2 also, c.pass2
will not be able to read the c.pass1 output. Both c.pass1 and
c.pass2 read stdin and write stdout normally.
</para>
</section>

<section><title>c.opt (Assembly code optimizer)</title>
<cmdsynopsis>
  <command>c.opt</command>
  <arg><replaceable>inpath</replaceable></arg>
  <arg><replaceable>outpath</replaceable></arg>
</cmdsynopsis>
<para>
C.opt reads stdin and writes stdout. <replaceable>inpath</replaceable>
must be present if <replaceable>outpath</replaceable> is given.
Since c.opt rearranges and changes code, comments and assembler directives
may be rearranged.
</para>
</section>

<section><title>c.asm (Assembler)</title>
<cmdsynopsis>
  <command>c.asm</command>
  <arg choice="plain"><replaceable>file</replaceable></arg>
  <arg>options</arg>
</cmdsynopsis>
<para>
C.asm reads <replaceable>file</replaceable> as assembly language input. Errors are
written to stderr. Options are turned on with one '-' and
negated with '--'. To turn listing on use -l. To turn
listing off use --l. To turn conditionals off use --c.
</para>
<para>
Recognized options:
</para>
<informaltable frame="none">
<tgroup cols="2">
<colspec colwidth="0.9in"/>
<colspec colwidth="3.0in"/>
<tbody>
<row>
    <entry>-o=<replaceable>path</replaceable></entry>
    <entry>Write relocatable output to path. Must be a disk file.</entry>
</row>
<row>
    <entry>-l</entry>
    <entry>Write listing to stdout. (default off)</entry>
</row>
<row>
    <entry>-c</entry>
    <entry>List conditional assembly lines. (default on)</entry>
</row>
<row>
    <entry>-f</entry>
    <entry>Formfeed for top of form. (default off)</entry>
</row>
<row>
    <entry>-g</entry>
    <entry>List all code bytes generated. (default off)</entry>
</row>
<row>
    <entry>-x</entry>
    <entry>Suppress macro expansion listing. (default on)</entry>
</row>
<row>
    <entry>-e</entry>
    <entry>Print errors. (default on)</entry>
</row>
<row>
    <entry>-s</entry>
    <entry>Print symbol table. (default off)</entry>
</row>
<row>
    <entry>-d<replaceable>n</replaceable></entry>
    <entry>Set lines per page to <replaceable>n</replaceable>. (default 66).</entry>
</row>
<row>
    <entry>-w<replaceable>n</replaceable></entry>
    <entry>Set line width to <replaceable>n</replaceable>. (default 80).</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</section>

<section><title>c.link (Linker)</title>
<cmdsynopsis>
  <command>c.link</command>
  <arg>options</arg>
  <arg choice="plain"><replaceable>mainline</replaceable></arg>
  <arg rep="repeat" choice="plain"><replaceable>subn</replaceable></arg>
  <arg>options</arg>
</cmdsynopsis>
<para>
C.link turns c.asm output into executable form. All input
files must contain relocatable object format (ROF) files.
<replaceable>mainline</replaceable> specifies the base module from which to resolve
external references. A mainline module is indicated by setting
the type/lang value in the psect directive to non-zero. No other
ROF can contain a mainline psect. The mainline and all
subroutine files will appear in the final linked object module
whether actually referenced or not.
</para>
<para>
For the C Compiler, cstart.r is the mainline module. It is the
mainline module's job to perform the initialization of data and
the relocation of any data-text and data-data references within
the initialized data using the information in the object module
supplied be c.link.
</para>
<para>
Recognized options:
</para>
<informaltable frame="none">
<tgroup cols="2">
<colspec colwidth="0.9in"/>
<colspec colwidth="3.0in"/>
<tbody>
<row>
    <entry>-o=<replaceable>path</replaceable></entry>
    <entry>Linker object output file. Must be a disk
file. The last element in <replaceable>path</replaceable> is used as the
module name unless overridden by -n.</entry>
</row>
<row>
    <entry>-n=<replaceable>name</replaceable></entry>
    <entry>Use <replaceable>name</replaceable> as object file name.</entry>
</row>
<row>
    <entry>-l=<replaceable>path</replaceable></entry>
    <entry>Use <replaceable>path</replaceable> as library file. A library file
consistes of one or more merged assembly ROF
files. Each psect in the file is checked to see
if it resolves any unresolved references. If
so, the module is included on the final output
module, otherwise it is skipped. No mainline
psects are allowed in a library file. Library
files are searched on the order given on the
command line.</entry>
</row>
<row>
    <entry>-E=<replaceable>n</replaceable></entry>
    <entry></entry>
</row>
<row>
    <entry>-e=<replaceable>n</replaceable></entry>
    <entry><replaceable>n</replaceable> is used for the edition number in the final
output module. 1 is used is -e is not present.</entry>
</row>
<row>
    <entry>-M=<replaceable>size</replaceable></entry>
    <entry><replaceable>size</replaceable> indicates the number of pages (kbytes if
size is followed by a K) of additional memory,
c.link will allocate to the data area of the
final object module. If no additional memory is
given, c.link add up the total data stack
requirements found in the psect of the modules
in the input modules.</entry>
</row>
<row>
    <entry>-m</entry>
    <entry>Prints linkage map indicating base addresses of
the psects in the final object module.</entry>
</row>
<row>
    <entry>-s</entry>
    <entry>Prints final addresses assigned to symbols in
the final object module.</entry>
</row>
<row>
    <entry>-b=<replaceable>ept</replaceable></entry>
    <entry>Link C functions to be callable by BASIC09.
<replaceable>ept</replaceable> is the name of the function to be
transferred to when BASIC09 executes the RUN command.</entry>
</row>
<row>
    <entry>-t</entry>
    <entry>Allows static data to appear in a BASIC09 callable
module. It is assumed the C function called
and the calling BASIC09 program have provided
a sufficiently large static storage data area
pointed to by the Y register.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</section>
</appendix>