source: trunk/minix/man/man1/cc.1@ 11

Last change on this file since 11 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 15.1 KB
Line 
1.TH CC 1
2.SH NAME
3cc, pc, m2 \- MINIX 3 C, Pascal, and Modula-2 compilers
4.SH SYNOPSIS
5.in +.5i
6.ti -.5i
7.BR cc |\c
8.BR pc |\c
9.BR m2
10.RB [ "\-D \fIname\fR[\fB=\fIvalue" ]]
11\&...
12.RB [ "\-U \fIname" ]
13\&...
14.RB [ "\-I \fIdirectory" ]
15\&...
16.RB [ \-.\fIsuffix ]
17\&...
18.RB [ \-c ]
19.RB [ \-E ]
20.RB [ \-P ]
21.RB [ \-S ]
22.RB [ \-c.\fIsuffix ]
23.RB [ \-O ]
24.RB [ \-O\fIlevel ]
25.RB [ \-OS ]
26.RB [ \-OT ]
27.RB [ \-g ]
28.RB [ \-n ]
29.RB [ \-a ]
30.RB [ \-R ]
31.RB [ \-A ]
32.RB [ \-s ]
33.RB [ \-fsoft ]
34.RB [ \-fnone ]
35.RB [ \-w ]
36.RB [ \-wo ]
37.RB [ \-ws ]
38.RB [ \-wa ]
39.RB [ \-3 ]
40.RB [ \-_ ]
41.RB [ \-W\fIname\fB\-\fIoption ]
42\&...
43.RB [ \-m\fIarch ]
44.RB [ "\-o \fIoutfile" ]
45.RB [ "\-L \fIdirectory" ]
46\&...
47.RB [ \-i ]
48.RB [ \-sep ]
49.RB [ \-com ]
50.RB [ \-r ]
51.RB [ "\-stack \fIsize" ]
52.I operand
53\&...
54.sp .4v
55.ti -.5i
56(Minix-86 subset:)
57.ti -.5i
58.BR cc |\c
59.BR pc |\c
60.BR m2
61.RB [ "\-D\fIname\fR[\fB=\fIvalue" ]]
62\&...
63.RB [ "\-U\fIname" ]
64\&...
65.RB [ "\-I\fIdirectory" ]
66\&...
67.RB [ \-.o ]
68\&...
69.RB [ \-c ]
70.RB [ \-E ]
71.RB [ \-P ]
72.RB [ \-S ]
73.RB [ \-c.\fIsuffix ]
74.RB [ \-O ]
75.RB [ \-O\fIlevel ]
76.RB [ \-n ]
77.RB [ \-a ]
78.RB [ \-R ]
79.RB [ \-A ]
80.RB [ \-s ]
81.RB [ \-f ]
82.RB [ \-w ]
83.RB [ \-wo ]
84.RB [ \-ws ]
85.RB [ \-wa ]
86.RB [ \-3 ]
87.RB [ \-_ ]
88\&...
89.RB [ \-m ]
90.RB [ "\-o \fIoutfile" ]
91.RB [ "\-L\fIdirectory" ]
92\&...
93.RB [ \-i ]
94.RB [ \-sep ]
95.RB [ \-com ]
96.I operand
97\&...
98.in -.5i
99.SH DESCRIPTION
100.BR Cc ,
101.BR pc ,
102and
103.BR m2
104are the call names of the MINIX 3 C, Pascal, and Modula-2 compilers from
105the Amsterdam Compiler Kit (ACK).
106.PP
107All these call names are links to the
108.B acd
109driver program.
110.B Acd
111uses the driver description file
112.B /usr/lib/descr
113that describes the steps necessary to compile a source file. The
114.BR acd (1)
115manual page describes a few more flags, like
116.BR \-v ,
117that may be useful for debugging compiler problems.
118.PP
119Minix-86 uses a C program as the compiler driver. This driver is not as
120flexible as the one implemented with the
121.B acd
122driver, and offers a smaller number of options. The second line of
123the synopsis above shows the options that the Minix-86 driver supports. The
124rest of this manual page is geared towards the
125.B acd
126driver. People writing software for Minix-86, or that should be
127portable to all MINIX 3 versions should stick to the options listed under
128the Minix-86 compiler.
129.SH OPTIONS
130The transformations done by the compiler are modified by the following
131options. They are a superset of the options required by \s-2POSIX\s+2,
132with the MINIX 3 or compiler specific ones are marked as such. Options
133for one specific compiler are ignored for others. Read the OPTIONS section
134of
135.BR acd (1)
136for the driver specific options.
137.PP
138.TP
139.BI \-D " name\fR[\fB=\fIvalue\fR]"
140Same as if
141.BI #define " name value"
142had been given.
143.B 1
144is assumed if
145.I value
146is omitted. This argument, like all the other double arguments, may also
147be given as a single argument. (I.e. either as
148.BI \-D "\0name"
149or
150.BI \-D name\fR.)
151(The Minix-86 driver is not so flexible, the proper form can be seen in
152the synopsis.)
153.TP
154.BI \-U " \fIname"
155Undefine the pre-defined symbol
156.IR name .
157.TP
158.BI \-I " directory"
159Extend the include directory path with the given directory. These
160directories are searched for include files in the given order before the
161standard places. The standard place for the C compiler is
162.BR /usr/include ,
163and for the Modula-2 compiler it is
164.BR /usr/lib/m2 .
165.TP
166.BI \-. suffix
167Act as if a source file with the given suffix is present on the command line.
168For each language found on the command line the appropriate libraries are
169selected. The first language mentioned selects the runtime startoff.
170The call name of the driver also chooses the language, so \fBcc\fP is an
171implicit
172.BR \-.c .
173The runtime startoff can be omitted by specifying
174.B \-.o
175for those rare cases where you want to supply your own startoff. (MINIX 3)
176.TP
177.B \-c
178Transform the input files to object files and stop. The
179.B \-o
180option may be used under MINIX 3 to set the name of the object file.
181.BR Make (1)
182likes this, because
183.BI "cc \-c" " dir/file" .c
184puts
185.IB file .o
186in the current directory, but
187.BI "cc \-c" " dir/file" .c
188.BI \-o " dir/file" .o
189puts the
190.B .o
191file where
192.B make
193expects it to be by its builtin
194.B .c.o
195rule.
196(Minix-86 can only use
197.B \-o
198to name an executable.)
199.TP
200.B \-E
201Run the preprocessor over the input files and send the result to standard
202output or the file named by
203.BR \-o .
204Standard input is read if an input file is named "\fB\-\fR".
205.TP
206.B \-P
207Run the preprocessor over the input files and put the result to files
208with the suffix
209.BR .i .
210File and line number information is omitted from the output. Use
211.B \-P \-E
212under MINIX 3 to omit this info for
213.B \-E
214too.
215.TP
216.B \-S
217Transform the input files to assembly files with suffix
218.BR .s .
219.TP
220.BI \-c. suffix
221Transform the input files to files with the given suffix. This can only
222succeed if there is a valid transformation from the input file to the
223given suffix. The same goes for
224.B \-c
225and other options that are just special cases of this option, except for
226.BR \-P ,
227.B \-c.i
228keeps the line number info. The option
229.B \-c.a
230makes the driver transform the input files to object files and add them to a
231library. (So you do not need to know how the archiver works.) Note that you
232need to give object files as arguments if you want to replace old object
233files. Transformed files are added under a (unique) temporary name. With
234.B \-o
235you can name the library. (MINIX 3) (Minix-86 can't do
236.BR \-c.a .)
237.TP
238.B \-O
239Optimize code. This option is a no-op, because all the compilers already
240use the
241.BR \-O1
242optimization level to get code of reasonable quality. Use
243.BR \-O0
244to turn off optimization to speed up compilation at debug time.
245.TP
246.BI \-O level
247Compile with the given optimization level. (MINIX 3)
248.PP
249.B \-OS
250.br
251.B \-OT
252.RS
253Optimize for space or for time. (MINIX 3)
254.RE
255.TP
256.B \-g
257Compile the C source with debugging information. (The way
258.BR \-g ,
259.B \-s
260and
261.B \-O
262interact is left unspecified.)
263.TP
264.B \-n
265Omit the file and line number tracking that is used for runtime error reports
266from Pascal or Modula-2 programs. The
267.B \-n
268flag is normally used to compile library modules, but may also be useful to
269make a program smaller and faster once debugged. (Pascal & Modula-2)
270.TP
271.B \-a
272Enable assertions, i.e. statements of the form \fBassert\fI\ test\fR
273that cause a descriptive runtime error if the boolean expression
274.I test
275evaluates false. (Pascal & Modula-2)
276.TP
277.B \-R
278Disable runtime checks like overflow checking. (Pascal & Modula-2)
279.TP
280.B \-A
281Enable array bound checks. (Pascal & Modula-2)
282.TP
283.B \-s
284Strip the resulting executable of its symbol table.
285.PP
286.B \-fsoft
287.br
288.B \-f
289.RS
290Use software floating point instead of hardware floating point. This is
291a loader flag, but in general it is best to specify this flag in all
292phases of the compilation. (MINIX 3)
293.RE
294.TP
295.B \-fnone
296Ignored. Used under Minix-vmd to omit floating point printing/scanning
297code. The standard MINIX 3 compiler figures this out automatically using
298a special loader trick. (MINIX 3)
299.TP
300.B \-w
301Do not produce warnings about dubious C language constructs. Normally
302the compiler is configured to do the maximum amount of checking
303without being too annoying. (MINIX 3)
304.TP
305.B \-wo
306Omit warnings about old (K&R) style. (MINIX 3)
307.TP
308.B \-ws
309Omit strict warnings. (MINIX 3)
310.TP
311.B \-wa
312Omit all warnings. (MINIX 3)
313.TP
314.B \-3
315Only accept 3rd edition Modula-2. (Modula-2)
316.TP
317.B \-_
318Allow underscores in Pascal or Modula-2 identifiers, but not at the beginning
319of an identifier. (Pascal & Modula-2)
320.TP
321.BI \-W name \- option
322If
323.I name
324is the name of the compiler this driver is working for, then
325.I option
326is activated for that compiler. See below for a per-compiler list. Any other
327.B \-W
328option is ignored. (\fB\-W\fP is described by \s-2POSIX\s+2 as an optional
329flag to send options to the different compiler passes with a totally
330different (and nicely ignored) syntax as described here.) (Minix-86 ignores
331any
332.B \-W
333flag.)
334.TP
335.B \-m
336Under Minix-86 this option transforms the function declarations (prototypes)
337to the old K&R form, i.e. the arguments declarations are removed. This saves
338a lot of memory in the compiler and may allow a large program to be compiled.
339One must make sure that function arguments are properly type-cast where
340necessary. (MINIX 3)
341.TP
342.BI \-m arch
343Set the target architecture for a cross compiler. Normally the compiler
344produces code for the same architecture it itself is compiled for. The
345.B ARCH
346environment variable may also be used to set the architecture. Architectures
347names are:
348.B i86
349(Intel 8086 and 286),
350.B i386
351(Intel 386, 486, ...),
352.B m68000
353(Motorola MC68000 & MC68010, 16-bit ints),
354.B m68010
355(Motorola MC68000 & MC68010, 32-bit ints),
356.B m68020
357(Motorola MC68020, 32-bit ints),
358.B sparc
359(Sun SPARC). (MINIX 3) (Ignored under Minix-86.)
360.TP
361.BI \-o " outfile"
362Set the output file for the
363.BR \-c ,
364.BR \-c.a ,
365and
366.BR \-E
367options, or choose the executable name instead of the default
368.BR a.out .
369(Minix-86 can only choose the executable name.)
370.TP
371.BI \-L " directory"
372Extend the library search path with
373.IR directory .
374These directories are searched for libraries named by
375.B \-l
376in the given order before the standard places. The standard places are
377.B /lib/\c
378.IR arch ,
379and
380.B /usr/lib/\c
381.IR arch .
382The search for libaries in directories added with
383.B \-L
384looks in
385.IB directory /\c
386.IR arch
387and
388.I directory
389itself.
390.RI ( Arch
391is the machine architecture name. This is
392MINIX 3 dependent, compilers on other systems usually only look in
393.IR directory .)
394(Minix-86 only has
395.B /lib
396and
397.B /usr/lib
398as the standard places.)
399.PP
400.B \-sep
401.br
402.B \-com
403.RS
404Create a Separate I&D or a common I&D executable. The text segment of a
405separate I&D executable is read-only and shareable. For an
406.B i86
407binary this also means that the text and data segment can each be 64
408kilobytes large instead of just 64 kilobytes together. Separate I&D is the
409default. Common I&D is probably only useful for the bootstraps. The
410.B \-i
411option has the same meaning as
412.BR \-sep ,
413but should no longer be used.
414(MINIX 3)
415.RE
416.TP
417.B \-r
418Makes the loader produce a relocatable object file, i.e. a file that
419may be loaded again. The runtime startoff and the default libraries are
420omitted, only the files mentioned are combined. (MINIX 3)
421.TP
422.BI \-stack " size"
423Allow the process
424.I size
425bytes of heap and stack.
426.I Size
427is a C-style decimal, octal, or hexadecimal number, optionally followed by
428the multipliers
429.BR m ,
430.BR k ,
431.BR w ,
432and
433.B b
434for mega (1024*1024), kilo (1024), "word" (2 or 4), and byte (1). Uppercase
435letters are accepted too. A size of
436.B 32kw
437is used by default, translating to 64k for
438.BR i86 ,
439and 132k for other architectures. Too large a size is rounded down to keep
440the data segment within 64 kilobytes for the
441.BR i86 .
442(MINIX 3)
443.SH OPERANDS
444All leftover operands are treated as files to be compiled, with one
445exception. The construct
446.BI \-l " library"
447is used to denote a library, usually
448.BI lib library .a\fR,
449that is to be searched in the directories mentioned with
450.B \-L
451or the standard places. These libraries keep their place among the
452(transformed) input files when presented to the loader. (It is a common
453mistake to write
454.BR "cc\ \-lcurses\ x.c"
455instead of
456.BR "cc\ x.c\ \-lcurses" .)
457.SH IMPLEMENTATION
458The MINIX 3 compiler implementation uses the ACK compilers adapted for use
459under MINIX 3 as described below. Read
460.BR ACK (7)
461for more detailed information on the ACK compilers themselves.
462.SS "Feature test macros"
463The preprocessors are given these arguments to define feature test macros:
464.B \-D__ACK__
465tells what compiler is used.
466.B \-D__minix
467tells that this is MINIX 3.
468.BI \-D__ arch
469tells the architecture.
470(More macros are defined, but they are only to be used in the include files.)
471.PP
472The symbols above are predefined by the preprocessor so that your program is
473able to "sense" the environment it is in. It is also possible for your
474program to do the opposite, to tell what kind of environment it likes to
475have. By default,
476.B cc
477compiles a standard C program. If you want the extensions described in
478POSIX.1 to become visible, then you have to set
479.BR _POSIX_SOURCE " to " 1
480at the start of your program.
481To enable \s-2UNIX\s+2 or MINIX 3 extensions you need to also set
482.BR _MINIX " to " 1 .
483If you don't want to clutter your source files with these symbols then you
484can use
485.B cc \-D_MINIX \-D_POSIX_SOURCE
486to get the POSIX.1 and the MINIX 3 extensions.
487.SS "Preprocessing"
488Pascal, Modula-2, EM source (see below), and Assembly source are
489preprocessed by the C preprocessor if the very first character in the file
490is a '\fB#\fP' character.
491.SS "Assembly dialects"
492No two compilers use the same assembly language. To be able to use the same
493assembly dialect for the low level support routines an assembly converter is
494provided. The input of this converter can be of type
495.BR ack ,
496.BR ncc ,
497or
498.BR bas ,
499and the output can be of type
500.BR ack ,
501.BR ncc ,
502or
503.BR gnu .
504The suffix of the file tells the assembly dialect (see below), or one can
505use the option
506.BI \-Was\- dialect
507to tell the driver what the dialect of a plain
508.B .s
509file is. The assembly converter is not as smart as the assembler, the
510translation is more or less a text substitution. It leaves a lot of
511checking to the target assembler. You have to restrict yourself to a subset
512that is understood by both assemblers. The ACK assembler for instance
513doesn't care if you use `ax' or `eax' for a 32 bit register, it looks at the
514instruction type. The GNU assembler doesn't like this, so you have to use
515the proper register name in ACK assembly that is to be translated to GNU
516assembly. Expressions are converted as is, even if the operator precedence
517rules of the two assembly languages differ. So use parentheses. The
518converter does promise one thing: compiler output can be properly
519translated. (Note that under Minix-86
520.B \-W
521is ignored. All assembly should therefore be in the "ncc" dialect.)
522.SH FILES
523.TP 10
524.B /usr/lib/descr
525The compiler description file.
526.TP
527.B .c
528Suffix of a C source file.
529.TP
530.B .mod
531Modula-2.
532.TP
533.B .p
534Pascal.
535.TP
536.B .i
537Preprocessed C source.
538.TP
539.B .k
540ACK machine independent compact EM code produced by the C, Pascal, or
541Modula-2 front end (or any other ACK front end.) The ACK compilers are
542based on the UNCOL idea where several front ends compile to a common
543intermediate language, and several back ends transform the intermediate
544language to the target machine language. The ACK intermediate language
545is named "EM".
546.TP
547.B .m
548Peephole optimized EM.
549.TP
550.B .gk
551Result of the (optional) EM global optimizer.
552.TP
553.B .g
554Result of the second EM peephole optimizer used after the global optimizer.
555.TP
556.B .e
557Human readable EM. (Human created or decoded compact EM.)
558.TP
559.B .s
560Target machine assembly. (Current compiler dialect.)
561.TP
562.B .ack.s
563ACK assembly.
564.TP
565.B .ncc.s
566ACK Xenix style assembly. This dialect is used by the 16 bit ACK ANSI C
567compiler.
568.TP
569.B .gnu.s
570GNU assembly.
571.TP
572.B .bas.s
573BCC assembly. (Used by the Bruce Evans' BCC compiler, for many years the
574compiler for Minix-386.)
575.TP
576.B .o
577Object code.
578.TP
579.B .a
580Object code library.
581.TP
582.B a.out
583Default output executable.
584.SH "SEE ALSO"
585.BR acd (1),
586.BR ACK (7).
587.SH AUTHOR
588Kees J. Bot (kjb@cs.vu.nl)
Note: See TracBrowser for help on using the repository browser.