Picolibc Options (Using the GNU Compiler Collection (GCC))

#### 3.20.39 Picolibc Options ¶

These options control compilation and linking when using Picolibc:

`--oslib=library` ¶

  Search the library named library after the C library, permitting symbols undefined by the C library to be defined by this library. The C library, libgcc and this library are placed between `--start-group` and `--end-group` flags so that each can refer to symbols in the others. For many targets, Picolibc provides a ‘`semihost`’ variant (specified with `--oslib=semihost`) which provides enough basic OS functionality to support console and file I/O when run in an emulator or when using an in-circuit debugger.

`--crt0=[none|minimal|hosted|semihost]` ¶

  Replace the default `crt0.o` name with `crt0-variant.o`. The ‘`none`’ variant provides no startup code at all, allowing you to supply your own. ‘`minimal`’ performs basic memory setup but does not invoke any constructors. When no `-crt0` option is provided, the default initialization code adds calls to all constructors. ‘`hosted`’ adds a call to `exit` when `main` returns. ‘`semihost`’ accesses a command-line parameter supplied via the semihosting interface and splits that into arguments at whitespace boundaries, passing the resulting array of strings to `main` in `argc` and `argv`. On some targets, including AArch64, ARC, ARM, LoongArch, M680x0, RISC-V, SH, and x86, ‘`semihost`’ also traps hardware exceptions and prints information to the console. Note that `--crt0=semihost` depends upon APIs provided by `--oslib=semihost`.

`--printf=[d|f|l|i|m]` ¶

  Select the `printf` variant. Picolibc provides five different `printf` variants which offer decreasing levels of functionality along with decreasing code size. ‘`d`’ is the default level, offering full C17 and POSIX.1-2024 conformance. ‘`f`’ provides the same feature set, but supports `float` values instead of `double` which are passed using the `printf_float` macro. ‘`l`’ elides all floating-point and POSIX positional parameter support. ‘`i`’ limits integers to those no larger than `long`. ‘`m`’ removes support for most formatting options including width and precision. The formats and arguments are still parsed correctly, but output does not respect those parameters.

`--scanf=[d|f|l|i|m]` ¶

  Select the `scanf` variant. Picolibc provides five different `scanf` variants which offer decreasing levels of functionality along with decreasing code size. ‘`d`’ is the default level, offering full C17 and POSIX.1-2024 conformance. ‘`f`’ removes support for `double` values. ‘`l`’ elides all floating point support. ‘`i`’ limits integers to those no larger than `long`. ‘`m`’ removes support for ‘`%[`’ conversion specifiers.