# Download Circle C++

Written by [Sean Baxter](mailto:seanbax.circle@gmail.com).

## Linux

* [x86-64](download/circle_linux_x86_64.tgz) Build 236
* [aarch64](download/circle_linux_aarch64.tgz) Build 236

## Windows

* [x86-64](download/circle_windows_x86_64.tgz) Build 236

## Max OSX

* [aarch64](download/circle_macos_aarch64.tgz) Build 236

# Circle user guide

[Markdown](user-guide.md)

- [Compiler identification macros](#compiler-identification-macros)
- [Environment variables](#environment-variables)
- [Unix commands](#unix-commands)
  - [Compile and run](#compile-and-run)
  - [Choose the language](#choose-the-language)
  - [Configure headers and macros](#configure-headers-and-macros)
  - [Preprocess and generate dependencies](#preprocess-and-generate-dependencies)
  - [Link programs and libraries](#link-programs-and-libraries)
  - [Optimize and debug](#optimize-and-debug)
  - [Stack protection](#stack-protection)
  - [Sanitizers](#sanitizers)
    - [MemorySanitizer](#memorysanitizer)
    - [ThreadSanitizer](#threadsanitizer)
    - [Control Flow Integrity](#control-flow-integrity)
  - [Profile Guided Optimization](#profile-guided-optimization)
  - [Select a target](#select-a-target)
  - [Compile GPU programs](#compile-gpu-programs)
  - [Inspect compiler output](#inspect-compiler-output)
  - [Diagnostics](#diagnostics)
- [Windows CL commands](#windows-cl-commands)
  - [Compile and link on Windows](#compile-and-link-on-windows)
  - [Configure language and headers on Windows](#configure-language-and-headers-on-windows)
  - [Optimize and debug on Windows](#optimize-and-debug-on-windows)
  - [Inspect compiler output on Windows](#inspect-compiler-output-on-windows)
  - [Compile GPU programs on Windows](#compile-gpu-programs-on-windows)

Compiler options grouped by operation. In option values, `|` separates alternatives.

## Compiler identification macros

- `__CIRCLE_LANG__` is defined as `1` when compiling with Circle.
- `__circle_build__` is the integer Circle build number.
- `__CIRCLE_CUDA_SINGLE_PASS__` is defined as `1` when CUDA compilation is
  enabled without `-cuda-multi-pass`.
- `__CIRCLE_CUDA_MULTI_PASS__` is defined as `1` when CUDA compilation uses
  `-cuda-multi-pass` (`/cuda-multi-pass` in CL mode).

## Environment variables

- `CUDA_PATH` selects the CUDA toolkit directory, such as `/usr/local/cuda`.
  Overridden by explicit `-cuda-path` option.
- `CUDA_TOOLS` overrides the directory containing `ptxas`, `cuobjdump`,
  `nvlink`, and `fatbinary`. Overridden by `-cuda-tools`. If neither is set,
  Circle uses the selected toolkit's tools.
- `SDKROOT` selects a valid macOS SDK when `-isysroot` is absent.
- `DEVELOPER_DIR` adds macOS SDK and compiler runtime discovery locations.
  Standard Command Line Tools and Xcode locations are also searched.
- `INCLUDE`, `LIB` supply semicolon-separated header and library search paths
  on Windows, normally set by a Visual Studio developer prompt. Circle probes
  installed toolchains when either variable supplies no usable directories.
- `ProgramFiles` adds `%ProgramFiles%/LLVM/lib/clang` to automatic sanitizer
  and profiling runtime discovery. Explicit runtime-path options override discovery.
- `TMPDIR` selects Circle's temporary directory on macOS.
- `TMP`, `TEMP`, `USERPROFILE` select the temporary directory on Windows,
  in that order. The fallback is `C:\Temp`.
- `CIRCLE_JIT_PATH` names the Circle executable used by the runtime JIT
  resolver. Required when that resolver invokes the compiler.
- `LLVM_PROFILE_FILE` overrides the instrumented program's PGO output filename.
  Default `default_%m.profraw`, under the directory selected by
  `-fprofile-generate` if supplied. `%m` identifies the binary and enables
  runtime merging. `%p` inserts the process ID.
- `ASAN_OPTIONS` configures the AddressSanitizer runtime, for example
  `detect_leaks=0`.
- `MSAN_OPTIONS` configures the MemorySanitizer runtime, for example
  `halt_on_error=0` with `-fsanitize-recover=memory`.
- `UBSAN_OPTIONS` configures the UndefinedBehaviorSanitizer runtime, for example
  `print_stacktrace=1`.

`LLVM_PROFILE_FILE`, `ASAN_OPTIONS`, `MSAN_OPTIONS`, and `UBSAN_OPTIONS` apply when running
an instrumented program. CUDA compilation requires an explicit toolkit path
or one of the toolkit environment variables above.

## Unix commands

- `--driver-mode=unix` selects Unix-style options. Must be the first argument.

Unix style is the default on Linux and macOS.

### Compile and run

- `-c` compiles without linking.
- `-o <file>` sets the output path.
- `-fsyntax-only` checks syntax without generating code.
- `-jit` runs through the JIT.
- `@<file>` reads arguments from a GNU-quoted response file.
- `--` ends option processing. Following arguments are input files.
- `-filetype=s|ll|bc|o|so|exe|ast|ptx|ltoir|cubin|sass|fatbin` selects output format.
- `-console` writes textual output to the console.
- `-icase` enables case-insensitive file lookup.

### Choose the language

- `-std=c++11|c++0x|c++14|c++1y|c++17|c++1z|c++20|c++2a|c++2b|c++23`
- `-std=gnu++11|gnu++0x|gnu++14|gnu++1y|gnu++17|gnu++1z|gnu++20|gnu++2a|gnu++2b|gnu++23`
- `-std=c89|c90|c99|c9x|c11|c1x|c17|c18|c23|c2x`
- `-std=gnu89|gnu90|gnu99|gnu9x|gnu11|gnu1x|gnu17|gnu18|gnu23|gnu2x`
- `-std=iso9899:1990|iso9899:1999|iso9899:199x|iso9899:2011|iso9899:2017|iso9899:2024`
  The C parser also accepts any combination of the prefixes `c`, `gnu`, and
  `iso9899:` with the suffixes `89`, `90`, `1990`, `99`, `9x`, `1999`, `199x`,
  `11`, `1x`, `2011`, `17`, `18`, `2017`, `23`, `2x`, and `2024`.
- `-x c|c++`
- `-fexceptions`, `-fno-exceptions` enable or disable C++ exceptions.
- `-fno-rtti` disables host RTTI.
- `-fsigned-char`, `-funsigned-char` set plain `char` signedness.
- `-ftemplate-depth=<n>` sets the template depth limit.
- `-fconstexpr-steps=<n>` sets the constant-evaluation step limit.
- `-ftrial-steps=<n>` sets the speculative evaluation step limit.
- `-except=normal|error|silent` selects Circle exception handling behavior.
- `-funwind-tables` requests unwind tables.
- `-ffreestanding`, `-fhosted` select freestanding or hosted compilation.
- `-fext-numeric-literals`, `-fno-ext-numeric-literals` enable or disable extended numeric literals.
- `-fpack-struct=<n>` sets structure packing.
- `-flax-vector-conversions` allows all lax vector conversions.
- `-flax-vector-conversions=none|integer|all` selects the conversion policy.
- `-ftemplate-depth-255` sets the template depth limit to 255.
- `-no-zero-array` disables zero-length arrays.
- `-P2128` enables P2128 behavior.
- `-fexperimental-library` enables experimental library behavior.
- `-fast-build=none|system|headers|all` selects definition deferral. Default `headers`.

### Configure headers and macros

- `-I <dir>` adds an include directory.
- `-isystem <dir>` adds a system include directory.
- `-iquote <dir>` adds a directory for quoted includes.
- `-include <file>` includes a header before the source.
- `-D <macro>[=<value>]` defines a macro.
- `-U <macro>` undefines a macro.
- `-F <dir>` adds a framework search directory for headers and linking.
- `-isysroot <dir>` sets the SDK root.
- `-nostdinc` disables standard C include directories.
- `-nostdinc++` disables standard C++ include directories.

### Preprocess and generate dependencies

- `-E` writes preprocessed source to standard output.
- `-dM` dumps macro definitions.
- `-M` emits user and system dependencies without compiling.
- `-MM` emits user dependencies without compiling.
- `-MD` emits user and system dependencies while compiling.
- `-MMD` emits user dependencies while compiling.
- `-MF <file>` sets the dependency output file.
- `-MT <target>` sets the dependency target.

### Link programs and libraries

- `-shared` builds a shared library.
- `-fPIC` generates position-independent code.
- `-L <dir>` adds a library search directory.
- `-l <name>` links a named library.
- `-stdlib=libc++|libstdc++|msstl` selects the C++ standard library.
- `-gcc-toolchain=<dir>` selects a GCC toolchain root.
- `-pthread` enables pthread compile and link policy.
- `-static` requests static linking.
- `-fuse-ld=lld|gold|mold|bfd` selects the linker.
- `-Wl,<arg1>,<arg2>,...` forwards comma-separated linker arguments.
- `-Xlinker <arg>` forwards one linker argument.
- `-dynamiclib` aliases `-shared`.
- `-bundle` builds a Darwin bundle.
- `-dynamic` forwards dynamic linking to the Darwin linker. Ignored elsewhere.
- `-framework <name>` links a framework.
- `-undefined <policy>` forwards the undefined-symbol policy to the linker.
- `-install_name <name>` forwards the library install name.
- `-compatibility_version <version>` forwards the library compatibility version.
- `-current_version <version>` forwards the library current version.
- `-fPIE`, `-fpie` alias `-fPIC`.
- `-libstdc++=<version>` selects a libstdc++ version.
- `-rdynamic` exports executable symbols dynamically.
- `-nodefaultlibs` omits default runtime libraries.
- `-nolibc` omits libc.
- `-nostdlib` omits startup files and standard libraries.
- `-nostdlib++` omits the C++ standard library.
- `-no-demangle` disables linker diagnostic demangling.
- `-ML <file>` loads a metaprogramming support library. Repeatable.

### Optimize and debug

- `-O0`, `-O1`, `-O2`, `-O3` set host optimization level.
- `-Os` optimizes host code for size.
- `-Oz` optimizes host code more aggressively for size than `-Os`.
- `-g` emits host debug information.
- `-fno-inline` disables inlining.
- `-fe-inline`, `-no-fe-inline` enable or disable optional frontend inlining.
- `-fno-strict-aliasing` disables strict aliasing.
- `-fstrict-aliasing` enables strict aliasing.
- `-ffunction-sections`, `-fdata-sections` request separate function or data sections.
- `-fno-optimize-sibling-calls` disables sibling-call optimization.
- `-ast-inline`, `-no-ast-inline` enable or disable AST inlining.
- `-fe-inline-max-callee-cost=<n>` sets the automatic inline callee cost limit. Default 128.
- `-fe-inline-max-caller-cost=<n>` sets the cumulative caller cost limit. Default 1024.
- `-fe-inline-max-depth=<n>` sets the automatic inline depth limit. Default 16.
- `-fe-param-use`, `-no-fe-param-use` enable or disable parameter-use optimization.
- `-no-nrvo` disables named return value optimization.
- `-no-always-inline` disables forced always-inline behavior.
- `-no-unroll` disables loop unrolling.
- `-fvisibility=default|hidden|internal|protected` sets symbol visibility.
- `-fvisibility-inlines-hidden` hides inline-function symbols.
- `-fno-builtin-operator-new`, `-fno-builtin-operator-delete` disable built-in treatment of these operators.
- `-ffast-math`, `-fno-fast-math` enable or disable fast math.
- `-fapprox-func`, `-fno-approx-func` enable or disable approximate floating-point functions and device division.
- `-fdenormal-fp-math-f32=<mode>` sets float32 denormal handling.
  Modes are `ieee`, `preserve-sign`, `positive-zero`, and `dynamic`.
  Accepts a single mode or `output,input`.
- `-ftrapping-math`, `-fno-trapping-math` enable or disable floating-point exception policy.
- `-no-panic` disables panic instrumentation.
- `-panic-overflow` enables signed and unsigned overflow panics.
- `-panic-overflow-signed`, `-panic-overflow-unsigned` select overflow panics separately.
- `-flto`, `-flto=full`, and `-flto=thin` enable host link-time optimization.
- `-fno-lto` disables host link-time optimization.

### Stack protection

- `-fstack-protector` protects functions with character buffers of at least
  eight bytes or variable-sized stack allocations. Defines `__SSP__=1`.
- `-fstack-protector-strong` additionally protects functions with other arrays
  or address-taken locals. Defines `__SSP_STRONG__=2`.
- `-fstack-protector-all` protects every emitted host function.
  Defines `__SSP_ALL__=3`.
- `-fno-stack-protector` disables protection. Default.
- `__attribute__((no_stack_protector))`, `[[gnu::no_stack_protector]]`
  disable protection for an individual function.

### Sanitizers

- `-fsanitize=<checks>` enables a comma-separated list of `address`, `memory`, `thread`, `undefined`,
  `signed-integer-overflow`, `integer-divide-by-zero`, `shift`, `alignment`,
  `null`, or the CFI checks listed below.
- `-fno-sanitize=<checks>` disables selected sanitizers.
- `-fsanitize-recover=<checks>`, `-fno-sanitize-recover=<checks>` enable or disable recovery.
- `-fsanitize-trap=<checks>`, `-fno-sanitize-trap=<checks>` enable or disable trap mode.
- `-fsanitize-recover` aliases `-fsanitize-recover=undefined`.
- `-fno-sanitize-recover` aliases `-fno-sanitize-recover=all`.
- `--sanitizer-runtime-path=<dir>` sets the sanitizer runtime search directory.

The disable, recovery, and trap options also accept `all`. ASan, MSan, and TSan
do not support trap mode. TSan reporting policy is controlled by `TSAN_OPTIONS`.

ASan, MSan, TSan, and reporting UBSan checks require Clang's compiler-rt runtimes when
linking. Supply the same sanitizer flags during separate compilation and linking.

#### MemorySanitizer

- `-fsanitize=memory` detects uses of uninitialized values in host code.
- `-fsanitize-memory-track-origins=0|1|2` selects no tracking, allocation
  origins, or allocation origins with propagation through stores. Default `0`.
- `-fsanitize-memory-track-origins` enables origin tracking at level `2`.
- `-fno-sanitize-memory-track-origins` disables origin tracking.
- `-fsanitize-memory-param-retval` enables eager argument and return checks. Default.
- `-fno-sanitize-memory-param-retval` disables eager checks while preserving
  initialization-state propagation.
- `-fsanitize-recover=memory` permits recovery when
  `MSAN_OPTIONS=halt_on_error=0` is also set.
- `__has_feature(memory_sanitizer)` identifies MSan builds.
- `__attribute__((no_sanitize("memory")))` suppresses function checks while
  preserving initialization state at function boundaries.

Supports 64-bit Linux AArch64 and x86-64. Requires compatible compiler-rt
runtimes and instrumented dependencies, including the C++ standard library,
for reliable initialization tracking. Shared libraries use the executable's
runtime. Fully static executables, ASan combinations, trap mode, device
instrumentation, and use-after-destruction poisoning are unsupported.
MSan can be combined with the implemented UBSan checks.

#### ThreadSanitizer

- `-fsanitize=thread` detects data races in host code.
- `-fno-sanitize=thread` disables TSan.
- `__has_feature(thread_sanitizer)` and `__SANITIZE_THREAD__` identify TSan builds.
- `__attribute__((no_sanitize("thread")))` suppresses ordinary memory-access
  checks while retaining atomic synchronization and function boundary tracking.
- `TSAN_OPTIONS=halt_on_error=1` stops execution after the first report.

Supports 64-bit Linux AArch64 and x86-64 targets and macOS AArch64. Requires Clang's
compiler-rt TSan runtime. Linux executables default to PIE. Windows, 32-bit
targets, fully static executables, ASan or MSan combinations, trap mode, and
device instrumentation are unsupported. TSan can be combined with UBSan.
See [ThreadSanitizer usage](sanitizer.md#threadsanitizer) for linking and testing.

#### Control Flow Integrity

- `-fsanitize=cfi-icall` checks function-pointer call types.
- `-fsanitize=cfi-vcall` checks virtual-call vtable compatibility.
- `-fsanitize=cfi-derived-cast` checks base-to-derived pointer and reference casts.
- `-fsanitize=cfi-unrelated-cast` checks casts from `void*` and reinterpret
  casts to pointers or references to polymorphic classes.
- `-fsanitize-cfi-icall-generalize-pointers` relaxes pointer parameter and return
  type matching while preserving pointee `const` and `volatile` qualifiers.
- `-fno-sanitize-cfi-icall-generalize-pointers` restores strict type matching.
- `-fno-sanitize=<checks>` disables selected CFI checks.
- `-fno-sanitize-trap=<checks>` reports failures through compiler-rt instead
  of trapping. `-fsanitize-recover=<checks>` enables recovery in reporting mode.

Requires `-flto`, `-flto=full`, or `-flto=thin` at compile and link time.
Virtual-call and cast checks require complete polymorphic classes with hidden
visibility or internal linkage, typically selected with `-fvisibility=hidden`.
Function-pointer targets must participate in the CFI-enabled LTO build.
Cross-DSO CFI and device instrumentation are unsupported.

The `no_sanitize("cfi")` function attribute excludes all
implemented CFI checks, or name individual checks to exclude them selectively.

### Profile Guided Optimization

- `-fprofile-generate` instruments host code and links the profiling runtime.
  Writes `default_%m.profraw` in the working directory.
- `-fprofile-generate=directory` writes raw profiles under this directory,
  creating it as needed.
- `-fprofile-use` reads `default.profdata` from the working directory.
- `-fprofile-use=path` reads an indexed profile file, or `default.profdata`
  within the specified directory. Raw profiles require merging with `llvm-profdata`.
- `-fprofile-update=single` uses non-atomic counter updates. Default.
- `-fprofile-update=atomic` uses atomic counter updates for concurrent training.
- `-fprofile-update=prefer-atomic` uses atomic updates on supported host targets.
- `-fno-profile-generate` cancels earlier generation options.
- `-fno-profile-use` cancels earlier profile-use options.
- `--profile-runtime-path=path` selects a Clang resource directory or a
  directory containing its profiling runtime.

`LLVM_PROFILE_FILE` overrides the output filename. `%m` identifies the
instrumented binary and enables runtime merging. Generation and use are
mutually exclusive. Device modules are not instrumented.

For separate compilation, generation flags apply at compile and link time,
while profile-use flags apply at compile time. Generation requires a compatible
Clang compiler-rt profiling runtime. Automatic discovery requires Circle's LLVM
major version. `-nostdlib` and `-nodefaultlibs` suppress automatic runtime linking.

### Select a target

- `-target <target>` selects the target.
- `-mcpu=<cpu>` selects the CPU.
- `-march=<arch>` selects the architecture.
- `-mfeatures=<a,b,...>` adds target features.
- `-m<feature>` enables a target feature, such as `-mavx2`.
- `-m32`, `-m64` select 32-bit or 64-bit code generation. Mutually exclusive.
- `-abi=itanium|windows` selects the ABI.
- `--target=<target>` aliases `-target <target>`.
- `-arch arm64|aarch64` selects a Darwin architecture. Only one `-arch` is supported.
- `--itanium`, `--windows` select the ABI.

Targets are `x86_64`, `x86_64-pc-linux-gnu`, `aarch64`,
`aarch64-unknown-linux-gnu`, `aarch64-apple-darwin`,
`aarch64-pc-windows-msvc`, and `x86_64-pc-windows-msvc`.

### Compile GPU programs

- `-sm_<arch>` adds a CUDA target.
- `-ptx-version=<version>` selects the PTX ISA version.
- `-cuda-path=<dir>` sets the CUDA toolkit root.
- `-cuda-tools=<dir>` sets the CUDA tools directory.
- `-OG0`, `-OG1`, `-OG2`, `-OG3` set device optimization level.
- `-G` emits device debug information.
- `-lineinfo` emits device line information.
- `-cuda-multi-pass` compiles each architecture in a separate device pass.
- `-cuda-jobs=<n>` sets multi-pass concurrency. `0` selects automatically.
- `-cuda-device-arg=<arg>` forwards an argument to device subprocesses.
- `-filetype=ptx|cubin|sass|fatbin` selects device output.
- `-nvvm` enables libNVVM use.
- `-Xptxas <arg>` forwards one argument to `ptxas`. Repeatable.
- `-device-lto` enables deferred device LTO inputs.
- `-dlto` enables device LTO behavior.
- `-stdpar` enables standard parallelism support.
- `-arch=<arch>` aliases the CUDA architecture selection. Accepts `80` or `sm_80`, for example.
- `--cuda-path=<dir>`, `-cuda-path <dir>`, `--cuda-path <dir>` are toolkit-path aliases.
- `--cuda-tools=<dir>`, `-cuda-tools <dir>`, `--cuda-tools <dir>` are tools-path aliases.
- `-cuda-toolkit-version=<major.minor>`, `--cuda-toolkit-version=<major.minor>` override the toolkit version inferred from its path.
- `-gpu` selects GPU output behavior.
- `-Grtti` enables device RTTI.
- `-nvvm-reflect-ftz` enables NVVM reflect flush-to-zero.
- `-nvvm-no-libdevice` omits libdevice.
- `-cuda0` uses CUDA 0 compatibility headers.
- `-no-sass` skips PTX assembly into SASS/CUBIN.
- `-device-functions-internal-linkage` gives device functions internal linkage.
- `-kernel-occupancy-arch=<n>` sets the occupancy architecture.

CUDA architecture suffixes are `35`, `37`, `50`, `52`, `53`, `60`, `61`, `62`, `70`, `72`, `75`, `80`, `86`, `87`, `88`, `89`, `90`, `90a`, `100`, `100a`, `100f`, `103`, `103a`, `103f`, `107`, `107a`, `107f`, `110`, `110a`, `110f`, `120`, `120a`, `120f`, `121`, `121a`, `121f`.

PTX versions are `3.2`, `4.0`, `4.1`, `4.2`, `4.3`, `5.0`, `6.0`, `6.1`, `6.3`, `6.4`, `6.5`, `7.0`, `7.1`, `7.2`, `7.3`, `7.4`, `7.5`, `7.6`, `7.7`, `7.8`, `8.0`, `8.1`, `8.2`, `8.3`, `8.4`, `8.5`, `8.6`, `8.7`, `8.8`, `9.0`, `9.1`, `9.2`, `9.3`, `9.4`.

PTX `9.4` and CUDA targets `sm_107`, `sm_107a`, and `sm_107f` require
`-nvvm` or `-filetype=ltoir`. The default LLVM NVPTX backend does not support
them. Both libNVVM paths require `sm_100` or later.

Device optimization defaults to `-OG3`, or `-OG0` with `-G`. An explicit
`-OG` level overrides that default.

### Inspect compiler output

- `--help` prints help.
- `--version` prints compiler and LLVM versions.
- `-###` prints the resolved driver plan without executing it.
- `-S` emits assembly.
- `-emit-llvm` emits LLVM IR. Combine with `-S` for text or `-c` for bitcode.
- `-v` enables verbose output.
- `-Wall` enables the supported general warning group.
- `-Werror` treats warnings as errors.
- `-save-temps[=<dir>]` preserves temporary files.
- `-dump-paths` dumps resolved include paths.
- `-print-paths` prints compiler resource paths.
- `-fdump-record-layouts` dumps record layouts.
- `-dump-llvm` dumps generated LLVM IR.
- `-ir-names` preserves readable IR names.
- `-verify-ir` verifies generated IR.
- `-ftime-report` prints a timing report.
- `-ftime-log=<file>` writes timing data to a file.
- `-version` aliases `--version`.
- `-dumpversion` prints the compiler version.
- `-dumpmachine`, `-print-target-triple` print the target triple.
- `-verbose` aliases `-v`.
- `-Wformat` enables the supported format warning group.
- `-Wno-deprecated` disables supported deprecation warnings.
- `-Wno-unknown-warning-option` suppresses unknown-warning-option diagnostics.
- `-W<name>` accepts other warning names without effect.
- `-ferror-limit=<n>` sets the diagnostic error limit.
- `-tabsize=<n>` sets diagnostic tab width.
- `-warn-unknown-declspec` warns about unknown declaration specifiers.
- `-stat` prints statistics.
- `-print-deferred` prints deferred-definition information.
- `-dump-templates-simple`, `-dump-templates-full` dump templates.
- `-dump-calls-simple`, `-dump-calls-full` dump calls.
- `-dump-functions-simple`, `-dump-functions-full` dump functions.
- `-log-entity-file=<file>` writes entity logging.
- `-ir-namse` is a compatibility spelling for `-ir-names`.
- `-x86-asm-syntax=att|intel` selects x86 assembly syntax.
- `-mllvm <arg>` forwards an option to LLVM. Repeatable.

### Diagnostics

- `-dump-driver-state` dumps the resolved driver state.
- `-dump-link-request` dumps the typed link request.
- `-dump-ast-inline` dumps AST inlining information.
- `-object-symbol-mangled-fileno=<n>` sets the mangled-symbol output descriptor.
- `-env-input-path=<file>` sets environment input.
- `-env-output-path=<file>` sets environment output.
- `-env-input-fileno=<n>` sets the environment input descriptor.
- `-cuda-device-pass=<arch>` selects an internal CUDA device pass.
- `-cuda-ptx-output=<file>` sets internal PTX output.
- `-cuda-cubin-output=<file>` sets internal CUBIN output.

## Windows CL commands

- `--driver-mode=cl` selects CL-style options. Must be the first argument.

CL style is the default on Windows. CL and Unix options use separate parsers.

### Compile and link on Windows

- `/c` compiles without linking.
- `/Fo <file>` names object, assembly, or preprocessor output.
- `/Fe <file>` names an executable or DLL. Cannot be combined with `/c`.
- `/Zs` checks syntax without generating code.
- `/LD` builds a DLL.
- `/LIBPATH:<dir>` adds a library search directory.
- `/link <args...>` forwards all remaining arguments to the linker.
- `@<file>` reads arguments using Windows command-line quoting.

### Configure language and headers on Windows

- `/std:c++14|c++17|c++20|c++23|c++latest` (`c++latest` selects C++23)
- `/I <dir>` adds an include directory.
- `/external:I <dir>` adds a system include directory.
- `/FI <file>` forces an include.
- `/D <macro>[=<value>]` defines a macro.
- `/U <macro>` undefines a macro.
- `/Tc <file>`, `/Tp <file>` compile one input as C or C++.
- `/TC`, `/TP` compile all inputs as C or C++.
- `/Zp<n>` sets structure packing.
- `/EHsc`, `/EHs-c-` enable or disable C++ exceptions.
- `/GR-` disables RTTI.
- `/J` makes plain `char` unsigned.
- `/X` ignores standard include paths.
- `-fast-build=none|system|headers|all` selects definition deferral.

### Optimize and debug on Windows

- `/Od` disables optimization.
- `/O1` selects optimization level 1.
- `/O2` optimizes for speed.
- `/Ox` currently maps to the same level as `/O2`.
- `/Ob0` disables inlining.
- `/Z7`, `/Zi` emit CodeView debug information.
- `/MD`, `/MDd` select the dynamic MSVC runtime or its debug version.
- `/MT`, `/MTd` select the static MSVC runtime or its debug version.
- `-g` emits debug information.
- `-O0`, `-O1`, `-O2`, `-O3` set host optimization level.
- `-Os` optimizes host code for size.
- `-Oz` optimizes host code more aggressively for size than `-Os`.
- `/arch:SSE2|AVX|AVX2|AVX512` selects target instructions.
- `/fp:except`, `/fp:except-` enable or disable floating-point exception policy.
- `/fsanitize=<checks>`, `-fsanitize=<checks>` enable sanitizers.
- `-fno-sanitize=<checks>` disables sanitizers.
- `-fsanitize-recover=<checks>`, `-fno-sanitize-recover=<checks>` control recovery.
- `-fsanitize-trap=<checks>`, `-fno-sanitize-trap=<checks>` control trap mode.
- `--sanitizer-runtime-path=<dir>` sets the runtime search directory.

The dash-prefixed [PGO options](#profile-guided-optimization) and
[CFI options](#control-flow-integrity) also work in CL mode.

### Inspect compiler output on Windows

- `/E` preprocesses to standard output.
- `/P` preprocesses to a file.
- `/FA` emits assembly.
- `/showIncludes` prints included files.
- `/WX` treats warnings as errors.
- `/help` prints help.
- `/Bv` prints compiler and LLVM versions.
- `-###` prints the resolved driver plan without executing it.
- `/?` aliases `/help`.
- `-version` aliases `/Bv`.
- `/WX-` disables treating warnings as errors.
- `/ftime-report` prints a compilation timing report.
- `-mllvm <arg>` forwards an option to LLVM. Repeatable.

### Compile GPU programs on Windows

- `-sm_<arch>`, `-arch=<arch>` add a CUDA architecture.
- `/cuda-multi-pass` enables per-architecture device compilation.
