Scroll to navigation

CCOM(1) General Commands Manual CCOM(1)

NAME

ccomC compiler

SYNOPSIS

ccom [-gkpsv] [-f features] [-m options] [-W warnings] [-X flags] [-x settings] [-Z flags] [infile] [outfile]

DESCRIPTION

The ccom utility provides a C compiler. The frontend is usually pcc(1). It is intended to be run directly. ccom reads the C source from infile or standard input and writes the assembler source to outfile or to standard output.

The options are as follows:

feature
Enable language features. Multiple -f options can be given, the following features are supported:
Enable stack smashing protection. Currently the same as stack-protector-all.
Enable stack smashing protection for all functions.
[=n]
Specify maximum alignment for structure members, similar to a #pragma pack statement at the start of the file. If no value is given, the default is 1.
Emit code for a freestanding environment. Currently not implemented.
Include debugging information in the output code for use by symbolic and source-level debuggers. Currently this uses the format, encoding information in symbol le entrie
Generate PIC code.
option
Target-specific options, used in machine-dependent code. Multiple -m options can be given, the following options are supported:
AMD64
 
ARM
, big-endian, , , soft-float, , , , , , , , , , , , , , & .
HPPA
 
i386
 
M16C
 
MIPS
& big-endian.
NOVA
 
PDP-10
 
PDP-11
 
PowerPC
, big-endian, soft-float & .
Sparc64
 
VAX
 
Generate profiling code.
Print statistics to standard error when complete. This includes: name table entries, name string size, permanent allocated memory, temporary allocated memory, lost memory, argument list unions, dimension/function unions, struct/union/enum blocks, inline node count, inline control blocks, and permanent symtab entries.
Display version.
warning
Do some basic checks and emit warnings about possible coding problems. Multiple -W options can be given, the following warnings are supported:
[=warning]
Enable warning, and treat it as an error condition. If a specific warning is not given, producing any warning will cause an error.
Warn when unsupported attributes are used. This warning is enabled by default.
Report whenever a symbol marked with the ‘deprecated’ attribute is used. This warning is enabled by default.
(TODO) Require explicit prototypes for all called functions.
(TODO) Warn when a function declaration lacks a type.
Require explicit prototypes for all global function definitions.
Warn when pointer operations are done with mismatched signed and unsigned values.
(TODO) Warn about comparisons between signed and unsigned values.
(TODO) Require that function prototypes are strictly C99.
Report when a local variable shadows something from a higher scope.
Report when integer values may be implicitly truncated to fit a smaller type.
A variable is read before being written.
Report unhandled pragma statements.
Report statements that cannot be executed.

Any of the above may be prefixed with “no-” in order to disable the effect.

flags
C specific debugging where flags is one or more of the following:

Building of parse trees
Declarations (using multiple d flags gives more output)
Pass1 trees at exit
Initializations
Memory allocations
Turn off optimisations
Prototypes
Inlining
Type conversions
Target-specific flag, used in machine-dependent code
setting
Enable setting in the compiler. Multiple -x options can be given, the following settings are supported:
Apply sparse conditional constant propagation techniques for optimization. Currently not implemented.
Do dead code elimination.
Delete redundant jumps and dead code.
 
Use GNU C semantics rather than C99 for some things. Currently only inline.
Replace calls to functions marked with an inline specifier with a copy of the actual function.
Convert statements into static single assignment form for optimization. Not yet finished.
Enable optimization of tail-recursion functions. Currently not implemented.
Locate automatic variables into registers where possible, for further optimization by the register allocator.
Treat character constants as unsigned values.
flags
Code generator (pass2) specific debugging where flags is one or more of the following:

Basic block and SSA building
Code printout
Trees when entering pass2
Instruction matcher, may provide much output
Print flow graphs
Memory allocation
Instruction generator
Register allocator
Shape matching in instruction generator
Type matching in instruction generator
Sethi-Ullman computations
Target-specific flag, used in machine-dependent code

PRAGMAS

Input lines starting with a “#pragma” directive can be used to modify behaviour of ccom during compilation. All tokens up to the first unescaped newline are considered part of the pragma command, with the following operations being recognized:

Standard C99 operator follows. Currently no C99 operations are implemented, and any directives starting with this token will be silently ignored.
effect "option"
GNU C compatibility. Alter the effects of compiler diagnostics. The required effect should be stated as , error or , followed by the compiler diagnostic option in double quotes. For example, to force unknown pragmas to always generate an error, a standard header might include
#pragma GCC diagnostic error "-Wunknown-pragmas"
identifier ...
GNU C compatibility. Cause an error if any of the following identifiers subsequently appear in the code (but not in any macro expansions). Currently not implemented.
GNU C compatibility. Currently not implemented.
GNU C compatibility. Currently not implemented.
([n])
Set the default maximum alignment for structures and unions, such that members will have their natural alignment requirements clamped at this value and may be stored misaligned. If n is not given, the alignment is reset to the target default.
([, n])
Push the current pack setting onto an internal stack then, if n is given, change the default alignment for structures and unions. Currently not implemented.
()
Change the pack setting to the most recently pushed value, and remove that setting from the stack. Currently not implemented.
[n]
Set the maximum alignment for the structure or union defined in the current statement. If n is not given, the default value of 1 is used. (Currently this works except n is not used)
[n]
Set the minimum alignment for the structure or union defined in the current statement.
name
Provide an alternative name which will be used to reference the object declared in the current statement.
name[=alias]
Mark name as a weak rather than a global symbol, to allow its definition to be overridden at link time. If an alias is given, this will be used as the default value of name.
Currently not implemented.

and the following target-specific operations are handled by machine-dependent code:

For AMD64 and i386 targets, the variable declared in the current statement will be referenced via the “thread-local storage” mechanism.
For AMD64, ARM, HPPA, i386, MIPS and PowerPC targets, when the current statement is a function declaration, generate a reference in the section, enabling library code to call the function prior to entering ().
For AMD64, ARM, HPPA, i386, MIPS and PowerPC targets, when the current statement is a function declaration, generate a reference in the section, enabling library code to call the function when main() returns or the () function is called.
name
For AMD64, ARM, HPPA and i386 targets, place the subsequent code in the named section. (This is currently broken).
name
For AMD64, HPPA and i386 targets, emit assembler instructions providing an alias for the symbol defined by the current statement.
For i386 targets, enable “stdcall” semantics during code generation, where function arguments are passed on the stack in right-to-left order, and the callee is responsible for adjusting the stack pointer before returning. Any function result is passed in the EAX register. On win32, the function name is postfixed with an “@” and the size of the stack adjustment.
For i386 targets, enable “cdecl” semantics during code generation, where function arguments are passed on the stack in right-to-left order, and the caller is responsible for cleaning up the stack after the function returns. Any function result is passed in the EAX register. This is the default.
For i386-win32 targets, enable “fastcall” semantics during code generation. (Currently this is equivalent to stdcall, which is likely wrong).
For i386-win32 targets, references to the external symbol defined by the current statement will be made via indirect access through a location identified by the symbol name prefixed with “__imp_”.
For i386-win32 targets, the external symbol declared by the current statement will be exported as an indirect reference to be accessed with dllimport. The global locator will be the symbol name prefixed with “__imp_”. Currently this is not completely implemented.

Any unknown “#pragma” directives will be ignored unless the -Wunknown-pragmas diagnostic is in effect.

SEE ALSO

as(1), cpp(1), pcc(1)

HISTORY

The ccom compiler is based on the original Portable C Compiler by S. C. Johnson, written in the late 70's. Even though much of the compiler has been rewritten (about 50% of the frontend code and 80% of the backend), some of the basics still remain. Most is written by Anders Magnusson, with the exception of the data-flow analysis part and the SSA conversion code which is written by Peter A Jonsson, and the Mips port that were written as part of a project by undergraduate students at Lulea University of Technology.

This product includes software developed or owned by Caldera International, Inc.

March 22, 2012 Debian