Tool Options
11.4. Linker Options
This section lists all linker options.
Options in Eclipse versus options on the command line
Most command line options have an equivalent option in Eclipse but some options are only available on the command line. Eclipse invokes the linker via the control program. Therefore, it uses the syntax of the control program to pass options and files to the linker. If there is no equivalent option in Eclipse, you can specify a command line option in Eclipse as follows:
1.
From the Project menu, select Properties
The Properties dialog appears.
2.
In the left pane, expand C/C++ Build and select Settings.
In the right pane the Settings appear.
3.
On the Tool Settings tab, select Linker » Miscellaneous.
4.
In the Additional options field, enter one or more command line options.
Because Eclipse uses the control program, Eclipse automatically precedes the option with -Wl to pass the option via the control program directly to the linker.
Be aware that some command line options are not useful in Eclipse or just do not have any effect. For example, the option --keep-output-files keeps files after an error occurred. When you specify this option in Eclipse, it will have no effect because Eclipse always removes the output file after an error had occurred.
Short and long option names
Options can have both short and long names. Short option names always begin with a single minus (-) character, long option names always begin with two minus (--) characters.You can abbreviate long option names as long as it forms a unique name. You can mix short and long option names on the command line.
Options can have flags or suboptions. To switch a flag 'on', use a lowercase letter or a +longflag. To switch a flag off, use an uppercase letter or a -longflag. Separate longflags with commas. The following two invocations are equivalent: ltc -mfkl test.o
ltc --map-file-format=+files,+link,+locate test.o
When you do not specify an option, a default value may become active.
511
TASKING VX-toolset for TriCore User Guide
Linker option: --case-insensitive
Menu entry
1.
Select Linker » Miscellaneous.
2.
Enable the option Link case insensitive.
Command line syntax
--case-insensitive
Default: case sensitive
Description
With this option you tell the linker not to distinguish between upper and lower case characters in symbols.
By default the linker considers upper and lower case characters as different characters.
Assembly source files that are generated by the compiler must always be assembled and thus linked case sensitive. When you have written your own assembly code and specified to assemble it case insensitive, you must also link the
.o
file case insensitive.
Related information
Assembler option --case-insensitive
512
Tool Options
Linker option: --chip-output (-c)
Menu entry
1.
Select Linker » Output Format.
2.
Enable the option Generate Intel Hex format file and/or Generate S-records file.
3.
Enable the option Create file for each memory chip.
4.
Optionally, specify the Size of addresses.
Eclipse always uses the project name as the basename for the output file.
Command line syntax
--chip-output=[basename]:format[:addr_size],...
-c[basename]:format[:addr_size],...
You can specify the following formats:
IHEX
SREC
Intel Hex
Motorola S-records
The addr_size specifies the size of the addresses in bytes (record length). For Intel Hex you can use the values 1, 2 or 4 bytes (default). For Motorola-S you can specify: 2 (S1 records), 3 (S2 records) or 4 bytes
(S3 records, default).
Description
With this option you specify the Intel Hex or Motorola S-record output format for loading into a
PROM-programmer. The linker generates a file for each ROM memory defined in the LSL file, where sections are located: memory memname
{ type=rom; }
The name of the file is the name of the Eclipse project or, on the command line, the name of the memory device that was emitted with extension
.hex
or
.sre
. Optionally, you can specify a basename which prepends the generated file name.
The linker always outputs a debugging file in ELF/DWARF format and optionally an absolute object file in Intel Hex-format and/or Motorola S-record format.
Example
To generate Intel Hex output files for each defined memory, enter the following on the command line: ltc --chip-output=myfile:IHEX test1.o
513
TASKING VX-toolset for TriCore User Guide
In this case, this generates the file myfile_
memname
.hex
.
Related information
Linker option --output (Output file)
514
Tool Options
Linker option: --define (-D)
Menu entry
1.
Select Linker » Miscellaneous.
2.
Add the option --define to the Additional options field.
Command line syntax
--define=macro_name[=macro_definition]
-Dmacro_name[=macro_definition]
Description
With this option you can define a macro and specify it to the linker LSL file preprocessor. If you only specify a macro name (no macro definition), the macro expands as '1'.
You can specify as many macros as you like; just use the option --define (-D) multiple times. If the command line exceeds the limit of the operating system, you can define the macros in an option file which you then must specify to the linker with the option --option-file (-f) file.
The definition can be tested by the preprocessor with
#if
,
#ifdef
and
#ifndef
, for conditional locating.
Example
To define the RESET vector, which is used in the linker script file tc1v1_3.lsl
, enter: ltc test.o -otest.elf --lsl-file=tc1v1_3.lsl --define=RESET=0xa0000000
Related information
Linker option --option-file
(Specify an option file)
515
TASKING VX-toolset for TriCore User Guide
Linker option: --diag
Menu entry
1.
From the Window menu, select Show View » Other » Basic » Problems.
The Problems view is added to the current perspective.
2.
In the Problems view right-click on a message.
A popup menu appears.
3.
Select Detailed Diagnostics Info.
A dialog box appears with additional information.
Command line syntax
--diag=[format:]{all | nr,...}
You can set the following output formats:
html rtf text
HTML output.
Rich Text Format.
ASCII text.
Default format: text
Description
With this option you can ask for an extended description of error messages in the format you choose.
The output is directed to stdout (normally your screen) and in the format you specify. You can specify the following formats: html, rtf or text (default). To create a file with the descriptions, you must redirect the output.
With the suboption all, the descriptions of all error messages are given. If you want the description of one or more selected error messages, you can specify the error message numbers, separated by commas.
With this option the linker does not link/locate any files.
Example
To display an explanation of message number 106, enter: ltc --diag=106
This results in the following message and explanation:
E106: unresolved external: <message>
The linker could not resolve all external symbols.
516
Tool Options
This is an error when the incremental linking option is disabled.
The <message> indicates the symbol that is unresolved.
To write an explanation of all errors and warnings in HTML format to file lkerrors.html
, use redirection and enter: ltc --diag=html:all > lkerrors.html
Related information
Section 8.10, Linker Error Messages
517
TASKING VX-toolset for TriCore User Guide
Linker option: --error-file
Menu entry
-
Command line syntax
--error-file[=file]
Description
With this option the linker redirects error messages to a file. If you do not specify a filename, the error file is ltc.elk
.
Example
To write errors to errors.elk
instead of stderr
, enter: ltc --error-file=errors.elk test.o
Related information
Section 8.10, Linker Error Messages
518
Tool Options
Linker option: --error-limit
Menu entry
1.
Select Linker » Diagnostics.
2.
Enter a value in the Maximum number of emitted errors field.
Command line syntax
--error-limit=number
Default: 42
Description
With this option you tell the linker to only emit the specified maximum number of errors. When 0 (null) is specified, the linker emits all errors. Without this option the maximum number of errors is 42.
Related information
Section 8.10, Linker Error Messages
519
TASKING VX-toolset for TriCore User Guide
Linker option: --extern (-e)
Menu entry
-
Command line syntax
--extern=symbol,...
-esymbol,...
Description
With this option you force the linker to consider the given symbol as an undefined reference. The linker tries to resolve this symbol, either the symbol is defined in an object file or the linker extracts the corresponding symbol definition from a library.
This option is, for example, useful if the startup code is part of a library. Because your own application does not refer to the startup code, you can force the startup code to be extracted by specifying the symbol
_START
as an unresolved external.
Example
Consider the following invocation: ltc mylib.a
Nothing is linked and no output file will be produced, because there are no unresolved symbols when the linker searches through mylib.a
.
ltc --extern=_START mylib.a
In this case the linker searches for the symbol
_START
in the library and (if found) extracts the object that contains
_START
, the startup code. If this module contains new unresolved symbols, the linker looks again in mylib.a
. This process repeats until no new unresolved symbols are found.
Related information
Section 8.3, Linking with Libraries
520
Tool Options
Linker option: --first-library-first
Menu entry
-
Command line syntax
--first-library-first
Description
When the linker processes a library it searches for symbols that are referenced by the objects and libraries processed so far. If the library contains a definition for an unresolved reference the linker extracts the object that contains the definition from the library.
By default the linker processes object files and libraries in the order in which they appear on the command line. If you specify the option --first-library-first the linker always tries to take the symbol definition from the library that appears first on the command line before scanning subsequent libraries.
This is for example useful when you are working with a newer version of a library that partially overlaps the older version. Because they do not contain exactly the same functions, you have to link them both.
However, when a function is present in both libraries, you may want the linker to extract the most recent function.
Example
Consider the following example: ltc --first-library-first a.a test.o b.a
If the file test.o
calls a function which is both present in a.a
and b.a
, normally the function in b.a
would be extracted. With this option the linker first tries to extract the symbol from the first library a.a
.
Note that routines in b.a
that call other routines that are present in both a.a
and b.a
are now also resolved from a.a
.
Related information
Linker option --no-rescan (Rescan libraries to solve unresolved externals)
521
TASKING VX-toolset for TriCore User Guide
Linker option: --help (-?)
Menu entry
-
Command line syntax
--help[=item]
-?
You can specify the following arguments:
options
Show extended option descriptions
Description
Displays an overview of all command line options. When you specify the argument options you can list detailed option descriptions.
Example
The following invocations all display a list of the available command line options: ltc -?
ltc --help ltc
To see a detailed description of the available options, enter:
ltc --help=options
Related information
522
Linker option: --hex-format
Menu entry
1.
Select Linker » Output Format.
2.
Enable the option Generate Intel Hex format file.
3.
Select Linker » Miscellaneous.
4.
Add the option --hex-format to the Additional options field.
Command line syntax
--hex-format=flag,...
You can set the following flag:
+/-start-address s/S
Emit start address record
Default:
--hex-format=s
Description
With this option you can specify to emit or omit the start address record from the hex file.
Related information
Linker option --output
(Output file)
Tool Options
523
TASKING VX-toolset for TriCore User Guide
Linker option: --import-object
Menu entry
-
Command line syntax
--import-object=file,...
Description
With this option the linker imports a binary file containing raw data and places it in a section. The section name is derived from the filename, in which dots are replaced by an underscore. So, when importing a file called my.jpg
, a section with the name my_jpg
is created. In your application you can refer to the created section by using linker labels.
Related information
Section 8.5, Importing Binary Files
524
Tool Options
Linker option: --include-directory (-I)
Menu entry
-
Command line syntax
--include-directory=path,...
-Ipath,...
Description
With this option you can specify the path where your LSL include files are located. A relative path will be relative to the current directory.
The order in which the linker searches for LSL include files is:
1. The pathname in the LSL file and the directory where the LSL file is located (only for #include files that are enclosed in "")
2. The path that is specified with this option.
3. The default directory
$(PRODDIR)\include.lsl
.
Example
Suppose that your linker script file mylsl.lsl
contains the following line:
#include "myinc.inc"
You can call the linker as follows: ltc --include-directory=c:\proj\include --lsl-file=mylsl.lsl test.o
First the linker looks for the file myinc.inc
in the directory where mylsl.lsl
is located. If it does not find the file, it looks in the directory c:\proj\include
(this option). Finally it looks in the directory
$(PRODDIR)\include.lsl
.
Related information
Linker option --lsl-file
(Specify linker script file)
525
TASKING VX-toolset for TriCore User Guide
Linker option: --incremental (-r)
Menu entry
-
Command line syntax
--incremental
-r
Description
Normally the linker links and locates the specified object files. With this option you tell the linker only to link the specified files. The linker creates a linker output file
.out
. You then can link this file again with other object files until you have reached the final linker output file that is ready for locating.
In the last pass, you call the linker without this option with the final linker output file
.out
. The linker will now locate the file.
Example
In this example, the files test1.o
, test2.o
and test3.o
are incrementally linked:
1.
ltc --incremental test1.o test2.o --output=test.out
test1.o and test2.o are linked
2.
ltc --incremental test3.o test.out
test3.o and test.out are linked, task1.out is created
3.
ltc task1.out
task1.out is located
Related information
Section 8.4, Incremental Linking
526
Tool Options
Linker option: --keep-output-files (-k)
Menu entry
Eclipse always removes the output files when errors occurred.
Command line syntax
--keep-output-files
-k
Description
If an error occurs during linking, the resulting output file may be incomplete or incorrect. With this option you keep the generated output files when an error occurs.
By default the linker removes the generated output file when an error occurs. This is useful when you use the make utility. If the erroneous files are not removed, the make utility may process corrupt files on a subsequent invocation.
Use this option when you still want to use the generated file. For example when you know that a particular error does not result in a corrupt object file, or when you want to inspect the output file, or send it to Altium support.
Related information
Linker option --warnings-as-errors (Treat warnings as errors)
527
TASKING VX-toolset for TriCore User Guide
Linker option: --library (-l)
Menu entry
1.
Select Linker » Libraries.
The lower box shows the list of libraries that are linked with the project.
2.
To add a library, click on the Add button in the Libraries box.
3.
Type or select a library (including its path).
4.
Optionally, disable the option Link default libraries.
Use the Edit and Delete button to change a library or to remove a library from the list.
Command line syntax
--library=name
-lname
Description
With this option you tell the linker to use system library lib
name
.a
, where name is a string. The linker first searches for system libraries in any directories specified with --library-directory, then in the directories specified with the environment variables
LIBTC1V1_2 / LIBTC1V1_3 / LIBTC2
, unless you used the option --ignore-default-library-path.
Example
To search in the system library libc.a
(C library): ltc test.o mylib.a --library=c
The linker links the file test.o
and first looks in library mylib.a
(in the current directory only), then in the system library libc.a
to resolve unresolved symbols.
Related information
Linker option --library-directory
(Additional search path for system libraries)
Section 8.3, Linking with Libraries
528
Tool Options
Linker option: --library-directory (-L) / --ignore-default-library-path
Menu entry
1.
Select Linker » Libraries.
The Libraries search path box shows the directories that are added to the search path for library files.
2.
To define a new directory for the search path, click on the Add button in the Library search path box.
3.
Type or select a path.
Use the Edit and Delete button to change a path or to remove a path from the list.
Command line syntax
--library-directory=path,...
-Lpath,...
--ignore-default-library-path
-L
Description
With this option you can specify the path(s) where your system libraries, specified with the option --library
(-l), are located. If you want to specify multiple paths, use the option --library-directory for each separate path.
The default path is
$(PRODDIR)\lib
.
If you specify only -L (without a pathname) or the long option --ignore-default-library-path, the linker will not search the default path and also not in the paths specified in the environment variables
LIBTC1V1_2 / LIBTC1V1_3 / LIBTC2
. So, the linker ignores steps 2 and 3 as listed below.
The priority order in which the linker searches for system libraries specified with the option --library (-l) is:
1. The path that is specified with the option --library-directory.
2. The path that is specified in the environment variables
LIBTC1V1_2 / LIBTC1V1_3 / LIBTC2
.
3. The default directory
$(PRODDIR)\lib
.
4. The processor specific directory, for example
$(PRODDIR)\lib\tc1
.
Example
Suppose you call the linker as follows: ltc test.o --library-directory=c:\mylibs --library=c
529
TASKING VX-toolset for TriCore User Guide
First the linker looks in the directory c:\mylibs
for library libc.a
(this option). If it does not find the requested libraries, it looks in the directory that is set with the environment variables
LIBTC1V1_2 /
LIBTC1V1_3 / LIBTC2
. Then the linker looks in the default directory
$(PRODDIR)\lib
.
Related information
Linker option --library (Link system library)
Section 8.3.1, How the Linker Searches Libraries
530
Tool Options
Linker option: --link-only
Menu entry
-
Command line syntax
--link-only
Description
With this option you suppress the locating phase. The linker stops after linking and informs you about unresolved references.
Related information
Control program option -cl
(Stop after linking)
531
TASKING VX-toolset for TriCore User Guide
Linker option: --lsl-check
Menu entry
-
Command line syntax
--lsl-check
Description
With this option the linker just checks the syntax of the LSL file(s) and exits. No linking or locating is performed. Use the option --lsl-file to specify the name of the Linker Script File you want to test.
Related information
Linker option --lsl-file (Linker script file)
Linker option --lsl-dump (Dump LSL info)
Section 8.7, Controlling the Linker with a Script
532
Tool Options
Linker option: --lsl-dump
Menu entry
-
Command line syntax
--lsl-dump[=file]
Description
With this option you tell the linker to dump the LSL part of the map file in a separate file, independent of the option --map-file (generate map file). If you do not specify a filename, the file ltc.ldf
is used.
Related information
Linker option --map-file-format (Map file formatting)
533
TASKING VX-toolset for TriCore User Guide
Linker option: --lsl-file (-d)
Menu entry
An LSL file can be generated when you create your project in Eclipse:
1.
From the File menu, select File » New » Other... » TASKING C/C++ » TASKING VX-toolset for
TriCore C/C++ Project.
The New C/C++ Project wizard appears.
2.
Fill in the project settings in each dialog and click Next > until the TriCore Project Settings appear.
3.
Enable the optionadd Linker script file to the project and click Finish.
Eclipse creates your project and the file project
.lsl
in the project directory.
Command line syntax
--lsl-file=file
-dfile
Description
A linker script file contains vital information about the core for the locating phase of the linker. A linker script file is coded in LSL and contains the following types of information:
• the architecture definition describes the core's hardware architecture.
• the memory definition describes the physical memory available in the system.
• the section layout definition describes how to locate sections in memory.
With this option you specify a linker script file to the linker. If you do not specify this option, the linker uses a default script file. You can specify the existing file target
.lsl
or the name of a manually written linker script file. You can use this option multiple times. The linker processes the LSL files in the order in which they appear on the command line.
Related information
Linker option --lsl-check (Check LSL file(s) and exit)
Section 8.7, Controlling the Linker with a Script
534
Tool Options
Linker option: --map-file (-M)
Menu entry
1.
Select Linker » Map File.
2.
Enable the option Generate map file.
3.
Enable or disable the types of information to be included.
Command line syntax
--map-file[=file]
-M[file]
Default: no map file is generated
Description
With this option you tell the linker to generate a linker map file. If you do not specify a filename and you specified the option --output, the linker uses the same basename as the output file with the extension
.map
. If you did not specify the option --output, the linker uses the file task1.map
. Eclipse names the
.map
file after the project.
A linker map file is a text file that shows how the linker has mapped the sections and symbols from the various object files (
.o
) to the linked object file. A locate part shows the absolute position of each section.
External symbols are listed per space with their absolute address, both sorted on symbol and sorted on address.
Related information
Linker option --map-file-format
(Format map file)
Section 13.2, Linker Map File Format
535
TASKING VX-toolset for TriCore User Guide
Linker option: --map-file-format (-m)
Menu entry
1.
Select Linker » Map File.
2.
Enable the option Generate map file.
3.
Enable or disable the types of information to be included.
Command line syntax
--map-file-format=flag,...
-mflags
You can set the following flags:
+/-callgraph
+/-files
+/-invocation
+/-link
+/-locate
+/-memory
+/-nonalloc
+/-overlay
+/-statics
+/-crossref
+/-lsl
+/-rules c/C f/F i/I k/K l/L m/M n/N o/O q/Q r/R s/S u/U
Include call graph information
Include processed files information
Include invocation and tool information
Include link result information
Include locate result information
Include memory usage information
Include non alloc information
Include overlay information
Include module local symbols information
Include cross references information
Include processor and memory information
Include locate rules
Use the following options for predefined sets of flags:
--map-file-format=0 -m0
--map-file-format=1
--map-file-format=2
-m1
-m2
Link information
Alias for -mcfikLMNoQrSU
Locate information
Alias for -mCfiKlMNoQRSU
Most information
Alias for -mcfiklmNoQrSu
Default:
--map-file-format=2
Description
With this option you specify which information you want to include in the map file.
536
Tool Options
On the command line you must use this option in combination with the option --map-file (-M).
Related information
Linker option --map-file (Generate map file)
Section 13.2, Linker Map File Format
537
TASKING VX-toolset for TriCore User Guide
Linker option: --misra-c-report
Menu entry
-
Command line syntax
--misra-c-report[=file]
Description
With this option you tell the linker to create a MISRA-C Quality Assurance report. This report lists the various modules in the project with the respective MISRA-C settings at the time of compilation. If you do not specify a filename, the file basename
.mcr
is used.
Related information
C compiler option --misrac (MISRA-C checking)
538
Linker option: --munch
Menu entry
-
Command line syntax
--munch
Description
With this option you tell the linker to activate the muncher in the pre-locate phase.
Related information
Section 5.1.2, The Muncher Phase
Tool Options
539
TASKING VX-toolset for TriCore User Guide
Linker option: --non-romable
Menu entry
-
Command line syntax
--non-romable
Description
With this option you tell the linker that the application is not romable. The linker will locate all ROM sections in RAM. A copy table is generated and is located in RAM. When the application is started, that data and
BSS sections are re-initialized.
-
Related information
540
Tool Options
Linker option: --no-rescan
Menu entry
1.
Select Linker » Libraries.
2.
Disable the option Rescan libraries to solve unresolved externals.
Command line syntax
--no-rescan
Description
When the linker processes a library it searches for symbol definitions that are referenced by the objects and libraries processed so far. If the library contains a definition for an unresolved reference the linker extracts the object that contains the definition from the library. The linker processes object files and libraries in the order in which they appear on the command line.
When all objects and libraries are processed the linker checks if there are unresolved symbols left. If so, the default behavior of the linker is to rescan all libraries in the order given at the command line. The linker stops rescanning the libraries when all symbols are resolved, or when the linker could not resolve any symbol(s) during the rescan of all libraries. Notice that resolving one symbol may introduce new unresolved symbols.
With this option, you tell the linker to scan the object files and libraries only once. When the linker has not resolved all symbols after the first scan, it reports which symbols are still unresolved. This option is useful if you are building your own libraries. The libraries are most efficiently organized if the linker needs only one pass to resolve all symbols.
Related information
Linker option --first-library-first
(Scan libraries in given order)
541
TASKING VX-toolset for TriCore User Guide
Linker option: --no-rom-copy (-N)
Menu entry
-
Command line syntax
--no-rom-copy
-N
Description
With this option the linker will not generate a ROM copy for data sections. A copy table is generated and contains entries to clear BSS sections. However, no entries to copy data sections from ROM to RAM are placed in the copy table.
The data sections are initialized when the application is downloaded. The data sections are not re-initialized when the application is restarted.
-
Related information
542
Tool Options
Linker option: --no-warnings (-w)
Menu entry
1.
Select Linker » Diagnostics.
The Suppress warnings box shows the warnings that are currently suppressed.
2.
To suppress a warning, click on the Add button in the Suppress warnings box.
3.
Enter the numbers, separated by commas, of the warnings you want to suppress (for example
135,136
). Or you can use the Add button multiple times.
4.
To suppress all warnings, enable the option Suppress all warnings.
Use the Edit and Delete button to change a warning number or to remove a number from the list.
Command line syntax
--no-warnings[=number,...]
-w[number,...]
Description
With this option you can suppresses all warning messages or specific warning messages.
On the command line this option works as follows:
• If you do not specify this option, all warnings are reported.
• If you specify this option but without numbers, all warnings are suppressed.
• If you specify this option with a number, only the specified warning is suppressed. You can specify the option --no-warnings=number multiple times.
Example
To suppress warnings 135 and 136, enter: ltc --no-warnings=135,136 test.o
Related information
Linker option --warnings-as-errors (Treat warnings as errors)
543
TASKING VX-toolset for TriCore User Guide
Linker option: --optimize (-O)
Menu entry
1.
Select Linker » Optimization.
2.
Select one or more of the following options:
• Delete unreferenced sections
• Use a 'first-fit decreasing' algorithm
• Compress copy table
• Delete duplicate code
• Delete duplicate data
Command line syntax
--optimize=flag,...
-Oflags
You can set the following flags:
+/-delete-unreferenced-sections
+/-first-fit-decreasing
+/-copytable-compression
+/-delete-duplicate-code
+/-delete-duplicate-data c/C l/L t/T x/X y/Y
Delete unreferenced sections from the output file
Use a 'first-fit decreasing' algorithm to locate unrestricted sections in memory
Emit smart restrictions to reduce copy table size
Delete duplicate code sections from the output file
Delete duplicate constant data from the output file
Use the following options for predefined sets of flags:
--optimize=0
--optimize=1
--optimize=2
-O0
-O1
-O2
No optimization
Alias for -OCLTXY
Default optimization
Alias for -OcLtxy
All optimizations
Alias for -Ocltxy
Default:
--optimize=1
544
Description
With this option you can control the level of optimization.
Related information
For details about each optimization see
Section 8.6, Linker Optimizations .
Tool Options
545
TASKING VX-toolset for TriCore User Guide
Linker option: --option-file (-f)
Menu entry
1.
Select Linker » Miscellaneous.
2.
Add the option --option-file to the Additional options field.
Be aware that the options in the option file are added to the linker options you have set in the other pages. Only in extraordinary cases you may want to use them in combination.
Command line syntax
--option-file=file,...
-f file,...
Description
This option is primarily intended for command line use. Instead of typing all options on the command line, you can create an option file which contains all options and flags you want to specify. With this option you specify the option file to the linker.
Use an option file when the command line would exceed the limits of the operating system, or just to store options and save typing.
Option files can also be generated on the fly, for example by the make utility. You can specify the option
--option-file multiple times.
Format of an option file
• Multiple arguments on one line in the option file are allowed.
• To include whitespace in an argument, surround the argument with single or double quotes.
• If you want to use single quotes as part of the argument, surround the argument by double quotes and vise versa:
"This has a single quote ' embedded"
'This has a double quote " embedded'
'This has a double quote " and a single quote '"' embedded"
• When a text line reaches its length limit, use a \ to continue the line. Whitespace between quotes is preserved.
"This is a continuation \ line"
-> "This is a continuation line"
546
Tool Options
• It is possible to nest command line files up to 25 levels.
Example
Suppose the file myoptions
contains the following lines:
--map-file=my.map (generate a map file) test.o (input file)
--library-directory=c:\mylibs (additional search path for system libraries)
Specify the option file to the linker: ltc --option-file=myoptions
This is equivalent to the following command line:
ltc --map-file=my.map test.o --library-directory=c:\mylibs
Related information
547
TASKING VX-toolset for TriCore User Guide
Linker option: --output (-o)
Menu entry
1.
Select Linker » Output Format.
2.
Enable one or more output formats.
For some output formats you can specify a number of suboptions.
Eclipse always uses the project name as the basename for the output file.
Command line syntax
--output=[filename][:format[:addr_size][,space_name]]...
-o[filename][:format[:addr_size][,space_name]]...
You can specify the following formats:
ELF
IHEX
SREC
ELF/DWARF
Intel Hex
Motorola S-records
Description
By default, the linker generates an output file in ELF/DWARF format, with the name task1.elf
.
With this option you can specify an alternative filename, and an alternative output format. The default output format is the format of the first input file.
You can use the --output option multiple times. This is useful to generate multiple output formats. With the first occurrence of the --output option you specify the basename (the filename without extension), which is used for subsequent --output options with no filename specified. If you do not specify a filename, or you do not specify the --output option at all, the linker uses the default basename task
n.
IHEX and SREC formats
If you specify the Intel Hex format or the Motorola S-records format, you can use the argument addr_size to specify the size of addresses in bytes (record length). For Intel Hex you can use the values: 1, 2, and
4 (default). For Motorola S-records you can specify: 2 (S1 records), 3 (S2 records, default) or 4 bytes (S3 records).
With the argument space_name you can specify the name of the address space. The name of the output file will be filename with the extension
.hex
or
.sre
and contains the code and data allocated in the specified space. If they exist, any other address spaces are also emitted whereas their output files are named filename_spacename with the extension
.hex
or
.sre
.
If you do not specify space_name, or you specify a non-existing space, the default address space is filled in.
548
Tool Options
Use option --chip-output (-c) to create Intel Hex or Motorola S-record output files for each chip defined in the LSL file (suitable for loading into a PROM-programmer).
Example
To create the output file myfile.hex
of the address space named linear
, enter: ltc test.o --output=myfile.hex:IHEX:2,linear
If they exist, any other address spaces are emitted as well and are named myfile_
spacename
.hex
.
Related information
Linker option --chip-output
(Generate an output file for each chip)
Linker option --hex-format
(Specify Hex file format settings)
549
TASKING VX-toolset for TriCore User Guide
Linker option: --print-mangled-symbols (-P)
Menu entry
-
Command line syntax
--print-mangled-symbols
-P
Description
C++ compilers generate unreadable symbol names. These symbols cannot easily be related to your C++ source file anymore. Therefore the linker will by default decode these symbols conform the IA64 ABI when printed to stdout
. With this option you can override this default setting and print the mangled names instead.
-
Related information
550
Tool Options
Linker option: --strip-debug (-S)
Menu entry
1.
Select Linker » Miscellaneous.
2.
Enable the option Strip symbolic debug information.
Command line syntax
--strip-debug
-
-S
Description
With this option you specify not to include symbolic debug information in the resulting output file.
Related information
551
TASKING VX-toolset for TriCore User Guide
Linker option: --user-provided-initialization-code (-i)
Menu entry
1.
Select Linker » Miscellaneous.
2.
Enable the option Do not use standard copy table for initialization.
Command line syntax
--user-provided-initialization-code
-i
Description
It is possible to use your own initialization code, for example, to save ROM space. With this option you tell the linker not to generate a copy table for initialize/clear sections. Use linker labels in your source code to access the positions of the sections when located.
If the linker detects references to the TASKING initialization code, an error is emitted: it is either the
TASKING initialization routine or your own, not both.
Note that the options --no-rom-copy and --non-romable, may vary independently. The
'copytable-compression' optimization (--optimize=t) is automatically disabled when you enable this option.
Related information
Linker option --no-rom-copy (Do not generate ROM copy)
Linker option --non-romable (Application is not romable)
Linker option --optimize (Specify optimization)
552
Tool Options
Linker option: --verbose (-v) / --extra-verbose (-vv)
Menu entry
-
Command line syntax
--verbose / --extra-verbose
-v / -vv
Description
With this option you put the linker in verbose mode. The linker prints the link phases while it processes the files. In the extra verbose mode, the linker also prints the filenames and it shows which objects are extracted from libraries. With this option you can monitor the current status of the linker.
-
Related information
553
TASKING VX-toolset for TriCore User Guide
Linker option: --version (-V)
Menu entry
-
Command line syntax
--version
-V
Description
Display version information. The linker ignores all other options or input files.
Example
ltc --version
The linker does not link any files but displays the following version information:
TASKING VX-toolset for TriCore: object linker vx.yrz Build nnn
Copyright 2002-year Altium BV Serial# 00000000
-
Related information
554
Tool Options
Linker option: --warnings-as-errors
Menu entry
1.
Select Global Options.
2.
Enable the option Treat warnings as errors.
Command line syntax
--warnings-as-errors[=number,...]
Description
When the linker detects an error or warning, it tries to continue the link process and reports other errors and warnings. When you use this option without arguments, you tell the linker to treat all warnings as errors. This means that the exit status of the linker will be non-zero after the detection of one or more linker warnings. As a consequence, the linker will not produce any output files.
You can also limit this option to specific warnings by specifying a comma-separated list of warning numbers.
Related information
Linker option --no-warnings
(Suppress some or all warnings)
555