Print this page
ld: implement -ztype and rework option parsing


  13        [-i] [-I name] [-l x] [-L path] [-m] [-M mapfile]
  14        [-N string] [-o outfile] [-p auditlib] [-P auditlib]
  15        [-Q y | n] [-R path] [-s] [-S supportlib] [-t]
  16        [-u symname] [-V] [-Y P,dirlist] [-z absexec]
  17        [-z allextract | defaultextract | weakextract ] [-z altexec64]
  18        [-z aslr[=state]] [-z assert-deflib] [ -z assert-deflib=libname]
  19        [-z combreloc | nocombreloc ] [-z defs | nodefs]
  20        [-z direct | nodirect] [-z endfiltee]
  21        [-z fatal-warnings | nofatal-warnings ] [-z finiarray=function]
  22        [-z globalaudit] [-z groupperm | nogroupperm]
  23        [-z guidance[=id1,id2...] [-z help ]
  24        [-z ignore | record] [-z initarray=function] [-z initfirst]
  25        [-z interpose] [-z lazyload | nolazyload]
  26        [-z ld32=arg1,arg2,...] [-z ld64=arg1,arg2,...]
  27        [-z loadfltr] [-z muldefs] [-z nocompstrtab] [-z nodefaultlib]
  28        [-z nodelete] [-z nodlopen] [-z nodump] [-z noldynsym]
  29        [-z nopartial] [-z noversion] [-z now] [-z origin]
  30        [-z preinitarray=function] [-z redlocsym] [-z relaxreloc]
  31        [-z rescan-now] [-z recan] [-z rescan-start ... -z rescan-end]]
  32        [-z target=sparc|x86] [-z text | textwarn | textoff]

  33        [-z verbose] [-z wrap=symbol] filename...
  34 
  35 
  36 DESCRIPTION
  37        The link-editor, ld, combines relocatable object files by resolving
  38        symbol references to symbol definitions, together with performing
  39        relocations.  ld operates in two modes, static or dynamic, as governed
  40        by the -d option. In all cases, the output of ld is left in the file
  41        a.out by default. See NOTES.
  42 
  43 
  44        In dynamic mode, -dy, the default, relocatable object files that are
  45        provided as arguments are combined to produce an executable object
  46        file. This file is linked at execution with any shared object files
  47        that are provided as arguments. If the -G option is specified,
  48        relocatable object files are combined to produce a shared object.
  49        Without the -G option, a dynamic executable is created.
  50 
  51 
  52        In static mode, -dn, relocatable object files that are provided as


1091            reasons, this mode is not the default when building an executable
1092            or shared object. However, its use is recommended to ensure that
1093            the text segment of the dynamic object being built is shareable
1094            between multiple running processes. A shared text segment incurs
1095            the least relocation overhead when loaded into memory. See
1096            Position-Independent Code in Linker and Libraries Guide.
1097 
1098 
1099        -z textoff
1100 
1101            In dynamic mode only, allows relocations against all allocatable
1102            sections, including non-writable ones. This mode is the default
1103            when building a shared object.
1104 
1105 
1106        -z textwarn
1107 
1108            In dynamic mode only, lists a warning if any relocations against
1109            non-writable, allocatable sections remain. This mode is the default
1110            when building an executable.

























1111 
1112 
1113        -z verbose
1114 
1115            This option provides additional warning diagnostics during a link-
1116            edit.  Presently, this option conveys suspicious use of
1117            displacement relocations. This option also conveys the restricted
1118            use of static TLS relocations when building shared objects. In
1119            future, this option might be enhanced to provide additional
1120            diagnostics that are deemed too noisy to be generated by default.
1121 
1122 
1123        -zwrap=symbol
1124        -wrap= symbol
1125        --wrap= symbol
1126 
1127            Rename undefined references to symbol in order to allow wrapper
1128            code to be linked into the output object without having to modify
1129            source code. When -z wrap is specified, all undefined references to
1130            symbol are modified to reference __wrap_symbol, and all references




  13        [-i] [-I name] [-l x] [-L path] [-m] [-M mapfile]
  14        [-N string] [-o outfile] [-p auditlib] [-P auditlib]
  15        [-Q y | n] [-R path] [-s] [-S supportlib] [-t]
  16        [-u symname] [-V] [-Y P,dirlist] [-z absexec]
  17        [-z allextract | defaultextract | weakextract ] [-z altexec64]
  18        [-z aslr[=state]] [-z assert-deflib] [ -z assert-deflib=libname]
  19        [-z combreloc | nocombreloc ] [-z defs | nodefs]
  20        [-z direct | nodirect] [-z endfiltee]
  21        [-z fatal-warnings | nofatal-warnings ] [-z finiarray=function]
  22        [-z globalaudit] [-z groupperm | nogroupperm]
  23        [-z guidance[=id1,id2...] [-z help ]
  24        [-z ignore | record] [-z initarray=function] [-z initfirst]
  25        [-z interpose] [-z lazyload | nolazyload]
  26        [-z ld32=arg1,arg2,...] [-z ld64=arg1,arg2,...]
  27        [-z loadfltr] [-z muldefs] [-z nocompstrtab] [-z nodefaultlib]
  28        [-z nodelete] [-z nodlopen] [-z nodump] [-z noldynsym]
  29        [-z nopartial] [-z noversion] [-z now] [-z origin]
  30        [-z preinitarray=function] [-z redlocsym] [-z relaxreloc]
  31        [-z rescan-now] [-z recan] [-z rescan-start ... -z rescan-end]]
  32        [-z target=sparc|x86] [-z text | textwarn | textoff]
  33        [-z type=exec|kmod|reloc|shared]
  34        [-z verbose] [-z wrap=symbol] filename...
  35 
  36 
  37 DESCRIPTION
  38        The link-editor, ld, combines relocatable object files by resolving
  39        symbol references to symbol definitions, together with performing
  40        relocations.  ld operates in two modes, static or dynamic, as governed
  41        by the -d option. In all cases, the output of ld is left in the file
  42        a.out by default. See NOTES.
  43 
  44 
  45        In dynamic mode, -dy, the default, relocatable object files that are
  46        provided as arguments are combined to produce an executable object
  47        file. This file is linked at execution with any shared object files
  48        that are provided as arguments. If the -G option is specified,
  49        relocatable object files are combined to produce a shared object.
  50        Without the -G option, a dynamic executable is created.
  51 
  52 
  53        In static mode, -dn, relocatable object files that are provided as


1092            reasons, this mode is not the default when building an executable
1093            or shared object. However, its use is recommended to ensure that
1094            the text segment of the dynamic object being built is shareable
1095            between multiple running processes. A shared text segment incurs
1096            the least relocation overhead when loaded into memory. See
1097            Position-Independent Code in Linker and Libraries Guide.
1098 
1099 
1100        -z textoff
1101 
1102            In dynamic mode only, allows relocations against all allocatable
1103            sections, including non-writable ones. This mode is the default
1104            when building a shared object.
1105 
1106 
1107        -z textwarn
1108 
1109            In dynamic mode only, lists a warning if any relocations against
1110            non-writable, allocatable sections remain. This mode is the default
1111            when building an executable.
1112 
1113 
1114        -z type=exec|kmod|reloc|shared
1115 
1116            Specifies the type of object to create.
1117 
1118 
1119            exec
1120 
1121                Dynamic executable
1122 
1123 
1124            reloc
1125 
1126                Relocatable object
1127 
1128 
1129            shared
1130 
1131                Dynamic shared object
1132 
1133 
1134            kmod
1135 
1136                illumos kernel module
1137 
1138 
1139        -z verbose
1140 
1141            This option provides additional warning diagnostics during a link-
1142            edit.  Presently, this option conveys suspicious use of
1143            displacement relocations. This option also conveys the restricted
1144            use of static TLS relocations when building shared objects. In
1145            future, this option might be enhanced to provide additional
1146            diagnostics that are deemed too noisy to be generated by default.
1147 
1148 
1149        -zwrap=symbol
1150        -wrap= symbol
1151        --wrap= symbol
1152 
1153            Rename undefined references to symbol in order to allow wrapper
1154            code to be linked into the output object without having to modify
1155            source code. When -z wrap is specified, all undefined references to
1156            symbol are modified to reference __wrap_symbol, and all references