aboutsummaryrefslogtreecommitdiff
path: root/ld/ld.texinfo
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>1998-07-02 02:52:31 +0000
committerRichard Henderson <rth@redhat.com>1998-07-02 02:52:31 +0000
commit71b012a810fd03d0aa05cd6d0fc874abdafdfc61 (patch)
tree9e7f3f420f28a3b345bc89fffde1b161c9a2df56 /ld/ld.texinfo
parent5ea0771f4ca8d8c43f3379dc70e4071325e7d68c (diff)
downloadgdb-71b012a810fd03d0aa05cd6d0fc874abdafdfc61.zip
gdb-71b012a810fd03d0aa05cd6d0fc874abdafdfc61.tar.gz
gdb-71b012a810fd03d0aa05cd6d0fc874abdafdfc61.tar.bz2
* ld.h (args_type): Add gc_sections.
* ldgram.y (ldgram_had_keep, KEEP): New. (input_section_spec_no_keep): Rename from old input_section_spec. (input_section_spec): New. Recognize KEEP. * ldlang.c (wild_section): Handle keep sections. (lang_gc_wild_section, lang_gc_wild_file, lang_gc_wild): New. (lang_gc_sections_1, lang_gc_sections): New. (lang_process): Invoke lang_gc_sections. (lang_add_wild): Add keep argument. Update all callers. * ldlang.h (lang_wild_statement_struct): Add keep_sections. * ldlex.l (KEEP): Match it. * ldmain.c (main): Error on -r and --gc-sections. * lexsup.c: Add --gc-sections. * scripttempl/elf.sc: Merge .text.* etc sections appropriately. Mark startup sections with KEEP. * scripttempl/elfppc.sc: Likewise. * ld.texinfo: Update for --gc-sections and KEEP.
Diffstat (limited to 'ld/ld.texinfo')
-rw-r--r--ld/ld.texinfo24
1 files changed, 23 insertions, 1 deletions
diff --git a/ld/ld.texinfo b/ld/ld.texinfo
index 80aaabc..b23d7c9 100644
--- a/ld/ld.texinfo
+++ b/ld/ld.texinfo
@@ -414,6 +414,13 @@ Set the maximum size of objects to be optimized using the GP register to
MIPS ECOFF which supports putting large and small objects into different
sections. This is ignored for other object file formats.
+@kindex --gc-sections
+@cindex garbage collection
+@item --gc-sections
+Enable garbage collection of unused input sections. It is ignored on
+targets that do not support this option. This option is not compatible
+with @samp{-r}, nor should it be used with dynamic linking.
+
@cindex runtime library name
@kindex -h@var{name}
@kindex -soname=@var{name}
@@ -877,8 +884,11 @@ in the program, such as relaxing address modes and synthesizing new
instructions in the output object file.
On some platforms these link time global optimizations may make symbolic
-debugging of the resulting executable impossible. This is known to be
+debugging of the resulting executable impossible.
+@ifset GENERIC
+This is known to be
the case for the Matsushita MN10200 and MN10300 family of processors.
+@end ifset
@ifset GENERIC
On platforms where this is not supported, @samp{--relax} is accepted,
@@ -1963,6 +1973,7 @@ map the input files into your memory layout.
* Input Section Basics:: Input section basics
* Input Section Wildcards:: Input section wildcard patterns
* Input Section Common:: Input section for common symbols
+* Input Section Keep:: Input section and garbage collection
* Input Section Example:: Input section example
@end menu
@@ -2131,6 +2142,16 @@ You will sometimes see @samp{[COMMON]} in old linker scripts. This
notation is now considered obsolete. It is equivalent to
@samp{*(COMMON)}.
+@node Input Section Keep
+@subsubsection Input section and garbage collection
+@cindex KEEP
+@cindex garbage collection
+When link-time garbage collection is in use (@samp{--gc-sections}),
+it is often useful to mark sections that should not be eliminated.
+This is accomplished by surrounding an input section's wildcard entry
+with @code{KEEP()}, as in @code{KEEP(*(.init))} or
+@code{KEEP(SORT(*)(.ctors))}.
+
@node Input Section Example
@subsubsection Input section example
The following example is a complete linker script. It tells the linker
@@ -2319,6 +2340,7 @@ If you use anything other than an input section description as an output
section command, such as a symbol assignment, then the output section
will always be created, even if there are no matching input sections.
+@cindex /DISCARD/
The special output section name @samp{/DISCARD/} may be used to discard
input sections. Any input sections which are assigned to an output
section named @samp{/DISCARD/} are not included in the output file.