Print this page
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.

Split Close
Expand all
Collapse all
          --- old/usr/src/man/man1/ld.1
          +++ new/usr/src/man/man1/ld.1
↓ open down ↓ 12 lines elided ↑ open up ↑
  13   13  .nf
  14   14  \fBld\fR [\fB-32\fR | \fB-64\fR] [\fB-a\fR | \fB-r\fR] [\fB-b\fR] [\fB-B\fRdirect | nodirect]
  15   15  [\fB-B\fR dynamic | static] [\fB-B\fR eliminate] [\fB-B\fR group] [\fB-B\fR local]
  16   16  [\fB-B\fR reduce] [\fB-B\fR symbolic] [\fB-c\fR \fIname\fR] [\fB-C\fR] [\fB-d\fR y | n]
  17   17  [\fB-D\fR \fItoken\fR,...] [\fB-e\fR \fIepsym\fR] [\fB-f\fR \fIname\fR | \fB-F\fR \fIname\fR] [\fB-G\fR] [\fB-h\fR \fIname\fR]
  18   18  [\fB-i\fR] [\fB-I\fR \fIname\fR] [\fB-l\fR \fIx\fR] [\fB-L\fR \fIpath\fR] [\fB-m\fR] [\fB-M\fR \fImapfile\fR]
  19   19  [\fB-N\fR \fIstring\fR] [\fB-o\fR \fIoutfile\fR] [\fB-p\fR \fIauditlib\fR] [\fB-P\fR \fIauditlib\fR]
  20   20  [\fB-Q\fR y | n] [\fB-R\fR \fIpath\fR] [\fB-s\fR] [\fB-S\fR \fIsupportlib\fR] [\fB-t\fR]
  21   21  [\fB-u\fR \fIsymname\fR] [\fB-V\fR] [\fB-Y P\fR\fI,dirlist\fR] [\fB-z\fR absexec]
  22   22  [\fB-z\fR allextract | defaultextract | weakextract ] [\fB-z\fR altexec64]
  23      -[\fB-z\fR assert-deflib ] [ \fB-z\fR assert-deflib=\fIlibname\fR ]
       23 +[\fB-z\fR aslr[=\fIstate\fR]] [\fB-z\fR assert-deflib] [ \fB-z\fR assert-deflib=\fIlibname\fR]
  24   24  [\fB-z\fR combreloc | nocombreloc ] [\fB-z\fR defs | nodefs]
  25   25  [\fB-z\fR direct | nodirect] [\fB-z\fR endfiltee]
  26   26  [\fB-z\fR fatal-warnings | nofatal-warnings ] [\fB-z\fR finiarray=\fIfunction\fR]
  27   27  [\fB-z\fR globalaudit] [\fB-z\fR groupperm | nogroupperm] 
  28   28  [\fB-z\fR guidance[=\fIid1\fR,\fIid2\fR...] [\fB-z\fR help ]
  29   29  [\fB-z\fR ignore | record] [\fB-z\fR initarray=\fIfunction\fR] [\fB-z\fR initfirst]
  30   30  [\fB-z\fR interpose] [\fB-z\fR lazyload | nolazyload]
  31   31  [\fB-z\fR ld32=\fIarg1\fR,\fIarg2\fR,...] [\fB-z\fR ld64=\fIarg1\fR,\fIarg2\fR,...]
  32   32  [\fB-z\fR loadfltr] [\fB-z\fR muldefs] [\fB-z\fR nocompstrtab] [\fB-z\fR nodefaultlib]
  33   33  [\fB-z\fR nodelete] [\fB-z\fR nodlopen] [\fB-z\fR nodump] [\fB-z\fR noldynsym]
  34   34  [\fB-z\fR nopartial] [\fB-z\fR noversion] [\fB-z\fR now] [\fB-z\fR origin]
  35   35  [\fB-z\fR preinitarray=\fIfunction\fR] [\fB-z\fR redlocsym] [\fB-z\fR relaxreloc]
  36   36  [\fB-z\fR rescan-now] [\fB-z\fR recan] [\fB-z\fR rescan-start \fI\&...\fR \fB-z\fR rescan-end]]
  37   37  [\fB-z\fR target=sparc|x86] [\fB-z\fR text | textwarn | textoff]
  38   38  [\fB-z\fR verbose] [\fB-z\fR wrap=\fIsymbol\fR] \fIfilename\fR...
  39   39  .fi
  40   40  
  41   41  .SH DESCRIPTION
  42      -.sp
  43   42  .LP
  44   43  The link-editor, \fBld\fR, combines relocatable object files by resolving
  45   44  symbol references to symbol definitions, together with performing relocations.
  46   45  \fBld\fR operates in two modes, static or dynamic, as governed by the \fB-d\fR
  47   46  option. In all cases, the output of \fBld\fR is left in the file \fBa.out\fR by
  48   47  default. See NOTES.
  49   48  .sp
  50   49  .LP
  51   50  In dynamic mode, \fB-dy\fR, the default, relocatable object files that are
  52   51  provided as arguments are combined to produce an executable object file. This
↓ open down ↓ 44 lines elided ↑ open up ↑
  97   96  .sp
  98   97  .LP
  99   98  \fBld\fR is a cross link-editor, able to link 32-bit objects or 64-bit objects,
 100   99  for Sparc or x86 targets. \fBld\fR uses the \fBELF\fR class and machine type of
 101  100  the first relocatable object on the command line to govern the mode in which to
 102  101  operate. The mixing of 32-bit objects and 64-bit objects is not permitted.
 103  102  Similarly, only objects of a single machine type are allowed. See the
 104  103  \fB-32\fR, \fB-64\fR and \fB-z target\fR options, and the \fBLD_NOEXEC_64\fR
 105  104  environment variable.
 106  105  .SS "Static Executables"
 107      -.sp
 108  106  .LP
 109  107  The creation of static executables has been discouraged for many releases. In
 110  108  fact, 64-bit system archive libraries have never been provided. Because a
 111  109  static executable is built against system archive libraries, the executable
 112  110  contains system implementation details. This self-containment has a number of
 113  111  drawbacks.
 114  112  .RS +4
 115  113  .TP
 116  114  .ie t \(bu
 117  115  .el o
↓ open down ↓ 15 lines elided ↑ open up ↑
 133  131  performance.
 134  132  .RE
 135  133  .sp
 136  134  .LP
 137  135  With Solaris 10, 32-bit system archive libraries are no longer provided.
 138  136  Without these libraries, specifically \fBlibc.a\fR, the creation of static
 139  137  executables is no longer achievable without specialized system knowledge.
 140  138  However, the capability of \fBld\fR to process static linking options, and the
 141  139  processing of archive libraries, remains unchanged.
 142  140  .SH OPTIONS
 143      -.sp
 144  141  .LP
 145  142  The following options are supported.
 146  143  .sp
 147  144  .ne 2
 148  145  .na
 149  146  \fB\fB-32\fR | \fB-64\fR\fR
 150  147  .ad
 151  148  .sp .6
 152  149  .RS 4n
 153  150  Creates a 32-bit, or 64-bit object.
↓ open down ↓ 684 lines elided ↑ open up ↑
 838  835  exhaust the virtual memory that is available to the 32-bit \fBld\fR. The
 839  836  \fB-z\fR \fBaltexec64\fR option can be used to force the use of the associated
 840  837  64-bit \fBld\fR. The 64-bit \fBld\fR provides a larger virtual address space
 841  838  for building 32-bit objects. See \fIThe 32-bit link-editor and 64-bit
 842  839  link-editor\fR in \fILinker and Libraries Guide\fR.
 843  840  .RE
 844  841  
 845  842  .sp
 846  843  .ne 2
 847  844  .na
      845 +\fB-z\fR \fBaslr[=\fIstate\fR]\fR
      846 +.ad
      847 +.sp .6
      848 +.RS 4n
      849 +Specify whether the executable's address space should be randomized on
      850 +execution.  If \fIstate\fR is "enabled" randomization will always occur when
      851 +this executable is run (regardless of inherited settings).  If \fIstate\fR is
      852 +"disabled" randomization will never occur when this executable is run.  If
      853 +\fIstate\fR is omitted, ASLR is enabled.
      854 +
      855 +An executable that should simply use the settings inherited from its
      856 +environment should not use this flag at all.
      857 +.RE
      858 +
      859 +.sp
      860 +.ne 2
      861 +.na
 848  862  \fB\fB-z\fR \fBcombreloc\fR | \fBnocombreloc\fR\fR
 849  863  .ad
 850  864  .sp .6
 851  865  .RS 4n
 852  866  By default, \fBld\fR combines multiple relocation sections when building
 853  867  executables or shared objects. This section combination differs from
 854  868  relocatable objects, in which relocation sections are maintained in a
 855  869  one-to-one relationship with the sections to which the relocations must be
 856  870  applied. The \fB-z\fR \fBnocombreloc\fR option disables this merging of
 857  871  relocation sections, and preserves the one-to-one relationship found in the
↓ open down ↓ 764 lines elided ↑ open up ↑
1622 1636  \fB__wrap_malloc\fR instead. The call to \fB__real_malloc\fR will call the real
1623 1637  \fBmalloc\fR function.
1624 1638  .sp
1625 1639  The real and wrapped functions should be maintained in separate source files.
1626 1640  Otherwise, the compiler or assembler may resolve the call instead of leaving
1627 1641  that operation for the link-editor to carry out, and prevent the wrap from
1628 1642  occurring.
1629 1643  .RE
1630 1644  
1631 1645  .SH ENVIRONMENT VARIABLES
1632      -.sp
1633 1646  .ne 2
1634 1647  .na
1635 1648  \fB\fBLD_ALTEXEC\fR\fR
1636 1649  .ad
1637 1650  .sp .6
1638 1651  .RS 4n
1639 1652  An alternative link-editor path name. \fBld\fR executes, and passes control to
1640 1653  this alternative link-editor. This environment variable provides a generic
1641 1654  means of overriding the default link-editor that is called from the various
1642 1655  compiler drivers. See the \fB-z altexec64\fR option.
↓ open down ↓ 108 lines elided ↑ open up ↑
1751 1764  \fBld\fR and overrides any non-suffixed version of the environment variable
1752 1765  that is in effect. See the \fB-S\fR option.
1753 1766  .RE
1754 1767  
1755 1768  .sp
1756 1769  .LP
1757 1770  Notice that environment variable-names that begin with the
1758 1771  characters '\fBLD_\fR' are reserved for possible future enhancements to \fBld\fR and
1759 1772  \fBld.so.1\fR(1).
1760 1773  .SH FILES
1761      -.sp
1762 1774  .ne 2
1763 1775  .na
1764 1776  \fB\fBlib\fIx\fR.so\fR\fR
1765 1777  .ad
1766 1778  .RS 15n
1767 1779  shared object libraries.
1768 1780  .RE
1769 1781  
1770 1782  .sp
1771 1783  .ne 2
↓ open down ↓ 29 lines elided ↑ open up ↑
1801 1813  .na
1802 1814  \fB\fB/usr/lib/ld\fR\fR
1803 1815  .ad
1804 1816  .RS 15n
1805 1817  A directory containing several \fBmapfiles\fR that can be used during
1806 1818  link-editing. These \fBmapfiles\fR provide various capabilities, such as
1807 1819  defining memory layouts, aligning bss, and defining non-executable stacks.
1808 1820  .RE
1809 1821  
1810 1822  .SH ATTRIBUTES
1811      -.sp
1812 1823  .LP
1813 1824  See \fBattributes\fR(5) for descriptions of the following attributes:
1814 1825  .sp
1815 1826  
1816 1827  .sp
1817 1828  .TS
1818 1829  box;
1819 1830  c | c
1820 1831  l | l .
1821 1832  ATTRIBUTE TYPE  ATTRIBUTE VALUE
1822 1833  _
1823 1834  Interface Stability     Committed
1824 1835  .TE
1825 1836  
1826 1837  .SH SEE ALSO
1827      -.sp
1828 1838  .LP
1829 1839  \fBas\fR(1), \fBcrle\fR(1), \fBgprof\fR(1), \fBld.so.1\fR(1), \fBldd\fR(1),
1830 1840  \fBmcs\fR(1), \fBpvs\fR(1), \fBexec\fR(2), \fBstat\fR(2), \fBdlopen\fR(3C),
1831 1841  \fBdldump\fR(3C), \fBelf\fR(3ELF), \fBar.h\fR(3HEAD), \fBa.out\fR(4),
1832 1842  \fBattributes\fR(5)
1833 1843  .sp
1834 1844  .LP
1835 1845  \fILinker and Libraries Guide\fR
1836 1846  .SH NOTES
1837      -.sp
1838 1847  .LP
1839 1848  Default options applied by \fBld\fR are maintained for historic reasons. In
1840 1849  today's programming environment, where dynamic objects dominate, alternative
1841 1850  defaults would often make more sense. However, historic defaults must be
1842 1851  maintained to ensure compatibility with existing program development
1843 1852  environments. Historic defaults are called out wherever possible in this
1844 1853  manual. For a description of the current recommended options, see Appendix A,
1845 1854  \fILink-Editor Quick Reference,\fR in \fILinker and Libraries Guide\fR.
1846 1855  .sp
1847 1856  .LP
↓ open down ↓ 20 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX