Print this page
Code review comments from jeffpc
7029 want per-process exploit mitigation features (secflags)
7030 want basic address space layout randomization (aslr)
7031 noexec_user_stack should be a secflag
7032 want a means to forbid mappings around NULL.
   1 LD(1)                            User Commands                           LD(1)
   2 
   3 
   4 
   5 NAME
   6        ld - link-editor for object files
   7 
   8 SYNOPSIS
   9        ld [-32 | -64] [-a | -r] [-b] [-Bdirect | nodirect]
  10        [-B dynamic | static] [-B eliminate] [-B group] [-B local]
  11        [-B reduce] [-B symbolic] [-c name] [-C] [-d y | n]
  12        [-D token,...] [-e epsym] [-f name | -F name] [-G] [-h name]
  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 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


 579            undefined references and to promote tentative definitions with data
 580            definitions. Weak symbol references do not trigger extraction.
 581            Under the -z allextract or --whole-archive options, all archive
 582            members are extracted from the archive. Under -z weakextract, weak
 583            references trigger archive extraction. The -z defaultextract or
 584            --no-whole-archive options provide a means of returning to the
 585            default following use of the former extract options. See Archive
 586            Processing in Linker and Libraries Guide.
 587 
 588 
 589        -z altexec64
 590 
 591            Execute the 64-bit ld. The creation of very large 32-bit objects
 592            can exhaust the virtual memory that is available to the 32-bit ld.
 593            The -z altexec64 option can be used to force the use of the
 594            associated 64-bit ld. The 64-bit ld provides a larger virtual
 595            address space for building 32-bit objects. See The 32-bit link-
 596            editor and 64-bit link-editor in Linker and Libraries Guide.
 597 
 598 












 599        -z combreloc | nocombreloc
 600 
 601            By default, ld combines multiple relocation sections when building
 602            executables or shared objects. This section combination differs
 603            from relocatable objects, in which relocation sections are
 604            maintained in a one-to-one relationship with the sections to which
 605            the relocations must be applied. The -z nocombreloc option disables
 606            this merging of relocation sections, and preserves the one-to-one
 607            relationship found in the original relocatable objects.
 608 
 609            ld sorts the entries of data relocation sections by their symbol
 610            reference. This sorting reduces runtime symbol lookup. When
 611            multiple relocation sections are combined, this sorting produces
 612            the least possible relocation overhead when objects are loaded into
 613            memory, and speeds the runtime loading of dynamic objects.
 614 
 615            Historically, the individual relocation sections were carried over
 616            to any executable or shared object, and the -z combreloc option was
 617            required to enable the relocation section merging previously
 618            described.  Relocation section merging is now the default. The -z


1293        accessing the old file contents to continue running. If the old file
1294        has no other links, the disk space of the removed file is freed when
1295        the last process referencing the file terminates.
1296 
1297 
1298        The behavior of ld when the file being created already exists was
1299        changed with SXCE build 43. In older versions, the existing file was
1300        rewritten in place, an approach with the potential to corrupt any
1301        running processes that is using the file. This change has an
1302        implication for output files that have multiple hard links in the file
1303        system. Previously, all links would remain intact, with all links
1304        accessing the new file contents. The new ld behavior breaks such links,
1305        with the result that only the specified output file name references the
1306        new file. All the other links continue to reference the old file. To
1307        ensure consistent behavior, applications that rely on multiple hard
1308        links to linker output files should explicitly remove and relink the
1309        other file names.
1310 
1311 
1312 
1313                               September 10, 2013                         LD(1)
   1 LD(1)                            User Commands                           LD(1)
   2 
   3 
   4 
   5 NAME
   6        ld - link-editor for object files
   7 
   8 SYNOPSIS
   9        ld [-32 | -64] [-a | -r] [-b] [-Bdirect | nodirect]
  10        [-B dynamic | static] [-B eliminate] [-B group] [-B local]
  11        [-B reduce] [-B symbolic] [-c name] [-C] [-d y | n]
  12        [-D token,...] [-e epsym] [-f name | -F name] [-G] [-h name]
  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


 579            undefined references and to promote tentative definitions with data
 580            definitions. Weak symbol references do not trigger extraction.
 581            Under the -z allextract or --whole-archive options, all archive
 582            members are extracted from the archive. Under -z weakextract, weak
 583            references trigger archive extraction. The -z defaultextract or
 584            --no-whole-archive options provide a means of returning to the
 585            default following use of the former extract options. See Archive
 586            Processing in Linker and Libraries Guide.
 587 
 588 
 589        -z altexec64
 590 
 591            Execute the 64-bit ld. The creation of very large 32-bit objects
 592            can exhaust the virtual memory that is available to the 32-bit ld.
 593            The -z altexec64 option can be used to force the use of the
 594            associated 64-bit ld. The 64-bit ld provides a larger virtual
 595            address space for building 32-bit objects. See The 32-bit link-
 596            editor and 64-bit link-editor in Linker and Libraries Guide.
 597 
 598 
 599        -z aslr[=state]
 600 
 601            Specify whether the executable's address space should be randomized
 602            on execution.  If state is "enabled" randomization will always
 603            occur when this executable is run (regardless of inherited
 604            settings).  If state is "disabled" randomization will never occur
 605            when this executable is run.  If state is omitted, ASLR is enabled.
 606 
 607            An executable that should simply use the settings inherited from
 608            its environment should not use this flag at all.
 609 
 610 
 611        -z combreloc | nocombreloc
 612 
 613            By default, ld combines multiple relocation sections when building
 614            executables or shared objects. This section combination differs
 615            from relocatable objects, in which relocation sections are
 616            maintained in a one-to-one relationship with the sections to which
 617            the relocations must be applied. The -z nocombreloc option disables
 618            this merging of relocation sections, and preserves the one-to-one
 619            relationship found in the original relocatable objects.
 620 
 621            ld sorts the entries of data relocation sections by their symbol
 622            reference. This sorting reduces runtime symbol lookup. When
 623            multiple relocation sections are combined, this sorting produces
 624            the least possible relocation overhead when objects are loaded into
 625            memory, and speeds the runtime loading of dynamic objects.
 626 
 627            Historically, the individual relocation sections were carried over
 628            to any executable or shared object, and the -z combreloc option was
 629            required to enable the relocation section merging previously
 630            described.  Relocation section merging is now the default. The -z


1305        accessing the old file contents to continue running. If the old file
1306        has no other links, the disk space of the removed file is freed when
1307        the last process referencing the file terminates.
1308 
1309 
1310        The behavior of ld when the file being created already exists was
1311        changed with SXCE build 43. In older versions, the existing file was
1312        rewritten in place, an approach with the potential to corrupt any
1313        running processes that is using the file. This change has an
1314        implication for output files that have multiple hard links in the file
1315        system. Previously, all links would remain intact, with all links
1316        accessing the new file contents. The new ld behavior breaks such links,
1317        with the result that only the specified output file name references the
1318        new file. All the other links continue to reference the old file. To
1319        ensure consistent behavior, applications that rely on multiple hard
1320        links to linker output files should explicitly remove and relink the
1321        other file names.
1322 
1323 
1324 
1325                                  June 6, 2016                            LD(1)