FLANG(1)

๐Ÿ“ฆ
version 22.1.8 ยท 2 versions
, in fedora 44

โœจ FLANG(1) โœจ โ€” flang, the Flang Fortran compiler ๐Ÿ’…

๐ŸŽ€ NAME ๐ŸŽ€

flang โ€” the Flang Fortran compiler. That's the whole name situation, bestie: it's flang, it's the Flang compiler, and it speaks Fortran. ๐Ÿ’–

๐ŸŒธ SYNOPSIS ๐ŸŒธ

flang [options] filename ...

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

Okay so flang is a Fortran compiler that supports all of Fortran 95 and many newer language features. It supports OpenMP and has some support for OpenACC and CUDA. It encompasses preprocessing, parsing, optimization, code generation, assembly, and linking. Depending on the options you pass in, Flang will do only some โ€” or literally all โ€” of these actions. While Flang is highly integrated, it's important to understand the stages of compilation so you know how to invoke it. These stages are:

  • Driver โ€” The flang executable is actually a small driver that orchestrates the execution of other tools such as the compiler, assembler, and linker. Typically you don't need to interact with the driver, but you transparently use it to run the other tools.
  • Preprocessing โ€” This stage performs tokenization of the input source file, macro expansion, #include expansion, and handles other preprocessor directives.
  • Parsing and Semantic Analysis โ€” This stage parses the input file, translating preprocessor tokens into a parse tree. Once it's in the form of a parse tree, it applies semantic analysis to compute types for expressions and determine whether the code is well formed. Parse errors and most compiler warnings are generated by this stage.
  • Code Generation and Optimization โ€” This stage translates the parse tree into intermediate code (known as "LLVM IR") and, ultimately, machine code. It also optimizes this intermediate code and handles target-specific code generation. The output of this stage is typically a .s file, referred to as an "assembly" file. Flang also supports the use of an integrated assembler, in which the code generator produces object files directly. This avoids the overhead of generating the .s file and calling the target assembler explicitly.
  • Assembler โ€” This stage runs the target assembler to translate the output of the compiler into a target object file. The output of this stage is typically a .o file, referred to as an "object" file.
  • Linker โ€” This stage runs the target linker to merge multiple object files into an executable or dynamic library. The output of this stage is typically an a.out, .dylib, or .so file.

๐Ÿ’… OPTIONS ๐Ÿ’…

  • -B<prefix> โ€” Search $prefix$file for executables, libraries, and data files. If $prefix is a directory, search $prefix/$file.
  • -Qunused-arguments โ€” Don't emit warning for unused driver arguments.
  • --config=<file>, --config <arg> โ€” Specify configuration file.
  • -dumpmachine โ€” Display the compiler's target processor.
  • -dumpversion โ€” Display the version of the compiler.
  • -fdo-concurrent-to-openmp=<arg> โ€” Try to map do concurrent loops to OpenMP [none|host|device]. <arg> must be 'none', ' host' or ' device'.
  • -finit-global-zero, -fno-init-global-zero โ€” Zero initialize globals without default initialization (default).
  • -fppc-native-vector-element-order, -fno-ppc-native-vector-element-order โ€” Specifies PowerPC native vector element order (default).
  • -frepack-arrays, -fno-repack-arrays โ€” Create temporary copies of non-contiguous assumed shape dummy arrays in subprogram prologues, and destroy them in subprogram epilogues. The temporary copy is initialized with values from the original array in the prologue, if needed. In the epilogue, the current values in the temporary array are copied into the original array, if needed. Accessing the contiguous temporary in the program code may result in faster execution comparing to accessing elements of the original array, when they are sparse in memory. At the same time, the overhead of copying values between the original and the temporary arrays may be significant, which may slow down some programs. Enabling array repacking may also change the behavior of certain programs:
    • The copy actions may introduce a data race in valid OpenACC/OpenMP programs. For example, if different threads execute the same subprogram with a non-contiguous assumed shape dummy array, and the different threads access unrelated parts of the array, then the whole array copy made in each thread will cause a data race.
    • OpenACC/OpenMP offload programs may behave incorrectly with regards to the device data environment, due to the fact that the original array and the temporary may have different presence status on the device.
    • IS_CONTIGUOUS intrinsic may return TRUE with the array repacking enabled, whereas it would return FALSE with the repacking disabled.
    • The result of LOC intrinsic applied to an actual argument associated with a non-contiguous assumed shape dummy array may be different from the result of LOC applied to the dummy array.
  • -frtlib-add-rpath, -fno-rtlib-add-rpath โ€” Add -rpath with architecture-specific resource directory to the linker flags. When --hip-link is specified, also add -rpath with HIP runtime library directory to the linker flags.
  • -fsave-main-program, -fno-save-main-program โ€” Place all main program variables in static memory (otherwise scalars may be placed on the stack).
  • -fstack-arrays, -fno-stack-arrays โ€” Attempt to allocate array temporaries on the stack, no matter their size.
  • -fstack-repack-arrays, -fno-stack-repack-arrays โ€” Controls whether the array temporaries created under -frepack-arrays are allocated on the stack or on the heap. By default, the heap is used. Allocations of polymorphic types are always done on the heap, though this may change in future releases.
  • -funsafe-cray-pointers, -fno-unsafe-cray-pointers โ€” Optimizations allow for unsafe Cray pointer usages.
  • -fversion-loops-for-stride, -fno-version-loops-for-stride โ€” Create unit-strided versions of loops.
  • --gcc-install-dir=<arg> โ€” Use GCC installation in the specified directory. The directory ends with path components like lib{,32,64}/gcc{,-cross}/$triple/$version. Note: executables (e.g. ld) used by the compiler are not overridden by the selected GCC installation.
  • --gcc-toolchain=<arg> โ€” Specify a directory where Flang can find lib{,32,64}/gcc{,-cross}/$triple/$version. Flang will use the GCC installation with the largest version.
  • --gcc-triple=<arg> โ€” Search for the GCC installation with the specified triple.
  • -gpulibc โ€” Link the LLVM C Library for GPUs.
  • -help, --help โ€” Display available options.
  • --help-hidden โ€” Display help for hidden options.
  • -mllvm <arg>, -mllvm=<arg> โ€” Additional arguments to forward to LLVM's option processing.
  • -mmlir <arg> โ€” Additional arguments to forward to MLIR's option processing.
  • -module-dir<dir>, -J<arg> โ€” This option specifies where to put .mod files for compiled modules. It is also added to the list of directories to be searched by an USE statement. The default is the current directory.
  • --no-default-config โ€” Disable loading default configuration files.
  • -nodefaultlibs โ€” (no description given in the original here, bestie โ€” just the flag itself).
  • -nogpulibc โ€” (no description given in the original here, bestie โ€” just the flag itself).
  • -nopie โ€” (no description given in the original here, bestie โ€” just the flag itself).
  • -o<file> โ€” Write output to <file>.
  • --offloadlib, --no-offloadlib โ€” Link device libraries for GPU device compilation.
  • -print-effective-triple, --print-effective-triple โ€” Print the effective target triple.
  • -print-resource-dir, --print-resource-dir โ€” Print the resource directory pathname that contains lib and include directories with the runtime libraries and MODULE files.
  • -print-target-triple, --print-target-triple โ€” Print the normalized target triple.
  • -pthread, -no-pthread โ€” Support POSIX threads in generated code.
  • -resource-dir <arg>, -resource-dir=<arg> โ€” The directory which holds the compiler resource files.
  • -rtlib=<arg>, --rtlib=<arg> โ€” Compiler runtime library to use.
  • -save-temps=<arg>, --save-temps=<arg>, -save-temps (equivalent to -save-temps=cwd), --save-temps (equivalent to -save-temps=cwd) โ€” Save intermediate compilation results. <arg> can be set to 'cwd' for current working directory, or 'obj' which will save temporary files in the same directory as the final output file.
  • --sysroot=<arg> โ€” (no description given in the original here, bestie โ€” just the flag itself).
  • --target=<arg>, -target <arg> โ€” Generate code for the given target.
  • -v โ€” Show commands to run and use verbose output.
  • --version โ€” Print version information.
  • -w, --no-warnings โ€” Suppress all warnings.
  • -x<language> โ€” Treat subsequent input files as having type <language>.

๐ŸŽ€ Actions ๐ŸŽ€

The action to perform on the input.

  • -E โ€” Only run the preprocessor.
  • -S โ€” Only run preprocess and compilation steps.
  • -c โ€” Only run preprocess, compile, and assemble steps.
  • -emit-llvm โ€” Use the LLVM representation for assembler and object files.
  • -fsyntax-only โ€” Run the preprocessor, parser and semantic analysis stages.

โœจ Compilation options โœจ

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

  • -Xflang <arg> โ€” Pass <arg> to the flang compiler.
  • -moutline-atomics, -mno-outline-atomics โ€” Generate local calls to out-of-line atomic operations.
  • -print-supported-cpus, --print-supported-cpus, -mcpu=help, -mtune=help โ€” Print supported cpu models for the given target (if target is not specified, it will print the supported cpus for the default target).
  • -std=<arg>, --std=<arg> โ€” Language standard to compile for.

๐Ÿงš Preprocessor options ๐Ÿงš

Flags controlling the behavior of the Flang preprocessor.

  • -D<macro>=<value> โ€” Define <macro> to <value> (or 1 if <value> omitted).
  • -P โ€” Disable linemarker output in -E mode.
  • -U<macro> โ€” Undefine macro <macro>.

๐Ÿ“ Include path management ๐Ÿ“

Flags controlling how #includes are resolved to files.

  • -I<dir> โ€” Add directory to include search path. For C++ inputs, 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.
  • -isysroot<dir> โ€” Set the system root directory (usually /).

๐Ÿ’œ Dumping preprocessor state ๐Ÿ’œ

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

  • -dM โ€” Print macro definitions in -E mode instead of normal output.

๐Ÿ‘‘ Diagnostic options ๐Ÿ‘‘

Flags controlling which warnings, errors, and remarks Flang will generate. See Clang's Diagnostic Reference for a full list of warning and remark flags.

  • -R<remark> โ€” Enable the specified remark.
  • -Rpass-analysis=<arg> โ€” Report transformation analysis from optimization passes whose name matches the given POSIX regular expression.
  • -Rpass-missed=<arg>

And for the ones that didn't fire? Report missed transformations by optimization passes whose name matches the given POSIX regular expression ๐Ÿซถ

  • -Rpass=<arg> โ€” Report transformations performed by optimization passes whose name matches the given POSIX regular expression
  • -W<warning> โ€” turn on the warning you just named, periodt.

โœจ Target-independent compilation options โœจ

okay this is the big one, grab a snack ๐Ÿ“

  • -cpp โ€” turn on the predefined macros and the command-line preprocessor macros ๐Ÿ’…
  • -fPIC, -fno-PIC
  • -fPIE, -fno-PIE
  • -falternative-parameter-statement โ€” enables the old style PARAMETER statement, the vintage one โœจ
  • -fapprox-func, -fno-approx-func โ€” lets certain math function calls get swapped out for an approximately equivalent calculation
  • -fassociative-math, -fno-associative-math
  • -fatomic-fine-grained-memory, -fno-atomic-fine-grained-memory โ€” may have atomic operations on fine-grained memory
  • -fatomic-ignore-denormal-mode, -fno-atomic-ignore-denormal-mode, -munsafe-fp-atomics โ€” lets atomic operations ignore denormal mode
  • -fatomic-remote-memory, -fno-atomic-remote-memory โ€” may have atomic operations on remote memory
  • -fbackslash, -fno-backslash โ€” says a backslash inside a string introduces an escape character
  • -fbuiltin, -fno-builtin
  • -fcoarray โ€” enables Coarray features ๐ŸŒˆ
  • -fcolor-diagnostics, -fdiagnostics-color, -fno-color-diagnostics โ€” enables colors in diagnostics (yes queen, make the errors pretty)
  • -fcomplex-arithmetic=<arg> โ€” controls how complex number multiplication and division get calculated. arg must be 'full', 'improved', 'promoted' or 'basic'.
  • -fconvert=<arg> โ€” set endian conversion of data for unformatted files
  • -fd-lines-as-code, -fno-d-lines-as-code โ€” treat fixed form lines with 'd' or 'D' in the first column as blank.
  • -fd-lines-as-comments, -fno-d-lines-as-comments โ€” treat fixed form lines with 'd' or 'D' in the first column as comments.
  • -fdefault-double-8 โ€” set the default double precision kind to an 8 byte wide type
  • -fdefault-integer-4 โ€” set the default integer and logical kind to a 4 byte wide type
  • -fdefault-integer-8 โ€” set the default integer and logical kind to an 8 byte wide type
  • -fdefault-real-4 โ€” set the default real kind to a 4 byte wide type
  • -fdefault-real-8 โ€” set the default real kind to an 8 byte wide type
  • -fdiagnostics-color=<arg> โ€” when to use colors in diagnostics. arg must be 'auto', 'always' or 'never'.
  • -fexperimental-loop-fusion, -fno-experimental-loop-fusion โ€” enable the loop fusion pass ๐Ÿ”ฅ
  • -ffast-math, -fno-fast-math โ€” allows aggressive, lossy floating-point optimizations. it's giving "we ball" energy, so know what you're doing.
  • -ffast-real-mod, -fno-fast-real-mod โ€” enable optimization of MOD for REAL types
  • -ffat-lto-objects, -fno-fat-lto-objects โ€” enable fat LTO object support
  • -ffixed-form โ€” process source files in fixed form
  • -ffixed-line-length=<arg>, -ffixed-line-length-<arg> โ€” set the column after which characters are ignored in typical fixed-form lines in the source file
  • -ffp-contract=<arg> โ€” form fused FP ops (e.g. FMAs). the tea:
    • fast โ€” fuses across statements, disregarding pragmas
    • on โ€” only fuses in the same statement unless dictated by pragmas
    • off โ€” never fuses
    • fast-honor-pragmas โ€” fuses across statements unless dictated by pragmas

default is 'fast' for CUDA, 'fast-honor-pragmas' for HIP, and 'on' otherwise. arg must be 'fast', 'on', 'off' or 'fast-honor-pragmas'.

  • -ffree-form โ€” process source files in free form ๐Ÿฆ‹
  • -fhermetic-module-files โ€” emit hermetic module files (no nested USE association)
  • -fhonor-infinities, -fno-honor-infinities โ€” says floating-point optimizations aren't allowed to assume arguments and results aren't +-inf.
  • -fhonor-nans, -fno-honor-nans โ€” says floating-point optimizations aren't allowed to assume arguments and results aren't NANs.
  • -fimplicit-none, -fno-implicit-none โ€” no implicit typing allowed unless an IMPLICIT statement overrides it
  • -fimplicit-none-ext, -fno-implicit-none-ext โ€” no implicit externals allowed
  • -finput-charset=<arg> โ€” specify the default character set for source files
  • -finstrument-functions โ€” generate calls to instrument function entry and exit
  • -fintegrated-as, -fno-integrated-as โ€” enable the integrated assembler
  • -fintrinsic-modules-path <dir>, -fintrinsic-modules-path=<arg> โ€” this one tells the compiler where your pre-compiled intrinsic modules live, for when they're not in the default location it expects. ๐Ÿ’…
  • -flarge-sizes โ€” use INTEGER(KIND=8) for the result type in size-related intrinsics
  • -flogical-abbreviations, -fno-logical-abbreviations โ€” enable logical abbreviations
  • -floop-interchange, -fno-loop-interchange โ€” enable the loop interchange pass
  • -flto-partitions=<arg> โ€” how many partitions to use for parallel full LTO codegen, ld.lld only.
  • -flto=<arg>, -flto (equivalent to -flto=full), -flto=auto (equivalent to -flto=full), -flto=jobserver (equivalent to -flto=full) โ€” set LTO mode. arg must be 'thin' or 'full'.
  • -fms-runtime-lib=<arg> โ€” specify Visual Studio C runtime library. "static" and "static_dbg" correspond to the cl flags /MT and /MTd which use the multithread, static version. "dll" and "dll_dbg" correspond to the cl flags /MD and /MDd which use the multithread, dll version. arg must be 'static', 'static_dbg', 'dll' or 'dll_dbg'.
  • -fomit-frame-pointer, -fno-omit-frame-pointer โ€” omit the frame pointer from functions that don't need it. some stack unwinding cases, like profilers and sanitizers, may prefer you specify -fno-omit-frame-pointer. on many targets, -O1 and higher omit the frame pointer by default. -m[no-]omit-leaf-frame-pointer takes precedence for leaf functions. ๐Ÿ‘‘
  • -fopenacc โ€” enable OpenACC
  • -fopenmp, -fno-openmp โ€” parse OpenMP pragmas and generate parallel code.
  • -fopenmp-force-usm โ€” force behavior as if the user specified pragma omp requires unified_shared_memory.
  • -fopenmp-simd, -fno-openmp-simd โ€” emit OpenMP code only for SIMD-based constructs.
  • -fopenmp-target-debug, -fno-openmp-target-debug โ€” enable debugging in the OpenMP offloading device RTL
  • -fopenmp-version=<arg> โ€” set OpenMP version (e.g. 45 for OpenMP 4.5, 51 for OpenMP 5.1). default value is 31 for Flang.
  • -fopenmp=<arg>
  • -foptimization-record-file=<file> โ€” 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. ๐Ÿšซ
  • -foptimization-record-passes=<regex> โ€” only include passes which match a specified regular expression in the generated optimization record (by default, include all passes)
  • -fpass-plugin=<dsopath> โ€” load pass plugin from a dynamic shared object file (only with new pass manager).
  • -fpic, -fno-pic
  • -fpie, -fno-pie
  • -fprofile-generate โ€” generate instrumented code to collect execution counts into default.profraw (overridden by the LLVM_PROFILE_FILE env var)
  • -fprofile-use=<pathname> โ€” use instrumentation data for profile-guided optimization. if pathname is a directory, it reads from <pathname>/default.profdata. otherwise, it reads from file pathname.
  • -frealloc-lhs, -fno-realloc-lhs โ€” if an allocatable left-hand side of an intrinsic assignment is unallocated, or its shape/type doesn't match the right-hand side, then it gets automatically (re)allocated โœจ
  • -freciprocal-math, -fno-reciprocal-math โ€” allow division operations to be reassociated
  • -frecord-command-line, -fno-record-command-line โ€” generate a section named ".GCC.command.line" containing the driver command-line. after linking, the section may contain multiple command lines, which will be individually terminated by null bytes. separate arguments within a command line are combined with spaces; spaces and backslashes within an argument are escaped with backslashes. this format differs from the format of the equivalent section produced by GCC with the -frecord-gcc-switches flag. this option is currently only supported on ELF targets.
  • -frepack-arrays-contiguity=<arg> โ€” when -frepack-arrays is in effect, 'whole' enables repacking for arrays that are non-contiguous in any dimension, 'innermost' enables repacking for arrays that are non-contiguous in the innermost dimension (the default). arg must be 'whole' or 'innermost'.
  • -fropi, -fno-ropi โ€” generate read-only position independent code (ARM only)
  • -frwpi, -fno-rwpi โ€” generate read-write position independent code (ARM only)
  • -fsave-optimization-record, -fno-save-optimization-record โ€” generate a YAML optimization record file
  • -fsave-optimization-record=<format> โ€” generate an optimization record file in a specific format
  • -fsigned-zeros, -fno-signed-zeros
  • -fslp-vectorize, -fno-slp-vectorize, -ftree-slp-vectorize โ€” enable the superword-level parallelism vectorization passes
  • -fstrict-overflow, -fno-strict-overflow
  • -ftime-report
  • -ftime-report-json
  • -funderscoring, -fno-underscoring โ€” appends one trailing underscore to external names
  • -funroll-loops, -fno-unroll-loops โ€” turn on loop unroller
  • -funsigned, -fno-unsigned โ€” enables UNSIGNED type
  • -fuse-ld=<arg>
  • -fveclib=<arg> โ€” use the given vector functions library.
Note: -fveclib=libmvec on AArch64 requires GLIBC 2.40 or newer.

arg must be 'Accelerate', 'libmvec', 'MASSV', 'SVML', 'SLEEF', 'Darwin_libsystem_m', 'ArmPL', 'AMDLIBM' or 'none'.

  • -fvectorize, -fno-vectorize, -ftree-vectorize โ€” enable the loop vectorization passes
  • -fverbose-asm, -fno-verbose-asm โ€” generate verbose assembly output
  • -fwrapv, -fno-wrapv โ€” treat signed integer overflow as two's complement
  • -fwrapv-pointer, -fno-wrapv-pointer โ€” treat pointer overflow as two's complement
  • -fxor-operator, -fno-xor-operator โ€” enable .XOR. as a synonym of .NEQV.
  • -nocpp โ€” disable predefined and command line preprocessor macros
  • -pedantic, --pedantic โ€” warn on language extensions

๐ŸŒˆ Common Offloading options ๐ŸŒˆ

  • --offload-arch=<arg1>,<arg2>..., --no-offload-arch=<arg1>,<arg2>... โ€” specify an offloading device architecture for CUDA, HIP, or OpenMP (e.g. sm_35). if 'native' is used, the compiler will detect locally installed architectures. for HIP offloading, the device architecture can be followed by target ID features delimited by a colon (e.g. gfx908:xnack+:sramecc-). may be specified more than once. ๐Ÿ’…
  • --offload-device-only โ€” only compile for the offloading device.
  • --offload-host-device โ€” compile for both the offloading host and device (default).
  • --offload-host-only โ€” only compile for the offloading host.
  • --offload-targets=<arg1>,<arg2>..., -fopenmp-targets=<arg1>,<arg2>... โ€” specify a list of target architectures to use for offloading.

๐ŸŽ€ HIP options ๐ŸŽ€

  • --rocm-device-lib-path=<arg> โ€” ROCm device library path. alternative to rocm-path.
  • --rocm-path=<arg>
  • ROCm installation path โ€” used for finding and automatically linking required bitcode libraries. yes bestie, it goes looking for your bitcode for you, we love a self-sufficient king ๐Ÿซถ

๐ŸŽฏ Target-dependent compilation options ๐ŸŽฏ

okay so these ones are all about what machine you're building for, and a bunch of them come with zero description in the source. I'm not gonna invent lore for them โ€” I'm just gonna list them like the mysterious little icons they are. no notes given, and honestly? that's the vibe ๐Ÿ’…

  • -m32 โ€” listed with no description attached. that's it, that's the whole entry. ๐Ÿ’€
  • -m64 โ€” same energy as -m32, no description in the source.
  • -mabi=<arg> โ€” no description given.
  • -maix32 โ€” no description given.
  • -maix64 โ€” no description given.
  • -march=<arg> โ€” want the list of available architectures for your target? Run -mcpu=help. (yes, -mcpu=help gives you the arch list too, that's just how it is โœจ)
  • -masm=<arg> โ€” no description given.
  • -mcmodel=<arg> โ€” no description given.
  • -mcode-object-version=<arg> โ€” specify the code object ABI version. Defaults to 6. (AMDGPU only!) And <arg> has to be one of none, 4, 5, or 6 โ€” anything else and it's not it, bestie.
  • -mcpu=<arg> โ€” want the list of available CPUs for your target? Run -mcpu=help. ๐Ÿ–ฅ๏ธ
  • -mdynamic-no-pic<arg> โ€” no description given.
  • -mlarge-data-threshold=<arg> โ€” no description given.
  • -mmacos-version-min=<arg>, -mmacosx-version-min=<arg> โ€” set the macOS deployment target. ๐ŸŽ two spellings, one destiny
  • -mprefer-vector-width=<arg> โ€” picks the preferred vector width for auto-vectorization. Defaults to none, which just means "let the target make its own choices". letting your target decide, very autonomous of it
  • -mrecip โ€” literally equivalent to -mrecip=all. that's the whole thing. ๐Ÿ˜Œ
  • -mrecip=<arg1>,<arg2>... โ€” controls use of approximate reciprocal and reciprocal square root instructions, followed by <n> iterations of Newton-Raphson refinement. Here's the grammar, verbatim, do not lose it: <value> = ( ['!'] ['vec-'] ('rcp'|'sqrt') [('h'|'s'|'d')] [':'<n>] ) | 'all' | 'default' | 'none' ๐Ÿงฎ
  • -mrvv-vector-bits=<arg> โ€” specify the size in bits of an RVV vector register. Defaults to the vector length agnostic value of "scalable". Accepts powers of 2 between 64 and 65536. It also accepts "zvl" to use the value implied by -march/-mcpu. (RISC-V only!)
  • -mtune=<arg> โ€” only supported on AArch64, PowerPC, RISC-V, SPARC, SystemZ, and X86. if your arch isn't on that list, this flag is not for you and it's not personal, it's just architecture ๐Ÿฆ‹

๐Ÿฆ‹ AARCH64 ๐Ÿฆ‹

  • -msve-streaming-vector-bits=<arg> โ€” specify the size in bits of an SVE vector register in streaming mode. Defaults to the vector length agnostic value of "scalable". (AArch64 only!)
  • -msve-vector-bits=<arg> โ€” specify the size in bits of an SVE vector register (no streaming mode this time, bestie). Defaults to the vector length agnostic value of "scalable". (AArch64 only!)

๐Ÿ’ป X86 ๐Ÿ’ป

  • -mapx-features=<arg1>,<arg2>..., -mno-apx-features=<arg1>,<arg2>... โ€” enable features of APX. <arg> must be one of egpr, push2pop2, ppx, ndd, ccmp, nf, cf, or zu. eight options, one flag family, we love a checklist โœจ

๐Ÿ‰ LoongArch ๐Ÿ‰

okay so LoongArch brought a LOT of pairs โ€” every one of these is a thing-on/thing-off duo, so I'm listing both halves together like the matching set they are. ๐ŸŽ€

  • -mannotate-tablejump, -mno-annotate-tablejump โ€” enable annotate table jump instruction, to correlate it with the jump table.
  • -mdiv32, -mno-div32 โ€” use div.w[u] and mod.w[u] instructions with input not sign-extended.
  • -mfrecipe, -mno-frecipe โ€” enable frecipe.{s/d} and frsqrte.{s/d}.
  • -mlam-bh, -mno-lam-bh โ€” enable amswap[_db].{b/h} and amadd[_db].{b/h}.
  • -mlamcas, -mno-lamcas โ€” enable amcas[_db].{b/h/w/d}.
  • -mlasx, -mno-lasx โ€” enable the Loongson Advanced SIMD Extension (LASX).
  • -mld-seq-sa, -mno-ld-seq-sa โ€” do not generate same-address load-load barrier instructions (dbar 0x700). not me generating the barrier, we are NOT generating the barrier ๐Ÿšซ
  • -mlsx, -mno-lsx โ€” enable the Loongson SIMD Extension (LSX).
  • -mscq, -mno-scq โ€” enable the sc.q instruction.
  • -msimd=<arg> โ€” select which SIMD extension(s) get enabled in LoongArch. Your choices are 'none', 'lsx', or 'lasx'. pick your fighter ๐Ÿ’…

โšก Optimization level โšก

Flags controlling how much optimization should be performed. the "how hard should we try" section, basically

  • -O<arg> โ€” no description given in the source.
  • -Ofast<arg> โ€” DEPRECATED. ๐Ÿ‘‘ Here's the replacement math, straight from the page: use '-O3 -ffast-math -fstack-arrays' for the same behavior, or '-O3 -fstack-arrays' if you only want conforming optimizations. she's retired, she's still iconic, but she's retired ๐Ÿ˜ญ

๐Ÿ› Debug information generation ๐Ÿ›

Flags controlling how much and what kind of debug information should be generated. future-you debugging past-you: this section is your bestie fr fr

๐Ÿ“– Kind and level of debug information ๐Ÿ“–

  • -g โ€” generate source-level debug information.
  • -gdwarf โ€” generate source-level debug information with the default DWARF version.
  • -gdwarf-2 โ€” generate source-level debug information with DWARF version 2.
  • -gdwarf-3 โ€” generate source-level debug information with DWARF version 3.
  • -gdwarf-4 โ€” generate source-level debug information with DWARF version 4.
  • -gdwarf-5 โ€” generate source-level debug information with DWARF version 5.
  • -gdwarf-6 โ€” generate source-level debug information with DWARF version 6.

๐Ÿ” Debug level ๐Ÿ”

  • -g0 โ€” no description given.
  • -g2 โ€” no description given.
  • -g3 โ€” no description given.
  • -gline-directives-only โ€” emit debug line info directives only.
  • -gline-tables-only, -g1 โ€” emit debug line number tables only. tables, not directives, important distinction bestie ๐Ÿซถ

๐Ÿ”ง Debug information options ๐Ÿ”ง

  • -gsplit-dwarf, -gno-split-dwarf โ€” no description given for the pair.
  • -gsplit-dwarf=<arg> โ€” set the DWARF fission mode. <arg> must be 'split' or 'single'. fission mode sounds so dramatic and I respect it deeply ๐Ÿ’œ

๐Ÿ”— Linker options ๐Ÿ”—

Flags that are passed on to the linker. say hi to your linker for me ๐Ÿ‘‹

  • -L<dir> โ€” add directory to library search path.
  • -Wl,<arg>,<arg2>... โ€” pass the comma separated arguments in <arg> to the linker.
  • -Xlinker <arg> โ€” pass <arg> to the linker.
  • -Xoffload-linker<triple> <arg> โ€” pass <arg> to the offload linkers, or the ones identified by -<triple>.
  • -l<arg> โ€” no description given.
  • -nostdlib โ€” no description given.
  • -pie, -no-pie โ€” no description given.
  • -rdynamic โ€” no description given.
  • -rpath <arg> โ€” no description given.
  • -shared, --shared โ€” no description given.
  • -shared-libflangrt โ€” link the flang-rt shared library.
  • -static, --static โ€” no description given.
  • -static-libflangrt โ€” link the flang-rt static library.
  • -stdlib โ€” no description given. the page just ends it there, right after -stdlib, no further comment, and honestly? main character exit ๐Ÿ’…

๐Ÿ‘‘ Author ๐Ÿ‘‘

Flang Contributors. the whole squad, no single name, just collective slay ๐Ÿซถ

2017-2026, The Flang Team. ๐ŸŽ€


okay bestie that's the whole page, we made it, and before you go: this one is FLANG(1), volume 22, dated Jul 16, 2026 โ€” so if your copy says something else, you're reading a different edition and I need you to go check. go compile something beautiful, you absolute legend, periodt โœจ๐Ÿ’–๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from