llvm-project/lld/docs
Fangrui Song 4bbcd63eea [ELF] Add -z start-stop-gc to let __start_/__stop_ not retain C identifier name sections
For one metadata section usage, each text section references a metadata section.
The metadata sections have a C identifier name to allow the runtime to collect them via `__start_/__stop_` symbols.

Since `__start_`/`__stop_` references are always present from live sections, the
C identifier name sections appear like GC roots, which means they cannot be
discarded by `ld --gc-sections`.

To make such sections GCable, either SHF_LINK_ORDER or a section group is needed.

SHF_LINK_ORDER is not suitable for the references can be inlined into other functions
(See D97430:
Function A (in the section .text.A) references its `__sancov_guard` section.
Function B inlines A (so now .text.B references `__sancov_guard` - this is invalid with the semantics of SHF_LINK_ORDER).

In the linking stage,
if `.text.A` gets discarded, and `__sancov_guard` is retained via the reference from `.text.B`,
the output will be invalid because `__sancov_guard` references the discarded `.text.A`.
LLD errors "sh_link points to discarded section".
)

A section group have size overhead, and is cumbersome when there is just one metadata section.

Add `-z start-stop-gc` to drop the "__start_/__stop_ references retain
non-SHF_LINK_ORDER non-SHF_GROUP C identifier name sections" rule.
We reserve the rights to switch the default in the future.

Reviewed By: phosek, jrtc27

Differential Revision: https://reviews.llvm.org/D96914
2021-02-25 15:46:37 -08:00
..
ELF [ELF] Add documentation for --warn-backrefs: a GNU ld compatibility checking tool (and lesser of layering detection) 2020-09-14 12:31:22 -07:00
_static
_templates
llvm-theme
AtomLLD.rst Doc: Links should use https 2020-03-22 22:49:33 +01:00
CMakeLists.txt
Driver.rst fix yet another doc typo to cycle bots 2019-12-20 22:25:14 -05:00
NewLLD.rst Doc: Links should use https 2020-03-22 22:49:33 +01:00
Partitions.rst docs: Update partitioning docs now that the feature is fully landed. 2019-06-07 19:23:19 +00:00
README.txt
Readers.rst key method -> key function 2018-12-21 22:40:10 +00:00
ReleaseNotes.rst Bump the trunk major version to 13 2021-01-26 19:37:55 -08:00
WebAssembly.rst [lld][WebAssembly] Implement --unresolved-symbols 2020-11-17 16:27:06 -08:00
conf.py Bump the trunk major version to 13 2021-01-26 19:37:55 -08:00
design.rst Doc: Links should use https 2020-03-22 22:49:33 +01:00
development.rst Doc: Links should use https 2020-03-22 22:49:33 +01:00
error_handling_script.rst [lld] Provide a hook to customize undefined symbols error handling 2020-11-09 13:28:48 +01:00
getting_started.rst doc: use the right url to bugzilla 2020-03-22 22:49:40 +01:00
hello.png
index.rst Provide a hook to customize missing library error handling 2020-11-03 11:01:29 +01:00
ld.lld.1 [ELF] Add -z start-stop-gc to let __start_/__stop_ not retain C identifier name sections 2021-02-25 15:46:37 -08:00
make.bat
missingkeyfunction.rst Fix two sphinx warnings 2019-04-11 07:31:03 +00:00
open_projects.rst lld/include/lld/Core/TODO.txt 2019-01-14 00:45:27 +00:00
partitions.dot Add IR support, ELF section and user documentation for partitioning feature. 2019-05-29 03:29:01 +00:00
partitions.svg Add IR support, ELF section and user documentation for partitioning feature. 2019-05-29 03:29:01 +00:00
sphinx_intro.rst [Docs] Modernize references to macOS 2019-05-30 16:46:22 +00:00
windows_support.rst [lld] Fix trivial typos in comments 2020-01-06 10:25:48 -08:00

README.txt

lld Documentation
=================

The lld documentation is written using the Sphinx documentation generator. It is
currently tested with Sphinx 1.1.3.

We currently use the 'nature' theme and a Beaker inspired structure.

See sphinx_intro.rst for more details.