table of contents
| CC(1) | General Commands Manual | CC(1) |
NAME¶
cc — front-end to
the C compiler
SYNOPSIS¶
cc |
[-cEgkLMPOStvXx] [-fPIC]
[-fpic]
[-moption]
[-nostartfiles]
[-nostdinc] [-nostdlib]
[-pg] [-pthread]
[-static] [-B
prefix] [-D
macro[=value]] [-d
option] [-I
directory] [-include
path] [-isystem
path] [-o
outfile] [-Wl
flags] [file ...] |
DESCRIPTION¶
The cc utility provides a front-end to the
“portable C compiler”. Multiple files may be given on the
command line. Unrecognized options are all sent directly to
ld(1).
Filenames that end with .c are passed via cpp(1) → ccom(1) → as(1) → ld(1).
Filenames that end with .i are passed via ccom(1) → as(1) → ld(1).
Filenames that end with .s are passed via as(1) → ld(1).
Filenames that end with .S are passed via cpp(1) → as(1) → ld(1).
Filenames that end with .o are passed directly to ld(1).
The options are as follows:
-Bprefix- Define alternate prefix path for cpp(1), ccom(1), as(1), or ld(1) executables.
-C- Passed to the cpp(1) preprocessor to not discard comments.
-c- Only compile or assemble and then stop. Do not link. The resulting object
output is saved as a filename with a “.o” suffix unless
-ooption is used. Note: cannot be combined with-oif multiple files are given. -Dmacro[=value]- Passed to the cpp(1) preprocessor to define macro.
-doption- Passed to the as(1) assembler.
-E- Stop after preprocessing with cpp(1). Do not compile,
assemble, or link. Output is sent to standard output unless the
-ooption is used. -fPIC- Generate PIC code.
-fpic- Tells C compiler to generate PIC code and tells assembler that PIC code has been generated.
-g- Send
-gflag to ccom(1) to create debug output. This unsets the-Ooption. -Ipath- Passed to the cpp(1) preprocessor to add header search directory to override system defaults.
-includefile- Tells the cpp(1) preprocessor to include the file during preprocessing.
-isystempath- Defines path as a system header directory for the cpp(1) preprocessor.
-k- Generate PIC code. See
-fpicoption. -L- TODO
-M- Pass
-Mflag to cpp(1) to generate dependencies for make(1). -moptions- Target-dependent option.
- ARM
- -mlittle-endian -mbig-endian -mfpe=fpa -mfpe=vpf -msoft-float -march=armv1 -march=armv2 -march=armv2a -march=armv3 -march=armv4 -march=armv4t -march=armv4tej -march=armv5 -march=armv6 -march=armv6t2 -march=armv6kz -march=armv6k -march=armv7
- HPPA
- i386
- MIPS
- -mlittle-endian -mbig-endian -mhard-float -msoft-float
- PDP-10
- PowerPC
- Sparc64
- VAX
-nostartfiles- Do not link with the system startup files (crt0.c, etc.)
-nostdinc- Do not use the system include paths (/usr/include, etc.)
-nostdlib- Do not link with the system C library (libc).
-O- Enable optimizations. Currently passes
-xdeljumpsand-xtempsto ccom(1). Note: this is unset if the-goption is used. -ooutfile- Save result to outfile.
-P- TODO
-pg- Enable profiling on the generated executable.
-pthread- Defines _PTHREADS preprocessor directive for cpp(1). Uses -lpthread for the ld(1) linker.
-S- Stop after compilation by ccom(1). Do not assemble and
do not link. The resulting assembler-language output is saved as a
filename with a “.s” suffix unless the
-ooption is used. Note: cannot be combined with-oif multiple files are given. -static- Do not use dynamic linkage. By default, it will link using the dynamic linker options and/or shared objects for the platform.
- Create a shared object of the result. Tells the linker not to generate an executable.
-t- Passes
-tto cpp(1) for traditional C preprocessor syntax. -Umacro- Passes to the cpp(1) preprocessor to remove the initial macro definition.
-v- Outputs the version of
ccand shows what commands will be run with their command line arguments. -Wlflags- Options for the linker.
-X- Don't remove temporary files on exit.
-x- May be used to give separate optimization flags to ccom, see
-Ofor options. -xc- Gcc compatibility option; specify that the language in use is c.
Predefined Macros¶
A few macros are predefined by cc when
sent to cpp(1).
- __PCC__
- Set to the major version of pcc(1). These macros can be
used to select code based on pcc(1) compatibility. See
the
-voption. - __PCC_MINOR__
- Set to the minor version.
- __PCC_MINORMINOR__
- Set to the minor-minor version — the number after the minor version.
- _PTHREADS
- Defined when
-pthreadswitch is used.
Also system- and/or machine-dependent macros may also be
predefined; for example: __NetBSD__,
__ELF__, and __i386__.
SEE ALSO¶
HISTORY¶
The cc command comes from the original
Portable C Compiler by S. C. Johnson, written in the late 70's.
This product includes software developed or owned by Caldera International, Inc.
| September 14, 2007 | Linux 6.17.3-1-default |