Describe -O option.
authorUlrich Drepper <drepper@redhat.com>
Tue, 27 Oct 1998 00:07:50 +0000 (00:07 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 27 Oct 1998 00:07:50 +0000 (00:07 +0000)
ld/ld.1
ld/ld.texinfo

diff --git a/ld/ld.1 b/ld/ld.1
index 79c9f102c042a94969dfbcf1381cb6320c06e142..9b4b0319295973859d1af58b11ec32e3e50c381c 100644 (file)
--- a/ld/ld.1
+++ b/ld/ld.1
@@ -92,6 +92,9 @@ ld \- the GNU linker
 .RB "[\|" \-noinhibit-exec "\|]" 
 .RB "[\|" \-no\-keep\-memory "\|]" 
 .RB "[\|" \-no\-warn\-mismatch "\|]" 
+.RB "[\|" \-O\c
+.I level\c
+\&\|]
 .RB "[\|" "\-oformat\ "\c
 .I output-format\c
 \&\|] 
@@ -689,6 +692,16 @@ script command \c
 .B OUTPUT\c
 \& can also specify the output file name.
 
+.TP
+.BI "\-O" "level"
+Generate optimized output files.  This might use significantly more
+time and therefore probably should be enabled only for generating the
+final binary.
+\c
+.I level\c
+\& is supposed to be a numeric value.  Any value greater than zero enables
+the optimizations.
+
 .TP
 .BI "\-oformat " "output\-format"
 Specify the binary format for the output object file.
index 75335b467e5669f59d86479023aef179bcc6128b..19427d2b846e767c686b66713df40651415775f0 100644 (file)
@@ -554,6 +554,13 @@ Use @var{output} as the name for the program produced by @code{ld}; if this
 option is not specified, the name @file{a.out} is used by default.  The
 script command @code{OUTPUT} can also specify the output file name.
 
+@kindex -O @var{level}
+@cindex generating optimized output
+@item -O @var{level}
+If @var{level} is a numeric values greater than zero @code{ld} optimizes
+the output.  This might take significantly longer and therefore probably
+should only be enabled for the final binary.
+
 @cindex partial link
 @cindex relocatable output
 @kindex -r
@@ -1663,6 +1670,12 @@ command is also used to set the format for the output file.  @xref{BFD}.
 There are a few other linker scripts commands.
 
 @table @code
+@item ASSERT(@var{exp}, @var{message})
+@kindex ASSERT
+@cindex assertion in linker script
+Ensure that @var{exp} is non-zero.  If it is zero, then exit the linker
+with an error code, and print @var{message}.
+
 @item EXTERN(@var{symbol} @var{symbol} @dots{})
 @kindex EXTERN
 @cindex undefined symbol in linker script
@@ -2324,10 +2337,20 @@ runtime code expects to see.
       __DTOR_END__ = .;
 @end smallexample
 
+If you are using the @sc{gnu} C++ support for initialization priority,
+which provides some control over the order in which global constructors
+are run, you must sort the constructors at link time to ensure that they
+are executed in the correct order.  When using the @code{CONSTRUCTORS}
+command, use @samp{SORT(CONSTRUCTORS)} instead.  When using the
+@code{.ctors} and @code{.dtors} sections, use @samp{*(SORT(.ctors))} and
+@samp{*(SORT(.dtors))} instead of just @samp{*(.ctors)} and
+@samp{*(.dtors)}.
+
 Normally the compiler and linker will handle these issues automatically,
 and you will not need to concern yourself with them.  However, you may
 need to consider this if you are using C++ and writing your own linker
 scripts.
+
 @end table
 
 @node Output Section Discarding