Manual Pages for UNIX Darwin command on man ld
MyWebUniversity

Manual Pages for UNIX Darwin command on man ld

ld(1) BSD General Commands Manual ld(1)

NAME

lldd - linker

SYNOPSIS

lldd files... [options] [-oo outputfile]

DESCRIPTION

The lldd command combines several object files and libraries, resolves ref-

erences, and produces an ouput file. lldd can produce a final linked image

(executable, dylib, or bundle), or with the -r option, produce another

object file. If the -o option is not used, the output file produced is

named "a.out". UUnniivveerrssaall

The linker accepts universal (multiple-architecture) input files, but

always creates a "thin" (single-architecture), standard Mach-O output

file. The architecture for the output file is specified using the -arch

option. If this option is not used, lldd attempts to determine the output

architecture by examining the object files in command line order. The first "thin" architecture determines that of the output file. If no

input object file is a "thin" file, the native 32-bit architecture for

the host is used.

Usually, lldd is not used directly. Instead the gcc(1) compiler driver

invokes lldd.. The compiler driver can be passed multiple -arch options and

it will create a universal final linked image by invoking lldd multiple

times and then running lipo(1) merge the outputs into a universal file. LLaayyoouutt The object files are loaded in the order in which they are specified on the command line. The segments and the sections in those segments will appear in the output file in the order they are encountered in the object

files being linked. All zero fill sections will appear after all non-

zero fill sections in their segments. Sections created from files with

the -sectcreate option will be laid out at after sections from .o files.

The use of the -orderfile option will alter the layout rules above, and

move the symbols specified to start of their section. LLiibbrraarriieess A static library (aka static archive) is a collection of .o files with a

table of contents that lists the global symbols in the .o files. lldd will

only pull .o files out of a static library if needed to resolve some sym-

bol reference. Unlike traditional linkers, lldd will continually search a

static library while linking. There is no need to specify a static library multiple times on the command line. A dynamic library (aka dylib or framework) is a final linked image. Putting a dynamic library on the command line causes two things: 1) The generated final linked image will have encoded that it depends on that dynamic library. 2) Exported symbols from the dynamic library are used to resolve references.

Both dynamic and static libraries are searched as they appear on the com-

mand line. SSeeaarrcchh ppaatthhss

lldd maintains a list of directories to search for a library or framework

to use. The default library search path is /usr/lib then /usr/local/lib.

The -L option will add a new library search path. The default framework

search path is /Library/Frameworks then /System/Library/Frameworks. (Note: previously, /Network/Library/Frameworks was at the end of the default path. If you need that functionality, you need to explicitly add

-F/Network/Library/Frameworks). The -F option will a new framework

search path. The -Z option will remove the standard search paths. The

-syslibroot option will prepend a prefix to all search paths.

TTwwoo-lleevveell nnaammeessppaaccee

By default all references resolved to a dynamic library record the

library to which they were resolved. At runtime, dyld uses that informa-

tion to directly resolve symobls. The alternative is to use the

-flatnamespace option. With flat namespace, the library is not

recorded. At runtime, dyld will search each dynamic library in load

order when resolving symbols. This is slower, but more like how other operating systems resolve symbols. IInnddiirreecctt ddyynnaammiicc lliibbrraarriieess If the command line specifies to link against dylib A, and when dylib A was built it linked against dylib B, then B is considered an indirect

dylib. When linking for two-level namespace, ld does not look at indi-

rect dylibs, except when re-exported by a direct dylibs. On the other

hand when linking for flat namespace, ld does load all indirect dylibs

and uses them to resolve references. Even though indirect dylibs are

specified via a full path, lldd first uses the specified search paths to

locate each indirect dylib. If one cannot be found using the search paths, the full path is used. DDyynnaammiicc lliibbrraarriieess uunnddeeffiinneess

When linking for two-level namespace, lldd does not verify that undefines

in dylibs actually exist. But when linking for flat namespace, lldd does

check that all undefines from all loaded dylibs have a matching defini-

tion. This is sometimes used to force selected functions to be loaded from a static library. OOPPTTIIOONNSS Options that control the kind of output

-eexxeeccuuttee The default. Produce a mach-o main executable that has file

type MHEXECUTE.

-ddyylliibb Produce a mach-o shared library that has file type MHDYLIB.

-bbuunnddllee Produce a mach-o bundle that has file type MHBUNDLE.

-rr Merges object files to produce another mach-o object file

with file type MHOBJECT.

-ddyylliinnkkeerr Produce a mach-o dylinker that has file type MHDYLINKER.

Only used when building dyld.

-ddyynnaammiicc The default. Implied by -dynamiclib, -bundle, or -execute

-ssttaattiicc Produces a mach-o file that does not use the dyld. Only used

building the kernel.

-aarrcchh archname

Specifies which architecture (e.g. ppc, ppc64, i386, x8664)

the output file should be.

-oo path Specifies the name and location of the output file. If not

specified, `a.out' is used. Options that control libraries

-llx This option tells the linker to search for libx.dylib or

libx.a in the library search path. If string x is of the form y.o, then that file is searched for in the same places, but without prepending `lib' or appending `.a' or `.dylib' to the filename.

-wweeaakk-llx This is the same as the -lx but forces the library and all

references to it to be marked as weak imports. That is, the library is allowed to be missing at runtime.

-wweeaakklliibbrraarryy pathtolibrary

This is the same as listing a file name path to a library on

the link line except that it forces the library and all ref-

erences to it to be marked as weak imports.

-rreeeexxppoorrtt-llx

This is the same as the -lx but specifies that the all sym-

bols in library x should be available to clients linking to

the library being created. This was previously done with a

separate -sublibrary option.

-rreeeexxppoorrttlliibbrraarryy pathtolibrary

This is the same as listing a file name path to a library on the link line and it specifies that the all symbols in

library path should be available to clients linking to the

library being created. This was previously done with a sepa-

rate -sublibrary option.

-llaazzyy-llx This is the same as the -lx but it is only for shared

libraries and the linker will construct glue code so that the shared library is not loaded until the first function in it is called.

-llaazzyylliibbrraarryy pathtolibrary

This is the same as listing a file name path to a shared

library on the link line except that the linker will con-

struct glue code so that the shared library is not loaded until the first function in it is called.

-LLdir Add dir to the list of directories in which to search for

libraries. Directories specified with -L are searched in the

order they appear on the command line and before the default search path.

-ZZ Do not search the standard directories when searching for

libraries and frameworks.

-ssyysslliibbrroooott rootdir

Prepend rootdir to all search paths when searching for libraries or frameworks.

-sseeaarrcchhppaatthhssffiirrsstt

By default the -lx and -weak-lx options first search for a

file of the form `libx.dylib' in each directory in the library search path, then a file of the form `libx.a' is searched for in the library search paths. This option changes it so that in each path `libx.dylib' is searched for then `libx.a' before the next path in the library search path is searched.

-ffrraammeewwoorrkk name[,suffix]

This option tells the linker to search for `name.frame-

work/name' the framework search path. If the optional suffix is specified the framework is first searched for the name

with the suffix and then without (e.g. look for `name.frame-

work/namesuffix' first, if not there try `name.frame-

work/name').

-wweeaakkffrraammeewwoorrkk name[,suffix]

This is the same as the -framework name[,suffix] but forces

the framework and all references to it to be marked as weak imports.

-rreeeexxppoorrttffrraammeewwoorrkk name[,suffix]

This is the same as the -framework name[,suffix] but also

specifies that the all symbols in that framework should be

available to clients linking to the library being created.

This was previously done with a separate -subumbrella

option.

-llaazzyyffrraammeewwoorrkk name[,suffix]

This is the same as the -framework name[,suffix] except that

the linker will construct glue code so that the framework is not loaded until the first function in it is called. You

cannot directly access data or Objective-C classes in a

frameworked linked this way.

-FFdir Add dir to the list of directories in which to search for

frameworks. Directories specified with -F are searched in

the order they appear on the command line and before the default search path.

-aallllllooaadd Loads all members of static archive libraries.

-OObbjjCC Loads all members of static archive libraries that implement

an Objective-C class or category.

Options that control additional content

-sseeccttccrreeaattee segname sectname file

The section sectname in the segment segname is created from the contents of file file. The combination of segname and

sectname must be unique -D there cannot already be a section

(segname,sectname) from any other input.

-ffiilleelliisstt file[,dirname]

Specifies that the linker should link the files listed in

file. This is an alternative to listing the files on the

command line. The file names are listed one per line sepa-

rated only by newlines. (Spaces and tabs are assumed to be part of the file name.) If the optional directory name, dirname is specified, it is prepended to each name in the list file.

-ddttrraaccee file

Enables dtrace static probes when producing a final linked image. The file file must be a DTrace script which declares the static probes. Options that control optimizations

-ddeeaaddssttrriipp

Remove functions and data that are unreachable by the entry point or exported symbols.

-ddeeaaddssttrriippddyylliibbss

Remove dylibs that are unreachable by the entry point or exported symbols. That is, suppresses the generation of load command commands for dylibs which supplied no symbols during

the link. This option should not be used when linking against

a dylib which is required at runtime for some indirect reason such as the dylib has an important initializer.

-oorrddeerrffiillee file

Alters the order in which functions and data are laid out.

For each section in the output file, any symbol in that sec-

tion that are specified in the order file file is moved to the start of its section and laid out in the same order as in the order file file. Order files are text files with one

symbol name per line. Lines starting with a # are comments.

A symbol name may be optionally preceded with its object file leafname and a colon (e.g. foo.o:foo). This is useful for static functions/data that occur in multiple files. A symbol name may also be optionally preceded with the architecture (e.g. ppc:foo or ppc:foo.o:foo). This enables you to have

one order file that works for multiple architectures. Lit-

eral c-strings may be ordered by by quoting the string (e.g.

"Hello, world\n") in the order file.

-mmaaccoossxxvveerrssiioonnmmiinn version

This is set to indicate the oldest Mac OS X version that that

the output is to be used on. Specifying a later version

enables the linker to assumes features of that OS in the out-

put file. The format of version is a Mac OS X version number such as 10.4 or 10.5

-iimmaaggeebbaassee address

Specifies the perferred load address for a dylib or bundle. The argument address is a hexadecimal number with an optional

leading 0x. By choosing non-overlapping address for all

dylibs and bundles that a program loads, launch time can be

improved because dyld will not need to "rebase" the image

(that is, adjust pointers within the image to work at the loaded address). It is often easier to not use this option, but instead use the rebase(1) tool, and give it a list of

dylibs. It will then choose non-overlapping addresses for

the list and rebase them all. This option is also called

-seg1addr for compatibility.

-nnooiimmpplliicciittddyylliibbss

When creating a two-level namespace final linked image, nor-

mally the linker will hoist up public dylibs that are implic-

itly linked to make the two-level namespace encoding more

efficient for dyld. For example, Cocoa re-exports AppKit and

AppKit re-exports Foundation. If you link with -framework

Cocoa and use a symbol from Foundation, the linker will implicitly add a load command to load Foundation and encode the symbol as coming from Foundation. If you use this option, the linker will not add a load command for Foundation and encode the symbol as coming from Cocoa. Then at runtime

dyld will have to search Cocoa and AppKit before finding the

symbol in Foundation. Options when creating a dynamic library (dylib)

-iinnssttaallllnnaammee name

Sets an internal "install path" (LCIDDYLIB) in a dynamic library. Any clients linked against the library will record

that path as the way dyld should locate this library. If

this option is not specified, then the -o path will be used.

This option is also called -dylibinstallname for compati-

bility.

-ccoommppaattiibbiilliittyyvveerrssiioonn number

Specifies the compatibility version number of the library.

When a library is loaded by dyld, the compatibility version

is checked and if the program's version is greater that the library's version, it is an error. The format of number is

X[.Y[.Z]] where X must be a positive non-zero number less

than or equal to 65535, and .Y and .Z are optional and if

present must be non-negative numbers less than or equal to

255. If the compatibility version number is not specified, it has a value of 0 and no checking is done when the library

is used. This option is also called -dylibcompatibil-

ityversion for compatibility.

-ccuurrrreennttvveerrssiioonn number

Specifies the current version number of the library. The cur-

rent version of the library can be obtained programmatically by the user of the library so it can determine exactly which version of the library it is using. The format of number is

X[.Y[.Z]] where X must be a positive non-zero number less

than or equal to 65535, and .Y and .Z are optional and if

present must be non-negative numbers less than or equal to

255. If the version number is not specified, it has a value

of 0. This option is also called -dylibcurrentversion for

compatibility. Options when creating a main executable

-ppiiee This makes a special kind of main executable that is position

independent (PIE). On Mac OS X 10.5, the OS will load a PIE at a random address each time it is executed. You cannot

create a PIE from .o files compiled with -mdynamic-no-pic.

That means the codegen is less optimal, but the address ran-

domization adds some security.

-ppaaggeezzeerroossiizzee size

By default the linker creates an unreadable segment starting at address zero named PAGEZERO. Its existence will cause a bus error if a NULL pointer is dereferenced. The argument size is a hexadecimal number with an optional leading 0x. If

size is zero, the linker will not generate a page zero seg-

ment. By default on 32-bit architectures the page zero size

is 4KB. On 64-bit architectures, the default size if 4GB.

The ppc64 architecture has some special cases. Since Mac OS X 10.4 did not support 4GB page zero programs, the default page

zero size for ppc64 will be 4KB unless -macosxversionmin is

10.5 or later. Also, the -mdynamic-no-pic codegen model for

ppc64 will only work if the code is placed in the lower 2GB of the address space, so the if the linker detects any such

code, the page zero size is set to 4KB and then a new unred-

able trailing segment is created after the code, filling up the lower 4GB.

-ssttaacckkssiizzee size

Specifies the maximum stack size for the main thread in a program. Without this option a program has a 8MB stack. The

argument size is a hexadecimal number with an optional lead-

ing 0x. The size should be an even multiple of 4KB, that is

the last three hexadecimal digits should be zero.

-aalllloowwssttaacckkeexxeeccuuttee

Marks executable so that all stacks in the task will be given stack execution privilege. This includes pthread stacks. Options when creating a bundle

-bbuunnddlleellooaaddeerr executable

This specifies the executable that will be loading the bundle output file being linked. Undefined symbols from the bundle are checked against the specified executable like it was one of the dynamic libraries the bundle was linked with. Options when creating an object file

-kkeeeepppprriivvaatteeeexxtteerrnnss

Don't turn private external (aka visibility=hidden) symbols

into static symbols, but rather leave them as private exter-

nal in the resulting object file.

-dd Force definition of common symbols. That is, transform ten-

tative defintions into real definitions. Options that control symbol resolution

-eexxppoorrtteeddssyymmbboollsslliisstt filename

The specified filename contains a list of global symbol names that will remain as global symbols in the output file. All other global symbols will be treated as if they were marked as privateextern (aka visibility=hidden) and will not be

global in the output file. The symbol names listed in file-

name must be one per line. Leading and trailing white space

are not part of the symbol name. Lines starting with # are

ignored, as are lines with only white space. Some wildcards

(similar to shell file matching) are supported. The *

matches zero or more characters. The ? matches one charac-

ter. [abc] matches one character which must be an 'a', 'b',

or 'c'. [a-z] matches any single lower case letter from 'a'

to 'z'.

-eexxppoorrtteeddssyymmbbooll symbol

The specified symbol is added to the list of global symbols names that will remain as global symbols in the output file. This option can be used multiple times. For short lists, this can be more convenient than creating a file and using

-exportedsymbolslist.

-uunneexxppoorrtteeddssyymmbboollsslliisstt file

The specified filename contains a list of global symbol names that will not remain as global symbols in the output file.

The symbols will be treated as if they were marked as pri-

vateextern (aka visibility=hidden) and will not be global in the output file. The symbol names listed in filename must be one per line. Leading and trailing white space are not

part of the symbol name. Lines starting with # are ignored,

as are lines with only white space. Some wildcards (similar

to shell file matching) are supported. The * matches zero or more characters. The ? matches one character. [abc] matches

one character which must be an 'a', 'b', or 'c'. [a-z]

matches any single lower case letter from 'a' to 'z'.

-uunneexxppoorrtteeddssyymmbbooll symbol

The specified symbol is added to the list of global symbols names that will not remain as global symbols in the output file. This option can be used multiple times. For short lists, this can be more convenient than creating a file and

using -unexportedsymbolslist.

-aalliiaass symbolname alternatesymbolname

Create an alias named alternatesymbolname for the symbol

symbolname. By default the alias symbol has global visibil-

ity. This option was previous the -idef:indir option.

-aalliiaasslliisstt filename

The specified filename contains a list of aliases. The symbol name and its alias are on one line, separated by whitespace.

Lines starting with # are ignored.

-ffllaattnnaammeessppaaccee

Alters how symbols are resolved at build time and runtime.

With -twolevelnamespace (the default), the linker only

searches dylibs on the command line for symbols, and records

in which dylib they were found. With -flatnamespace, the

linker searches all dylibs on the command line and all dylibs those original dylibs depend on. The linker does not record

which dylib an external symbol came from, so at runtime dyld

again searches all images and uses the first definition it finds. In addition, any undefines in loaded flatnamespace

dylibs must be resolvable at build time.

-uu symbolname

Specified that symbol symbolname must be defined for the link to succeed. This is useful to force selected functions to be loaded from a static library.

-UU symbolname

Specified that it is ok for symbolname to have no defini-

tion. With -twolevelnamespace, the resulting symbol will be

marked dynamiclookup which means dyld will search all loaded

images.

-uunnddeeffiinneedd treatment

Specifies how undefined symbols are to be treated. Options are: error, warning, suppress, or dynamiclookup. The default is error.

-rrppaatthh path

Add path to the runpath search path list for image being cre-

ated. At runtime, dyld uses the runpath when searching for

dylibs whose load path begins with @rpath/.

-ccoommmmoonnss treatment

Specifies how commons (aka tentative definitions) are resolved with respect to dylibs. Options are: ignoredylibs, usedylibs, error. The default is ignoredylibs which means the linker will turn a tentative definition in an object file

into a real definition and not even check dylibs for con-

flicts. The dylibs option means the linker should check

linked dylibs for definitions and use them to replace tenta-

tive definitions from object files. The error option means

the linker should issu an error whenever a tentative defini-

tion in an object file conflicts with an external symbol in a

linked dylib. See also -warncommons.

Options for introspecting the linker

-wwhhyyllooaadd Log why each object file in a static library is loaded. That

is, what symbol was needed. Also called -whyload for compat-

ibility.

-wwhhyylliivvee symbolname

Logs a chain of references to symbolname. Only applicable

with -deadstrip . It can help debug why something that you

think should be dead strip removed is not removed.

-pprriinnttssttaattiissttiiccss

Logs information about the amount of memory and time the linker used.

-tt Logs each file (object, archive, or dylib) the linker loads.

Useful for debugging problems with search paths where the wrong library is loaded.

-wwhhaattssllooaaddeedd

Logs just object files the linker loads.

-oorrddeerrffiilleessttaattiissttiiccss

Logs information about the processing of a -orderfile.

-mmaapp mapfilepath

Writes a map file to the specified path which details all symbols and their addresses in the output image. Options for controling symbol table optimizations

-SS Do not put debug information (STABS or DWARF) in the output

file.

-xx Do not put non-global symbols in the output file's symbol ta-

ble. Non-global symbols are useful when debugging and getting

symbol names in back traces, but are not used at runtime. If

-x is used with -r non-global symbol names are not removed,

but instead replaced with a unique, duumy name that will be automatically removed when linked into a final linked image. This allows dead code stripping, which uses symbols to break up code and data, to work properly and provides the security of having source symbol names removed.

-nnoonngglloobbaallssyymmbboollssssttrriipplliisstt filename

The specified filename contains a list of non-global symbol

names that should be removed from the output file's symbol

table. All other non-global symbol names will remain in the

output files symbol table. See -exportedsymbolslist for

syntax and use of wildcards.

-nnoonngglloobbaallssyymmbboollssnnoossttrriipplliisstt filename

The specified filename contains a list of non-global symbol

names that should be remain in the output file's symbol ta-

ble. All other symbol names will be removed from the output

file's symbol table. See -exportedsymbolslist for syntax

and use of wildcards.

Rarely used Options

-vv Prints the version of the linker.

-nnoouuuuiidd Do not generate an LCUUID load command in the output file.

-rroooottssaaffee Sets the MHROOTSAFE bit in the mach header of the output

file.

-sseettuuiiddssaaffee

Sets the MHSETUIDSAFE bit in the mach header of the output file.

-iinntteerrppoossaabbllee

Indirects access to all to exported symbols when creating a dynamic library.

-iinniitt symbolname

The specified symbolname will be run as the first initial-

izer. Only used when creating a dynamic library.

-ssuubblliibbrraarryy libraryname

The specified dylib will be re-exported. For example the

libraryname for /usr/lib/libobjcprofile.A.dylib would be

libobjc. Only used when creating a dynamic library.

-ssuubbuummbbrreellllaa frameworkname

The specified framework will be re-exported. Only used when

creating a dynamic library.

-aalllloowwaabblleecclliieenntt name

Restricts what can link against the dynamic library being created.

-cclliieennttnnaammee name

Enables a bundle to link against a dylib that was built with

-allowableclient. The name specified must match one of the

-allowableclient names specified when the dylib was created.

-uummbbrreellllaa frameworkname

Specifies that the dylib being linked is re-exported through

an umbrella framework of the specified name.

-hheeaaddeerrppaadd size

Specifies the minimum space for future expansion of the load commands. Only useful if intend to run installnametool to alter the load commands later. Size is a hexadecimal number.

-hheeaaddeerrppaaddmmaaxxiinnssttaallllnnaammeess

Automatically adds space for future expansion of load com-

mands such that all paths could expand to MAXPATHLEN. Only

useful if intend to run installnametool to alter the load commands later. Size is a hexadecimal number.

-bbiinnddaattllooaadd

Sets a bit in the mach header of the resulting binary which

tells dyld to bind all symbols when the binary is loaded,

rather than lazily.

-ffoorrcceeffllaattnnaammeessppaaccee

Sets a bit in the mach header of the resulting binary which

tells dyld to not only use flat namespace for the binary, but

force flat namespace binding on all dylibs and bundles loaded

in the process. Can only be used when linking main executa-

bles.

-sseeccttaalliiggnn segname sectname value

The section named sectname in the segment segname will have

its alignment set to value, where value is a hexadecimal num-

ber that must be an integral power of 2.

-ssttaacckkaaddddrr address

Specifies the initial address of the stack pointer value,

where value is a hexadecimal number rounded to a page bound-

ary.

-sseeggpprroott segname maxprot initprot

Specifies the maximum and initial virtual memory protection of the named segment, name, to be max and init ,respectively.

The values for max and init are any combination of the char-

acters `r' (for read), `w' (for write), `x' (for execute) and

`-' (no access).

-sseeggaaddddrrttaabbllee filename

Specifies a file containing base addresses for dynamic libraries. Each line of the file is a hexadecimal base address followed by whitespace then the install name of the

corresponding dylib. The # character denotes a comment.

-sseeggssrreeaaddwwrriitteeaaddddrr address

Allows a dynamic library to be built where the read-only and

read-write segments are not contiguous. The address speci-

fied is a hexadecimal number that indicates the base address

for the read-write segments.

-sseeggssrreeaaddoonnllyyaaddddrr address

Allows a dynamic library to be built where the read-only and

read-write segments are not contiguous. The address speci-

fied is a hexadecimal number that indicates the base address

for the read-only segments.

-sseeggaaddddrr name address

Specifies the starting address of the segment named name to be address. The address must be a hexadecimal number that is a multiple of 4K page size.

-ddyylliibbffiillee installname:filename

Specifies that a dynamic shared library is in a different location than its standard location. Use this option when you link with a library that is dependent on a dynamic library, and the dynamic library is in a location other than its default location. installname specifies the path where the library normally resides. filename specifies the path of the library you want to use instead. For example, if you link to a library that depends upon the dynamic library libsys and

you have libsys installed in a nondefault location, you would

use this option: -dylibfile /lib/lib-

syss.A.dylib:/me/lib/libsyss.A.dylib.

-pprreebbiinndd The created output file will be in the prebound format. This

was used in Mac OS X 10.3 and earlier to improve launch per-

formance.

-wweeaakkrreeffeerreenncceemmiissmmaattcchheess treatment

Specifies what to do if a symbol is weak-imported in one

object file but not weak-imported in another. The valid

treatments are: error, weak, or non-weak. The default is

non-weak.

-rreeaaddoonnllyyrreellooccss treatment

Enables the use of relocations which will cause dyld to mod-

ify (copy-on-write) read-only pages. The compiler will nor-

mally never generate such code.

-ffoorrcceeccppuussuubbttyyppeeAALLLL

The is only applicable with -arch ppc. It tells the linker

to ignore the PowerPC cpu requirements (e.g. G3, G4 or G5) encoded in the object files and mark the resulting binary as runnable on any PowerPC cpu.

-ddyylliinnkkeerriinnssttaallllnnaammee path

Only used when building dyld.

-nnooaarrcchhwwaarrnniinnggss

Suppresses warning messages about files that have the wrong

architecture for the -arch flag

-aarrcchheerrrroorrssffaattaall

Turns into errors, warnings about files that have the wrong

architecture for the -arch flag.

-ee symbolname

Specifies the entry point of a main executable. By default

the entry name is "start" which is found in crt1.o which con-

tains the glue code need to set up and call main().

-ww Suppress all warning messages

-ffiinnaalloouuttppuutt name

Specifies the install name of a dylib if -installname is not

used. This option is used by gcc driver when it is invoked

with multiple -arch arguments.

-aarrcchhmmuullttiippllee

Specifes that the linker should augment error and warning

messages with the architecture name. This option is used by

gcc driver when it is invoked with multiple -arch arguments.

-ttwwoolleevveellnnaammeessppaacceehhiinnttss

Specifies that hints should be added to the resulting binary

that can help speed up runtime binding by dyld as long as the

libraries being linked against have not changed.

-ddoott path Create a file a file at the specified path containing a graph

of symbol dependencies. The .dot file can be viewed in GraphViz.

-kkeeeepprreellooccss

Add section based relocation records to a final linked image.

These relocations are ignored at runtime by dyld.

-wwaarrnnssttaabbss

Print a warning when the linker cannot do a BINCL/EINCL opti-

mzation because the compiler put a bad stab symbol inside a BINCL/EINCL range.

-wwaarrnnccoommmmoonnss

Print a warning whenever the a tentative definition in an object file is found and a external symbol by the same name is also found in a linked dylib. This often means that the extern keyword is missing from a variable declaration in a header file.

-rreeaaddoonnllyyssttuubbss

[i386 only] Makes the IMPORT segment of a final linked

images read-only. This option makes a program slightly more

secure in that the JMP instructions in the i386 fast stubs cannot be easily overwritten by malicious code. The downside

is the dyld must use mprotect() to temporily make the segment

writable while it is binding the stubs.

-sslloowwssttuubbss

[i386 only] Instead of using single JMP instruction stubs, the linker creates code in the TEXT segment which calls through a lazy pointer in the DATA segment.

-iinntteerrppoossaabblleelliisstt filename

The specified filename contains a list of global symbol names

that should always be accessed indirectly. For instance, if

libSystem.dylib is linked such that malloc is interposable, then calls to malloc() from within libSystem will go through

a dyld stub and could potentially indirected to an alternate

malloc. If libSystem.dylib were built without making malloc interposable then if malloc was interposed at runtime, calls

to malloc from with libSystem would be missed (not inter-

posed) because they would be direct calls.

Obsolete Options

-sseeggaalliiggnn value

All segments must be page aligned. This option is obsolete.

-sseegglliinnkkeeddiitt

Object files (MHOBJECT) with a LINKEDIT segment are no longer supported. This option is obsolete.

-nnoosseegglliinnkkeeddiitt

This is the default. This option is obsolete.

-ffvvmmlliibb Fixed VM shared libraries (MHFVMLIB) are no longer sup-

ported. This option is obsolete.

-pprreellooaadd Preload executables (MHPRELOAD) are no longer supported.

This option is obsolete.

-sseeccttoobbjjeeccttssyymmbboollss segname sectname

Adding a local label at a section start is no longer sup-

ported. This option is obsolete.

-nnooffiixxpprreebbiinnddiinngg

The MHNOFIXPREBINDING bit of machheaders has been ignored since Mac OS X 10.3.9. This option is obsolete.

-nnoopprreebbiinnddaallllttwwoolleevveellmmoodduulleess

Multi-modules in dynamic libraries have been ignored at run-

time since Mac OS X 10.4.0. This option is obsolete.

-pprreebbiinnddaallllttwwoolleevveellmmoodduulleess

Multi-modules in dynamic libraries have been ignored at run-

time since Mac OS X 10.4.0. This option is obsolete.

-pprreebbiinnddaalllloowwoovveerrllaapp

When using -prebind, the linker allows overlapping by

default, so this option is obsolete.

-nnoopprreebbiinndd LDPREBIND is no longer supported as a way to force on pre-

binding, so there no longer needs to be a command line way to override LDPREBIND. This option is obsolete.

-sseeccttddiiffffrreellooccss treatment

This option was an attempt to warn about linking .o files

compiled without -mdynamic-no-pic into a main executable, but

the false positive rate generated too much noise to make the option useful. This option is obsolete.

-rruunniinniittllaazziillyy

This option was removed in Mac OS X 10.2.

-ssiinngglleemmoodduullee

This is now the default so does not need to be specified.

-mmuullttiimmoodduullee

Multi-modules in dynamic libraries have been ignored at run-

time since Mac OS X 10.4.0. This option is obsolete.

-nnooddeeaaddssttrriippiinniittssaannddtteerrmmss

The linker never dead strips initialzation and termination routines. They are considered "roots" of the dead strip graph.

-AA basefile

Obsolete incremental load format. This option is obsolete.

-bb Used with -A option to strip base file's symbols. This

option is obsolete. Obsolete option to produce a load map.

Use -map option instead.

-SSnn Don't strip any symbols. This is the default. This option

is obsolete.

-SSii Optimize stabs debug symbols to remove duplicates. This is

the default. This option is obsolete.

-SSpp Write minimal stabs which causes the debugger to open and

read the original .o file for full stabs. This style of

debugging is obsolete in Mac OS X 10.5. This option is obso-

lete.

-XX Strip local symbols that being the 'L'. This is the default.

This option is obsolete.

-ss Completely strip the output, including removing the symbol

table. This file format variant is no longer supported. This option is obsolete.

-mm Don't treat multiple definitions as an error. This is no

longer supported. This option is obsolete.

-yysymbol Display each file in which symbol is used. This was previ-

ously used to debug where an undefined symbol was used, but the linker now automatically prints out all usages. The

-whylive option can also be used to display what kept a sym-

bol from being dead striped. This option is obsolete.

-YY number Used to control how many occurances of each symbol specifed

with -y would be shown. This option is obsolete.

-nnoommuullttiiddeeffss

Only used when linking an umbrella framework. Sets the MHNOMULTIDEFS bit in the machheader. The MHNOMULTIDEFS bit has been obsolete since Mac OS X 10.4. This option is obsolete.

-mmuullttiippllyyddeeffiinneedduunnuusseedd treatment

Previously provided a way to warn or error if any of the sym-

bol definitions in the output file matched any definitions in dynamic library being linked. This option is obsolete.

-mmuullttiippllyyddeeffiinneedd treatment

Previously provided a way to warn or error if any of the sym-

bols used from a dynamic library were also available in another linked dynamic library. This option is obsolete.

-pprriivvaatteebbuunnddllee

Previously prevented errors when -flatnamespace, -bundle,

and -bundleloader were used and the bundle contained a defi-

nition that conflicted with a symbol in the main executable. The linker no longer errors on such conflicts. This option is obsolete.

-nnooaallllllooaadd

This is the default. This option is obsolete.

-sseeggaaddddrrttaabblleeffiilleennaammee path

Use path instead of the install name of the library for matching an entry in the segaddrtable. This option is obsolete.

-sseeccttoorrddeerr segname sectname orderfile

Replaced by more general -orderfile option.

-sseeccttoorrddeerrddeettaaiill

Produced extra logging about which entries from a sectorder

entries were used. Replaced by -orderfilestatistics. This

option is obsolete.

SEE ALSO

as(1), ar(1), cc(1), nm(1), otool(1) lipo(1), arch(3), dyld(3), Mach-

O(5), strip(1), rebase(1) Darwin December 8, 2006 Darwin




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™