Microchip Technology SW006021-2 Manuale Utente
MPLAB
®
XC8 C Compiler User’s Guide
DS52053B-page 96
2012 Microchip Technology Inc.
4.8.7
-L-: Adjust Linker Options Directly
The -L driver option can be used to specify an option which will be passed directly to
the linker. If -L is followed immediately by text starting with a dash character “-”, the
text will be passed directly to the linker without being interpreted by xc8. If the -L
option is not followed immediately by a dash character, it is assumed the option is the
library scan option, Section 4.8.6 “-L: Scan Library”.
the linker. If -L is followed immediately by text starting with a dash character “-”, the
text will be passed directly to the linker without being interpreted by xc8. If the -L
option is not followed immediately by a dash character, it is assumed the option is the
library scan option, Section 4.8.6 “-L: Scan Library”.
For example, if the option -L-N is specified, the -N option will be passed on to the linker
without any subsequent interpretation by the driver. The linker will then process this
option, when, and if, it is invoked, and perform the appropriate operation.
without any subsequent interpretation by the driver. The linker will then process this
option, when, and if, it is invoked, and perform the appropriate operation.
Take care with command-line options. The linker cannot interpret command-line driver
options; similarly the driver cannot interpret linker options. In most situations, it is
always the command-line driver, xc8, that is being executed. If you need to add alter-
nate linker settings in the Linker category in the Project Properties dialogue, you must
add driver options (not linker options). These driver options will be used by the driver
to generate the appropriate linker options during the linking process. The -L option is
a means of allowing a linker option to be specified via a driver option.
options; similarly the driver cannot interpret linker options. In most situations, it is
always the command-line driver, xc8, that is being executed. If you need to add alter-
nate linker settings in the Linker category in the Project Properties dialogue, you must
add driver options (not linker options). These driver options will be used by the driver
to generate the appropriate linker options during the linking process. The -L option is
a means of allowing a linker option to be specified via a driver option.
The -L option is especially useful when linking code which contains non-standard pro-
gram sections (or psects), as may be the case if the program contains hand-written
assembly code which contains user-defined psects (see 6.4.9.3 “PSECT” and
Section 5.15.1 “Program Sections”), or C code which uses the #pragma psect
directive (see 5.14.4.8 “The #pragma psect Directive”). Without this -L option, it
would be necessary to invoke the linker manually to allow the linker options to be
adjusted.
gram sections (or psects), as may be the case if the program contains hand-written
assembly code which contains user-defined psects (see 6.4.9.3 “PSECT” and
Section 5.15.1 “Program Sections”), or C code which uses the #pragma psect
directive (see 5.14.4.8 “The #pragma psect Directive”). Without this -L option, it
would be necessary to invoke the linker manually to allow the linker options to be
adjusted.
This option can also be used to replace default linker options. If the string starting from
the first character after the -L up to the first equal character, "=", matches a psect or
class name in the default options, then (the reference to the psect or class name in the
default option, and the remainder of that option, are deleted) that default linker option
is replaced by the option specified by the -L. For example, if a default linker option was:
the first character after the -L up to the first equal character, "=", matches a psect or
class name in the default options, then (the reference to the psect or class name in the
default option, and the remainder of that option, are deleted) that default linker option
is replaced by the option specified by the -L. For example, if a default linker option was:
-preset_vec=00h,intentry,init,end_init
the driver option -L-pinit=100h would result in the following options being passed
to the linker: -pinit=100h -preset_vec=00h. Note the end_init linker option
has been removed entirely. If there are no characters following the first equal character
in the -L option, then no replacement will be made for the default linker options that will
be deleted. For example, the driver option -L-pinit= will adjust the default options
passed to the linker, as above, but the -pinit linker option would be removed entirely.
to the linker: -pinit=100h -preset_vec=00h. Note the end_init linker option
has been removed entirely. If there are no characters following the first equal character
in the -L option, then no replacement will be made for the default linker options that will
be deleted. For example, the driver option -L-pinit= will adjust the default options
passed to the linker, as above, but the -pinit linker option would be removed entirely.
No warning is generated if such a default linker option cannot be found. The default
option that you are deleting or replacing must contain an equal character.
option that you are deleting or replacing must contain an equal character.
4.8.8
-M: Generate Map File
The -M option is used to request the generation of a map file. The map file is generated
by the linker and includes detailed information about where objects are located in mem-
ory. See Section 7.4 “Map Files” for information regarding the content of these files.
by the linker and includes detailed information about where objects are located in mem-
ory. See Section 7.4 “Map Files” for information regarding the content of these files.
If no filename is specified with the option, then the name of the map file will have the
project name (see Section 4.3 “The Compilation Sequence”), with the extension
.map
project name (see Section 4.3 “The Compilation Sequence”), with the extension
.map
.
This option is on by default when compiling from within MPLAB X IDE and using the
Universal Toolsuite.
Universal Toolsuite.