C++ Linker Output

From RAD Studio
Jump to: navigation, search

Go Up to C++ Linker


Project > Options > Building > C++ Linker > Output

Use this dialog box to set C++ linker output options.

Options Description

Target, Apply, Save

See Target Options.

Common items

See Common Items on Project Options Pages.

C++ Linker Output options supported on all platforms: Most of the options on this page are shared among all the C++ linkers and thus are supported on all the Supported Target Platforms. There are two exceptions:

  • Image flags (supported only on Windows platforms)
  • Section flags (supported only on Windows platforms)

Linker switches that are given are for both ILINK32 and ILINK64.

Map File options Description

Base address
(-b)

Specifies image base address for your executable or DLL. The load address of the first object in the application or library is set to the number you specify, if possible, and all successive objects are aligned on 64K linear address boundaries; internal fixups are ignored. However, if the module cannot be loaded using the specified address, the operating system reverts to its default setting and applies internal fixups. Preserve relocation table. Specify value in hex or decimal on 0x200 or 512 byte boundaries.
Default value = 0x00400000

Heap size, maximum
(-H)

Specifies the size of the reserved heap in hexadecimal or decimal. The minimum allowable value for this field is 0. Specifying the reserved heap size here overrides any HEAPSIZE setting in a module definition file.

Default value = 0x00100000

Heap size, minimum
(-Hc)

Specifies the size of the committed heap in hexadecimal or decimal. The minimum allowable value for this field is 0 and any value specified must be equal to or less than the Heap size, maximum option.

Specifying the committed heap size here overrides any HEAPSIZE setting in a module definition file.

Default value = 0x00001000

Supported only on 32-bit Windows and 64-bit Windows platforms.

Image comment string
(-GC)

Specifies comments to be inserted into the image (.exe, .dll, .bpl, and so forth) directly after the object table in the PE file header. These comments can be read out of the image with TDump or similar tools.

Image description
(-D)

Saves the specified description in the PE image.

Image flags
(-GF)

Allows you to set several flags on the image. The following flags are supported:

-GF:SWAPNET
-GF:SWAPCD
-GF:UNIPROCESSOR
-GF:LARGEADDRESSAWARE
-GF:AGGRESSIVESWAPNET
  • SWAPNET tells the OS to copy the image to a local swap file and run it from there if the image resides on a network drive.
  • SWAPCD tells the OS to copy the image to a local swap file and run it from there if the image resides on removable media (for example, CD, floppy, USB memory stick).
  • UNIPROCESSOR tells the OS that this application cannot run on a multiprocessor system.
  • LARGEADDRESSAWARE tells the OS that the application understands addresses bigger than 4G.
  • AGGRESSIVE permits the OS to aggressively trim the working set of an application when the application is idle. This is ideal for screen savers and other processes that wish to stay out of the way of main line processes as much as possible.

Default value = None

Supported only on 32-bit Windows and 64-bit Windows platforms.

The Ellipsis pop-up button is described in Common Items on Project Options Pages.

Map file type

Map file with segments


Includes only segments in the map file. Happens when none of -m,-s, or -x is specified. This is the default.
Map file with publics (-m)
Instructs the linker to produce a map file that contains an overview of the application segments and two listings of the public symbols.

The segments listing has a line for each segment showing the segment starting address, segment length, segment name, and the segment class.

The public symbols are broken down into two lists, the first showing the symbols in sorted alphabetically, the second showing the symbols in increasing address order. Symbols with absolute addresses are tagged Abs.

A list of public symbols is useful when debugging: many debuggers use public symbols, which lets you refer to symbolic addresses while debugging.
Detailed segment map (-s)
Creates the most comprehensive map file by adding a detailed map of segments to the map file created with the Map file with publics option. The detailed list of segments contains the segment class, the segment name, the segment group, the segment module, and the segment ACBP information. If the same segment appears in more than one module, each module appears as a separate line.
The ACBP field encodes the A (alignment), C (combination), and B (big) attributes into a set of four bit fields, as defined by Intel. ILINK32 uses only three of the fields: A, C, and B. The ACBP value in the map is printed in hexadecimal. The following field values must be ORed together to arrive at the ACBP value printed.
Field - Value - Description
A (alignment)

  • - 00 - An absolute segment
  • - 20 - A byte-aligned segment
  • - 40 - A word-aligned segment
  • - 60 - A paragraph-aligned segment
  • - 80 - A page-aligned segment
  • - A0 - An unnamed absolute portion of storage

C (combination)

  • - 00 - Cannot be combined
  • - 08 - A public combining segment

B (big)

  • - 00 - Segment less than 64K
  • - 02 - Segment exactly 64K

With the Segments options set, public symbols with no references are flagged idle. An idle symbol is a publicly defined symbol in a module that was not referenced by an EXTDEF record or by any other module included in the link. For example, this fragment from the public symbol section of a map file indicates that symbols Symbol1 and Symbol3 are not referenced by the image being linked:

0002:00000874 Idle Symbol1
0002:00000CE4 Symbol2
0002:000000E7 Idle Symbol3

Do not generate map (-x) Turns off the creation of the default linker map file. By default, the linker generates a map file with that contains general segment information including a list of segments, the program start address, and any warning or error messages produced during the link. There is no switch for this setting. Use the Do not generate map option to suppress the creation of this default map file.

Map with mangled names
(-M)

Prints the mangled C++ identifiers in the map file, not the full name. This can help you identify how names are mangled (mangled names are needed as input by some utilities).
Default = False

OS version
(-V)

Specifies the Windows version ID on which you expect your application to be run. The linker sets the Subsystem version field in the .EXE header to the number you specify in the input box.

You can also set the Windows version ID in the SUBSYSTEM portion of the module definition file (.DEF file) However, any version setting you specify in the IDE or on the command line overrides the setting in the .DEF file.

When you use the OS version option, the linker sets the Windows version ID to the specified number. For example, if you specify 4.0, the linker sets the Subsystem version field in the .EXE header to 4.0, which indicates a Windows 95 application.

Section flags
(-GS)

The Section flags option lets you add flags to a named image section. This option adds the flags to the existing flags for a given section. There is no way to remove default flags from a section.

Allowable flags are:
E - Executable
C - Contains Code
I - Contains initialized data
R - Section is readable
W - Section is writable
S - Section is shared
D - Section is discardable
K - Section must not be cached
P - Section must not be paged
Default = No flags
The Ellipsis pop-up button is described in Common Items on Project Options Pages.

Stack size, maximum
(-S)

Specifies the size of the reserved stack in hexadecimal or decimal. The minimum allowable value for this field is 4K (0x1000).
Specifying the reserved stack size here overrides any STACKSIZE setting in a module definition file.
Default = 0x00100000

Stack size, minimum
(-Sc)

Specifies the size of the committed stack in hexadecimal or decimal. The minimum allowable value for this field is 4K (0x1000) and any value specified must be equal to or less than the Stack size, maximum option.
Specifying the committed stack size here overrides any STACKSIZE setting in a module definition file.
Default = 0x00002000

User version
(-U)

Specifies the version ID of your executable. The linker sets the user version field in the executable's header to the number you specify.
When you use the User version option, the linker sets the application version ID to the specified number. For example, if you specify 4.0, the linker sets the user version field in the executable's header to 4.0.
Default = 1.0

See Also