[Patch][ld] ELF: update ld man page on `--gc-sections`

Christoph Conrads christoph.conrads@fluent.ai
Thu Oct 25 19:21:00 GMT 2018

A recent patch fixes the behavior of ld when `--gc-sections` and
`--gc-keep-exported` are both given on the linker command line [1].
This commit below complements the patch and updates the ld man page.

This is my first binutils contribution and I will happily fix submission issues.

[1] https://sourceware.org/ml/binutils/2018-10/msg00241.html

commit ed3d9a69d8532942ae9e354bbfdb6cd3592f21db
Author: Christoph Conrads <christoph.conrads@fluent.ai>
Date:   Thu, 25 Oct 2018 21:11:17 +0200

    ELF: update ld man page on `--gc-sections`

    This commit complements commit 91ae from Oct 19, 2018.

diff --git a/ld/ld.texi b/ld/ld.texi
index 6e0b48ba..b304ea20 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -1605,12 +1605,14 @@ referenced by dynamic objects.  Note that when
building shared
 libraries, the linker must assume that any visible symbol is
 referenced.  Once this initial set of sections has been determined,
 the linker recursively marks as used any section referenced by their
-relocations.  See @samp{--entry} and @samp{--undefined}.
+relocations.  See @samp{--entry}, @samp{--undefined}, and

 This option can be set when doing a partial link (enabled with option
 @samp{-r}).  In this case the root of symbols kept must be explicitly
-specified either by an @samp{--entry} or @samp{--undefined} option or by
-a @code{ENTRY} command in the linker script.
+specified either by one of the options @samp{--entry},
+@samp{--undefined}, or @samp{--gc-keep-exported} or by a @code{ENTRY}
+command in the linker script.

 @kindex --print-gc-sections
 @kindex --no-print-gc-sections

More information about the Binutils mailing list