bcc(1)
π bcc β Bruce's C compiler π
okay bestie, so this is bcc(1), and yeah it lives in the General Commands Manual section, which is giving "vintage but make it work". Bruce's C compiler. Bruce. A whole compiler. Let's get into it π«Ά
β¨ NAME β¨
bcc β Bruce's C compiler π
π SYNOPSIS π
bcc [-03EGNOPSVcegvwxW] [-Aas_option] [-Bexecutable_prefix] [-Ddefine]
[-Uundef] [-Mc_mode] [-o outfile] [-ansi] [-Ccc1_option] [-Pcpp_option]
[-Iinclude_dir] [-Lld_option] [-Ttmpdir] [-Qc386_option] [-ttext_segno]
[ld_options] [infiles]
like... look at her. so many flags. so much range. π
π¦ DESCRIPTION π¦
Bcc is a simple C compiler that spits out 8086 assembler, and on top of that, compile-time options let you get 80386 or 6809 versions too. She understands traditional K&R C, with exactly one little restriction: bit fields get mapped onto one of the other integer types. that's it. that's the whole caveat. iconic honestly.
The default behavior? Produce an 8086 executable called a.out from the source file. no notes. that's the vibe check she passes by default πΈ
β¨ OPTIONS β¨
okay this is the main character section, buckle up π
-ansiβ runs the C source throughunprotoizeafter preprocessing and before code generation. This lets some ansi C compile, but bestie listen to me: it is definitly NOT a true ansi-C compiler. do not come for me, I'm just the messenger π-0β 8086 target (works on a 80386 host, but not 6809)-3β 80386 target (may work on an 8086 host, but not 6809)-Aβ pass the remainder of the option through to the assembler (e.g.-A-l -Alistfilefor a listing)-Bβ prefix for the executable search path (as usual; the search order is all paths specified using-B, in order, then the path given in the environment variableBCC_EXEC_PREFIXif that is set, then the compiled-in defaults (something like/usr/lib/bcc/followed by/usr/bin/))-Cβ pass the remainder of the option tobcc-cc1, see code generation options-Dβ preprocessor define-Eβ produce preprocessor output to standard out-Gβ produce GCC objects (same as-Mg)-Ixyzβ include search pathxyz-Iβ don't add the default include to the search list-Lxyzβ add directory namexyzto the head of the list of library directories searched-Lβ don't add the default library to the search list-Mdβ alters the arguments for all passes so they produce MSDOS executable COM files. These are small model executables; use-ito get tiny model.-Mfβ setsbccto pass the-cand-farguments to the code generator for smaller, faster code. β οΈ heads up: this code is not compatible with the standard calling conventions, so a different version of the C library gets linked in too.-Mcβ setsbccto pass the-cargument to the code generator for smaller, faster code. Note the standard libc is normally transparent to this, but there are exceptions.-Msβ alters the arguments for all passes and selects the C-library to produce standalone Linux-86 executables-Mlβ switches to the i386-Linux code generator and library. This configuration accepts the-zflag to generate QMAGICa.outfiles instead of the normal OMAGIC ones.-Mgβ switches to the i386-Linux code generator and generates OMAGIC object files that can be linked with some versions of gcc; unfortunatly the most recent versions usecollect2to link and this crashes π-Nβ makes the linker produce a nativea.outfile (Linux OMAGIC). Combined with-3, the executable will run under Linux-i386.-Oβ optimize, callscopt(1)to optimize 8086 code. Specifiers to choose which rulescoptshould use can be appended to the-O, and the option can be repeated. β¨-Pβ produce preprocessor output with no line numbers to standard output-Qβ pass the full option toc386(only for the c386 version)-Sβ produce assembler file-Tβ temporary directory (overrides the previous value and the default; the default comes from the environment variableTMPDIRif that's set, otherwise/tmp)-Uβ preprocessor undefine-Vβ print names of files being compiled-Xβ pass the remainder of the option to the linker (e.g.-X-Ofilegets passed to the linker as-Ofile)-cβ produce object file-fβ turn on floating point support; no effect with i386, changes the libc library with 8086 code-gβ produce debugging info (ignored.) π-oβ output file name follows (assembler, object or executable) (as usual)-pβ produce profiling info (ignored.) π-t1β pass to the assembler to renumber the text segment for multi-segment programs-vβ print names and args of subprocesses being run. Two or more-v's print names of files being unlinked. Three or more-v's print names of paths being searched. (stacked-v's are lowkey a personality trait fr fr)-wβ Supress any warning diagnostics.-Wβ Turn on assembler warning messages.-xβ don't includecrt0.oin the link-iβ don't pass-ito the linker, so that it will create an impure executable-7β Turn on ancient C mode (see CODE GENERATOR OPTIONS below). Among other things, this disables valuable error checks and even parses certain constructs incompatibly (e.g.=-is postdecrement instead of an assignment of a negative number) with later C standards, so this option should only be used with ancient code. To generate executables for a V7 variant you should tell the linker to generate an olda.outheader with the-X-7option.
Other options get passed to the linker, in particular -lx, -M, -m, -s, -H.
π CODE GENERATOR OPTIONS π
These are all the options the code generator pass bcc-cc1 understands β only some of them will be useful for the -C option of bcc, so pick your faves π
-0β 8086 target (works even on a 80386 host, not on 6809)-3β 80386 target (may work even on an 8086 host, not on 6809)-Dβ define (as usual)-Eβ produce preprocessor output (as usual)-Iβ include search path (as usual)-Pβ produce preprocessor output with no line numbers (as usual)-cβ produce code with caller saving regs before function calls-dβ print debugging information in assembly output-fβ produce code with the 1st argument passed in a register (AX,EAXorX)-lβ produce code for 2 3 1 0 long byte order (only works in 16-bit code); a special library of compiler helper functions is needed for this mode-oβ assembler output file name follows-pβ produce (almost) position-independent code (only for the 6809)-tβ print source code in assembly output-wβ print whatcc1thinks is the location counter in assembly output-7β Accept various obsolete constructs for ancient C compilers, including Ritchie's Sixth Edition UNIX C compiler and Seventh Edition UNIX Portable C compiler. Enough of these compilers is emulated to compile all of Seventh Edition userspace and kernel. π€ that's a flex, honestly.
All the options except -D, -I and -o may be turned off by following the option letter with a -. Options are processed left to right, so the last setting has precedence. periodt.
πΈ PREPROCESSOR DEFINES πΈ
The preprocessor has a number of manifest constants, bestie, and here they all are:
__BCC__1β the compiler identifier, normally used to avoid compiler limitations__FILE__β stringized name of current input file__LINE__β current line number__MSDOS__1β compiler is configured for generating MSDOS executable COM files__STANDALONE__1β compiler is configured for generating standalone executables__AS386_16__1β compiler is generating 16 bit 8086 assembler and the#asmkeyword is available for including 8086 code__AS386_32__1β compiler is generating 32 bit 80386 assembler and the#asmkeyword is available for including 80386 code__CALLER_SAVES__1β compiler calling conventions are altered so the calling function must save theSIandDIregisters if they are in use (ESIandEDIon the 80386)__FIRST_ARG_IN_AX__1β compiler calling conventions are altered so the calling function is passing the first argument to the function in theAX(orEAX) register__LONG_BIG_ENDIAN__1β alters the word order of code generated by the 8086 compiler
These defines only occur in the 6809 version of the compiler:
__AS09__1β compiler is generating 6809 code__FIRST_ARG_IN_X__1β the first argument to functions is passed in theXregister__POS_INDEPENDENT__1β the code generated is (almost) position independent
π ENVIRONMENT π
BCC_EXEC_PREFIXβ default directory to seach for compiler passesTMPDIRβ directory to place temporary files (default/tmp)
β DIRECTORIES β
All the include, library and compiler components are stored under the /usr/bcc directory under Linux-i386. This is laid out the same as a /usr filesystem, and if bcc is to be the primary compiler on a system, it should be moved there. The configuration for this lives in the bcc.c source file only β all the other executables are independent of location. slay.
The library installation also creates the file /usr/lib/liberror.txt, and this path is hardcoded into the C library. (hardcoded?? in this economy?? π yeah.)
The bcc executable itself, as86 and ld86 are in /usr/bin.
π₯ SEE ALSO π₯
π BUGS π
The bcc.c compiler driver source is very untidy. (no cap. it's giving chaos.)
The linker, ld86, produces a broken a.out object file if given one input and the -r option β this is so it is compatible with pre-dev86 versions. so it's broken on purpose, which is somehow worse and also lowkey iconic π
and that's the whole page bestie!! this was bcc(1) from the General Commands Manual, dated Nov, 1997 β yeah she's vintage, she's from the 90s, she was doing 8086 before it was cool, and she still ate π
β¨ mwah, go compile something ππ¦
π¦ where this page comes from
- alpine 3.22: dev86-doc 0.16.21-r3 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- alpine 3.23: dev86-doc 0.16.21-r4 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- alpine 3.24: dev86-doc 0.16.21-r4 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- fedora 43: dev86 0.16.21-31.fc43 Β· GPL-1.0-or-later AND GPL-2.0-or-later AND LicenseRef-Callaway-LGPLv2+
- fedora 44: dev86 0.16.21-33.fc44 Β· GPL-1.0-or-later AND GPL-2.0-or-later AND LicenseRef-Callaway-LGPLv2+
- nixos 26.05: dev86 1.0.1-unstable-2025-02-12
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms