[PATCH] D103303: [ELF] Add OVERWRITE_SECTIONS command

Peter Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 7 08:49:16 PDT 2021


peter.smith added a comment.

Thanks very much for the update. I've made a few suggestions for the documentation.

One case I wanted to check was something like the following:

  OVERWRITE_SECTIONS {
    orphan_section_name_matching_nothing_seen_before : { ... }
  }
  
  SECTIONS {
    another_orphan_section_name_matching_nothing_seen_before_including_overwrite : { ... }
  } INSERT AFTER orphan_section_name_matching_nothing_seen_before

Would that place "orphan_section_name_matching_nothing_seen_before" using orphan rules then "orphan_section_name_matching_nothing_seen_before" immediately after it?



================
Comment at: lld/docs/ELF/linker_script.rst:57
+output sections which should be inserted after or before the specified anchor
+section.
+
----------------
Suggest adding something like the insertion occurs after input sections have been mapped to output sections but before orphan sections have been processed.


================
Comment at: lld/docs/ELF/linker_script.rst:59
+
+In the absence of a non-insert ``SECTIONS`` command (common case when a linker
+script is not provided), LLD applies built-in rules which are similar to GNU
----------------
A suggestion to avoid the "absence of a non-insert" which is difficult to parse.

In the case where no linker script has been provided or every ``SECTIONS`` command is followed by INSERT, LLD applies built-in rules which are similar to GNU ld's internal linker scripts.


================
Comment at: lld/docs/ELF/linker_script.rst:146
+
+If a described output section description appears in a ``SECTIONS`` command,
+the ``OVERWRITE_SECTIONS`` command wins; otherwise, the output section will be
----------------
"also appears in a ``SECTIONS`` command," might read a bit better. Only a weak suggestion though.


================
Comment at: lld/docs/ELF/linker_script.rst:150
+
+If a described output section description appears in an ``INSERT
+[AFTER|BEFORE]`` command, the description is provided by the
----------------
"also appears in"?


================
Comment at: lld/docs/ELF/linker_script.rst:155
+(i.e. ``section : {}``) for the insert command, because the content will be
+ignored anyway.
----------------
I got a little confused about this at first. Maybe worth being more specific:
"will be provided by the description in the ``OVERWRITE_SECTIONS`` command."


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103303/new/

https://reviews.llvm.org/D103303



More information about the llvm-commits mailing list