CCOM(1)

πŸŽ€ NAME πŸŽ€

ccom β€” the C compiler. like, the actual compiler compiler. section 1 of the General Commands Manual, CCOM(1), bestie. πŸ’–


✨ SYNOPSIS ✨

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

🌸 DESCRIPTION 🌸

okay so. ccom is a C compiler, periodt. the frontend you actually talk to is usually pcc(1), which means…

⚠️ ccom is not intended to be run directly. it's the backstage queen, not the one you dm. respect the pipeline. πŸ’…

what it does: it reads your C source from infile (or from standard input if you didn't hand it one) and writes the assembler source to outfile (or to standard output if you didn't hand it one). that's the vibe. in goes C, out goes assembly. πŸ¦‹

The options are as follows:


πŸ’… OPTIONS πŸ’…

  • -f feature β€” turn on language features. you can stack multiple -f options, and these are the features that exist:
    • stack-protector β€” Enable stack smashing protection. Currently the same as stack-protector-all.
    • stack-protector-all β€” Enable stack smashing protection for all functions. all of them. every single one. no exceptions. πŸ‘‘
    • pack-struct[=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.
    • freestanding β€” Emit code for a freestanding environment. Currently not implemented (it's giving "coming soon" energy, don't count on it).
  • -g β€” Include debugging information in the output code for use by symbolic and source-level debuggers. Currently this uses the stabs format, encoding information in symbol table entries. yes, stabs. it's the format's name, not a threat. πŸ”ͺ
  • -k β€” Generate PIC code. position-independent, main character energy. ✨
  • -m option β€” target-specific options, used in machine-dependent code. you can stack multiple -m options. here's the full roster of targets and what they take:
    • AMD64 β€” (no -m options listed for this one)
    • ARM β€” little-endian, big-endian, fpe=fpa, fpe=vpf, soft-float, arch=armv1, arch=armv2, arch=armv2a, arch=armv3, arch=armv4, arch=armv4t, arch=armv4tej, arch=armv5, arch=armv5te, arch=armv5tej, arch=armv6, arch=armv6t2, arch=armv6kz, arch=armv6k & arch=armv7. it's a whole buffet. πŸ“
    • HPPA β€” (no -m options listed for this one)
    • i386 β€” (no -m options listed for this one)
    • M16C β€” (no -m options listed for this one)
    • MIPS β€” little-endian & big-endian.
    • NOVA β€” (no -m options listed for this one)
    • PDP-10 β€” (no -m options listed for this one)
    • PDP-11 β€” (no -m options listed for this one)
    • PowerPC β€” little-endian, big-endian, soft-float & hard-float.
    • Sparc64 β€” (no -m options listed for this one)
    • VAX β€” (no -m options listed for this one)
  • -p β€” Generate profiling code. so you can find out where your program spends all its time (spoiler: it's the same function as always). πŸ”₯
  • -s β€” Print statistics to standard error when complete. and bestie, it prints everything: 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. a full receipts moment. 🧾
  • -v β€” Display version. short, sweet, iconic.
  • -W warning β€” Do some basic checks and emit warnings about possible coding problems. you can stack multiple -W options, and here's what's supported:
    • error[=warning] β€” Enable warning, and treat it as an error condition. If a specific warning is not given, producing any warning will cause an error. 😭
    • attributes β€” Warn when unsupported attributes are used. This warning is enabled by default.
    • deprecated-declarations β€” Report whenever a symbol marked with the β€˜deprecated’ attribute is used. This warning is enabled by default.
    • implicit-function-declaration β€” (TODO) Require explicit prototypes for all called functions.
    • implicit-int β€” (TODO) Warn when a function declaration lacks a type.
    • missing-prototypes β€” Require explicit prototypes for all global function definitions.
    • pointer-sign β€” Warn when pointer operations are done with mismatched signed and unsigned values.
    • sign-compare β€” (TODO) Warn about comparisons between signed and unsigned values.
    • strict-prototypes β€” (TODO) Require that function prototypes are strictly C99.
    • shadow β€” Report when a local variable shadows something from a higher scope. πŸ‘» (yes, that's why it's called that, no cap)
    • truncate β€” Report when integer values may be implicitly truncated to fit a smaller type.
    • uninitialized β€” A variable is read before being written.
    • unknown-pragmas β€” Report unhandled pragma statements.
    • unreachable-code β€” Report statements that cannot be executed.
πŸ’‘ any of the above may be prefixed with β€œno-” in order to disable the effect. so no-shadow, no-uninitialized, whatever you need. slay.
  • -X flags β€” C specific debugging, where flags is one or more of the following:
    • b β€” Building of parse trees
    • d β€” Declarations (using multiple d flags gives more output β€” more ds, more drama πŸ’€)
    • e β€” Pass1 trees at exit
    • i β€” Initializations
    • n β€” Memory allocations
    • o β€” Turn off optimisations
    • p β€” Prototypes
    • s β€” Inlining
    • t β€” Type conversions
    • x β€” Target-specific flag, used in machine-dependent code
  • -x setting β€” Enable setting in the compiler. you can stack multiple -x options, and these are the settings on the menu:
    • ccp β€” Apply sparse conditional constant propagation techniques for optimization. Currently not implemented.
    • dce β€” Do dead code elimination. bye bestie, you're not even reachable. πŸ‘‹
    • deljumps β€” Delete redundant jumps and dead code.
    • gnu89 β€” the manpage gives this one no blurb. we love an enigma. ✨
    • gnu99 β€” Use GNU C semantics rather than C99 for some things. Currently only inline.
    • inline β€” Replace calls to functions marked with an inline specifier with a copy of the actual function.
    • ssa β€” Convert statements into static single assignment form for optimization. Not yet finished.
    • tailcall β€” Enable optimization of tail-recursion functions. Currently not implemented.
    • temps β€” Locate automatic variables into registers where possible, for further optimization by the register allocator.
    • uchar β€” Treat character constants as unsigned values.
  • -Z flags β€” Code generator (pass2) specific debugging, where flags is one or more of the following:
    • b β€” Basic block and SSA building
    • c β€” Code printout
    • e β€” Trees when entering pass2
    • f β€” Instruction matcher, may provide much output (it's giving verbose πŸ—£οΈ)
    • g β€” Print flow graphs
    • n β€” Memory allocation
    • o β€” Instruction generator
    • r β€” Register allocator
    • s β€” Shape matching in instruction generator
    • t β€” Type matching in instruction generator
    • u β€” Sethi-Ullman computations
    • x β€” Target-specific flag, used in machine-dependent code

✨ PRAGMAS ✨

okay bestie, listen, this is the part where you get to talk back to the compiler mid-compile. iconic behaviour, honestly. πŸ’…

Input lines starting with a #pragma directive can be used to modify behaviour of ccom during compilation. Every token up to the first unescaped newline counts as part of the pragma command, and these are the operations it recognises:

  • STDC β€” a Standard C99 operator follows. Currently no C99 operations are implemented, and any directives starting with this token will be silently ignored. (she's giving ghosting, and honestly? fair) πŸ‘»
  • GCC diagnostic effect "option" β€” GNU C compatibility. This one alters the effects of compiler diagnostics. The required effect should be stated as warning, error or ignored, followed by the compiler diagnostic option in double quotes. So, for example, to force unknown pragmas to always generate an error, a standard header might include:
#pragma GCC diagnostic error "-Wunknown-pragmas"
  • GCC poison 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.
  • GCC system_header β€” GNU C compatibility. Currently not implemented.
  • GCC visibility β€” GNU C compatibility. Currently not implemented.
  • pack([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. squish those structs, slay 🫢
  • pack(push[, 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.
  • pack(pop) β€” Change the pack setting to the most recently pushed value, and remove that setting from the stack. Currently not implemented.
  • packed [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 β€” so like, it shows up to the party but doesn't do anything 😭)
  • aligned [n] β€” Set the minimum alignment for the structure or union defined in the current statement.
  • rename name β€” Provide an alternative name which will be used to reference the object declared in the current statement. glow-up via rebrand, we love to see it ✨
  • weak 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.
  • ident β€” Currently not implemented.

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

  • tls β€” For AMD64 and i386 targets, the variable declared in the current statement will be referenced via the β€œthread-local storage” mechanism.
  • init β€” For AMD64, ARM, HPPA, i386, MIPS and PowerPC targets, when the current statement is a function declaration, generate a reference in the .ctors section, enabling library code to call the function prior to entering main().
  • fini β€” For AMD64, ARM, HPPA, i386, MIPS and PowerPC targets, when the current statement is a function declaration, generate a reference in the .dtors section, enabling library code to call the function when main() returns or the exit() function is called.
  • section name β€” For AMD64, ARM, HPPA and i386 targets, place the subsequent code in the named section. (This is currently broken). πŸ’€
  • alias name β€” For AMD64, HPPA and i386 targets, emit assembler instructions providing an alias for the symbol defined by the current statement.
  • stdcall β€” 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.
  • cdecl β€” 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. she's the main character, the blueprint, the moment πŸ‘‘
  • fastcall β€” For i386-win32 targets, enable β€œfastcall” semantics during code generation. (Currently this is equivalent to stdcall, which is likely wrong).
  • dllimport β€” 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_.
  • dllexport β€” 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)

go read those too bestie, expanding your horizons fr fr πŸ“š


πŸ“œ 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.


and that's the whole page, bestie!! πŸŽ€ this one came from Debian, dated March 22, 2012 β€” so like, a vintage icon, honestly. no cap, she's been serving since the 70's and she's still compiling. periodt. πŸ’œβœ¨