ClangCommandLineReference.rst 87.1 KB

Clang command line argument reference

Introduction

This page lists the command line arguments currently supported by the GCC-compatible clang and clang++ drivers.

Add <dir> to search path for binaries and object files used implicitly

Add directory to framework include search path

Treat source input files as Objective-C inputs

Treat source input files as Objective-C++ inputs

Do not emit metadata containing compiler name and version

Don't emit warning for unused driver arguments

Emit metadata containing compiler name and version

Pass the comma separated arguments in <arg> to the assembler

Pass <arg> to the CUDA/HIP device compilation

Pass <arg> to the CUDA/HIP host compilation

Pass <arg> to fatbinary invocation

Pass <arg> to the ptxas assembler

Pass <arg> to the target offloading toolchain.

Pass <arg> to the target offloading toolchain identified by <triple>.

Run the static analyzer

Static analyzer report output format (html|plist|plist-multi-file|plist-html|sarif|text).

Emit ARC errors even if the migrator can fix them

Output path for the plist report

Specifies configuration file

Compile CUDA code for both host and device (default). Has no effect on non-CUDA compilations.

Compile CUDA code for device only

Compile CUDA code for host only. Has no effect on non-CUDA compilations.

Include PTX for the following GPU architecture (e.g. sm_35) or 'all'. May be specified more than once.

Enable device-side debug info generation. Disables ptxas optimizations.

Filename to write DOT-formatted header dependencies to

Filename (or -) to write dependency output to

Emit Clang AST files for source inputs

Trivial automatic variable initialization to zero is only here for benchmarks, it'll eventually be removed, and I'm OK with that because I'm only using it to benchmark

Flush denormal floating point values to zero in CUDA device mode.

Reserve register r19 (Hexagon only)

Specify comma-separated list of triples OpenMP offloading targets to be supported

Add -rpath with architecture-specific resource directory to the linker flags

Path to system blacklist file for sanitizers

Build this module as a system module. Only used with -emit-module

Use the gcc toolchain at the given directory

Generate CodeView debug information

Emit type record hashes in a .debug$H section

Default max threads per block for kernel launch bounds for HIP

Display available options

Display help for hidden options

Link clang-offload-bundler bundles for HIP

Enable builtin #include directories even when -nostdinc is used before or after -ibuiltininc. Using -nobuiltininc after the option disables it

Make the next included directory (-I or -F) an indexer header map

Enforce targets of indirect branches and function returns

Run the migrator

Additional arguments to forward to LLVM's option processing

Directory to dump module dependencies to

Don't error out if the detected version of the CUDA install is too low for the requested CUDA gpu architecture.

Disable builtin #include directories

Do not link device library for CUDA/HIP device compilation

Disable standard #include directories for the C++ standard library

Write output to <file>

Make migration to 'atomic' properties

Enable migration to modern ObjC

Enable migration to property and method annotations

Enable migration to infer NS_DESIGNATED_INITIALIZER for initializer methods

Enable migration to infer instancetype for method result type

Enable migration to modern ObjC literals

Enable migration to NS_ENUM/NS_OPTIONS macros

Enable migration to modern ObjC property

Enable migration of setter/getter messages to property-dot syntax

Enable migration to add protocol conformance on classes

Enable migration to modern ObjC readonly property

Enable migration to modern ObjC readwrite property

Enable migration to modern ObjC subscripting

Enable migration to use NS_NONATOMIC_IOSONLY macro for setting property's 'atomic' attribute

Enable migration to annotate property with NS_RETURNS_INNER_POINTER

Only modify files with a filename contained in the provided directory path

CUDA/HIP offloading device architecture (e.g. sm_35, gfx906). May be specified more than once.

Enable mcount instrumentation

Use pipes between commands, when possible

Print the effective target triple

Print the full library path of <file>

Enable Objective-C Ivar layout bitmap print trace

Print the library path for the currently used compiler runtime library ("libgcc.a" or "libclang_rt.builtins.*.a")

Print the full program path of <name>

Print the resource directory pathname

Print the paths used for finding libraries and programs

Print the normalized target triple

Print the registered targets

Support POSIX threads in generated code

Whether to build a relocatable precompiled header

Rewrite Legacy Objective-C source to C++

Compiler runtime library to use

Save llvm statistics.

Save intermediate compilation results.

Serialize compiler diagnostics to a file

Dynamically link the sanitizer runtime

Statically link the sanitizer runtime

Use the static host OpenMP runtime while linking.

C++ standard library to use

Generate code for the given target

Time individual commands

Enable some traditional CPP emulation

Unwind library to use

Show commands to run and use verbose output

Verify the binary representation of debug output

Print version information

Suppress all warnings

Resolve file paths relative to the specified directory

Treat subsequent input files as having type <language>

Actions

The action to perform on the input.

Only run the preprocessor

Only run preprocess and compilation steps

Only run preprocess, compile, and assemble steps

Generate Inteface Stub Files.

Use the LLVM representation for assembler and object files

Generate Interface Stub Files, emit merged text not binary.

Provide information about a particular module file

Only precompile the input

Rewrite Objective-C source to C++

Load and verify that a pre-compiled header file is not stale

Compilation flags

Flags controlling the behavior of Clang during compilation. These flags have no effect during actions that do not perform compilation.

Pass <arg> to the assembler

Pass <arg> to the clang compiler

Attempt to match the ABI of Clang <version>

Treat each comma separated argument in <arg> as a documentation comment block command

Require member pointer base types to be complete if they would be significant under the Microsoft ABI

Allow __declspec as a keyword

Print fix-its in machine parseable form

Print source range spans in numeric form

Discard value names in LLVM IR

Enables an experimental new pass manager in LLVM.

Enables the use of non-default rounding modes and non-default exception handling on targets that are not currently ready.

Use separate accesses for consecutive bitfield runs with legal widths and alignments.

Enables the global instruction selector

Inline suitable functions

Inline functions which are (explicitly or implicitly) marked inline

Disable auto-generation of preprocessed source files and a script for reproduction during a clang crash

Don't use blacklist file for sanitizers

Level of field padding for AddressSanitizer

Enable linker dead stripping of globals in AddressSanitizer

Enable poisoning array cookies when using custom operator new[] in AddressSanitizer

Enable use-after-scope detection in AddressSanitizer

Enable ODR indicator globals to avoid false ODR violation reports in partially sanitized programs at the cost of an increase in binary size

Path to blacklist file for sanitizers

Make the jump table addresses canonical in the symbol table

Enable control flow integrity (CFI) checks for cross-DSO calls.

Generalize pointers in CFI indirect call type signature checks

Restrict sanitizer coverage instrumentation exclusively to modules and functions that match the provided special case list, except the blocked ones

Disable sanitizer coverage instrumentation for modules and functions that match the provided special case list, even the allowed ones

Specify the type of coverage instrumentation for Sanitizers

Select the HWAddressSanitizer ABI to target (interceptor or platform, default interceptor). This option is currently unused.

Enable origins tracking in MemorySanitizer

Enable origins tracking in MemorySanitizer

Enable use-after-destroy detection in MemorySanitizer

Enable recovery for specified sanitizers

Enable sanitizer statistics gathering.

Enable atomic operations instrumentation in ThreadSanitizer (default)

Enable function entry/exit instrumentation in ThreadSanitizer (default)

Enable memory access instrumentation in ThreadSanitizer (default)

Enable trapping for specified sanitizers

Strip (or keep only, if negative) a given number of path components when emitting check metadata.

Turn on runtime checks for various forms of undefined or suspicious behavior. See user manual for available checks

Enable function outlining (AArch64 only)

Print supported cpu models for the given target (if target is not specified, it will print the supported cpus for the default target)

Language standard to compile for

Preprocessor flags

Flags controlling the behavior of the Clang preprocessor.

Include comments in preprocessed output

Include comments from within macros in preprocessed output

Define <macro> to <value> (or 1 if <value> omitted)

Show header includes and nesting depth

Disable linemarker output in -E mode

Undefine macro <macro>

Pass the comma separated arguments in <arg> to the preprocessor

Pass <arg> to the preprocessor

remap file source paths in predefined preprocessor macros

Include path management

Flags controlling how #includes are resolved to files.

Add directory to include search path. If there are multiple -I options, these directories are searched in the order they are given before the standard system directories are searched. If the same directory is in the SYSTEM include search paths, for example if also specified with -isystem, the -I option will be ignored

Restrict all prior -I flags to double-quoted inclusion and remove current directory from include path

Ignore environment variables to detect CUDA installation

CUDA installation path

Add directory to the C++ SYSTEM include search path

Use the last modification time of <file> as the build session timestamp

Time when the current build session started

Specify the mapping of module name to precompiled module file, or load a module file if name is omitted.

Specify the module cache path

Disable validation of the diagnostic options when loading the module

Specify the interval (in seconds) after which a module file will be considered unused

Specify the interval (in seconds) between attempts to prune the module cache

Specify the module user build path

Don't verify input files for the modules if the module has been successfully validated or loaded during this build session

Validate the system headers that a module depends on when loading the module

Specify the prebuilt module path

Add directory to AFTER include search path

Add directory to SYSTEM framework search path

Add directory to SYSTEM framework search path, absolute paths are relative to -isysroot

Include macros from file before parsing

Include file before parsing

Include precompiled header file

Set the -iwithprefix/-iwithprefixbefore prefix

Add directory to QUOTE include search path

Set the system root directory (usually /)

Add directory to SYSTEM include search path

Add directory to end of the SYSTEM include search path

Overlay the virtual filesystem described by file over the real file system

Set directory to SYSTEM include search path with prefix

Set directory to include search path with prefix

Add directory to SYSTEM include search path, absolute paths are relative to -isysroot

Path to libomptarget-nvptx libraries

Path to ptxas (used for compiling CUDA code)

ROCm installation path, used for finding and automatically linking required bitcode libraries.

Use directory as the C++ standard library include path

Treat all #include paths starting with <prefix> as including a system header.

Dependency file generation

Flags controlling generation of a dependency file for make-like build systems.

Like -MD, but also implies -E and writes to stdout by default

Write a depfile containing user and system headers

Write depfile output from -MMD, -MD, -MM, or -M to <file>

Add missing headers to depfile

Write a compilation database entry per input

Like -MMD, but also implies -E and writes to stdout by default

Write a depfile containing user headers

Create phony target for each dependency (other than main file)

Specify name of main file output to quote in depfile

Specify name of main file output in depfile

Use NMake/Jom format for the depfile

Dumping preprocessor state

Flags allowing the state of the preprocessor to be dumped in various ways.

Print macro definitions in -E mode in addition to normal output

Print include directives in -E mode in addition to normal output

Print macro definitions in -E mode instead of normal output

Diagnostic flags

Flags controlling which warnings, errors, and remarks Clang will generate. See the :doc:`full list of warning and remark flags <DiagnosticsReference>`.

Enable the specified remark

Report transformation analysis from optimization passes whose name matches the given POSIX regular expression

Report missed transformations by optimization passes whose name matches the given POSIX regular expression

Report transformations performed by optimization passes whose name matches the given POSIX regular expression

Enable the specified warning

Enable warnings for deprecated constructs and define __DEPRECATED

Target-independent compilation options

Emit an address-significance table

Enable C++17 aligned allocation functions

Treat editor placeholders as valid source code

Use ANSI escape codes for diagnostics

Use Apple's kernel extensions ABI

Force linking the clang builtins runtime library

Enable Apple gcc-compatible #pragma pack handling

Restrict code to those available for App Extensions

Generate labels for each basic block or place each basic block or a subset of basic blocks in its own section.

Enable the 'blocks' language feature

Accept non-standard constructs supported by the Borland compiler

Load the clang builtins module map file.

Instrument control-flow architecture protection. Options: return, branch, full, none.

Enable C++ builtin type char8_t

Enable colors in diagnostics

Place uninitialized global variables in a common block

Assume functions may be convergent

Enable support for the C++ Coroutines TS

Generate coverage mapping to enable code coverage analysis

Generate instrumented code to collect context sensitive execution counts into default.profraw (overridden by LLVM_PROFILE_FILE env var)

Generate instrumented code to collect context sensitive execution counts into <directory>/default.profraw (overridden by LLVM_PROFILE_FILE env var)

Use approximate transcendental functions

Use 32-bit pointers for accessing const/local/shared address spaces

Enable C++ exceptions

Place each data in its own section

The compilation directory to embed in the debug info.

Default DWARF version to use, if a -g option caused DWARF debug info to be produced

Emit extra debug info to make sample profile more accurate

Emit macro debug information

remap file source paths in debug info

Use DWARF base address selection entries in .debug_ranges

Place debug types in their own section (ELF Only)

Parse templated function definitions at the end of the translation unit

Treat usage of null pointers as undefined behavior (default)

Print absolute paths in diagnostics

Prevent optimization remarks from being output if they do not have at least this profile count

Enable profile hotness information in diagnostic line

Display include stacks for diagnostic notes

Print option name with mappable diagnostics

Print a template comparison tree for differing templates

Enable alternative token representations '<:', ':>', '<%', '%>', '%:', '%:%:' (default)

Allow '$' in identifiers

Enable '[[]]' attributes in all C and C++ language modes

Use DWARF style exceptions

Embed LLVM bitcode (option: off, all, bitcode, marker)

Emit all declarations, even if unused

Use emutls functions to access thread_local variables

Enable matrix data type and related builtin functions

Enable support for exception handling

Enable the experimental new constant interpreter

Use the experimental C++ class ABI for classes with virtual tables

Allow aggressive, lossy floating-point optimizations

remap file source paths in debug info and predefined preprocessor macros

Enable fixed point types

Always emit a debug frame section

Emits more virtual tables to improve devirtualization

Enable support for int128_t type

Form fused FP ops (e.g. FMAs): fast (everywhere) | on (according to FP_CONTRACT pragma) | off (never fuse). Default is 'fast' for CUDA/HIP and 'on' otherwise.

Specifies the exception behavior of floating-point operations.

Controls the semantics of floating-point calculations.

Assert that the compilation takes place in a freestanding environment

Place each function in its own section

Allow GNU-extension keywords regardless of language standard

Generate output compatible with the standard GNU Objective-C runtime

Use the gnu89 inline semantics

Sets various macros to claim compatibility with the given GCC version (default is 4.2.1)

Allow device side init function in HIP

Generate relocatable device code, also known as separate compilation mode

Use new kernel launching API for HIP

Enable support for ignoring exception handling constructs

Implicitly search the file system for module map files.

Instrument function entry only, after inlining, without arguments to the instrumentation call

Generate calls to instrument function entry and exit

Like -finstrument-functions, but insert the calls after inlining

Enable the integrated assembler

Run cc1 in-process

Use jump tables for lowering switches

Keep static const variables if unused

Enable implicit vector bit-casts

Enable LTO in 'full' mode

Controls the backend parallelism of -flto=thin (default of 0 means the number of threads will be derived from the number of CPUs detected)

Set LTO mode to either 'full' or 'thin'

Require math functions to indicate errors by setting errno

Max total number of preprocessed tokens for -Wmax-tokens.

Specify the maximum alignment to enforce on pointers lacking an explicit alignment

Allow merging of constants

Format message diagnostics so that they fit within N columns

Load this module map file

Specify the name of the module to build

Enable the 'modules' language feature

Require declaration of modules used within a module

Ignore the definition of the given macro when building and loading modules

Search even non-imported modules to resolve references

Like -fmodules-decluse but requires all headers to be in modules

Enable support for the C++ Modules TS

Validate PCM input files based on content if mtime differs

Enable full Microsoft Visual C++ compatibility

Dot-separated value representing the Microsoft compiler version number to report in _MSC_VER (0 = don't define it (default))

Accept some non-standard constructs supported by the Microsoft compiler

Microsoft compiler version number to report in _MSC_VER (0 = don't define it (default))

Specifies the largest alignment guaranteed by '::operator new(size_t)'

Disable implicit builtin knowledge of a specific function

Do not elide types when printing diagnostics

Do not treat C++ operator name keywords as synonyms for operators

Directly create compilation output files. This may lead to incorrect incremental builds if the compiler crashes

Disable stack clash protection

Synthesize retain and release calls for Objective-C pointers

Use EH-safe code when synthesizing retains and releases in -fobjc-arc

Enable Objective-C exceptions

Specify the target Objective-C runtime kind and version

Enable ARC-style weak references in Objective-C

Parse OpenMP pragmas and generate parallel code.

Emit OpenMP code only for SIMD-based constructs.

Specify the output name of the file containing the optimization remarks. Implies -fsave-optimization-record. On Darwin platforms, this cannot be used with multiple -arch <arch> options.

Only include passes which match a specified regular expression in the generated optimization record (by default, include all passes)

Generate instrumented code to collect order file into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var)

Specify the default maximum struct packing alignment

Recognize and construct Pascal-style string literals

Load pass plugin from a dynamic shared object file (only with new pass manager).

Generate M NOPs before function entry and N-M NOPs after function entry

Override the default ABI to return all structs on the stack

Validate PCH input files based on content if mtime differs

Load the named plugin (dynamic shared object)

Instrument only functions from files where names don't match all the regexes separated by a semi-colon

Instrument only functions from files where names match any regex separated by a semi-colon

Generate instrumented code to collect execution counts into default.profraw (overridden by LLVM_PROFILE_FILE env var)

Generate instrumented code to collect execution counts into <directory>/default.profraw (overridden by LLVM_PROFILE_FILE env var)

Generate instrumented code to collect execution counts into default.profraw file (overridden by '=' form of option or LLVM_PROFILE_FILE env var)

Generate instrumented code to collect execution counts into <file> (overridden by LLVM_PROFILE_FILE env var)

Use instrumentation data for profile-guided optimization

Use the remappings described in <file> to match the profile data against names in the program

Specifies that the sample profile is accurate. If the sample
profile is accurate, callsites without profile samples are marked as cold. Otherwise, treat callsites without profile samples as if we have no profile

Enable sample-based profile guided optimizations

Use instrumentation data for profile-guided optimization. If pathname is a directory, it reads from <pathname>/default.profdata. Otherwise, it reads from file <pathname>.

Allow division operations to be reassociated

Override the default ABI to return small structs in registers

Use atexit or __cxa_atexit to register global destructors

Enable C++17 relaxed template template argument matching

Turn on loop reroller

Generate read-only position independent code (ARM only)

Generate read-write position independent code (ARM only)

Generate a YAML optimization record file

Generate an optimization record file in a specific format

Use SEH style exceptions

Allocate to an enum type only as many bytes as it needs for the declared range of possible values

Force wchar_t to be a short unsigned int

Which overload candidates to show when overload resolution fails: best|all; defaults to all

char is signed

Enable C++14 sized global deallocation functions

Use SjLj style exceptions

Enable the superword-level parallelism vectorization passes

Provide minimal debug info in the object/executable to facilitate online symbolication/stack traces in the absence of .dwo/.dwp files when using Split DWARF

Enables splitting of the LTO unit

Enable stack clash protection

Enable stack protectors for some functions vulnerable to stack smashing. This uses a loose heuristic which considers functions vulnerable if they contain a char (or 8bit integer) array or constant sized calls to alloca , which are of greater size than ssp-buffer-size (default: 8 bytes). All variable sized calls to alloca are considered vulnerable. A function witha stack protector has a guard value added to the stack frame that is checked on function exit. The guard value must be positioned in the stack frame such that a buffer overflow from a vulnerable variable will overwrite the guard value before overwriting the function's return address. The reference stack guard value is stored in a global variable.

Enable stack protectors for all functions

Enable stack protectors for some functions vulnerable to stack smashing. Compared to -fstack-protector, this uses a stronger heuristic that includes functions containing arrays of any size (and any type), as well as any calls to alloca or the taking of an address from a local variable

Emit section containing metadata on function stack sizes

Emit full debug info for all types used by the program

Suppress (or emit) debug info for types that are unused but defined by the program.

Enable optimizations based on the strict definition of an enum's value range

Assume that overflowing float-to-int casts are undefined (default)

Enable optimizations based on the strict rules for overwriting polymorphic C++ objects

Write minimized bitcode to <file> for the ThinLTO thin link only

Perform ThinLTO importing using provided function summary index

Turn on time profiler. Generates JSON file based on output filename. Results can be analyzed with chrome://tracing or Speedscope App for flamegraph visualization.

Minimum time granularity (in microseconds) traced by time profiler

Issue call to specified function rather than a trap instruction

Trap on integer overflow

Specify the function to be called on overflow

Process trigraph sequences

Stop initializing trivial automatic stack variables after the specified number of instances

Initialize trivial automatic stack variables: uninitialized (default) | pattern

Use unique names for basic block sections (ELF Only)

Uniqueify Internal Linkage Symbol Names by appending the MD5 hash of the module path

Turn on loop unroller

Use #line in preprocessed output

Compute and store the hash of input files used to build an AST. Files with mismatching mtime's are considered valid if both contents is identical

Use the given vector functions library

Enable the loop vectorization passes

Generate verbose assembly output

Enables dead virtual function elimination optimization. Requires -flto=full

Give global C++ operator new and delete declarations hidden visibility

Give inline C++ member functions hidden visibility by default

Give global types 'default' visibility and global functions and variables 'hidden' visibility by default

Set the default symbol visibility for all global declarations

Use WebAssembly style exceptions

Enables whole-program vtable optimization. Requires -flto

Treat signed integer overflow as two's complement

Store string literals as writable data

Always emit __xray_customevent(...) calls even if the containing function is not always instrumented

Always emit __xray_typedevent(...) calls even if the containing function is not always instrumented

DEPRECATED: Filename defining the whitelist for imbuing the 'always instrument' XRay attribute.

Filename defining the list of functions/types for imbuing XRay attributes.

Don't instrument functions with loops unless they also meet the minimum function size

Sets the minimum function size to instrument with XRay

Generate XRay instrumentation sleds on function entry and exit

Select which XRay instrumentation points to emit. Options: all, none, function-entry, function-exit, function, custom. Default is 'all'. 'function' includes both 'function-entry' and 'function-exit'.

Tells clang to add the link dependencies for XRay.

List of modes to link in by default into XRay instrumented binaries.

DEPRECATED: Filename defining the whitelist for imbuing the 'never instrument' XRay attribute.

Enable System z vector language extension

OpenCL flags

OpenCL only. Allow denormals to be flushed to zero.

OpenCL only. Sets -cl-finite-math-only and -cl-unsafe-math-optimizations, and defines __FAST_RELAXED_MATH__.

OpenCL only. Allow floating-point optimizations that assume arguments and results are not NaNs or +-Inf.

OpenCL only. Specify that single precision floating-point divide and sqrt used in the program source are correctly rounded.

OpenCL only. Generate kernel argument metadata.

OpenCL only. Allow use of less precise MAD computations in the generated binary.

OpenCL only. Allow use of less precise no signed zeros computations in the generated binary.

OpenCL only. This option disables all optimizations. By default optimizations are enabled.

OpenCL only. Treat double precision floating-point constant as single precision constant.

OpenCL language standard to compile for.

OpenCL only. This option is added for compatibility with OpenCL 1.0.

OpenCL only. Defines that the global work-size be a multiple of the work-group size specified to clEnqueueNDRangeKernel

OpenCL only. Allow unsafe floating-point optimizations. Also implies -cl-no-signed-zeros and -cl-mad-enable.

SYCL flags

Enable SYCL kernels compilation for device

SYCL language standard to compile for.

Target-dependent compilation options

Put objects of at most <size> bytes into small data section (MIPS / Hexagon)

Reserve the x1 register (AArch64/RISC-V only)

Reserve the x10 register (AArch64/RISC-V only)

Reserve the x11 register (AArch64/RISC-V only)

Reserve the x12 register (AArch64/RISC-V only)

Reserve the x13 register (AArch64/RISC-V only)

Reserve the x14 register (AArch64/RISC-V only)

Reserve the x15 register (AArch64/RISC-V only)

Reserve the x16 register (AArch64/RISC-V only)

Reserve the x17 register (AArch64/RISC-V only)

Reserve the x18 register (AArch64/RISC-V only)

Reserve the x19 register (AArch64/RISC-V only)

Reserve the x2 register (AArch64/RISC-V only)

Reserve the x20 register (AArch64/RISC-V only)

Reserve the x21 register (AArch64/RISC-V only)

Reserve the x22 register (AArch64/RISC-V only)

Reserve the x23 register (AArch64/RISC-V only)

Reserve the x24 register (AArch64/RISC-V only)

Reserve the x25 register (AArch64/RISC-V only)

Reserve the x26 register (AArch64/RISC-V only)

Reserve the x27 register (AArch64/RISC-V only)

Reserve the x28 register (AArch64/RISC-V only)

Reserve the x29 register (AArch64/RISC-V only)

Reserve the x3 register (AArch64/RISC-V only)

Reserve the x30 register (AArch64/RISC-V only)

Reserve the x31 register (AArch64/RISC-V only)

Reserve the x4 register (AArch64/RISC-V only)

Reserve the x5 register (AArch64/RISC-V only)

Reserve the x6 register (AArch64/RISC-V only)

Reserve the x7 register (AArch64/RISC-V only)

Reserve the x8 register (AArch64/RISC-V only)

Reserve the x9 register (AArch64/RISC-V only)

Return all structs in memory (PPC32 only)

Specify the boundary's size to align branches

Specify types of branches to align

Align doubles to two words in structs (x86 only)

Link stack frames through backchain on System Z

Align selected branches (fused, jcc, jmp) within 32-byte boundary

Allow use of CRC instructions (ARM/Mips only)

Force double to be 32 bits or 64 bits

Set EABI type, e.g. 4, 5 or gnu (default depends on triple)

Enable use of experimental RISC-V extensions.

Insert calls to fentry at function entry (x86/SystemZ only)

Enable merging of globals

Use Intel MCU ABI

(integrated-as) Emit an object file which can be used with an incremental linker

Generate branches with extended addressability, usually via indirect jumps.

Enable only control-flow mitigations for Load Value Injection (LVI)

Enable all mitigations for Load Value Injection (LVI)

Set Mac OS X deployment target

Set the default structure layout to be compatible with the Microsoft compiler standard

Generate mcount/__fentry__ calls as nops. To activate they need to be patched in.

Omit frame pointer setup for leaf functions

Use packed stack layout (SystemZ only).

Specify maximum number of prefixes to use for padding

Use copy relocations support for PIE builds

Specifies preferred vector width for auto-vectorization. Defaults to 'none' which allows target specific decisions.

Enable hexagon-qdsp6 backward compatibility

Generate a __mcount_loc section entry for each __fentry__ call.

(integrated-as) Relax all machine instructions

Make StdCall calling convention the default

Enable speculative execution side effect suppression (SESES). Includes LVI control flow integrity mitigations

Select return address signing scope

Use software floating point

Set the stack alignment

Enable stack probes

Set the stack probe size

Force realign the stack at entry to every function

Return small structs in registers (PPC32 only)

The thread model to use, e.g. posix, single (posix by default)

Enable direct TLS access through segment registers (default)

Specify bit size of immediate TLS offsets (AArch64 ELF only): 12 (for 4KB) | 24 (for 16MB, default) | 32 (for 4GB) | 48 (for 256TB, needs -mcmodel=large)

Accepted for compatibility with GCC. Currently has no effect.

Wavefront size 64 is used

AARCH64

Make the x10 register call-saved (AArch64 only)

Make the x11 register call-saved (AArch64 only)

Make the x12 register call-saved (AArch64 only)

Make the x13 register call-saved (AArch64 only)

Make the x14 register call-saved (AArch64 only)

Make the x15 register call-saved (AArch64 only)

Make the x18 register call-saved (AArch64 only)

Make the x8 register call-saved (AArch64 only)

Make the x9 register call-saved (AArch64 only)

Workaround Cortex-A53 erratum 835769 (AArch64 only)

Generate code which only uses the general purpose registers (AArch64 only)

AMDGPU

Enable code object v3 (AMDGPU only)

CU wavefront execution mode is used (AMDGPU only)

Enable SRAM ECC (AMDGPU only)

Enable XNACK (AMDGPU only)

ARM

Follows the AAPCS standard that all volatile bit-field write generates at least one load. (ARM only).

Reserve the r9 register (ARM only)

Allow use of CMSE (Armv8-M Security Extensions)

Disallow generation of data access to code sections (ARM only)

Disallow use of movt/movw pairs (ARM only)

Disallow converting instructions with negative immediates to their negation or inversion.

Disallow use of CRC instructions (ARM only)

Disallow generation of deprecated IT blocks for ARMv8. It is on by default for ARMv8 Thumb mode.

Thread pointer access method (AArch32/AArch64 only)

Allow memory accesses to be unaligned (AArch32/AArch64 only)

Hexagon

Enable generation of memop instructions

Enable generation of new-value jumps

Enable generation of new-value stores

Enable generation of instruction packets

Hexagon

Enable Hexagon Vector eXtensions

Set Hexagon Vector Length

Enable Hexagon Vector eXtensions

MIPS

Enable SVR4-style position-independent code (Mips only)

Place constants in the .rodata section instead of the .sdata section even if they meet the -G <size> threshold (MIPS)

Assume that externally defined data is in the small data if it meets the -G <size> threshold (MIPS)

Use 32-bit floating point registers (MIPS only)

Use 64-bit floating point registers (MIPS only)

Use GP relative accesses for symbols known to be in a small data section (MIPS)

Change indirect jump instructions to inhibit speculation

Extend the -G behaviour to object local data (MIPS)

Enable the generation of 4-operand madd.s, madd.d and related instructions.

Enable MSA ASE (MIPS only)

Enable MT ASE (MIPS only)

PowerPC

WebAssembly

WebAssembly Driver

Execution model (WebAssembly only)

X86

RISCV

Enable linker relaxation

Enable using library calls for save and restore

Long double flags

Selects the long double implementation

Force long double to be 128 bits

Force long double to be 64 bits

Force long double to be 80 bits, padded to 128 bits for storage

Optimization level

Flags controlling how much optimization should be performed.

Debug information generation

Flags controlling how much and what kind of debug information should be generated.

Kind and level of debug information

Generate source-level debug information

Generate source-level debug information with the default dwarf version

Generate source-level debug information with dwarf version 2

Generate source-level debug information with dwarf version 3

Generate source-level debug information with dwarf version 4

Generate source-level debug information with dwarf version 5

Debug level

Emit debug line info directives only

Emit debug line number tables only

Generate debug info with external references to clang modules or precompiled headers

Debugger to tune debug information for

Debug information flags

Embed source text in DWARF debug sections

Set DWARF fission mode to either 'split' or 'single'

DWARF debug sections compression type

DWARF debug sections compression type

Static analyzer flags

Flags controlling the behavior of the Clang Static Analyzer.

Pass <arg> to the static analyzer

Fortran compilation flags

Flags that will be passed onto the gfortran compiler when Clang is given a Fortran input.

Linker flags

Flags that are passed on to the linker

Add directory to library search path

Specify <script> as linker script

Set starting address of BSS to <addr>

Set starting address of DATA to <addr>

Set starting address of TEXT to <addr>

Pass the comma separated arguments in <arg> to the linker

Pass <arg> to the linker

HIP device library path. Alternative to rocm-path.

HIP device library

undef all system defines

Pass -z <arg> to the linker