12.07.2015 Views

MPLAB C32 C COMPILER USER'S GUIDE

MPLAB C32 C COMPILER USER'S GUIDE

MPLAB C32 C COMPILER USER'S GUIDE

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>MPLAB</strong> ® <strong>C32</strong> C Compiler User’s Guide1.8.9 Options for LinkingIf any of the options -c, -S or -E are used, the linker is not run and object file namesshould not be used as arguments.TABLE 1-13: LINKING OPTIONSOptionDefinition-Ldir-llibrary-nodefaultlibsAdd directory dir to the list of directories to be searched for librariesspecified by the command line option -l.Search the library named library when linking.The linker searches a standard list of directories for the library, which isactually a file named liblibrary.a. The linker then uses this file as ifit had been specified precisely by name.It makes a difference where in the command you write this option. Thelinker 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 beforebar.o. If bar.o refers to functions in libz.a, those functions may notbe 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 whosemembers are object files). The linker handles an archive file by scanningthrough it for members which define symbols that have so far beenreferenced but not defined. But if the file that is found is an ordinaryobject file, it is linked in the usual fashion. The only difference betweenusing 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:\libfor libraries specified with the -l option. For a compiler installed into thedefault location, this would be:c:\Program Files\Microchip\<strong>MPLAB</strong> <strong>C32</strong>\libThis behavior can be overridden using the environment variables.Do not use the standard system libraries when linking. Only the librariesyou specify are passed to the linker. The compiler may generate calls tomemcmp, memset and memcpy. These entries are usually resolved byentries in the standard compiler libraries. These entry points should besupplied through some other mechanism when this option is specified.-nostdlib Do not use the standard system startup files or libraries when linking. Nostartup 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 compilerlibraries. These entry points should be supplied through some othermechanism when this option is specified.-s Remove all symbol table and relocation information from theexecutable.-u symbol Pretend symbol is undefined to force linking of library modules todefine the symbol. It is legitimate to use -u multiple times with differentsymbols to force loading of additional library modules.-Wl,option Pass option as an option to the linker. If option contains commas, itis split into multiple options at the commas.-Xlinker option Pass option as an option to the linker. You can use this to supplysystem-specific linker options that <strong>MPLAB</strong> <strong>C32</strong> C compiler does notknow how to recognize.DS51686A-page 36© 2007 Microchip Technology Inc.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!