rg-cc

"I can C for miles and miles"

When we started writing games for the Falcon, we did everything entirely in assembly language. This inevitably led to many long hours in Mon-ST sweating over crashes and memory scribblers. After a long hard year of writing Double Bobble 2000, we decided there had to be a better way; and there was. We switched to C for writing high-level logic and program flow, and assembly for graphics routines and performance-critical code.

We started this work with Hisoft's Lattice C, but quickly switched to Pure C due to its much higher speed (both in compile times and runtime performance).

In later years, as we moved to cross-platform development, we found VBCC was really tailored for our needs.

But revisiting our workflows after many years of absence, it became obvious that things would have to change.

VBCC was not being updated very regularly and had some nasty compiler bugs that were annoying to work around. Pure C still produces excellent 68k code, but is awkward to use in a cross-platform toolchain, and lacks many modern C features and optimisations. Modern compilers like GCC are large and bloated, and although they have amazing high-level optimisations, they don't always do a great job at the final step of writing 68k code.

Wouldn't it be nice to have something better? A modern compiler, with modern features and modern optimisations, that also deeply understands and optimises for the 68k architecture.

That is the design ethos behind rg-cc: a brand new C99 compiler, built from the ground up around the 68k architecture.

We kept it simple — a single executable that compiles, assembles, links, and even includes its own build system, with no dependencies or external tooling needed.


Contents


Command-Line Interface

Install

rg-cc is distributed as a single standalone executable (static musl on Linux with zero host library dependencies; standard OS system libraries only on macOS and Windows). Prebuilt packages for macOS, Linux, and Windows are available from rg.atari.org.

Simply drop the executable somewhere on your PATH.

Quick start

# Compile single C file to relocatable object (default: fastcall ABI, 68000 CPU)
rg-cc -c game.c -o game.o

# Compile with optimisation level 2 and size-favouring mode
rg-cc -c -O2 --opt-size game.c -o game.o

# Multi-file parallel compilation (Rayon multi-threaded across CPU cores)
rg-cc -c -I include/ -D NDEBUG player.c enemy.c audio.c video.c

# Direct single-step link into an Atari executable (one of the objects defines `main`)
rg-cc game.o player.o enemy.o audio.o video.o -o game.tos

# Build a multi-target project from ./build.rbs or a classic Pure C .PRJ file
rg-cc build
rg-cc MYGAME.PRJ

# Preprocess only (GCC -E) or emit Makefile header dependency files
rg-cc -E main.c -o main.i
rg-cc -c main.c --emit-depfile

# Inspect SSA three-address intermediate representation (IR)
rg-cc --ir --opt 2 math.c

Compile and run

The direct-to-executable path links the bundled startup and the compiler-support runtime for you, so a freestanding program goes from source to a runnable Atari executable in one step:

printf 'int main(void) { return 0; }\n' > hello.c
rg-cc hello.c -o hello.tos

hello.tos boots on a real ST (or under an emulator) and terminates with Pterm(0) using the value main returned. Standard C, math, GEM, Line-A, Pure C <ext.h>, and POSIX calls are all bundled and linked automatically; see the library contract.


Headers & libraries

rg-cc compiles in freestanding mode by default and hosted mode when you pass --hosted. This decides which headers are built in and what you need to link yourself:

ModeBuilt-in Header Families
Freestanding (default)Core C (<stdint.h>, <stddef.h>, <stdbool.h>, <stdarg.h>, <limits.h>, <float.h>, <inttypes.h>, <complex.h>, <time.h>, <wchar.h>, <iso646.h>, <stdalign.h>, <stdnoreturn.h>), Atari OS/GUI (<tos.h>, <osbind.h>, <gemdos.h>, <bios.h>, <xbios.h>, <linea.h>, <gem.h>, <aes.h>, <vdi.h>, <ext.h>), Pure C / VBCC compat (<compiler.h>, <math_881.h>, <math_040.h>, <math_060.h>), plus <fenv.h>, <locale.h>, <math.h>, <signal.h>, <tgmath.h>, <wctype.h>, <strings.h>, <sys/types.h>, <sys/stat.h>
Hosted (--hosted)Everything above plus <assert.h>, <ctype.h>, <errno.h>, <fcntl.h>, <setjmp.h>, <stdio.h>, <stdlib.h>, <string.h>, <unistd.h>

All core Atari and C libraries are built in. When linking without -nostdlib or -nodefaultlibs, rg-cc compiles and links its own in-memory runtime archives matching your active --abi, --mshort, CPU, and FPU settings:

ArchiveContents
crt0.oTOS startup (_start, __BasPag), Mshrink, stack setup, Pterm exit
libc.aC99 stdio, stdlib (malloc/free), string, ctype, time, errno, assert, setjmp/longjmp
libm.aPure C99 floating-point maths (sin, cos, sqrt, pow, exp, log, atan2, rounding)
libgem.aAES (trap #2, 0xC8) and VDI (trap #2, 0x73) bindings (mt_*, v_*, aes_global, gl_apid)
liblinea.aLine-A (0xA000–0xA00A) pixel, line, and rectangle helpers (__aline, linea_init)
libext.aPure C / Turbo C <ext.h> helpers (findfirst/findnext, fnsplit/fnmerge, getdate, delay)
libposix.aPOSIX file and directory wrappers (open, read, write, close, lseek, stat, mkdir, sbrk)
libintrt.a, libsoftfloat.a64-bit integer and IEEE soft-float compiler helpers

Bring your own library. Headers found on -I <dir> take precedence over built-ins, and any -l archive or .a/.o file you pass is linked before the built-in libraries so external libraries (such as libcmini, MiNTLib, or gemlib) take priority. Pass -nodefaultlibs or -nostdlib to disable the built-in libraries, or --emit-runtime [<DIR>] to inspect or link against the archives on disk. For example, linking against an external cdecl library:

rg-cc --hosted --abi cdecl -I /path/to/libcmini/include main.c -L /path/to/libcmini/lib -lc -o main.tos

Target CPU, FPU & ABI

rg-cc generates code for the Motorola 680x0 family and supports both Atari ST system conventions and custom register layouts.

Target CPUs (--mcpu <CPU>)

TargetCapabilities / Codegen Model
68000 (default)16/32-bit CISC baseline; 16-bit ALU multiplications (muls.w/mulu.w), 8-bit brief indexed addressing (d8(An,Dn)).
68020Full 32-bit ALU (muls.l, divs.l), hardware scaled indexing (d(An,Dn*scale)), bitfield instructions (bfextu, bfins).
68030On-chip data/instruction caches, MMU support, 68020 instruction superset.
68040Integrated FPU pipeline, copyback cache, dual execution units.
68060Dual-issue superscalar p-pipe/s-pipe branch folding instruction scheduler.

Floating-Point Models (--hard-float / --soft-float)

By default, floating-point operations are rejected at compile time so software-float helpers are never linked accidentally. Pass --soft-float or --hard-float when your code uses float or double:

Calling Conventions (--abi <ABI>)


Compiling

rg-cc works both as a single-file compiler and as a fast parallel driver:

# Single-file compile
rg-cc -c main.c -o main.o

# Multi-file batch compilation
rg-cc -c src/main.c src/render.c src/audio.c src/physics.c

When multiple source files are passed with -c, rg-cc uses Rayon threads to parse, optimise, and assemble all translation units concurrently across all available CPU cores.

Response Files (@<file>)

To pass hundreds of source files, include paths, or macro definitions without running into OS command-line length limits (or inside complex build tools like Make, Ninja, and FASTBuild), rg-cc supports response files:

# Read arguments from a response file
rg-cc @build_args.rsp

# Mix direct flags with response files
rg-cc -c -O2 @sources.rsp -o combined.o

Pass --lto to enable cross-translation-unit whole-program optimisation:

rg-cc -c --lto file1.c file2.c file3.c -o combined.o

Under --lto, all translation units are merged into one AST/IR module before optimisation for cross-file inlining, unused static dead-code pruning, interprocedural register allocation (IPRA), and global constant propagation across module boundaries.


Preprocessor

rg-cc contains a standards-compliant, zero-copy C99 preprocessor supporting macro expansion, token pasting (##), stringification (#), variadic macros (__VA_ARGS__), and header search paths.

Include paths & macros

FlagMeaningExample
-I <DIR>Add directory to include search path-I include/
-D <NAME[=VAL]>Define preprocessor macro-D NDEBUG or -D SCREEN_WIDTH=320
-U, --undefine <NAME>Undefine preprocessor macro-U DEBUG
--include <FILE>Force-include header before compiling--include config.h
--iquote <DIR>Quote-include path (#include "...")--iquote src/
--isystem <DIR>System-include path (#include <...>)--isystem /usr/include
--idirafter <DIR>Search directory after all standard -I--idirafter compat/

Preprocess Only (-E)

rg-cc -E input.c -o preprocessed.i

Writes the preprocessed C source containing #line / # N "filename" linemarkers to stdout or the specified output file.

Makefile Dependency Generation (--emit-depfile)

Ideal for build orchestration systems (Make, Ninja, FASTBuild):

rg-cc -c main.c --emit-depfile
# Generates main.o and main.d containing: main.o: main.c header1.h header2.h

Optimisation

rg-cc features a multi-stage SSA optimising pipeline:

rg-cc -c --opt 0 foo.c    # Debug / Fast (peephole only)
rg-cc -c --opt 1 foo.c    # Basic SSA optimisations (GVN, SCCP, DCE, inlining)
rg-cc -c --opt 2 foo.c    # Full release optimisation (LICM, LSR, scheduling, unrolling)
rg-cc -c --opt 3 foo.c    # Aggressive optimisation (maximum inlining & loop unrolling)

Optimisation Tiers

LevelPasses ExecutedTarget Use Case
-O0 / --opt 0Constant folding, local dead code elimination, machine peephole.Fast compilation, clean debugging with exact source line mappings.
-O1 / --opt 1Global Value Numbering (GVN), Sparse Conditional Constant Propagation (SCCP), small leaf inlining, algebraic simplification.Balanced compile time and execution performance.
-O2 / --opt 2Default Release. Loop-Invariant Code Motion (LICM), Loop Strength Reduction (LSR), instruction scheduling, memory-direct RMW.Recommended default for shipping games and applications.
-O3 / --opt 3Aggressive caller inlining (up to 128 IR insns), constant-trip loop unrolling, speculative branch elimination.Critical inner loops and compute-heavy mathematical code.

Size-Favouring Mode (--opt-size)

When compiling code for memory-constrained 512 KB–1 MB Atari STs, pass --opt-size:

rg-cc -c -O2 --opt-size cold_ui.c -o cold_ui.o

--opt-size maintains all correctness and redundancy elimination passes (GVN, SCCP, DCE) while turning off byte-expanding cycle-favouring transformations (such as aggressive inlining and large multiply-to-shift-add expansions).

Profile-Guided Function Size Mode (--opt-size-list <FILE>)

Compile hot functions for maximum cycle speed while keeping cold functions size-optimised in the same file:

rg-cc -c -O2 --opt-size-list cold_functions.txt game.c

Fine-Grained Pass Flags (--flags <SPEC>)

Override specific internal optimiser passes on the command line:

rg-cc -c -O2 --flags ptr_loop_dbra=on,unroll=off game.c

Output formats

Output depends on whether you compile intermediate objects (-c) or link a final executable:

Executables (.PRG / .TOS)

When invoked without -c, rg-cc links the compiled code (or supplied object files) directly into an Atari GEMDOS executable:

# Single-step compilation and linking to an Atari PRG executable
rg-cc player.c enemy.c audio.c -o game.prg

# Linking previously compiled object files into a TOS binary
rg-cc player.o enemy.o audio.o -o game.tos

Because rg-cc embeds its own linker directly:

Object files (-c)

When compiling with -c, rg-cc outputs relocatable object files (.o):

rg-cc -c game.c -o game.o

Why does rg-cc use ELF32 for intermediate objects instead of legacy Atari DRI/GST formats?

Direct ELF vs. assembly text

rg-cc includes a direct machine-instruction encoder alongside its text-assembly path:


Warnings

rg-cc provides rich compiler diagnostics with source snippets, column carets, and severity levels.

rg-cc -c --wall --wextra game.c        # Enable common and extra warning sets
rg-cc -c --werror game.c               # Treat all warnings as fatal errors
rg-cc -c --pedantic game.c             # Strict C99 conformance validation
rg-cc -c -g game.c                     # Emit DWARF 4 debug symbols (.debug_line, .debug_info)

Warning Control Flags

Flag / OptionEffectExample
-w, --quietSilence all compiler warning messagesrg-cc -c -w game.c
-Wall, --wallEnable standard diagnostic warningsrg-cc -c -Wall game.c
-Wextra, --wextraEnable extra detailed compiler diagnosticsrg-cc -c -Wextra game.c
-Werror, --werrorPromote all enabled warnings to fatal compilation errorsrg-cc -c -Werror game.c
-Wpedantic, --pedanticEnforce strict ISO C99 standards conformance checksrg-cc -c -pedantic game.c
-Werror=<CAT>, --werror-cat <CAT>Promote a specific warning category <CAT> to a fatal errorrg-cc -c -Werror=shadow game.c
-Wno-<CAT>, --wno-cat <CAT>Disable and silence a specific warning category <CAT>rg-cc -c -Wno-unused game.c
-W<CAT>, --w-cat <CAT>Explicitly enable a specific warning category <CAT>rg-cc -c -Wshadow game.c
-g, --debugEmit DWARF 4 debug info sections (.debug_line, .debug_info)rg-cc -c -g game.c
--hostedCompile in hosted mode (__STDC_HOSTED__=1) with built-in hosted headers and bundled C/GEM/POSIX libraries — see the library contractrg-cc -c --hosted game.c
--std <STD>Set the C standard dialect (c89, c99, gnu99, c11); see C dialectsrg-cc -c --std c99 game.c

C dialects

--std <STD> selects the C standard the front end applies. It is read: it sets __STDC_VERSION__, and it decides whether an implicit function declaration is a constraint violation.

--std__STDC_VERSION__Implicit function declaration
(omitted)199901Laccepted (the legacy permissive default)
c89undefined — the macro is C99's (§6.10.8)accepted (the C89 rule, §6.5.2.2)
c99199901Lrefused (§6.5.2.2p1 removed the implicit declaration)
gnu99199901Laccepted (the C99 macro set with the GNU/legacy permissiveness)
c11201112Lrefused

An undeclared identifier used as a value (int y = undefined_thing;) is refused under every dialect: neither C89's implicit declaration (which covers a call) nor its implicit int (which covers a declaration) makes a bare object use legal. An unknown --std value is refused at argument parsing, and the accepted set is exactly what --help lists.

Warning Categories

Specific warning classes can be enabled (-W<cat>), disabled (-Wno-<cat>), or promoted to fatal errors (-Werror=<cat>):

Category (<CAT>)Trigger Condition / DescriptionEnabled In
shadowA local variable declaration shadows a variable, parameter, or global from an outer scope.-Wextra
unusedAn unused variable, function parameter, or static function definition is detected.-Wall
unused-variableA local variable is declared or assigned but never read.-Wall
unused-parameterA function parameter is declared in a defined function body but never referenced.-Wextra
unused-functionA static function is declared/defined in the translation unit but never called.-Wall
implicitImplicit type conversions that may lose precision or sign, or implicit function declarations.-Wall
pointer-signPointer assignment or argument passing between signed and unsigned pointer targets.-Wall
pedanticUse of non-standard C GNU extensions, anonymous struct/unions outside C11, or VLA edge cases.-Wpedantic
cppPreprocessor #warning directives, macro redefinition mismatches, or #if evaluation anomalies.Default
ltoCross-translation unit symbol mismatches, type conflicts, or duplicate static declarations under --lto.Default
attributesUnknown __attribute__((...)) ignored during parsing.Default
incompatible-pointer-typesPointer type mismatches in assignments, initialisers, and calls.Default
address-of-packed-memberTaking the address of a packed struct member (unaligned pointer risk).Default

Diagnostic Pragmas

rg-cc supports standard GCC diagnostic pragmas to selectively suppress or elevate warnings inside source code:

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#pragma GCC diagnostic ignored "-Wunused-parameter"

void handler(int unused_param) {
    int x = 10; // shadowing outer declaration without warning
}

#pragma GCC diagnostic pop

GCC & VBCC flags

rg-cc normalises common GCC and VBCC command-line flags out of the box so existing Makefiles, FASTBuild configs, and Atari scripts work unchanged:

Short / Common FlagNormalised rg-cc TargetDescription
-O0, -O1, -O2, -O3--opt <0..3>Standard optimisation levels
-Os, -Osize, -O2-size--opt-sizeSize-favouring optimisation
-m68000 .. -m68060--mcpu 68000 .. 68060CPU target architecture (-m68010 maps to --mcpu 68000)
-mfastcall, -mregargs--abi fastcallFastcall register calling convention
-mstdargs, -mcdecl--abi cdeclStack-based calling convention
-mhard-float, -m68881, -mfpu--hard-floatHardware floating-point coprocessor
-msoft-float, -mno-fpu--soft-floatSoftware floating-point helpers
-flto, -fwhole-program--ltoCross-TU whole-program optimisation
-w--quietSuppress all warnings and banners
-Wall, -Wextra, -Werror--wall, --wextra, --werrorStandard diagnostic flags
-Wpedantic, -pedantic--pedanticStrict standard compliance
-g, -g1..-g3, -ggdb-gDWARF 4 debug symbols
-mhosted, -fhosted--hostedHosted environment (__STDC_HOSTED__=1) with bundled standard libraries
-ffreestanding, -fno-hosted(default)Freestanding environment (__STDC_HOSTED__=0)

IR & token dumps

For engine developers and performance hackers, rg-cc provides deep visibility into its intermediate stages:

Dump Preprocessor Tokens (--dump-tokens)

rg-cc --dump-tokens main.c

Prints the lexical token stream with line/column coordinates.

Dump Preprocessed C (--dump-pp)

rg-cc --dump-pp main.c

Outputs preprocessed C source after expanding macros and #include directives.

Dump SSA Three-Address IR (--ir)

rg-cc --ir --opt 2 main.c

Prints the SSA intermediate representation showing basic blocks, phi nodes, value types, and dominator trees.

Dump Per-Pass Compiler Artefacts (--dump-dir <DIR>)

rg-cc -c main.c --opt 2 --dump-dir /tmp/compiler-dumps/

Writes complete per-pass intermediate files:


Project builds

rg-cc includes an integrated project build engine (the Reservoir Build System, RBS), so multi-file C and 680x0 assembly libraries and executables can be built by a single rg-cc invocation without external Makefiles, shell scripts, or separate assembler/archiver/linker processes. See the RBS reference for syntax and properties.

Declarative build.rbs projects

Running rg-cc build in a directory containing build.rbs (or passing rg-cc <path/to/build.rbs>) resolves the project graph, executes pre-build file operations (file_configure, files_copy, file_write), compiles C and 680x0 assembly translation units in parallel across CPU cores, archives static libraries, links GEMDOS .TOS/.PRG or ELF executables, and stages runtime assets (files_stage).

# Build default targets in ./build.rbs (default: --platform atari --config release)
rg-cc build

# Build a specific target or configuration
rg-cc build --config debug
rg-cc build my_demo -Diterations=2000

# Inspect resolved targets or emit compile_commands.json for clangd/IDE tooling
rg-cc build --list-targets
rg-cc build --compdb

# Clean target outputs or purge .rbs-cache
rg-cc build --clean
rg-cc build --clean-cache

Intermediate objects and target manifests are stored in .rbs-cache/ (or $RG_CC_CACHE_DIR) so unchanged translation units and up-to-date targets skip recompilation and relinking. Guarded headers (#ifndef GUARD_H / #define GUARD_H / #endif and #pragma once) are tokenised once and shared across translation units within the build process.

A build.rbs file uses a declarative, block-scoped DSL supporting:

Native Pure C .PRJ support

rg-cc also accepts classic Atari Pure C, Turbo C, and AHCC .PRJ project files directly:

rg-cc DEMO.PRJ
rg-cc build DESKTOP.PRJ --config debug

The .PRJ loader translates .C[...], .S[...], and .L[...] option directives, parenthesised #include header dependency lists, per-file flag overrides, and nested .prj sub-targets into the in-process build graph, mapping legacy Pure C startup objects (PCSTART.O) and standard library references to rg-cc's built-in runtime when not present on disk.

Porting external projects (libcmini, mintlib, Makefiles)

rg-cc bundles its own libc.a, libm.a, libgem.a, liblinea.a, libext.a, and libposix.a, so most --hosted Makefiles compile and link out of the box. When an external project explicitly supplies its own libc archive and matching headers, pass them via -I, -L, and -l (user archives take precedence over built-ins):

# Compile and link against an external cdecl libcmini archive
rg-cc -O2 --abi cdecl -I/path/to/libcmini/include -L/path/to/libcmini/lib main.c -lcmini -o app.tos

Reference

FlagMeaning / Description
@<FILE>Read command-line arguments and file lists from a response file
-cCompile source files (.c or .s/.S) to object files (.o) without linking
-S, --emit-asmCompile C source files to 680x0 assembly text (.s) without assembling or linking
--strip-debugStrip debug symbols from linked executable output (also -Wl,-S)
-o <FILE>Specify output filename
-I <DIR>Add directory to #include search list
-D <NAME[=VAL]>Define preprocessor macro
-U, --undefine <NAME>Undefine preprocessor macro
--include <FILE>Force-include header file before processing source
--iquote <DIR>Add directory to #include "..." quote search list
--isystem <DIR>Add directory to #include <...> system search list
--idirafter <DIR>Add directory to search list after all -I directories
-EPreprocess only; output preprocessed C with linemarkers
-g, --debugEmit DWARF 4 debug information sections
--mcpu <CPU>Target CPU model (68000, 68020, 68030, 68040, 68060)
--hard-floatGenerate native 68881/68882/68040 hardware FPU instructions
--soft-floatGenerate software floating-point runtime helper calls (required for float/double without FPU)
--abi <ABI>Calling convention (fastcall [default], cdecl / stdargs, or purec)
--vbcc-fastcall-aliasEnable VBCC fastcall register calling convention compatibility
--small-data / --no-small-dataEnable or disable small data base addressing (-msmall-data / Lattice -b0)
--opt <0..3>Optimisation level: 0 (debug/peephole), 1 (SSA basic), 2 (release), 3 (aggressive)
--opt-sizeSize-favouring optimisation mode (disables byte-expanding transforms)
--opt-size-list <FILE>Per-function profile-guided size optimisation list
--flags <SPEC>Fine-grained optimiser pass enable/disable overrides
--ltoWhole-program Link-Time Optimisation across multiple input files
--std <STANDARD>Set the C standard dialect (c89, c99, gnu99, c11); see C dialects
--dialect <DIALECT>Compiler compatibility dialect (gcc, purec, vbcc, ahcc, lattice, sozobon, alcyon, none)
--compat <COMPILER>Disambiguate colliding rival short flags (vbcc, purec, ahcc, lattice)
-funsigned-charTreat plain char as unsigned char and define __CHAR_UNSIGNED__=1
-fshort-enumsSize each enum to the smallest integer type holding all its enumerators
-fpack-struct[=N]Pack all struct/union members to N-byte alignment (default 1 if bare)
-mshort, --mshortUse 16-bit int (__INT_MAX__=32767, __SIZEOF_INT__=2, __MSHORT__=1)
-dM, --dump-definesDump all active preprocessor macro definitions to stdout and exit
-fsyntax-only, --syntax-onlyValidate syntax and semantic types without codegen or linking
--stack-size <BYTES>Set executable stack allocation size in bytes
--direct-elfDirect binary ELF32 emission (default, fast text-free path)
--text-asmGenerate intermediate assembly text (.s) and invoke assembler
--emit-headers [<DIR>]Extract built-in C and Atari OS headers to specified directory
--emit-runtime [<DIR>]Extract built-in runtime archives and startup objects to specified directory
--emit-depfileEmit Makefile-style header dependency files (.d)
--dep-onlyEmit Makefile-style depfile and exit without compiling (GCC -MM)
--dep-no-systemExclude --isystem headers from generated depfiles (GCC -MM / -MMD)
--depfile <FILE>Explicit target output path for dependency file
--dep-target <TARGET>Override rule target name in generated dependency file
--dep-phonyGenerate phony targets for each dependency (-MP)
-L <DIR>, -l <LIB>Library search paths and libraries to link with
-e, --entry <SYM>Override linker entry point symbol
-s, --strip-allStrip all symbols from linked output
-M, --print-mapEmit link map (-M / --print-map / --emit-map)
--sym <FORMAT>Symbol table format (dri, gst, extern, none)
--tos-flags <FLAGS>GEMDOS process header flags
-T, --script <SCRIPT>Custom linker script
--relax-pcrel / --no-relax-pcrelEnable or disable PC-relative size-changing relaxation (Lattice -r0)
--nostdlib, --nostartfiles, --nodefaultlibsOmit standard libraries, crt0.o, or built-in runtime libraries
--Bstatic, --no-rgcc-tag, --Wl <ARG>Static linking mode, omit RGCC provenance stamp, or pass raw linker flag
--irOutput SSA Three-Address Intermediate Representation to stdout
--dump-ppOutput preprocessed C source text to stdout
--dump-tokensOutput lexer token stream to stdout
--dump-dir <DIR>Save per-phase AST and IR dumps into specified directory
--emit-signaturesPrint function type signatures as TSV table and exit
build [FILE]Build an RBS (.rbs) or Pure C (.prj) project file
--platform <PLAT>Target platform override for RBS build (atari, linux, macos, windows, sdl, host)
--config <CFG>Build configuration override for RBS build (debug, release, shipping, lowmem)
--compdb [FILE]Emit Clang compile_commands.json compilation database
--cc, --ar, --ld <TOOL>External C compiler, archiver, and linker overrides for non-68k RBS platforms
--cleanRemove target outputs and build artefacts
--clean-cacheClear the .rbs-cache directory
--list-targetsList all resolved targets in build graph and exit
--wallEnable standard compiler warning diagnostics
--wextraEnable extra compiler warning diagnostics
--werrorTreat all warnings as fatal errors
--werror-cat <CAT>Promote a specific warning category to fatal error (-Werror=<CAT>)
--wno-cat <CAT>Disable a specific warning category (-Wno-<CAT>)
--w-cat <CAT>Enable a specific warning category (-W<CAT>)
--pedanticEnforce strict ISO C99 standards conformance
--hostedCompile in hosted environment mode (__STDC_HOSTED__=1) with built-in headers and bundled standard libraries
-v, --verboseVerbose compiler execution and phase timing output
-q, --quietSuppress compiler banners and status progress output
--color <WHEN>Colourised diagnostic output (auto, always, never; honours NO_COLOR)
--banner <STYLE>Startup masthead (none, line, logo)
--asciiUse ASCII fallback characters instead of Unicode box-drawing glyphs
--versionPrint compiler version
--helpDisplay command-line options and usage summary (unstable introspection flags are grouped separately)

GCC / VBCC Driver Compatibility Flags

rg-cc accepts standard GCC and VBCC short flags for drop-in Makefile, CMake, and Meson integration:

Flag(s)Behaviour
-O, -O0..-O3, -Os, -Og, -Ofast, -OzOptimisation levels (-Og maps to --opt=0, -Ofast to --opt=3, -Oz to --opt-size)
-Read C source from stdin (requires -E or -x c; default -c output is stdin.o)
-x <lang>Override input language (c, assembler, assembler-with-cpp, or none to restore extension detection)
-M, -MM, -MD, -MMD, -MF, -MT, -MQMakefile dependency generation (-MM/-MMD exclude -isystem headers; -MT<t>/-MQ<t> work attached or spaced)
-I, -iquote, -isystem, -idirafter, -include, -nostdincHeader search paths, forced includes, and standard include suppression
-D, -U, -E, -dMPreprocessor macros and standalone preprocessing modes
-m68000..-m68060, -msoft-float, -m68881, -m68882, -ansiTarget CPU, soft/hard-float, and -std=c89 alias
-fno-common, -fcommonCommon-symbol placement for uninitialised globals
-L, -l, -Wl,..., -Wp,..., -Wa,-m680*, -nostdlib, -nostartfiles, -nodefaultlibs, -s, -S, -gLinker search paths, libraries, pass-through flags, freestanding control, strip, .s assembly emission (-S), and debug info
-dumpversion, -dumpmachine, -vPrint compiler version, m68k-atari-tos target triple, or verbose driver banner (when no inputs are given)
-pipe, -fomit-frame-pointer, -fstrict-aliasing, -ffreestanding, -fsigned-char, -fno-builtin, -fPIC, -fpic, -fno-exceptions, -fno-rtti, -march=*, -mtune=*Accepted as compatibility no-ops (plain char is signed; int is 32-bit ILP32)

Environment Variables

VariableEffect
NO_COLORDisable ANSI colour output on stderr when set (standard no-color.org convention)
RG_CC_CACHE_DIROverride the default .rbs-cache directory used by RBS builds
RG_CC_OPT_FLAGSComma-separated optimiser pass overrides (equivalent to --flags=..., applied when --flags is omitted)
RG_CC_TEXT_ASMForce text assembly emission when set to 1, true, or on (equivalent to --text-asm)
RG_CC_VERIFY_EACHRun IR verification after every optimisation pass when set to 1, true, or on
RG_CC_PASS_REMARKSEmit optimisation pass remarks when set to 1, true, or on

Exit Status Codes

CodeMeaning
0Compilation / linking completed successfully
1Compilation, syntax, type, or semantic analysis error
2Command-line argument usage or configuration error

Greetings

 Aggression · Avena · Cerebral Vortex · Cream · Defence Force · Dekadence · DHS
    Dune · Effect · Ephidrena · Evolution · Extream · HMD · Holocaust · KÜA
Lamers · LineOut · LoUD · Marquee Design · MEC · MPS · MSB · New Beat · Newline
   NoExtra · Omega · OVR · Oxygene · Paradox · PHF · Sector One · smfx · SYNC
                           TPT · Vectronix · XiA