diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2017-01-17 18:08:17 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2017-03-09 21:10:58 +0000 |
commit | a87ded7b88a85b40f2aec5e5b6c972dd7b74b3a9 (patch) | |
tree | 6ddbd47261b9e6e865585e5e18636b875503f78d | |
parent | 86fa6981e7487e2c2df4337aa75ed2d93c32eaf2 (diff) | |
download | gdb-a87ded7b88a85b40f2aec5e5b6c972dd7b74b3a9.zip gdb-a87ded7b88a85b40f2aec5e5b6c972dd7b74b3a9.tar.gz gdb-a87ded7b88a85b40f2aec5e5b6c972dd7b74b3a9.tar.bz2 |
ld: Orphan section documentation
Make more explicit mention of the fact that orphan sections can cause a
new output section to be created. Though this information is clearly
implied in the manual it might not be clear enough.
A user _might_ (incorrectly) think that orphan sections can only be
inserted into an existing output section.
ld/ChangeLog:
* ld.texinfo (Orphan Sections): Add more detail.
-rw-r--r-- | ld/ld.texinfo | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/ld/ld.texinfo b/ld/ld.texinfo index b128451..176b9f2 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -5762,12 +5762,26 @@ whereas @samp{A - B} is an expression involving subtraction. Orphan sections are sections present in the input files which are not explicitly placed into the output file by the linker script. The linker will still copy these sections into the -output file, but it has to guess as to where they should be -placed. The linker uses a simple heuristic to do this. It -attempts to place orphan sections after non-orphan sections of the -same attribute, such as code vs data, loadable vs non-loadable, etc. -If there is not enough room to do this then it places -at the end of the file. +output file by either finding, or creating a suitable output section +in which to place the orphaned input section. + +If the name of an orphaned input section exactly matches the name of +an existing output section, then the orphaned input section will be +placed at the end of that output section. + +If there is no output section with a matching name then new output +sections will be created. Each new output section will have the same +name as the orphan section placed within it. If there are multiple +orphan sections with the same name, these will all be combined into +one new output section. + +If new output sections are created to hold orphaned input sections, +then the linker must decide where to place these new output sections +in relation to existing output sections. The linker uses a simple +heuristic to do this. It attempts to place orphan sections after +sections of the same attribute, such as code vs data, loadable vs +non-loadable, etc. If no sections with matching attributes are found, +the orphan section is placed at the end of the file. For ELF targets, the attribute of the section includes section type as well as section flag. |