XLINK.EXE, the macOS Linker

From RAD Studio
Jump to: navigation, search

Go Up to Command-Line Utilities Index


XLINK.EXE is the command-line interface of XLINK, the C++ linker for macOS.

Command Line Help

 C:\>xlink
 Turbo Incremental Link 1.00 Copyright (c) 1997-2011 {{Company}} Technologies, Inc.
 Syntax: ILINK objfiles, exefile, mapfile, libfiles, deffile, resfiles
 @xxxx indicates use response file xxxx
 General Options:                       -Af:nnnn Specify file alignment
  -C       Clear state before linking   -Ao:nnnn Specify object alignment
  -wxxx    Warning control              -ax      Specify application type
  -Enn     Max number of errors         -b:xxxx  Specify image base addr
  -r       Verbose linking              -Txx     Specify output file type
  -q       Suppress banner              -H:xxxx  Specify heap reserve size
  -c       Case sensitive linking       -Hc:xxxx Specify heap commit size
  -v       Full debug information       -S:xxxx  Specify stack reserve size
  -Gn      No state files               -Sc:xxxx Specify stack commit size
  -Gi      Generate import library      -Vd.d    Specify Windows version
  -GD      Generate .DRC file           -Dstring Set image description
 Map File Control:                      -Vd.d    Specify subsystem version
  -M       Map with mangled names       -Ud.d    Specify image user version
  -m       Map file with publics        -GC      Specify image comment str
  -s       Detailed segment map         -GF      Set image flags
  -x       No map                       -Gl      Static package
 Paths:                                 -Gpd     Design time only package
  -I       Intermediate output dir      -Gpr     Runtime only package
  -L       Specify library search paths -GS      Set section flags
  -j       Specify object search paths  -Gt      Fast TLS
 Image Control:                         -Gz      Do image checksum
  -d       Delay load a .DLL            -Rr      Replace resources

Output Generation

The -Txx option family can be used to control the output generation:

Option Command

-Tmd

Generate Mach dylib.

-Tme

Generate Mach executable.

-Tmp

Generate Mach package.

Library Specification

The XLINK library search path can be controlled with the following options:

Option        Description

-Fr

Specifies the logical root directory: $(SYSROOT). This option should be specified once. (With BCCOSX, you would use the --sysroot option.)

-Fp

Specifies the remote library paths. Paths specified with -Fp are prepended with $(SYSROOT) and the result is added to the library path. In a RAD Studio project, the remote libraries are specified in the SDK Manager panel (you should edit the SDK remote paths). This option can be specified multiple times. If this option is used, then the -Fr option should precede it.

-L

Specifies the local library search paths.

You can interleave the -L and -Fp options.

Framework Specification

Use the -Ff option to link a particular framework.

Option Description

-Ff

Instructs XLINK to link the specified framework. For example, to link the Carbon framework, write -FfCarbon.

--framework (BCCOSX option)

Instructs BCCOSX to link the specified framework. The framework names specified in this way are redirected to XLINK using the -Ff option.

In a RAD Studio project, the frameworks can be specified in the SDK Manager panel (edit the SDK remote paths).

Executable Header Parameters

A macOS dynamic library has an associated install name (or ld name). This is a string embedded in the .dylib file that represents the path of the .dylib file. For example, the install name of CoreServices is /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices. When building a macOS executable file or dynamic library that relies on CoreServices, XLINK inserts a record with the install name information of CoreServices in the binary image.

A macOS binary image contains a header with load-time parameters. Some of these parameters include dynamic library paths that might be unknown at link-time. Such paths can be patched, but this can be problematic if the linker does not reserve sufficient space in the image header. To specify the number of additional bytes to reserve, you can use the -Gr option.

Topics

See Also