Microchip Technology SW006023-2 Data Sheet

Page of 238
Compiler Command Line Driver
 2012 Microchip Technology Inc.
DS51686E-page 81
3.9.9
Options for Assembling
The following options control assembler operations.
3.9.10
Options for Linking
If any of the options 
-c
-S
 or 
-E
 are used, the linker is not run and object file names 
should not be used as arguments.
TABLE 3-15:
ASSEMBLY OPTIONS
Option
Definition
-Wa,option
Pass option as an option to the assembler. If option contains 
commas, it is split into multiple options at the commas.
TABLE 3-16:
LINKING OPTIONS
Option
Definition
-fill=<options
A memory-fill option to be passed on to the linker.
-Ldir
Add directory dir to the list of directories to be searched for libraries 
specified by the command line option -l.
-llibrary
Search the library named library when linking.
The linker searches a standard list of directories for the library, which 
is actually a file named liblibrary.a. The linker then uses this file 
as if it had been specified precisely by name.
It makes a difference where in the command you write this option. 
The linker processes libraries and object files in the order they are 
specified. Thus, foo.o -lz bar.o searches library z after file 
foo.o
 but before bar.o. If bar.o refers to functions in libz.a, 
those functions may not be loaded.
The directories searched include several standard system 
directories, plus any that you specify with -L.
Normally the files found this way are library files (archive files whose 
members are object files). The linker handles an archive file by 
scanning through it for members which define symbols that have 
been referenced but not defined yet. But if the file found is an 
ordinary object file, it is linked in the usual fashion. The only 
difference between using an -l option (e.g., -lmylib) and 
specifying a file name (e.g., libmylib.a) is that -l searches 
several directories, as specified.
By default the linker is directed to search:
<install-path>\lib
for libraries specified with the -l option. For a compiler installed into 
the default location, this would be:
Program Files\Microchip\mplab32\<version>\lib
This behavior can be overridden using the environment variables.
See also the INPUT and OPTIONAL linker script directives.
-nodefaultlibs
Do not use the standard system libraries when linking. Only the 
libraries you specify are passed to the linker. The compiler may 
generate calls to memcmp, memset and memcpy. These entries are 
usually resolved by entries in the standard compiler libraries. These 
entry points should be supplied through some other mechanism 
when this option is specified.
-nostdlib
Do not use the standard system start-up files or libraries when 
linking. No start-up files and only the libraries you specify are passed 
to the linker. The compiler may generate calls to memcmp, memset 
and memcpy. These entries are usually resolved by entries in 
standard compiler libraries. These entry points should be supplied 
through some other mechanism when this option is specified.