4.4.5 xc32-ld (32-Bit Linker)

A subset of command-line options may be specified in MPLAB X IDE. Select a category and set up linker options.

See also 4.4.7 Options Page Features.

Table 4-11. XC32-LD General Category
OptionDescriptionCommand Line
Heap Size (bytes)Specify the size of the heap in bytes. Allocate a run-time heap of size bytes for use by C programs. The heap is allocated from unused data memory. If not enough memory is available, an error is reported.-Wl,--defsym=_min_heap_size=size

See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.

Minimum stack size (bytes)Specify the minimum size of the stack in bytes. By default, the linker allocates all unused data memory for the run-time stack. Alternatively, the programmer may allocate the stack by declaring two global symbols: __SP_init and __SPLIM_init. Use this option to ensure that at least a minimum sized stack is available. The actual stack size is reported in the link map output file. If the minimum size is not available, an error is reported.-Wl,--defsym=_min_stack_size=size See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.
Allow overlapped sectionsCheck to not check section addresses for overlaps.

Uncheck to check for overlaps.

--[no-]check-sections See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.
Remove unused sectionsCheck to enable garbage collection of unused input sections (on some targets).

Uncheck to disable garbage collection.

--[no-]gc-sections See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.
Use response file to linkPass linker options in a file rather than on the command line. On Windows systems, this option allows you to properly link projects with a large number of object files that would normally overrun the command-line length limitation of the Windows OS.
Write Start Linear Address recordSet the start linear address for a type 5 records in HEX files.--write-sla

See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.

Additional driver optionsType here any additional driver options that do not have dedicated GUI widgets in the Project Properties dialog. The string entered here will be emitted verbatim with the other driver options.
Place code in data init templatePlace code sections into the data-initialization template stored in the .dinit section.--code-in-dinit
Allocate data-init section to serial memoryAllocate the .dinit template section to a memory region named serial_mem rather than kseg0_program_mem.--dinit-in-serial-mem
Table 4-12. XC32-LD Libraries Category
OptionDescriptionCommand Line
Optimization level of Standard LibrariesSelect an optimization level. Your compiler edition may support only some optimizations. Equivalent to -On option, where n is an option below:

0 - Do not optimize. The compiler’s goal is to reduce the cost of compilation and to make debugging produce the expected results.

1 - Optimize. Optimizing compilation takes somewhat longer and a lot more host memory for a large function. The compiler tries to reduce code size and execution time.

2 - Optimize even more. The compiler performs nearly all supported optimizations that do not involve a space-speed trade-off.

3 - Optimize yet more favoring speed (superset of O2).

s - Optimize yet more favoring size (superset of O2).

-On

See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.

System LibrariesAdd libraries to be linked with the project files. You may add more than one.--library=name

See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.

Library directoriesAdd a library directory to the library search path. You may add more than one.--library-path="name"

See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.

Exclude Standard LibrariesCheck to not use the standard system startup files or libraries when linking. Only use library directories specified on the command line.

Uncheck to use the standard system startup files and libraries.

-nostdlib

See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.

Do no link crt0 startup codeExclude the default startup code because the project provides application-specific startup code.-nostartfiles

See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.

Do not link device startup code
Link MIPS16 librariesLink the libraries precompiled for the MIPS16 instruction set, reducing code size.-mips16

See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.

Link microMIPS compressed startup code and librariesGenerate code using the microMIPS instructions. This feature is available only in the PRO edition.

-mmicromips See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.

Table 4-13. XC32-LD Fill Flash Memory Category
OptionDescriptionCommand Line
Which areas to fillSpecify which area of Flash memory to fill.

No Fill - None (default).

Fill All Unused - Fill all unused memory.

Provide Range to fill - Fill a range of memory. Enter a range under “Memory Address Range.”

--fill=sequence See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.

How to fill itSpecify how to fill Flash memory.

Provide sequence of values - provide a sequence under the Sequence option.

Constant or incrementing value - provide a constant, increment/decrement or increment/decrement constant under the same-named option.

--fill=sequence See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.
SequenceWhen Provide sequence of values is selected, enter a sequence. The form is n1, n2, .... where n1 uses C syntax. Example: 0x10, 25, 0x3F, 16.--fill=sequence See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.
ConstantWhen Constant or incrementing value is selected, enter a constant. Specify the constant using C syntax (for example, 0x for hex, 0 for octal). Example: 0x10 is the same as 020 or 16.--fill=sequence See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.
Increment/DecrementWhen Constant or incrementing value is selected, you can select to increment or decrement the initial value of “Constant” on each consecutive address.

No Incrementing - do not change constant value.

Increment Const - increment the constant value by the amount specified under the option “Increment/Decrement Constant.”

Decrement Const - decrement the constant value by the amount specified under the option “Increment/Decrement Constant.”

--fill=sequence See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.
Increment/Decrement ConstantWhen Increment Const or Decrement Const is selected, enter a constant increment or decrement value. Specify the constant using C syntax (for example, 0x for hex, 0 for octal). Example: 0x10 is the same as 020 or 16.--fill=sequence See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.
Memory Address RangeWhen Provide Range to fill is selected, enter the range here. Specify range as Start:End where Start and End use C syntax. Example 0x100:0x1FF is the same as 256:511.--fill=sequence See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.
Table 4-14. XC32-LD Diagnostics Category
OptionDescriptionCommand Line
Generate map fileCreate a map file.-Map="file" See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.
Display memory usage

Check to print memory usage report.

Uncheck to not print a report.

--report-mem See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.
Generate cross-reference file

Check to create a cross-reference table.

Uncheck to not create this table.

--cref See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.
Warn on section realignment

Check to warn if start of section changes due to alignment.

Uncheck to not warn.

--warn-section-align See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.
Trace SymbolsAdd/remove trace symbols.

-Y symbol or

--trace-symbol=symbol See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.
Table 4-15. XC32-LD Symbols and Macros Category
OptionDescriptionCommand Line
Linker symbolsCreate a global symbol in the output file containing the absolute address (expr). You may use this option as many times as necessary to define multiple symbols in the command line. A limited form of arithmetic is supported for the expr in this context: you may give a hexadecimal constant or the name of an existing symbol, or use + and - to add or subtract hexadecimal constants or symbols.--defsym=sym See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.
Preprocessor macro definitionsAdd linker macros.-Dmacro See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.
SymbolsSpecify symbol information in the output.

-S or

--strip-debug; -s or

--strip-all See MPLAB® XC32 Assembler, Linker and Utilities User's Guide.