5.4.2 Library Files

The names of the C/C++ standard library files appropriate for the selected target device, and other driver options, are determined by the driver.

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 the version of the target library that has been built with the same options.

By default, the 32-bit language tools use the directory <install-directory>/lib/gcc/ to store the specific libraries and the directory <install-directory>/pic32mx/lib to store the target-specific libraries. Both of these directory structures contain subdirectories for each of the multilib combinations specified above.

The target libraries that are distributed with the compiler are built for the corresponding command-line options:

  • Size vs speed (-Os vs. -O3)
  • MIPS16 vs MIPS32 vs microMIPS ISA mode (-mips16 vs. -mno-mips16 vs -mmicromips)
  • Software floating-point vs no floating-point support (-msoft-float vs -mno-float)

The following examples provide details on which of the multilibs subdirectories are chosen.

xc32-gcc foo.c

xc32-g++ foo.cpp

For this example, no command line options have been specified (that is, the default command line options are being used). In this case, the .subdirectories are used.
xc32-gcc -Os foo.c

xc32-g++ -Os foo.cpp

For this example, the command line option for optimizing for size has been specified (that is, -Os is being used). In this case, the ./size subdirectories are used.
xc32-gcc -O2 foo.c

xc32-g++ -O2 foo.cpp

For this example, the command line option for optimizing has been specified; however, this command line option optimizes for neither size nor space (that is, -O2 is being used). In this case, the .subdirectories are used.
xc32-gcc -Os -mips16 foo.c

xc32-g++ -Os -mips16 foo.cpp

For this example, the command line options for optimizing for size and for MIPS16 code have been specified (that is, -Os and -mips16 are being used). In this case, the ./size/mips16 subdirectories are used.