11 .Op Fl o Ar outputfile
15 command combines several object files and libraries, resolves references, and
16 produces an ouput file.
18 can produce a final linked image (executable, dylib, or bundle), or with the -r
19 option, produce another object file. If the -o option is not used, the output
20 file produced is named "a.out".
22 The linker accepts universal (multiple-architecture) input files, but
23 always creates a "thin" (single-architecture), standard Mach-O output file.
24 The architecture for the output file is specified using the -arch option.
25 If this option is not used,
27 attempts to determine the output architecture by examining the object
28 files in command line order. The first "thin"
29 architecture determines that of the output file. If no input
30 object file is a "thin" file, the native 32-bit architecture for the host is used.
34 is not used directly. Instead the
36 compiler driver invokes
38 The compiler driver can be passed multiple -arch options and it will create a
39 universal final linked image by invoking
41 multiple times and then running
43 merge the outputs into a universal file.
45 The object files are loaded in the order in which they are specified on the
46 command line. The segments and the sections in those segments will appear in
47 the output file in the order they are encountered in the object files being linked.
48 All zero fill sections will appear after all non-zero fill sections in their segments.
49 Sections created from files with the -sectcreate option will be laid out at after
50 sections from .o files. The use of the -order_file option will alter the layout
51 rules above, and move the symbols specified to start of their section.
53 A static library (aka static archive) is a collection of .o files with a table of contents
54 that lists the global symbols in the .o files.
56 will only pull .o files out of a static library if needed to resolve some symbol reference.
57 Unlike traditional linkers,
59 will continually search a static library while linking. There is no need to specify a static
60 library multiple times on the command line.
62 A dynamic library (aka dylib or framework) is a final linked image. Putting a dynamic
63 library on the command line causes two things: 1) The generated final linked image
64 will have encoded that it depends on that dynamic library. 2) Exported symbols from the
65 dynamic library are used to resolve references.
67 Both dynamic and static libraries are searched as they appear on the command line.
70 maintains a list of directories to search for a library or framework to use. The default
71 library search path is /usr/lib then /usr/local/lib. The -L option will add a new library search
72 path. The default framework search path is /Library/Frameworks then /System/Library/Frameworks.
73 (Note: previously, /Network/Library/Frameworks was at the end of the default path. If you need
74 that functionality, you need to explicitly add -F/Network/Library/Frameworks).
75 The -F option will a new framework search path. The -Z option will remove
76 the standard search paths. The -syslibroot option will prepend a prefix to all search
78 .Ss Two-level namespace
79 By default all references resolved to a dynamic library record the library to which
80 they were resolved. At runtime, dyld uses that information to directly resolve
81 symobls. The alternative is to use the -flat_namespace option. With flat namespace,
82 the library is not recorded. At runtime, dyld will search each dynamic library in load
83 order when resolving symbols. This is slower, but more like how other operating systems
85 .Ss Indirect dynamic libraries
86 If the command line specifies to link against dylib A, and when dylib A was built it linked
87 against dylib B, then B is considered an indirect dylib.
88 When linking for two-level namespace, ld does not look at indirect dylibs, except when
89 re-exported by a direct dylibs. On the other hand when linking for flat namespace,
90 ld does load all indirect dylibs and uses them to resolve references.
91 Even though indirect dylibs are specified via a full path,
93 first uses the specified search paths to locate each indirect dylib. If one cannot
94 be found using the search paths, the full path is used.
95 .Ss Dynamic libraries undefines
96 When linking for two-level namespace,
98 does not verify that undefines in dylibs actually
99 exist. But when linking for flat namespace,
101 does check that all undefines from all loaded dylibs have a matching definition.
102 This is sometimes used to force selected functions to be loaded from a static library.
104 .Ss Options that control the kind of output
107 The default. Produce a mach-o main executable that has file type MH_EXECUTE.
109 Produce a mach-o shared library that has file type MH_DYLIB.
111 Produce a mach-o bundle that has file type MH_BUNDLE.
113 Merges object files to produce another mach-o object file with file type MH_OBJECT.
115 Produce a mach-o dylinker that has file type MH_DYLINKER. Only used when building dyld.
117 The default. Implied by -dynamiclib, -bundle, or -execute
119 Produces a mach-o file that does not use the dyld. Only used building the kernel.
120 .It Fl arch Ar arch_name
121 Specifies which architecture (e.g. ppc, ppc64, i386, x86_64) the output file should be.
123 Specifies the name and location of the output file. If not specified, `a.out' is used.
125 .Ss Options that control libraries
128 This option tells the linker to search for libx.dylib or libx.a in the library search path.
129 If string x is of the form y.o, then that file is searched for in the same places, but without
130 prepending `lib' or appending `.a' or `.dylib' to the filename.
131 .It Fl weak-l Ns Ar x
132 This is the same as the -lx but forces the library and all references to it to be marked as weak imports.
133 That is, the library is allowed to be missing at runtime.
134 .It Fl weak_library Ar path_to_library
135 This is the same as listing a file name path to a library on the link line except that it forces the
136 library and all references to it to be marked as weak imports.
137 .It Fl reexport-l Ns Ar x
138 This is the same as the -lx but specifies that the all symbols in library x should be available to
139 clients linking to the library being created. This was previously done with a separate -sub_library option.
140 .It Fl reexport_library Ar path_to_library
141 This is the same as listing a file name path to a library on the link line and it specifies that the
142 all symbols in library path should be available to clients linking to the library being created.
143 This was previously done with a separate -sub_library option.
144 .It Fl lazy-l Ns Ar x
145 This is the same as the -lx but it is only for shared libraries and the linker
146 will construct glue code so that the shared library is not loaded until
147 the first function in it is called.
148 .It Fl lazy_library Ar path_to_library
149 This is the same as listing a file name path to a shared library on the link line
150 except that the linker will construct glue code so that the shared library is not
151 loaded until the first function in it is called.
155 to the list of directories in which to search for libraries.
156 Directories specified with -L are searched in the order they appear on the command line
157 and before the default search path.
159 Do not search the standard directories when searching for libraries and frameworks.
160 .It Fl syslibroot Ar rootdir
163 to all search paths when searching for libraries or frameworks.
164 .It Fl search_paths_first
165 By default the -lx and -weak-lx options first search for a file of the form `libx.dylib' in each directory
166 in the library search path, then a file of the form `libx.a' is searched for in the library search paths.
167 This option changes it so that in each path `libx.dylib' is searched for then `libx.a' before the
168 next path in the library search path is searched.
169 .It Fl framework Ar name[,suffix]
170 This option tells the linker to search for `name.framework/name' the framework search path.
171 If the optional suffix is specified the framework is first searched for the name with the suffix and then without
172 (e.g. look for `name.framework/name_suffix' first, if not there try `name.framework/name').
173 .It Fl weak_framework Ar name[,suffix]
174 This is the same as the -framework name[,suffix] but forces the framework and all
175 references to it to be marked as weak imports.
176 .It Fl reexport_framework Ar name[,suffix]
177 This is the same as the -framework name[,suffix] but also specifies that the
178 all symbols in that framework should be available to clients linking to the library being created.
179 This was previously done with a separate -sub_umbrella option.
180 .It Fl lazy_framework Ar name[,suffix]
181 This is the same as the -framework name[,suffix] except that the linker will
182 construct glue code so that the framework is not
183 loaded until the first function in it is called. You cannot directly access
184 data or Objective-C classes in a frameworked linked this way.
188 to the list of directories in which to search for frameworks.
189 Directories specified with -F are searched in the order they appear on the command line
190 and before the default search path.
192 Loads all members of static archive libraries.
194 Loads all members of static archive libraries that implement an Objective-C class or category.
196 .Ss Options that control additional content
198 .It Fl sectcreate Ar segname sectname file
203 is created from the contents of file
205 The combination of segname and sectname must be unique Ð there cannot already be a section (segname,sectname)
206 from any other input.
207 .It Fl filelist Ar file[,dirname]
208 Specifies that the linker should link the files listed in
210 This is an alternative to listing the files on the command line.
211 The file names are listed one per line separated only by newlines. (Spaces and tabs are assumed to be part of the file name.)
212 If the optional directory name,
214 is specified, it is prepended to each name in the list file.
215 .It Fl dtrace Ar file
216 Enables dtrace static probes when producing a final linked image. The file
218 must be a DTrace script which declares the static probes.
220 .Ss Options that control optimizations
223 Remove functions and data that are unreachable by the entry point or exported symbols.
224 .It Fl dead_strip_dylibs
225 Remove dylibs that are unreachable by the entry point or exported symbols. That is,
226 suppresses the generation of load command commands for dylibs which supplied no
227 symbols during the link. This option should not be used when linking against a dylib which
228 is required at runtime for some indirect reason such as the dylib has an important initializer.
229 .It Fl order_file Ar file
230 Alters the order in which functions and data are laid out. For each section in the output file,
231 any symbol in that section that are specified in the order file
233 is moved to the start of its section and laid out in the same order as in the order file
235 Order files are text files with one symbol name per line. Lines starting with a # are comments.
236 A symbol name may be optionally preceded with its object file leafname and a colon (e.g. foo.o:_foo).
237 This is useful for static functions/data that occur in multiple files.
238 A symbol name may also be optionally preceded with the architecture (e.g. ppc:_foo or ppc:foo.o:_foo).
239 This enables you to have one order file that works for multiple architectures.
240 Literal c-strings may be ordered by by quoting the string (e.g. "Hello, world\\n") in the order file.
241 .It Fl macosx_version_min Ar version
242 This is set to indicate the oldest Mac OS X version that that the output is to be used on. Specifying
243 a later version enables the linker to assumes features of that OS in the output file. The format of
245 is a Mac OS X version number such as 10.4 or 10.5
246 .It Fl image_base Ar address
247 Specifies the perferred load address for a dylib or bundle. The argument
249 is a hexadecimal number with an optional leading 0x. By choosing non-overlapping address for all
250 dylibs and bundles that a program loads, launch time can be improved because dyld will not need to
251 "rebase" the image (that is, adjust pointers within the image to work at the loaded address).
252 It is often easier to not use this option, but instead use the rebase(1) tool, and give it a list of dylibs.
253 It will then choose non-overlapping addresses for the list and rebase them all.
254 This option is also called -seg1addr for compatibility.
255 .It Fl no_implicit_dylibs
256 When creating a two-level namespace final linked image, normally the linker will hoist up public dylibs
257 that are implicitly linked to make the two-level namespace
258 encoding more efficient for dyld. For example, Cocoa re-exports AppKit and AppKit re-exports Foundation.
259 If you link with -framework Cocoa and use a symbol from Foundation, the linker will implicitly add a load
260 command to load Foundation and encode the symbol as coming from Foundation. If you use this option,
261 the linker will not add a load command for Foundation and encode the symbol as coming from Cocoa. Then
262 at runtime dyld will have to search Cocoa and AppKit before finding the symbol in Foundation.
264 .Ss Options when creating a dynamic library (dylib)
266 .It Fl install_name Ar name
267 Sets an internal "install path" (LC_ID_DYLIB) in a dynamic library. Any clients linked against the library
268 will record that path as the way dyld should locate this library. If this option is not specified, then
269 the -o path will be used. This option is also called -dylib_install_name for compatibility.
270 .It Fl compatibility_version Ar number
271 Specifies the compatibility version number of the library. When a library is loaded by dyld, the
272 compatibility version is checked and if the program's version is greater that the library's version, it is an error.
275 is X[.Y[.Z]] where X must be a positive non-zero number less than or equal to 65535,
276 and .Y and .Z are optional and if present must be non-negative numbers less than or equal to 255.
277 If the compatibility version number is not specified, it has a value of 0 and no checking is done when the library is used.
278 This option is also called -dylib_compatibility_version for compatibility.
279 .It Fl current_version Ar number
280 Specifies the current version number of the library. The current version of the library can be obtained
281 programmatically by the user of the library so it can determine exactly which version of the library it is using.
284 is X[.Y[.Z]] where X must be a positive non-zero number less than or equal to 65535,
285 and .Y and .Z are optional and if present must be non-negative numbers less than or equal to 255.
286 If the version number is not specified, it has a value of 0.
287 This option is also called -dylib_current_version for compatibility.
289 .Ss Options when creating a main executable
292 This makes a special kind of main executable that is position independent (PIE). On Mac OS X 10.5, the OS
293 will load a PIE at a random address each time it is executed. You cannot create a PIE from .o files compiled
294 with -mdynamic-no-pic. That means the codegen is less optimal, but the address randomization adds some
296 .It Fl pagezero_size Ar size
297 By default the linker creates an unreadable segment starting at address zero named __PAGEZERO. Its existence
298 will cause a bus error if a NULL pointer is dereferenced. The argument
300 is a hexadecimal number with an optional leading 0x. If
302 is zero, the linker will not generate a page zero segment. By default on 32-bit architectures the page zero size
303 is 4KB. On 64-bit architectures, the default size if 4GB. The ppc64 architecture has some special cases. Since Mac
304 OS X 10.4 did not support 4GB page zero programs, the default page zero size for ppc64 will be 4KB unless
305 -macosx_version_min is 10.5 or later. Also, the -mdynamic-no-pic codegen model for ppc64 will only work if the
306 code is placed in the lower 2GB of the address space, so the if the linker detects any such code, the page zero
307 size is set to 4KB and then a new unredable trailing segment is created after the code, filling up the lower 4GB.
308 .It Fl stack_size Ar size
309 Specifies the maximum stack size for the main thread in a program. Without this option a program has a 8MB stack.
312 is a hexadecimal number with an optional leading 0x. The
314 should be an even multiple of 4KB, that is the last three hexadecimal digits should be zero.
315 .It Fl allow_stack_execute
316 Marks executable so that all stacks in the task will be given stack execution privilege. This includes pthread stacks.
318 .Ss Options when creating a bundle
320 .It Fl bundle_loader Ar executable
323 that will be loading the bundle output file being linked.
324 Undefined symbols from the bundle are checked against the specified
326 like it was one of the
327 dynamic libraries the bundle was linked with.
329 .Ss Options when creating an object file
331 .It Fl keep_private_externs
332 Don't turn private external (aka visibility=hidden) symbols into static symbols,
333 but rather leave them as private external in the resulting object file.
335 Force definition of common symbols. That is, transform tentative defintions into real definitions.
337 .Ss Options that control symbol resolution
339 .It Fl exported_symbols_list Ar filename
342 contains a list of global symbol names that will remain as global symbols in the output file.
343 All other global symbols will be treated as if they were marked as __private_extern__ (aka visibility=hidden)
344 and will not be global in the output file. The symbol names listed in filename must be one per line.
345 Leading and trailing white space are not part of the symbol name.
346 Lines starting with # are ignored, as are lines with only white space.
347 Some wildcards (similar to shell file matching) are supported. The * matches zero or more characters.
348 The ? matches one character. [abc] matches one character which must be an 'a', 'b', or 'c'. [a-z] matches
349 any single lower case letter from 'a' to 'z'.
350 .It Fl exported_symbol Ar symbol
353 is added to the list of global symbols names that will remain as global symbols in the output file. This
354 option can be used multiple times. For short lists, this can be more convenient than creating a file and using
355 -exported_symbols_list.
356 .It Fl unexported_symbols_list Ar file
359 contains a list of global symbol names that will not remain as global symbols in the output file.
360 The symbols will be treated as if they were marked as __private_extern__ (aka visibility=hidden) and will not be global
361 in the output file. The symbol names listed in filename must be one per line.
362 Leading and trailing white space are not part of the symbol name.
363 Lines starting with # are ignored, as are lines with only white space.
364 Some wildcards (similar to shell file matching) are supported. The * matches zero or more characters.
365 The ? matches one character. [abc] matches one character which must be an 'a', 'b', or 'c'. [a-z] matches
366 any single lower case letter from 'a' to 'z'.
367 .It Fl unexported_symbol Ar symbol
370 is added to the list of global symbols names that will not remain as global symbols in the output file. This
371 option can be used multiple times. For short lists, this can be more convenient than creating a file and using
372 -unexported_symbols_list.
373 .It Fl alias Ar symbol_name Ar alternate_symbol_name
374 Create an alias named
375 .Ar alternate_symbol_name
378 By default the alias symbol has global visibility. This option was previous the -idef:indir option.
379 .It Fl alias_list Ar filename
382 contains a list of aliases. The symbol name and its alias are on one line, separated by whitespace.
383 Lines starting with # are ignored.
384 .It Fl flat_namespace
385 Alters how symbols are resolved at build time and runtime. With -two_levelnamespace (the default), the linker
386 only searches dylibs on the command line for symbols, and records in which dylib they were found. With -flat_namespace,
387 the linker searches all dylibs on the command line and all dylibs those original dylibs depend on. The linker
388 does not record which dylib an external symbol came from, so at runtime dyld again searches all images and uses
389 the first definition it finds. In addition, any undefines in loaded flat_namespace dylibs must be resolvable
391 .It Fl u Ar symbol_name
392 Specified that symbol
394 must be defined for the link to succeed. This is useful to force selected functions to be loaded
395 from a static library.
396 .It Fl U Ar symbol_name
397 Specified that it is ok for
399 to have no definition. With -two_levelnamespace, the resulting symbol will be marked dynamic_lookup which
400 means dyld will search all loaded images.
401 .It Fl undefined Ar treatment
402 Specifies how undefined symbols are to be treated. Options are: error, warning, suppress, or dynamic_lookup. The
407 to the runpath search path list for image being created. At runtime, dyld uses the runpath when searching
408 for dylibs whose load path begins with @rpath/.
409 .It Fl commons Ar treatment
410 Specifies how commons (aka tentative definitions) are resolved with respect to dylibs. Options are:
411 ignore_dylibs, use_dylibs, error. The default is ignore_dylibs which means the linker will turn a tentative
412 definition in an object file into a real definition and not even check dylibs for conflicts. The dylibs
413 option means the linker should check linked dylibs for definitions and use them to replace tentative definitions
414 from object files. The error option means the linker should issu an error whenever a tentative definition in an
415 object file conflicts with an external symbol in a linked dylib. See also -warn_commons.
417 .Ss Options for introspecting the linker
420 Log why each object file in a static library is loaded. That is, what symbol was needed. Also called -whyload
422 .It Fl why_live Ar symbol_name
423 Logs a chain of references to
425 Only applicable with -dead_strip .
426 It can help debug why something that you think should be dead strip removed is not removed.
427 .It Fl print_statistics
428 Logs information about the amount of memory and time the linker used.
430 Logs each file (object, archive, or dylib) the linker loads. Useful for debugging problems with search paths where the wrong library is loaded.
432 Logs just object files the linker loads.
433 .It Fl order_file_statistics
434 Logs information about the processing of a -order_file.
435 .It Fl map Ar map_file_path
436 Writes a map file to the specified path which details all symbols and their addresses in the output image.
438 .Ss Options for controling symbol table optimizations
441 Do not put debug information (STABS or DWARF) in the output file.
443 Do not put non-global symbols in the output file's symbol table. Non-global symbols are useful when debugging and
444 getting symbol names in back traces, but are not used at runtime. If -x is used with -r
445 non-global symbol names are not removed, but instead replaced with a unique, duumy name
446 that will be automatically removed when linked into a final linked image. This
447 allows dead code stripping, which uses symbols to break up code and data, to
448 work properly and provides the security of having source symbol names removed.
449 .It Fl non_global_symbols_strip_list Ar filename
452 contains a list of non-global symbol names that should be removed from the output file's symbol table. All other
453 non-global symbol names will remain in the output files symbol table. See -exported_symbols_list for syntax and use
455 .It Fl non_global_symbols_no_strip_list Ar filename
458 contains a list of non-global symbol names that should be remain in the output file's symbol table. All other
459 symbol names will be removed from the output file's symbol table. See -exported_symbols_list for syntax and use
462 .Ss Rarely used Options
465 Prints the version of the linker.
467 Do not generate an LC_UUID load command in the output file.
469 Sets the MH_ROOT_SAFE bit in the mach header of the output file.
471 Sets the MH_SETUID_SAFE bit in the mach header of the output file.
473 Indirects access to all to exported symbols when creating a dynamic library.
474 .It Fl init Ar symbol_name
475 The specified symbol_name will be run as the first initializer. Only used when creating a dynamic library.
476 .It Fl sub_library Ar library_name
477 The specified dylib will be re-exported. For example the library_name for /usr/lib/libobjc_profile.A.dylib would be libobjc.
478 Only used when creating a dynamic library.
479 .It Fl sub_umbrella Ar framework_name
480 The specified framework will be re-exported. Only used when creating a dynamic library.
481 .It Fl allowable_client Ar name
482 Restricts what can link against the dynamic library being created.
483 .It Fl client_name Ar name
484 Enables a bundle to link against a dylib that was built with -allowable_client.
485 The name specified must match one of the -allowable_client names specified when the dylib was created.
486 .It Fl umbrella Ar framework_name
487 Specifies that the dylib being linked is re-exported through an umbrella framework of the specified name.
488 .It Fl headerpad Ar size
489 Specifies the minimum space for future expansion of the load commands. Only useful if intend to run
490 install_name_tool to alter the load commands later. Size is a hexadecimal number.
491 .It Fl headerpad_max_install_names
492 Automatically adds space for future expansion of load commands such that all paths could expand to MAXPATHLEN.
493 Only useful if intend to run install_name_tool to alter the load commands later. Size is a hexadecimal number.
495 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.
496 .It Fl force_flat_namespace
497 Sets a bit in the mach header of the resulting binary which tells dyld to not only use flat namespace for the binary,
498 but force flat namespace binding on all dylibs and bundles loaded in the process. Can only be used when linking main executables.
499 .It Fl sectalign Ar segname Ar sectname Ar value
500 The section named sectname in the segment segname will have its alignment set to value, where value is a hexadecimal
501 number that must be an integral power of 2.
502 .It Fl stack_addr Ar address
503 Specifies the initial address of the stack pointer value, where value is a hexadecimal number rounded to a page boundary.
504 .It Fl segprot Ar segname Ar max_prot Ar init_prot
505 Specifies the maximum and initial virtual memory protection of the named segment, name, to be max and init ,respectively.
506 The values for max and init are any combination of the characters `r' (for read), `w' (for write), `x' (for execute) and `-' (no access).
507 .It Fl seg_addr_table Ar filename
508 Specifies a file containing base addresses for dynamic libraries. Each line of the file is a hexadecimal base address
509 followed by whitespace then the install name of the corresponding dylib. The # character denotes a comment.
510 .It Fl segs_read_write_addr Ar address
511 Allows a dynamic library to be built where the read-only and read-write segments are not contiguous. The address
512 specified is a hexadecimal number that indicates the base address for the read-write segments.
513 .It Fl segs_read_only_addr Ar address
514 Allows a dynamic library to be built where the read-only and read-write segments are not contiguous. The address
515 specified is a hexadecimal number that indicates the base address for the read-only segments.
516 .It Fl segaddr Ar name Ar address
517 Specifies the starting address of the segment named name to be address. The address must be a hexadecimal number
518 that is a multiple of 4K page size.
519 .It Fl dylib_file Ar install_name:file_name
520 Specifies that a dynamic shared library is in a different location than its standard location. Use this option
521 when you link with a library that is dependent on a dynamic library, and the dynamic library is in a location other
522 than its default location. install_name specifies the path where the library normally resides. file_name specifies
523 the path of the library you want to use instead. For example, if you link to a library that depends upon the dynamic
524 library libsys and you have libsys installed in a nondefault location, you would use this option:
525 -dylib_file /lib/libsys_s.A.dylib:/me/lib/libsys_s.A.dylib.
527 The created output file will be in the prebound format. This was used in Mac OS X 10.3 and earlier to improve launch performance.
528 .It Fl weak_reference_mismatches Ar treatment
529 Specifies what to do if a symbol is weak-imported in one object file but not weak-imported in another. The valid
530 treatments are: error, weak, or non-weak. The default is non-weak.
531 .It Fl read_only_relocs Ar treatment
532 Enables the use of relocations which will cause dyld to modify (copy-on-write) read-only pages. The compiler will
533 normally never generate such code.
534 .It Fl force_cpusubtype_ALL
535 The is only applicable with -arch ppc. It tells the linker to ignore the PowerPC cpu requirements (e.g. G3, G4 or G5) encoded
536 in the object files and mark the resulting binary as runnable on any PowerPC cpu.
537 .It Fl dylinker_install_name Ar path
538 Only used when building dyld.
539 .It Fl no_arch_warnings
540 Suppresses warning messages about files that have the wrong architecture for the -arch flag
541 .It Fl arch_errors_fatal
542 Turns into errors, warnings about files that have the wrong architecture for the -arch flag.
543 .It Fl e Ar symbol_name
544 Specifies the entry point of a main executable. By default the entry name is "start" which is found in crt1.o which contains
545 the glue code need to set up and call main().
547 Suppress all warning messages
548 .It Fl final_output Ar name
549 Specifies the install name of a dylib if -install_name is not used. This option is used by gcc driver when it is invoked
550 with multiple -arch arguments.
552 Specifes that the linker should augment error and warning messages with the architecture name. This option is used by gcc
553 driver when it is invoked with multiple -arch arguments.
554 .It Fl twolevel_namespace_hints
555 Specifies that hints should be added to the resulting binary that can help speed up runtime binding by dyld as long as the
556 libraries being linked against have not changed.
558 Create a file a file at the specified path containing a graph of symbol dependencies. The .dot file can be viewed in GraphViz.
560 Add section based relocation records to a final linked image. These relocations are ignored at runtime by dyld.
562 Print a warning when the linker cannot do a BINCL/EINCL optimzation because the compiler put a bad stab symbol inside
565 Print a warning whenever the a tentative definition in an object file is found and a external symbol by the same name
566 is also found in a linked dylib. This often means that the extern keyword is missing from a variable declaration
568 .It Fl read_only_stubs
569 [i386 only] Makes the __IMPORT segment of a final linked images read-only. This option makes a program slightly more
570 secure in that the JMP instructions in the i386 fast stubs cannot be easily overwritten by malicious code. The downside
571 is the dyld must use mprotect() to temporily make the segment writable while it is binding the stubs.
573 [i386 only] Instead of using single JMP instruction stubs, the linker creates code in the __TEXT segment which
574 calls through a lazy pointer in the __DATA segment.
575 .It Fl interposable_list Ar filename
578 contains a list of global symbol names that should always be accessed indirectly. For instance, if libSystem.dylib
579 is linked such that _malloc is interposable, then calls to malloc() from within libSystem will go through a dyld
580 stub and could potentially indirected to an alternate malloc. If libSystem.dylib were built without making _malloc
581 interposable then if _malloc was interposed at runtime, calls to malloc from with libSystem would be missed
582 (not interposed) because they would be direct calls.
586 .It Fl segalign Ar value
587 All segments must be page aligned. This option is obsolete.
589 Object files (MH_OBJECT) with a LINKEDIT segment are no longer supported. This option is obsolete.
591 This is the default. This option is obsolete.
593 Fixed VM shared libraries (MH_FVMLIB) are no longer supported. This option is obsolete.
595 Preload executables (MH_PRELOAD) are no longer supported. This option is obsolete.
596 .It Fl sectobjectsymbols Ar segname Ar sectname
597 Adding a local label at a section start is no longer supported. This option is obsolete.
598 .It Fl nofixprebinding
599 The MH_NOFIXPREBINDING bit of mach_headers has been ignored since Mac OS X 10.3.9. This option is obsolete.
600 .It Fl noprebind_all_twolevel_modules
601 Multi-modules in dynamic libraries have been ignored at runtime since Mac OS X 10.4.0. This option is obsolete.
602 .It Fl prebind_all_twolevel_modules
603 Multi-modules in dynamic libraries have been ignored at runtime since Mac OS X 10.4.0. This option is obsolete.
604 .It Fl prebind_allow_overlap
605 When using -prebind, the linker allows overlapping by default, so this option is obsolete.
607 LD_PREBIND is no longer supported as a way to force on prebinding, so there no longer needs to
608 be a command line way to override LD_PREBIND. This option is obsolete.
609 .It Fl sect_diff_relocs Ar treatment
610 This option was an attempt to warn about linking .o files compiled without -mdynamic-no-pic into
611 a main executable, but the false positive rate generated too much noise to make the option useful.
612 This option is obsolete.
613 .It Fl run_init_lazily
614 This option was removed in Mac OS X 10.2.
616 This is now the default so does not need to be specified.
618 Multi-modules in dynamic libraries have been ignored at runtime since Mac OS X 10.4.0. This option is obsolete.
619 .It Fl no_dead_strip_inits_and_terms
620 The linker never dead strips initialzation and termination routines. They are considered "roots" of the dead strip graph.
622 Obsolete incremental load format. This option is obsolete.
624 Used with -A option to strip base file's symbols. This option is obsolete.
626 Obsolete option to produce a load map. Use -map option instead.
628 Don't strip any symbols. This is the default. This option is obsolete.
630 Optimize stabs debug symbols to remove duplicates. This is the default. This option is obsolete.
632 Write minimal stabs which causes the debugger to open and read the original .o file for full stabs.
633 This style of debugging is obsolete in Mac OS X 10.5. This option is obsolete.
635 Strip local symbols that being the 'L'. This is the default. This option is obsolete.
637 Completely strip the output, including removing the symbol table. This file format variant is no longer supported.
638 This option is obsolete.
640 Don't treat multiple definitions as an error. This is no longer supported. This option is obsolete.
642 Display each file in which
644 is used. This was previously used to debug where an undefined symbol was used, but the linker now
645 automatically prints out all usages. The -why_live option can also be used to display what kept
646 a symbol from being dead striped. This option is obsolete.
648 Used to control how many occurances of each symbol specifed with -y would be shown. This option is obsolete.
650 Only used when linking an umbrella framework. Sets the MH_NOMULTIDEFS bit in the mach_header. The MH_NOMULTIDEFS
651 bit has been obsolete since Mac OS X 10.4. This option is obsolete.
652 .It Fl multiply_defined_unused Ar treatment
653 Previously provided a way to warn or error if any of the symbol definitions in the output file matched any
654 definitions in dynamic library being linked. This option is obsolete.
655 .It Fl multiply_defined Ar treatment
656 Previously provided a way to warn or error if any of the symbols used from a dynamic library were also
657 available in another linked dynamic library. This option is obsolete.
658 .It Fl private_bundle
659 Previously prevented errors when -flat_namespace, -bundle, and -bundle_loader were used and the bundle
660 contained a definition that conflicted with a symbol in the main executable. The linker no longer
661 errors on such conflicts. This option is obsolete.
663 This is the default. This option is obsolete.
664 .It Fl seg_addr_table_filename Ar path
667 instead of the install name of the library for matching an entry in the seg_addr_table. This option is obsolete.
668 .It Fl sectorder Ar segname sectname orderfile
669 Replaced by more general -order_file option.
670 .It Fl sectorder_detail
671 Produced extra logging about which entries from a sectorder entries were used. Replaced by -order_file_statistics.
672 This option is obsolete.
675 as(1), ar(1), cc(1), nm(1), otool(1) lipo(1),
676 arch(3), dyld(3), Mach-O(5), strip(1), rebase(1)