Linker Options

The following tables list the linker options. See Section 11 of this document and Section 12 for details on these options.

Table 3-20 Linker Basic Options

Option Alias Description
--run_linker -z Enables linking.
--output_file=file -o Names the executable output file. The default filename is a .out file.
--map_file=file -m Produces a map or listing of the input and output sections, including holes, and places the listing in file.
--stack_size=size [-]-stack Sets C system stack size to sizebytes and defines a global symbol that specifies the stack size. Default = 1K bytes.
--heap_size=size [-]-heap Sets heap size (for the dynamic memory allocation in C) to sizebytes and defines a global symbol that specifies the heap size. Default = 1K bytes.

Table 3-21 File Search Path Options

Option Alias Description
--library=file -l Names an archive library or link command file as linker input.
--disable_auto_rts Disables the automatic selection of a run-time-support library. See Section 11.3.1.1.
--priority -priority Satisfies unresolved references by the first library that contains a definition for that symbol.
--reread_libs -x Forces rereading of libraries, which resolves back references.
--search_path=pathname -I Alters library-search algorithms to look in a directory named with pathname before looking in the default location. This option must appear before the --library option.

Table 3-22 Command File Preprocessing Options

Option Alias Description
--define=name=value Predefines name as a preprocessor macro.
--undefine=name Removes the preprocessor macro name.
--disable_pp Disables preprocessing for command files.

Table 3-23 Diagnostic Message Options

Option Alias Description
--diag_error=num Categorizes the diagnostic identified by num as an error.
--diag_remark=num Categorizes the diagnostic identified by num as a remark.
--diag_suppress=num Suppresses the diagnostic identified by num.
--diag_warning=num Categorizes the diagnostic identified by num as a warning.
--display_error_number Displays a diagnostic's identifiers along with its text.
--emit_references:file[=file] Emits a file containing section information. The information includes section size, symbols defined, and references to symbols.
--emit_warnings_as_errors -pdew Treat warnings as errors.
--issue_remarks Issues remarks (non-serious warnings).
--no_demangle Disables demangling of symbol names in diagnostic messages.
--no_warnings Suppresses diagnostic warnings (errors are still issued).
--set_error_limit=count Sets the error limit to count. The linker abandons linking after this number of errors. (The default is 100.)
--verbose_diagnostics Provides verbose diagnostic messages that display the original source with line-wrap.

Table 3-24 Linker Output Options

Option Alias Description
--absolute_exe -a Produces an absolute, executable object file. This is the default; if neither --absolute_exe nor --relocatable is specified, the linker acts as if --absolute_exe were specified.
--mapfile_contents=attribute Controls the information that appears in the map file.
--relocatable -r Produces a nonexecutable, relocatable output object file.
--rom Creates a ROM object.
--xml_link_info=file Generates a well-formed XML file containing detailed information about the result of a link.

Table 3-25 Symbol Management Options

Option Alias Description
--entry_point=symbol -e Defines a global symbol that specifies the primary entry point for the executable object file.
--globalize=pattern Changes the symbol linkage to global for symbols that match pattern.
--hide=pattern Hides symbols that match the specified pattern.
--localize=pattern Make the symbols that match the specified pattern local.
--make_global=symbol -g Makes symbol global (overrides -h).
--make_static -h Makes all global symbols static.
--no_symtable -s Strips symbol table information and line number entries from the executable object file.
--retain={symbol|
    section specification}
Specifies a symbol or section to be retained by the linker.
--scan_libraries -scanlibs Scans all libraries for duplicate symbol definitions.
--symbol_map=refname=defname Specifies a symbol mapping; references to the refname symbol are replaced with references to the defname symbol.
--undef_sym=symbol -u Adds symbol to the symbol table as an unresolved symbol.
--unhide=pattern Excludes symbols that match the specified pattern from being hidden.

Table 3-26 Run-Time Environment Options

Option Alias Description
--arg_size=size --args Reserve size bytes for the argc/argv memory area.
--cinit_compression[=type] Specifies the type of compression to apply to the C auto initialization data. The default if this option is specified with no type is lzss for Lempel-Ziv-Storer-Szymanski compression.
--copy_compression[=type] Compresses data copied by linker copy tables. The default if this option is specified with no type is lzss for Lempel-Ziv-Storer-Szymanski compression.
--fill_value=value -f Sets default fill value for holes within output sections
--ram_model -cr Initializes variables at load time.
--rom_model -c Autoinitializes variables at run time.
--trampolines[=off|on] Generates far call trampolines. Default is on.

Table 3-27 Miscellaneous Options

Option Alias Description
--compress_dwarf[=off|on] Aggressively reduces the size of DWARF information from input object files. Default is on.
--linker_help [-]-help Displays information about syntax and available options.
--minimize_trampolines[=off | postorder] Places sections to minimize number of far trampolines required. Default is postorder.
--preferred_order=function Prioritizes placement of functions.
--strict_compatibility[=off|on] Performs more conservative and rigorous compatibility checking of input object files. Default is on.
--zero_init=[off|on] Controls preinitialization of uninitialized variables. Default is on.