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 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++ libraries will be linked.

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 19 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.

The target libraries that are distributed with the compiler are built for combinations of the following command-line options:
  • Alignment (-mno-unaligned-access)
  • Floating-point application binary interface (-mfloat-abi softfp, hard)
The C++ target libraries that are distributed with the compiler are built using combinations of the following command-line options:
  • 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.

  1. xc32-gcc foo.c


    xc32-g++ foo.cpp

    For 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.

  2. xc32-gcc -mfloat-abi=softfp foo.c


    xc32-g++ -mfloat-abi=softfp foo.cpp

    For this example, soft multilib subdirectories are used.

  3. xc32-gcc -mfloat-abi=hard foo.c


    xc32-g++ -mfloat-abi=hard foo.cpp

    For this example, the hard multilib subdirectories are used.