8.2 Compilation-Driver Linker Interface Syntax
In practice, the linker is usually invoked via xc32-gcc, the compilation driver. The basic form of the compilation-driver command line is:
xc32-gcc [options] filesThe driver options are case sensitive. The files are one or more object files (.o extension) or library archive files (.a extension) which will be linked together to form the final output.
To pass a linker option to the linker without having to invoke the linker directly, use the
driver's
-Wl,option option. For example, the following will pass the
--defsym option directly to the
linker.xc32-gcc -mprocessor=ATSAME54P20A
-mdfp="Microchip/SAME54_DFP/3.9.244" "input.o" -o"output.elf"
-Os -Wl,--defsym=_min_heap_size=2048,-Map="mapfile.map",
--cref,--report-memCalling the linker via the compilation driver has a few advantages over calling the linker directly.
- The driver's
-mprocessorand-mdfpoption allows the driver to pass the correct device-specific include-file, library search paths, and linker scripts to the linker. These files are contained in the Device Family Packs (DFPs) downloaded separately (see Dfp Option. - The driver accepts the C compiler's options relating to ISA mode and floating-point support etc., to select the appropriate multilib permutation. See the C compiler User's Guide relevant for your target device for more information on the C compiler's multilib feature.
