Download Circle C++

Written by Sean Baxter.

Linux

Windows

Mac OSX

Circle user guide

Markdown

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

Compiler identification macros

Environment variables

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

Unix style is the default on Linux and macOS.

Compile and run

Choose the language

Configure headers and macros

Preprocess and generate dependencies

Optimize and debug

Stack protection

Sanitizers

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

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

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 for linking and testing.

Control Flow Integrity

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

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

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

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

Diagnostics

Windows CL commands

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

Configure language and headers on Windows

Optimize and debug on Windows

The dash-prefixed PGO options and CFI options also work in CL mode.

Inspect compiler output on Windows

Compile GPU programs on Windows