Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
kefir(1)		     General Commands Manual			kefir(1)

NAME
     kefir -- C17/C23 language compiler

SYNOPSIS
     kefir [options] files... [-run [args...]]

DESCRIPTION
     kefir  command-line  options follow c99(1) compiler interface, extending it
     with some of supported gcc(1) flags and flags for special	kefir  features.
     Unknown command-line flags are ignored with a warning printed for each such
     flag passed to the compiler.  kefir compiler driver features multiple oper-
     ation  modes.  Command-line  flags  are  parsed in left-to-right order with
     later flags overriding earlier.  Some of operation  modes,  once  selected,
     prevent  further  parsing	and  immediately  invoke selected mode (refer to
     "OPTIONS" section for details).

OPTIONS
     The following options terminate command-line argument parsing:

     -h | --help
	     Print help text

     -v | --version
	     Print compiler version

     --compiler-info
	     Print compiler information

     --environment-info
	     Print compiler environment information (see  "ENVIRONMENT"  section
	     below)

     --environment-header
	     Print compiler environment header file (based on "ENVIRONMENT" sec-
	     tion and current target)

     -verbose
	     Report commands executed by the driver verbosely

     If  passed, -cc1 argument invokes kefir-cc1 compiler directly, skipping the
     driver. The argument shall always be passed first to take an effect.

     The rest of command-line options are parsed normally:

     -c      Skip the link-edit phase of the compilation, save object files

     -S      Skip assembling phase of the compilation, save assembly files

     -E      Preprocess C-language source files, print results to standard  out-
	     put

     -P      Preprocess  C-language source files, print results to standard out-
	     put

     -std= standard
	     Determine language standard. For C23, supported  values  are:  c23,
	     c2x,  gnu23,  gnu2x,  iso9899:2024.   For	C17 [default], any other
	     value not explicitly listed for C23.

     -x -language
	     Specify processing for the next input files. Supported values: none
	     [default], c, c-header, cpp-output, assembler, assembler-with-cpp.

     -preprocess-save
	     Preprocess C-language source files, save results

     -o file
	     Save results to the output file

     --target specification
	     Generate code for specified target system (see "TARGET" section be-
	     low)

     -O level
	     Code optimization level (default is 0).  All  non-zero  levels  are
	     equivalent  to  1.  All non-numerical levels (such as -Os) are also
	     equivalent to 1.

     -fpreprocessed
	     Skip preprocessor directive processing and  macro	expansion.  Pre-
	     processor	skips  over any directive except for line directive, and
	     acts solely as tokenizer.

     --preprocessor-linemarkers
	     Include linemarkers into preprocessor output [default: off].  Like-
	     marker  content  slightly	differs from gcc, which might break some
	     builds. Enable with care.

     -funsigned-char
	     Let the type char be unsigned. By default, it is target-specific.

     -fsigned-char
	     Let the type char be signed. By default, it is target-specific.

     -fcommon
	     Place tentative definitions into common section (equivalent to com-
	     mon attribute applied to all variables).

     -fvisibility=default|internal|hidden|protected
	     Set visibility for symbols in the program, unless overriden by par-
	     ticular symbol attribute.

     -fno-common
	     Do not place tentative definitions into common section [default].

     -ffast-math
	     Enable additional floating-point math optimization at  the  expense
	     of correctness in edge cases.  Currently only enables -fcx-limited-
	     range option. [default: off]

     -fcx-limited-range
	     Perform more efficient handling of complex floating-point multipli-
	     cation  and  division  at	the expense of correctness in edge cases
	     [default: off]

     -ffreestanding
	     Assert that compilation targets freestanding environment  [default:
	     off]

     -fno-freestanding
	     Assert that compilation targets hosted environment

     -fhosted
	     Assert that compilation targets hosted environment [default: on]

     -D name[=value]
	     Define preprocessor macro

     -U name
	     Undefine predefined preprocessor macro

     -I directory
	     Add directory to preprocessor include path

     -isystem directory
	     Add directory to preprocessor system include path

     -iquote directory
	     Add  directory to preprocessor include path for quoted includes ex-
	     clusively (processed before -I ).

     -idirafter directory
	     Add directory to preprocessor system include path (after processing
	     other system include directories)

     --embed-dir= directory
	     Add directory to preprocessor embed search path

     -M      Output a make rule describing the dependencies of source file  (in-
	     cluding the dependencies from system path)

     -MM     Output  a make rule describing the dependencies of source file (ex-
	     cluding the dependencies from system path and their transitive  in-
	     cludes)

     -MD     Output  a make rule describing the dependencies of source file (in-
	     cluding the dependencies from system path), while also running nor-
	     mal compilation pipeline.

     -MMD    Output a make rule describing the dependencies of source file  (ex-
	     cluding  the dependencies from system path and their transitive in-
	     cludes), while also running normal compilation pipeline.

     -MP     Output a phony target for each depenendency of source file

     -MT target
	     Override the default target name of make rule  produced  by  depen-
	     dency generation

     -MF filename
	     Override  the  default output file for make rule produced by depen-
	     dency generation.

     -dM     Generate list of define directives for preprocessor macros.

     -include file
	     Include file during preprocessing phase

     -s      Strip linked executable

     -r      Retain relocations in linked executable

     -e entry
	     Override entry point of linked executable

     -u symbol
	     Add undefined symbol to linked executable

     -l library
	     Link library

     -L directory
	     Add directory to linker library search path

     -rpath directory
	     Add directory to runtime library search path

     -soname name
	     Pass -soname option to the linker

     -pthread
	     Define macros and link pthread library

     -rdynamic
	     Pass --export-dynamic option to the linker

     -static
	     Produce a statically linked executable

     -shared
	     Produce a shared object

     -fPIC | -fpic
	     Produce position-independent code [default]

     -fno-pic
	     Do not produce position-independent code [default]

     -pie    Produce position-independent executable (requires -fPIC flag)

     -no-pie
	     Do not produce position-independent executable [default]

     -masm=ASSEMBLER
	     Produce  code  for  the  following  assembler:   [x86_64-gas-intel,
	     x86_64-gas-intel_prefix, x86_64-gas-att (default), x86_64-yasm, in-
	     tel  (alias for x86_64-gas-intel), att (alias for x86_64-gas-att)].
	     Also affects assembler flags. Note that KEFIR_AS or AS envinronment
	     variable shall be point to the respective assembler executable.

     -fomit-frame-pointer
	     Omit frame pointer in leaf functions that do not need  it	[default
	     on optimization levels > 0]

     -fno-omit-frame-pointer
	     Always  use frame pointer in all functions [default on optimization
	     level 0]

     -g | -ggdb
	     Produce debug information [default: off]

     -g[level] | -ggdb[level]
	     Produce debug information if level is greater than 0 [default: off]

     -nostartfiles
	     Do not link start files

     -nodefaultlibs
	     Do not link default libraries

     -nolibc
	     Do not link libc

     -nostdlib
	     Do not link start files and default libraries

     -nostdinc
	     Do not add standard library to include path

     -nortinc
	     Do not add runtime includes to include path

     --enable-atomics
	     Enables atomic support.  Implies  --Wdeclare-atomic-support  option
	     and  links appropriate atomic primitives library (libatomic/libcom-
	     piler_rt) where necessary.

     --disable-atomics
	     Disables atomic support. Implies  --Wno-declare-atomic-support  op-
	     tion.

     -Wp,option
	     Pass "option" to preprocessing phase as command line option. If op-
	     tion contains commas, it is split into multiple options

     -Xpreprocessor option
	     Pass "option" to preprocessing phase as command line option

     -Wc,option
	     Pass  "option" to compiling phase as command line option. If option
	     contains commas, it is split into multiple options

     -Wa,option
	     Pass "option" to assembler phase as command line option. If  option
	     contains commas, it is split into multiple options

     -Xassembler option
	     Pass "option" to assembler phase as command line option.

     -Wl,option
	     Pass  "option"  to  linking phase as command line option. If option
	     contains commas, it is split into multiple options

     -z -keyword
	     Pass "-z keyword" to linking phase as command line options.

     -Xlinker option
	     Pass "option" to linking phase as command line option

     -Woption
	     Pass "--option" to compiling phase as command line option

     -W option
	     Pass "option" to compiling phase as command line option

     --restrictive-c
	     Enable restrictive compiling mode with C extensions disabled

     --permissive-c
	     Enable permissive compiling mode with  C  extensions  enabled  [de-
	     fault]

     --print-tokens
	     Print tokenized source in JSON format

     --print-ast
	     Print AST in JSON format

     --print-ir
	     Print intermediate representation in JSON format

     --print-opt
	     Print optimization representation code in JSON format

     --print-opt-full
	     Print optimization representation of complete module in JSON format

     -run [file args...]
	     Run  the linked executable with the rest of command line arguments.
	     If no input file was specified, the first argument  is  treated  as
	     input file.

     -runarg arg
	     Pass an argument to the runned process (shall precede -run flag)

     -run-stdin file
	     Redirect runned process stdin from file (shall precede -run flag)

     -run-stdout file
	     Redirect runned process stdout to file (shall precede -run flag)

     -run-stderr file
	     Redirect runned process stderr to file (shall precede -run flag)

     -run-stderr2out
	     Redirect runned process stderr to stdout (shall precede -run flag)

   COMPILER OPTIONS
     Extra compiler options available via -W switch:

     --c17-standard
	     Use C17 language language standard.

     --c23-standard
	     Use C23 language language standard.

     --pp-timestamp timestamp
	     Override preprocessor timestamp

     --json-errors
	     Print errors in JSON format to stderr

     --tabular-errors
	     Print errors in tabular format to stderr

     --target-profile profile
	     Generate code for specified target (see "TARGET" subsection)

     --source-id identifier
	     Force use provided source file identifier

     --extension-lib libpath
	     Load extension library

     --system-include-dir dir
	     Add  directory  to  include search path and mark it as a system in-
	     clude path (used for dependency output)

     --embed-dir directory
	     Add directory to preprocessor embed search path

     --debug-info
	     Include debug information into produced output

     --optimizer-max-inline-depth depth
	     Maximum depth of function inlining (5 by default).

     --optimizer-max-inlines-per-func inlines
	     Maximum number of inlined functions (10 by default).

     --enable-lowering
	     Perform target-specific SSA lowering (mandatory for bit-precise in-
	     teger support) [default]

     --disable-lowering
	     Skip target-specific SSA lowering.

     --preprocessor-assembly-mode
	     Enable assembly preprocessing mode (default for .S files). In  this
	     mode, leading '$' characters are not treated as identifier part.

     --preprocessor-normal-mode
	     Disable assembly preprocessing mode (default).

     --feature-[name]
	     Enable compiler feature (see "FEATURES" subsection)

     --no-feature-[name]
	     Disable compiler feature (see "FEATURES" subsection)

     --internal-[flag]
	     Enable compiler internal flag (see "INTERNALS" subsection)

     --no-internal-[flag]
	     Disable compiler internal flag (see "INTERNALS" subsection)

     --codegen-[option]
	     Enable option for code generator (see "CODEGEN" subsection)

     --no-codegen-[option]
	     Disable option for code generator (see "CODEGEN" subsection)

     --optimizer-pipeline spec
	     Optimizer pipeline specification (see "OPTIMIZER" subsection)

     --precise-bitfield-load-store
	     Load  and	store  bitfields at byte boundaries [default: on].  Pro-
	     vides extra correctness for structures allocated close to a  bound-
	     ary  with	unmapped  memory  pages at the expense of less efficient
	     bitfield handling.  Does not change bitfield layout.

     --no-precise-bitfield-load-store
	     Load and store bitfields at machine word boundaries [default: off].
	     May cause failures for structures	allocated  close  to  boundaries
	     with unmapped memory pages. Does not change bitfield layout.

     --declare-atomic-support
	     Declare support of atomics (might require explicit linking of soft-
	     ware atomic library such as libatomic or libcompiler_rt).

     --no-declare-atomic-support
	     Declare  the absence of atomic support via defining __STDC_NO_ATOM-
	     ICS__ macro.

     --declare-decimal-support
	     Declare support of decimal floating-point (might  require	explicit
	     linking  of  libgcc);  has effect only is kefir has been built with
	     decimal-capable compiler.

     --no-declare-decimal-support
	     Do not declare support of decimal floating-point; suppresses defin-
	     itions of kefir-specific support macros.

     --declare-decimal-bitint-conv-support
	     Declare support of decimal floating-point conversion  to/from  bit-
	     precise  integers	(requires  linking with recent libgcc >=14); has
	     effect only is kefir has been built with decimal-capable compiler.

     --no-declare-decimal-support
	     Do not declare support of decimal floating-point conversion to/from
	     bit-precise integers; suppresses definitions of kefir-specific sup-
	     port macros.

     --optimize-stack-frame
	     Optimize stack frame layout by reusing space for variables for dis-
	     joint lifetimes. Might increase compilation time and memory use  on
	     very large functions. [default: on].

     --no-optimize-stack-frame
	     Do not optimize stack frame layout and allocate each variable sepa-
	     rately.

     --unsigned-char
	     Let the type char be unsigned. By default, it is target-specific.

     --signed-char
	     Let the type char be signed. By default, it is target-specific.

     --codegen-tentative-common
	     Place tentative definitions into common section (equivalent to com-
	     mon attribute applied to all variables).

     --codegen-tentative-no-common
	     Do not place tentative definitions into common section [default].

     --codegen-visibility-default
	     Keep default visibility for all symbols [default].

     --codegen-visibility-hidden
	     Make all symbols hidden unless an attribute specifies otherwise.

     --codegen-visibility-protected
	     Make all symbols protected unless an attribute specifies otherwise.

     --codegen-visibility-internal
	     Make all symbols internal unless an attribute specifies otherwise.

     --codegen-decimal-default
	     Use platform-native decimal number encoding [default].

     --codegen-decimal-bid
	     Use decimal number BID encoding. Requires kefir to be compiled with
	     BID-enabled compiler to provide correct encoding of static data.

     --codegen-decimal-dpd
	     Use decimal number DPD encoding. Requires kefir to be compiled with
	     DPD-enabled compiler to provide correct encoding of static data.

   FEATURES
     Supported	 features   (to   be  used  with  --Wfeature-[feature-name]  and
     --Wno-feature-[feature-name] flags):

     fail-on-attributes
	     Fail if __attribute__((...)) is encountered [default: off]

     missing-function-return-type
	     Permit function definitions with missing return type [default: on]

     designated-init-colons
	     Permit "fieldname:" syntax in designated initializers [default: on]

     labels-as-values
	     Permit label-addressing with && operator [default: on]

     non-strict-qualifiers
	     Disable strict qualifier checks for pointers [default: on]

     signed-enums
	     Force all enums to have signed integral type [default: off]

     implicit-function-decl
	     Permit implicit funciton declarations at use-site [default: on]

     empty-structs
	     Permit empty structure/union definitions [default: on]

     ext-pointer-arithmetics
	     Permit pointer arithmetics with function  and  void  pointers  [de-
	     fault: on]

     missing-braces-subobj
	     Permit missing braces for subobject initialization with scalar [de-
	     fault: on]

     statement-expressions
	     Enable statement expressions [default: on]

     omitted-conditional-operand
	     Permit  omission of the middle ternary expression operand [default:
	     on]

     int-to-pointer
	     Permit any integral type conversion to pointer [default: on]

     permissive-pointer-conv
	     Permit conversions between any pointer types [default: on]

     named-macro-vararg
	     Permit named macro variable arguments [default: on]

     include-next
	     Permit include_next preprocessor directive [default: on]

     fail-on-assembly
	     Disable support of inline assembly [default: off]

     va-args-comma-concat
	     Enable special processing for ", ##__VA_ARGS" case in  preprocessor
	     [default: on]

     switch-case-ranges
	     Enable support for ranges in switch cases [default: on]

     designator-subscript-ranges
	     Enable support for ranges in designator subscripts [default: on]

     imprecise-decimal-bitint-conv
	     Enable imprecise conversions between bit-precise integers and deci-
	     mal floating-point values during constant evaluation if precise na-
	     tive routines are not available [default: off]

     max-parser-errors [num]
	     Set  maximum number of parser errors produced; use -1 for unbounded
	     number of errors.	Note that printed error list  is  non-exhaustive
	     irrespective of the setting. [default: 24]

     max-analyzer-errors [num]
	     Set  maximum  number  of  analyzer  errors produced; use -1 for un-
	     bounded number of errors.	Note that printed error list is  non-ex-
	     haustive irrespective of the setting. [default: 24]

     Werror-compiler-ref
	     Include  compiler	source code references into reported errors [de-
	     fault: on].

     Wno-error-compiler-ref
	     Exclude compiler source code references from reported  errors  [de-
	     fault: off].

   CODEGEN
     Supported	code  geneator	options (to be used with --Wcodegen-[option] and
     --Wno-codegen-[option] flags):

     emulated-tls
	     Use emulated TLS [disabled by default, enabled on openbsd platform]

     tls-common
	     Generate common section for thread-local storage if respective  at-
	     tribute is on [enabled for linux and netbsd]

     pic     Generate position-independent code

     omit-frame-pointer
	     Omit frame pointer in leaf function that do not need it

     valgrind-compatible-x87
	     Replace x87 opcodes not supported by Valgrind by more expensive al-
	     ternatives [default: on]

     imprecise-decimal-bitint-conv
	     Use  imprecise conversions between bit-precise integers and decimal
	     floating-point values in generated code [default: off]

     syntax=SYNTAX
	     Produce assembly output with specified syntax  [x86_64-intel_nopre-
	     fix, x86_64-intel_prefix, x86_64-att (default), x86_64-yasm].

     details=DETAILS-SPEC
	     Augment  assembly	output	with  internal code generator details in
	     comments. DETAILS-SPEC can be: vasm (virtual  assembly),  vasm+regs
	     (virtual  assembly and register allocations), devasm (devirtualized
	     assembly).

     optimize
	     Perform low-level optimizations in code generator [default: on  for
	     -O1 and higher].

     no-optimize
	     Disable low-level optimizations in code generator.

   OPTIMIZER
     Optimizer	pipeline  specification  consists  of  comma  separated names of
     pipeline passes:

     noop    No-operation pass

     phi-removal
	     Wherever possible, substitue phi nodes of SSA representation by ac-
	     tual references

     mem2reg
	     Pull function local variables into registers

     memory-ssa
	     Perform memory SSA-based optimizations for  store-load,  load-load,
	     store-store sequences.

     sroa    Perfrom limited scalar replacement of non-escaping aggregates.

     op-simplify
	     General code simplification

     constant-fold
	     Folding constant expressions

     canonicalize
	     Canonicalizations for late pipeline stages

     gvn     Global  value  numering  pass to eliminate redundant arithmetic and
	     bitwise operations

     local-alloc-sink
	     Moving local variable allocations closer to their actual uses (does
	     not affect effective variable lifetimes).

     dead-code-elimination
	     Eliminating dead code, blocks and phi links.

     merge-blocks
	     Remove unnecessary jump and branch instructions and  merge  respec-
	     tive blocks.

     dead-alloc
	     Remove dead local variable allocations.

     inline-func
	     Perform function inlining.

     tail-call
	     Perform tail call optimization.

     lowering
	     Perform  target-specific lowering of the SSA representation. Manda-
	     tory for bit-precise integer support.

     inline-asm-untie
	     Untie inline assembly non-memory parameters from  directly  linking
	     to memory locations. Improves integration with mem2reg.

   TARGET
     Target platforms are specified in format [<backend>-]<platform>[-<variant>]
     where

     backend
	     opt [default]

     platform
	     <arch>-<os> | host [default]

     arch    x86_64 | hostcpu [default]

     platform
	     linux | freebsd | openbsd | netbsd | hostos [default]

     variant
	     none | musl | gnu | system | default
     Backend and variant are optional parts of the target specification. Variant
     "none"  avoids  any  implicit  library linkages and include path. On linux,
     "default" is equivalent to "gnu", on other platforms -- to "system".

ENVIRONMENT
     Environment variables that affect kefir operation:

     KEFIR_AS | AS
	     Override the default "as" assembler

     KEFIR_LD | LD
	     Override the default "ld" linker

     KEFIR_RTINC
	     Specify kefir runtime include location. Mandatory for all	platform
	     variants except "*-none"

     KEFIR_MUSL_INCLUDE
	     Specify  musl  include  paths  (separated	by  ';').  Mandatory for
	     "linux-musl" platform variant

     KEFIR_MUSL_LIB
	     Specify musl  library  paths  (separated  by  ';').  Mandatory  for
	     "linux-musl" platform variant

     KEFIR_MUSL_DYNAMIC_LINKER
	     Specify  dynamic  linker  path.  Optional for "linux-musl" platform
	     variant

     KEFIR_GNU_INCLUDE
	     Specify GNU include paths (separated by ';'). Mandatory for "linux-
	     gnu" platform variant

     KEFIR_GNU_LIB
	     Specify GNU library paths (separated by ';'). Mandatory for "linux-
	     gnu" platform variant

     KEFIR_GNU_DYNAMIC_LINKER
	     Specify dynamic linker  path.  Optional  for  "linux-gnu"	platform
	     variant

     KEFIR_FREEBSD_INCLUDE
	     Specify  FreeBSD  include	paths  (separated by ';'). Mandatory for
	     "freebsd-system" platform variant

     KEFIR_FREEBSD_LIB
	     Specify FreeBSD library paths (separated  by  ';').  Mandatory  for
	     "freebsd-system" platform variant

     KEFIR_FREEBSD_DYNAMIC_LINKER
	     Specify dynamic linker path. Optional for "freebsd-system" platform
	     variant

     KEFIR_OPENBSD_INCLUDE
	     Specify  OpenBSD  include	paths  (separated by ';'). Mandatory for
	     "openbsd-system" platform variant

     KEFIR_OPENBSD_LIB
	     Specify OpenBSD library paths (separated  by  ';').  Mandatory  for
	     "openbsd-system" platform variant

     KEFIR_OPENBSD_DYNAMIC_LINKER
	     Specify dynamic linker path. Optional for "openbsd-system" platform
	     variant

     KEFIR_TMPDIR
	     Override kefir temporary directory

     KEFIR_DRIVER_CLI_QUIET
	     Assign  "yes"  (without quotes) to suppress warnings related to un-
	     known command line options.

     SOURCE_DATE_EPOCH
	     Override preprocessor timestamp to specified  value.  Expects  Unix
	     epoch timestamp.

EXIT STATUS
     Normally kefir exits with 0 exit code. In case of any errors in any of com-
     pilation  stages, all further compilation is aborted and non-zero exit code
     returned.

STANDARDS
     kefir implements C17 language standard as specified in its final draft, and
     C23 language stadard as specified in the first draft of C2Y.

NOTES
     The kefir compiler is licensed under the terms of GNU GPLv3 license.   Run-
     time  code  provided  along  with	kefir  is  licensed  under  the terms of
     BSD-3-Clause license.

     kefir  is	developed  and	maintained  by	Jevgenij  Protopopov   (legally:
     Jevgenijs Protopopovs)

     Please report bugs found in kefir to jevgenij@protopopov.lv

     kefir  is	available online at https://sr.ht/~jprotopopov/kefir/ with read-
     only	mirrors       at       https://git.protopopov.lv/kefir	     and
     https://codeberg.org/jprotopopov/kefir

FreeBSD ports 15.quarterly	   April 2026				kefir(1)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=kefir&sektion=1&manpath=FreeBSD+Ports+15.1.quarterly>

home | help