|
|
1.1 root 1:
2:
3: cc Command cc
4:
5:
6:
7:
8: Compiler controller
9:
10: cccc [_c_o_m_p_i_l_e_r _o_p_t_i_o_n_s] _f_i_l_e .... [_l_i_n_k_e_r _o_p_t_i_o_n_s]
11:
12: cc is the program that controls compilation of C programs. It
13: guides files of source and object code through each phase of com-
14: pilation and linking. cccc has many options to assist in the com-
15: pilation of C programs; in essence, however, all you need to do
16: to produce an executable file from your C program is type cccc
17: followed by the name of the file or files that hold your program.
18: It checks whether the file names you give it are reasonable,
19: selects the right phase for each file, and performs other tasks
20: that ease the compilation of your programs.
21:
22: ***** File Names *****
23:
24: cc assumes that each file name that ends in .c or .h is a C
25: program and passes it to the C compiler for compilation.
26:
27: cc assumes that each file argument that ends in .s is in Mark
28: Williams assembly language and processes it with the assembler
29: as.
30:
31: cc also passes all files with the suffixes .o or .a unchanged to
32: the linker ld.
33:
34: ***** How cc Works *****
35:
36: cc normally works as follows: First, it compiles or assembles the
37: source files, naming the resulting object files by replacing the
38: .cc or .ss suffixes with the suffix .oo. Then, it links the object
39: files with the C runtime startup routine and the standard C
40: library, and leaves the result in file _f_i_l_e. If only one object
41: file is created during compilation, it is deleted after linking;
42: however, if more than one object file is created, or if an object
43: file of the same name existed before you began to compile, then
44: the object file or files are not deleted.
45:
46: ***** Options *****
47:
48: The following lists all of cccc's command-line options. cc passes
49: some options through to the linker ld unchanged, and correctly
50: interprets to it the options -oo and -uu.
51:
52: A number of the options are esoteric and normally are not used
53: when compiling a C program. The following are the most commonly
54: used options:
55:
56:
57: -cc Compile only; do not link
58: -ff Include floating-point pprriinnttff
59: -ll_n_a_m_e Pass library lliibb_n_a_m_e.aa to linker
60: -oo _n_a_m_e Call output file _n_a_m_e
61: -VV Print verbose listing of cccc's action
62:
63:
64: COHERENT Lexicon Page 1
65:
66:
67:
68:
69: cc Command cc
70:
71:
72:
73:
74:
75: -AA MicroEMACS option. If an error occurs during compilation, cc
76: automatically invokes the MicroEMACS screen editor. The er-
77: ror or errors are displayed in one window and the source code
78: file in the other, with the cursor set to the line number in-
79: dicated by the first error message. Typing <ctrl-X>> moves
80: to the next error, <ctrl-X>< moves to the previous error. To
81: recompile, close the edited file with <ctrl-Z>. Compilation
82: will continue either until the program compiles without er-
83: ror, or until you exit from the editor by typing <ctrl-U>
84: followed by <ctrl-X><ctrl-C>.
85:
86: -BB[_s_t_r_i_n_g]
87: Backup option. Use alternate versions of the compiler for
88: cc0, cc1, cc2, and cc3. If string is supplied, cc prepends
89: it to the names of the phases of the compiler to form the
90: pathnames where these are found. Otherwise, cc prepends the
91: name of the current directory. If a -t option was previously
92: given, only the parts of the compiler specified by it are af-
93: fected. Any number of -B and -t options may be used, with
94: each -t option specifying the passes affected by the subse-
95: quent -B option. For example, the command
96:
97: cc -tp2 -Bnew hello.c
98:
99: compiles hheelllloo.cc using nneewwcccc22 in place of the ordinarily used
100: /lliibb/cccc22, and using nneewwccpppp in place of the ordinarily used
101: /lliibb/ccpppp.
102:
103: -cc Compile option. Suppress linking and the removal of the ob-
104: ject files.
105:
106: -DD_n_a_m_e[=_v_a_l_u_e]
107: Define name to the preprocessor, as if set by a #define
108: directive. If value is present, it is used to initialize the
109: definition.
110:
111: -EE Expand option. Run the C preprocessor ccpppp and write its out-
112: put onto the standard output.
113:
114: -ff Floating point option. Include library routines that perform
115: floating-point arithmetic. Because the floating-point
116: routines require approximately five kilobytes of memory, the
117: standard C library does not include them; the -ff option tells
118: the compiler to include them. If a program is compiled
119: without the -ff option but attempts to print a floating point
120: number during execution by using the e, f, or g format
121: specifications to printf, the message
122:
123: You must compile with -f option for floating point
124:
125: will be printed and the program will exit.
126:
127:
128:
129:
130: COHERENT Lexicon Page 2
131:
132:
133:
134:
135: cc Command cc
136:
137:
138:
139: -II _n_a_m_e
140: IInclude option. Specify a directory the preprocessor should
141: search for files given in #include directives, using the
142: following criteria: If the #iinncclluuddee statement reads
143:
144: #include "file.h"
145:
146: cccc searches for ffiillee.hh first in the source directory, then in
147: the directory named in the -II_n_a_m_e option, and finally in the
148: system's default directories. If the #iinncclluuddee statement
149: reads
150:
151: #include <file.h>
152:
153: cccc searches for ffiillee.hh first in the directories named in the
154: -II_n_a_m_e option, and then in the system's default directories.
155: Multiple -II_n_a_m_e options are executed in the order of their of
156: appearance.
157:
158: -KK Keep option. Do not erase the intermediate files generated
159: during compilation. Temporary files will be written into the
160: current directory.
161:
162: -ll _n_a_m_e
163: llibrary option. Pass the name of a library to the linker.
164: cc expands -lname into /lliibb/lliibb_n_a_m_e.aa. If an alternative
165: library prefix has been specified by the -tl and -Bstring op-
166: tions, then -lname expands to stringlliibbname.aa. Note that
167: this is a linker option, and so must appear at the end of the
168: cc command line, or it will not be processed correctly.
169:
170: -MM _s_t_r_i_n_g
171: Machine option. Use an alternate version of cc0, cc1, cc1a,
172: cc1b, cc2, cc3, as, lib*.a, and crts0.o, named by fixing
173: string between the directory name and the pass and file
174: names.
175:
176: -nn Instruct the linker ld to bind the output with separate
177: shared and private segments, and which each starting on a
178: separate hardware-segment boundary. This allows several
179: processes to simultaneously use one copy of the shared seg-
180: ment. Note that programs linked with this option will run a
181: little more slowly than if they were not so linked; however,
182: if a program forks (e.g., kkeerrmmiitt) or will be used by more
183: than one user at a time (e.g., MicroEMACS), this slightly
184: slower time will be more than offset by the program's being
185: spared having to read an entire copy of itself from the disk.
186:
187: -NN[pp00112233ssddllrrtt]_s_t_r_i_n_g
188: Name option. Rename a specified pass to string. The letters
189: p0123sdlrt refer, respectively, to cpp, cc0, cc1, cc2, cc3,
190: the assembler, the linker, the libraries, the run-time start-
191: up, and the temporary files.
192:
193:
194:
195:
196: COHERENT Lexicon Page 3
197:
198:
199:
200:
201: cc Command cc
202:
203:
204:
205: -oo _n_a_m_e
206: Output option. Rename the executable file from the default
207: to _n_a_m_e. If this option is not used, the executable will be
208: named after the first .cc or .oo file on the command line.
209:
210: -OO Optimize option. Run the code generated by the C compiler
211: through the peephole optimizer. The optimizer pass is man-
212: datory for the i8086, Z8000, and M68000 compilers, and need
213: not be requested. It is optional for the PDP11 compiler, but
214: is recommended for all files except those that consist en-
215: tirely of initialized tables of data.
216:
217: -qq[pp00112233ss]
218: Quit option. Terminate compilation after running the
219: specified pass. The letters pp00112233ss refer, respectively, to
220: cpp, cc0, cc1, cc2, cc3, and the assembler. For example, to
221: terminate compilation after running the parser cc0, type -qq00.
222:
223: -QQ Quiet option. Suppress all messages.
224:
225: -SS Suppress the object-writing and link phases, and invoke the
226: disassembler cc3. This option produces an assembly-language
227: version of a C program for examination, for example if a com-
228: piler problem is suspected. The assembly-language output
229: file name replaces the .c suffix with .s. This is equivalent
230: to the -VVAASSMM option.
231:
232: -tt[pp0011aabb2233ssddllrrtt]
233: Take option. Use alternate versions of the compiler phases
234: and other files specified in the following string. If no
235: following string is given, the cccc uses alternate version of
236: every phase of the compiler, except the preprocessor. If the
237: -tt option is followed by a -BB option, cccc prepends the prefix
238: string named in the -BB option to the phases and files named
239: in the -tt option; otherwise, the it looks for the alternate
240: forms in the current directory.
241:
242: -UU _n_a_m_e
243: Undefine symbol name. Use this option to undefine symbols
244: that the preprocessor defines implicitly, such as the name of
245: the native system or machine.
246:
247: -VV Verbose option. cccc prints onto the standard output a step-
248: by-step description of each action it takes.
249:
250: VV_s_t_r_i_n_g
251: Variant option. Toggle (i.e., turn on or off) the variant
252: _s_t_r_i_n_g during the compilation. Variants that are marked oonn
253: are turned on by default. Options marked SSttrriicctt: generate
254: messages that warn of the conditions in question. cc recog-
255: nizes the following variants:
256:
257: -VVAASSMM
258: Output assembly-language code. Identical to -SS option, above.
259: It can be used with the -VVLLIINNEESS option, described below, to
260:
261:
262: COHERENT Lexicon Page 4
263:
264:
265:
266:
267: cc Command cc
268:
269:
270:
271: generate a line-numbered file of assembly language. Default
272: is ooffff.
273:
274: -VVCCOOMMMM
275: Permit .ccoomm-style data items. Default is oonn.
276:
277: -VVFFLLOOAATT
278: Include floating point pprriinnttff routines. Same as -f option,
279: above.
280:
281: -VVLLIINNEESS
282: Generate line number information. Can be used with the option
283: -VVAASSMM, described above, to generate assembly language output
284: that uses line numbers. Default is ooffff.
285:
286: -VVQQUUIIEETT
287: Suppress all messages. Identical to -Q option. Default is
288: ooffff.
289:
290: -VVSSBBOOOOKK
291: Strict: note deviations from _T_h_e _C _P_r_o_g_r_a_m_m_i_n_g _L_a_n_g_u_a_g_e, ed.
292: 1. Default is ooffff.
293:
294: -VVSSCCCCOONN
295: Strict: note constant conditional. Default is ooffff.
296:
297: -VVSSIINNUU
298: Implement struct-in-union rules instead of Berkeley-member
299: resolution rules. Default is ooffff, i.e., Berkeley rules are
300: the default.
301:
302: -VVSSLLCCOONN
303: Strict: iinntt constant promoted to lloonngg because value is too
304: big. Default is oonn.
305:
306: -VVSSMMEEMMBB
307: Strict: check use of structure/union members for adherence to
308: standard rules of C. Default is oonn.
309:
310: -VVSSNNRREEGG
311: Strict: register declaration reduced to auto. Default is oonn.
312:
313: -VVSSPPVVAALL
314: Strict: pointer value truncated. Default is ooffff.
315:
316: -VVSSRRTTVVCC
317: Strict: risky types in truth contexts. Default is ooffff.
318:
319: -VVSSTTAATT
320: Give statistics on optimization.
321:
322: -VVSS
323: Turn on all strict checking. Default is oonn.
324:
325:
326:
327:
328: COHERENT Lexicon Page 5
329:
330:
331:
332:
333: cc Command cc
334:
335:
336:
337: -VVSSUURREEGG
338: Strict: note unused registers. Default is ooffff.
339:
340: -VVSSUUVVAARR
341: Strict: note unused variables. Default is oonn.
342:
343: -VV33GGRRAAPPHH
344: Translate ANSI trigraphs. Default is ooffff.
345:
346: ***** See Also ***** as, C language, cc0, cc1, cc2, cc3, com-
347: mands, cpp, ld
348: _T_h_e _C _L_a_n_g_u_a_g_e, tutorial
349:
350:
351:
352:
353:
354:
355:
356:
357:
358:
359:
360:
361:
362:
363:
364:
365:
366:
367:
368:
369:
370:
371:
372:
373:
374:
375:
376:
377:
378:
379:
380:
381:
382:
383:
384:
385:
386:
387:
388:
389:
390:
391:
392:
393:
394: COHERENT Lexicon Page 6
395:
396:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.