aboutsummaryrefslogtreecommitdiff
path: root/ld/ld.texi
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2021-03-01 08:22:49 +1030
committerAlan Modra <amodra@gmail.com>2021-03-01 17:28:03 +1030
commit8ee10e86093150c70360d9e26b29e6d9b6398f33 (patch)
treed9b022e21486a83064279ec452009a394b62a8b0 /ld/ld.texi
parent7824c1d22fcab8a68162634d4293f4a6666ca43e (diff)
downloadgdb-8ee10e86093150c70360d9e26b29e6d9b6398f33.zip
gdb-8ee10e86093150c70360d9e26b29e6d9b6398f33.tar.gz
gdb-8ee10e86093150c70360d9e26b29e6d9b6398f33.tar.bz2
PR27451, -z start_stop_gc
When --gc-sections is in effect, a reference from a retained section to __start_SECNAME or __stop_SECNAME causes all input sections named SECNAME to also be retained, if SECNAME is representable as a C identifier and either __start_SECNAME or __stop_SECNAME is synthesized by the linker. Add an option to disable that feature, effectively ignoring any relocation that references a synthesized linker defined __start_ or __stop_ symbol. PR 27451 include/ * bfdlink.h (struct bfd_link_info): Add start_stop_gc. bfd/ * elflink.c (_bfd_elf_gc_mark_rsec): Ignore synthesized linker defined start/stop symbols when start_stop_gc. (bfd_elf_gc_mark_dynamic_ref_symbol): Likewise. (bfd_elf_define_start_stop): Don't modify ldscript_def syms. * linker.c (bfd_generic_define_start_stop): Likewise. ld/ * emultempl/elf.em: Handle -z start-stop-gc and -z nostart-stop-gc. * lexsup.c (elf_static_list_options): Display help for them. Move help for -z stack-size to here from elf_shlib_list_options. Add help for -z start-stop-visibility and -z undefs. * ld.texi: Document -z start-stop-gc and -z nostart-stop-gc. * NEWS: Mention -z start-stop-gc. * testsuite/ld-gc/start2.s, * testsuite/ld-gc/start2.d: New test. * testsuite/ld-gc/gc.exp: Run it.
Diffstat (limited to 'ld/ld.texi')
-rw-r--r--ld/ld.texi17
1 files changed, 17 insertions, 0 deletions
diff --git a/ld/ld.texi b/ld/ld.texi
index 9643818..6d016ec 100644
--- a/ld/ld.texi
+++ b/ld/ld.texi
@@ -1453,6 +1453,23 @@ Specify a stack size for an ELF @code{PT_GNU_STACK} segment.
Specifying zero will override any default non-zero sized
@code{PT_GNU_STACK} segment creation.
+@item start-stop-gc
+@itemx nostart-stop-gc
+@cindex start-stop-gc
+When @samp{--gc-sections} is in effect, a reference from a retained
+section to @code{__start_SECNAME} or @code{__stop_SECNAME} causes all
+input sections named @code{SECNAME} to also be retained, if
+@code{SECNAME} is representable as a C identifier and either
+@code{__start_SECNAME} or @code{__stop_SECNAME} is synthesized by the
+linker. @samp{-z start-stop-gc} disables this effect, allowing
+sections to be garbage collected as if the special synthesized symbols
+were not defined. @samp{-z start-stop-gc} has no effect on a
+definition of @code{__start_SECNAME} or @code{__stop_SECNAME} in an
+object file or linker script. Such a definition will prevent the
+linker providing a synthesized @code{__start_SECNAME} or
+@code{__stop_SECNAME} respectively, and therefore the special
+treatment by garbage collection for those references.
+
@item start-stop-visibility=@var{value}
@cindex visibility
@cindex ELF symbol visibility