5.4.1 Library Files
The Microchip Unified Standard C library contains a standardized collection of
functions, such as string, math and input/output routines. The Microchip Unified
Standard Libraries (libc-musl.a) will be linked with your project when
it contains C-only source and is built with the xc32-gcc driver. When
you build a project that contains C++ code with the xc32-g++ driver,
the Microchip Unified Standard Libraries and libstdc++.a libraries will
be linked.
MPLAB XC32 also provides a picolibc library as an alternative standard library that
supports thread-local storage. This library (libc-pico.a) is requested
using the -mchp-stdlibc option. The math version of this library is
called libm-pico.a. See Mchp-stdlibc Option for more
information on this option and Thread-local Storage for information on how thread-safe objects are supported by this
compiler.
The target libraries, called multilibs, are built multiple times with a permuted set of options. When the compiler driver is called to compile and link an application, the driver chooses a multilib library appropriate for the selected options. You do not normally need to specify the search path for the standard libraries, nor manually include library files into your project. How to use these functions is described in Libraries.
The multilib startup libraries are located under directories within the lib/gcc/pic32c/gcc-version directory of your compiler distribution, and the target-specific libraries are stored under directories in the pic32c/lib directory.
For all devices, the Thumb ISA library version can be selected for projects by specifying the -mthumb option to xc32-gcc at link time. For ARM9, Cortex-A5 and Cortex-A7 based devices, the ARM ISA library version can be additionally selected by specifying the -marm option at link time.
- Alignment (
-mno-unaligned-access) - Floating-point application binary interface
(
-mfloat-abi=soft|softfp|hard; some cases are not present because the combinations are either illegal or unnecessary)
- Exception support
(
-fno-exceptions,-fno-rtti)
The following examples provide details on which of the multilibs subdirectories are chosen. To ensure correct program operation and optimal performance, the options that determine the selected library should be used consistently when compiling all modules and at link time.
xc32-gcc foo.cxc32-g++ foo.cppFor this example, no command line options have been specified (i.e., the default command line options are being used). In this case, the default directories mentioned above are used.
xc32-gcc -mfloat-abi=softfp foo.cxc32-g++ -mfloat-abi=softfp foo.cppFor this example,
softfpmultilib subdirectories are used.xc32-gcc -mfloat-abi=hard foo.cxc32-g++ -mfloat-abi=hard foo.cppFor this example, the
hardmultilib subdirectories are used.
