1CCOM(1) BSD General Commands Manual CCOM(1)
2
4 ccom — C compiler
5
7 ccom [-gkpsv] [-f features] [-m options] [-W warnings] [-X flags]
8 [-x settings] [-Z flags] [infile] [outfile]
9
11 The ccom utility provides a C compiler. The frontend is usually pcc(1).
12 It is not intended to be run directly. ccom reads the C source from
13 infile or standard input and writes the assembler source to outfile or to
14 standard output.
15
16 The options are as follows:
17
18 -f feature
19 Enable language features. Multiple -f options can be given, the
20 following features are supported:
21
22 stack-protector
23 Enable stack smashing protection. Currently the same as
24 stack-protector-all.
25
26 stack-protector-all
27 Enable stack smashing protection for all functions.
28
29 pack-struct[=n]
30 Specify maximum alignment for structure members, similar
31 to a #pragma pack statement at the start of the file. If
32 no value is given, the default is 1.
33
34 freestanding
35 Emit code for a freestanding environment. Currently not
36 implemented.
37
38 -g Include debugging information in the output code for use by sym‐
39 bolic and source-level debuggers. Currently this uses the stabs
40 format, encoding information in symbol table entries.
41
42 -k Generate PIC code.
43
44 -m option
45 Target-specific options, used in machine-dependent code. Multi‐
46 ple -m options can be given, the following options are supported:
47
48 AMD64
49
50 ARM little-endian, big-endian, fpe=fpa, fpe=vpf, soft-float,
51 arch=armv1, arch=armv2, arch=armv2a, arch=armv3,
52 arch=armv4, arch=armv4t, arch=armv4tej, arch=armv5,
53 arch=armv5te, arch=armv5tej, arch=armv6, arch=armv6t2,
54 arch=armv6kz, arch=armv6k & arch=armv7.
55
56 HPPA
57
58 i386
59
60 M16C
61
62 MIPS little-endian & big-endian.
63
64 NOVA
65
66 PDP-10
67
68 PDP-11
69
70 PowerPC little-endian, big-endian, soft-float & hard-float.
71
72 Sparc64
73
74 VAX
75
76 -p Generate profiling code.
77
78 -s Print statistics to standard error when complete. This includes:
79 name table entries, name string size, permanent allocated memory,
80 temporary allocated memory, lost memory, argument list unions,
81 dimension/function unions, struct/union/enum blocks, inline node
82 count, inline control blocks, and permanent symtab entries.
83
84 -v Display version.
85
86 -W warning
87 Do some basic checks and emit warnings about possible coding
88 problems. Multiple -W options can be given, the following warn‐
89 ings are supported:
90
91 error[=warning]
92 Enable warning, and treat it as an error condition. If a
93 specific warning is not given, producing any warning will
94 cause an error.
95
96 attributes
97 Warn when unsupported attributes are used. This warning
98 is enabled by default.
99
100 deprecated-declarations
101 Report whenever a symbol marked with the ‘deprecated’
102 attribute is used. This warning is enabled by default.
103
104 implicit-function-declaration
105 (TODO) Require explicit prototypes for all called func‐
106 tions.
107
108 implicit-int
109 (TODO) Warn when a function declaration lacks a type.
110
111 missing-prototypes
112 Require explicit prototypes for all global function defi‐
113 nitions.
114
115 pointer-sign
116 Warn when pointer operations are done with mismatched
117 signed and unsigned values.
118
119 sign-compare
120 (TODO) Warn about comparisons between signed and unsigned
121 values.
122
123 strict-prototypes
124 (TODO) Require that function prototypes are strictly C99.
125
126 shadow Report when a local variable shadows something from a
127 higher scope.
128
129 truncate
130 Report when integer values may be implicitly truncated to
131 fit a smaller type.
132
133 uninitialized
134 A variable is read before being written.
135
136 unknown-pragmas
137 Report unhandled pragma statements.
138
139 unreachable-code
140 Report statements that cannot be executed.
141
142 Any of the above may be prefixed with “no-” in order to disable
143 the effect.
144
145 -X flags
146 C specific debugging where flags is one or more of the following:
147
148 b Building of parse trees
149 d Declarations (using multiple d flags gives more output)
150 e Pass1 trees at exit
151 i Initializations
152 n Memory allocations
153 o Turn off optimisations
154 p Prototypes
155 s Inlining
156 t Type conversions
157 x Target-specific flag, used in machine-dependent code
158
159 -x setting
160 Enable setting in the compiler. Multiple -x options can be
161 given, the following settings are supported:
162
163 ccp Apply sparse conditional constant propagation techniques
164 for optimization. Currently not implemented.
165
166 dce Do dead code elimination.
167
168 deljumps
169 Delete redundant jumps and dead code.
170
171 gnu89
172
173 gnu99 Use GNU C semantics rather than C99 for some things.
174 Currently only inline.
175
176 inline Replace calls to functions marked with an inline speci‐
177 fier with a copy of the actual function.
178
179 ssa Convert statements into static single assignment form for
180 optimization. Not yet finished.
181
182 tailcall
183 Enable optimization of tail-recursion functions. Cur‐
184 rently not implemented.
185
186 temps Locate automatic variables into registers where possible,
187 for further optimization by the register allocator.
188
189 uchar Treat character constants as unsigned values.
190
191 -Z flags
192 Code generator (pass2) specific debugging where flags is one or
193 more of the following:
194
195 b Basic block and SSA building
196 c Code printout
197 e Trees when entering pass2
198 f Instruction matcher, may provide much output
199 g Print flow graphs
200 n Memory allocation
201 o Instruction generator
202 r Register allocator
203 s Shape matching in instruction generator
204 t Type matching in instruction generator
205 u Sethi-Ullman computations
206 x Target-specific flag, used in machine-dependent code
207
209 Input lines starting with a “#pragma” directive can be used to modify be‐
210 haviour of ccom during compilation. All tokens up to the first unescaped
211 newline are considered part of the pragma command, with the following
212 operations being recognized:
213
214 STDC Standard C99 operator follows. Currently no C99 operations are
215 implemented, and any directives starting with this token will be
216 silently ignored.
217
218 GCC diagnostic effect "option"
219 GNU C compatibility. Alter the effects of compiler diagnostics.
220 The required effect should be stated as warning, error or
221 ignored, followed by the compiler diagnostic option in double
222 quotes. For example, to force unknown pragmas to always generate
223 an error, a standard header might include
224
225 #pragma GCC diagnostic error "-Wunknown-pragmas"
226
227 GCC poison identifier ...
228 GNU C compatibility. Cause an error if any of the following
229 identifiers subsequently appear in the code (but not in any macro
230 expansions). Currently not implemented.
231
232 GCC system_header
233 GNU C compatibility. Currently not implemented.
234
235 GCC visibility
236 GNU C compatibility. Currently not implemented.
237
238 pack([n])
239 Set the default maximum alignment for structures and unions, such
240 that members will have their natural alignment requirements
241 clamped at this value and may be stored misaligned. If n is not
242 given, the alignment is reset to the target default.
243
244 pack(push[, n])
245 Push the current pack setting onto an internal stack then, if n
246 is given, change the default alignment for structures and unions.
247 Currently not implemented.
248
249 pack(pop)
250 Change the pack setting to the most recently pushed value, and
251 remove that setting from the stack. Currently not implemented.
252
253 packed [n]
254 Set the maximum alignment for the structure or union defined in
255 the current statement. If n is not given, the default value of 1
256 is used. (Currently this works except n is not used)
257
258 aligned [n]
259 Set the minimum alignment for the structure or union defined in
260 the current statement.
261
262 rename name
263 Provide an alternative name which will be used to reference the
264 object declared in the current statement.
265
266 weak name[=alias]
267 Mark name as a weak rather than a global symbol, to allow its
268 definition to be overridden at link time. If an alias is given,
269 this will be used as the default value of name.
270
271 ident Currently not implemented.
272
273 and the following target-specific operations are handled by machine-
274 dependent code:
275
276 tls For AMD64 and i386 targets, the variable declared in the current
277 statement will be referenced via the “thread-local storage” mech‐
278 anism.
279
280 init For AMD64, ARM, HPPA, i386, MIPS and PowerPC targets, when the
281 current statement is a function declaration, generate a reference
282 in the .ctors section, enabling library code to call the function
283 prior to entering main().
284
285 fini For AMD64, ARM, HPPA, i386, MIPS and PowerPC targets, when the
286 current statement is a function declaration, generate a reference
287 in the .dtors section, enabling library code to call the function
288 when main() returns or the exit() function is called.
289
290 section name
291 For AMD64, ARM, HPPA and i386 targets, place the subsequent code
292 in the named section. (This is currently broken).
293
294 alias name
295 For AMD64, HPPA and i386 targets, emit assembler instructions
296 providing an alias for the symbol defined by the current state‐
297 ment.
298
299 stdcall
300 For i386 targets, enable “stdcall” semantics during code genera‐
301 tion, where function arguments are passed on the stack in right-
302 to-left order, and the callee is responsible for adjusting the
303 stack pointer before returning. Any function result is passed in
304 the EAX register. On win32, the function name is postfixed with
305 an “@” and the size of the stack adjustment.
306
307 cdecl For i386 targets, enable “cdecl” semantics during code genera‐
308 tion, where function arguments are passed on the stack in right-
309 to-left order, and the caller is responsible for cleaning up the
310 stack after the function returns. Any function result is passed
311 in the EAX register. This is the default.
312
313 fastcall
314 For i386-win32 targets, enable “fastcall” semantics during code
315 generation. (Currently this is equivalent to stdcall, which is
316 likely wrong).
317
318 dllimport
319 For i386-win32 targets, references to the external symbol defined
320 by the current statement will be made via indirect access through
321 a location identified by the symbol name prefixed with “__imp_”.
322
323 dllexport
324 For i386-win32 targets, the external symbol declared by the cur‐
325 rent statement will be exported as an indirect reference to be
326 accessed with dllimport. The global locator will be the symbol
327 name prefixed with “__imp_”. Currently this is not completely
328 implemented.
329
330 Any unknown “#pragma” directives will be ignored unless the
331 -Wunknown-pragmas diagnostic is in effect.
332
334 as(1), cpp(1), pcc(1)
335
337 The ccom compiler is based on the original Portable C Compiler by S. C.
338 Johnson, written in the late 70's. Even though much of the compiler has
339 been rewritten (about 50% of the frontend code and 80% of the backend),
340 some of the basics still remain. Most is written by Anders Magnusson,
341 with the exception of the data-flow analysis part and the SSA conversion
342 code which is written by Peter A Jonsson, and the Mips port that were
343 written as part of a project by undergraduate students at Lulea Univer‐
344 sity of Technology.
345
346 This product includes software developed or owned by Caldera Interna‐
347 tional, Inc.
348
349BSD March 22, 2012 BSD