Every option of plc, grouped by purpose. This page is for looking things up; Building explains the options that a normal build uses.
plc [OPTIONS] <input-files>...
plc [OPTIONS] <input-files>... <SUBCOMMAND>
Most options are global, so they work with a subcommand as well. plc -h prints the same list.
Subcommand Purpose
build [plc.json]Build the project that the project file describes
check [plc.json]Run the compiler up to validation, write nothing
config schemaPrint the JSON schema of the project file
config diagnosticsPrint the severity of every diagnostic code
explain <code>Print the explanation of a diagnostic code
generate [plc.json] headersGenerate C headers for a project
config prints JSON. generate headers accepts --header-language, where c is the implemented language, --header-output, and --header-prefix.
Option Effect
<input-files>Paths or glob patterns. Quote a pattern so the compiler expands it
-i, --include <file>Read declarations without compiling their bodies. Repeatable
--encoding <name>Read the sources with this encoding instead of UTF-8
The extension decides how a file is read: .cfc, .fbd, and .xml are graphical sources, .o, .so, and .exe go to the linker, and everything else is Structured Text.
Option Artifact Default name
none, --static An executable <first input>.out
-cAn object file, not linked <first input>.o
--relocatableOne object file with every unit <first input>.o
--sharedA shared object <first input>.so
--irLLVM intermediate representation <first input>.ll
--bcLLVM bitcode <first input>.bc
--astThe syntax tree after parsing standard output
--ast-loweredThe syntax tree after every rewrite standard output
The default name comes from the first argument as it was written, so a glob pattern gives a file whose name holds the pattern. Give -o with a pattern.
Option Effect
-o, --output <file>Name of the artifact
--build-location <dir>Directory for the intermediate object files
--checkProduce nothing; report the diagnostics only
Option Effect
-O, --optimization <level>none, less, default (the default), aggressive
--target <triple>Build for this LLVM target instead of the host
--sysroot <dir>Root for the headers and libraries of that target
-j, --threads <n>Use n threads. Without the option the compiler uses every core
--single-moduleBuild one LLVM module for the whole project
--fpicForce position-independent code
--fno-picForce code that is not position-independent
--fno-identDo not embed the compiler version in the artifact
Option Effect
--linker <command>Use this linker, for example cc or clang
--fuse-ld <name>Back end linker for a driver, for example mold
--linker-arg <argument>Pass one argument to the linker. Repeatable
-l, --library <name>Link lib<name>. Also -l:libfoo.so.1 and a full path
-L, --library-path <dir>Add a directory to the library search
--script <file>Give the linker a linker script
--nocrtDo not link the C runtime startup files
--nolibcDo not link the default C libraries
--allow-undefined-symbolsAllow undefined symbols in a shared object
Option Effect
-g, --debugSource lines, variables, and types, as DWARF 5
--debug-variablesThe global variables only
--gdwarf <2..5>The same as -g, with a fixed DWARF version
--gdwarf-variables <2..5>The same as --debug-variables, with a fixed DWARF version
--file-prefix-map OLD=NEWRewrite recorded paths. Repeatable. Alias --debug-prefix-map
--debug-compilation-dir <dir>Set the compilation directory in the debug information
Option Effect
--error-config <file>Change the severity of diagnostic codes
--error-format <format>rich (the default), clang, or none
--log-level <level>off, error, warn, info, debug, trace
-v, --verboseThe same as --log-level=debug
Option Effect
--generate-headersWrite C headers instead of code
--header-output <dir>Directory for the generated headers
--hwmap-file[=<file>]Write the map of hardware-bound variables. The = is required
--generate-external-constructorsAlso write constructors for {external} units
--constructors-onlyWrite the generated constructors and no bodies
--online-changeEmit the type information that a runtime needs to exchange code while it runs
--got-layout-file <file>Read and write the table layout that an online change keeps stable
Option Use instead
--pic--shared --fpic
--no-pic--shared --fno-pic
--hardware-conf <file>--hwmap-file=<file>, which also carries the mangled symbol names
--no-linker-scriptNothing. No script is used unless --script names one