This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: RFC: ld: Add --section-ordering-file FILE
On Tue, Apr 16, 2019 at 12:56 AM Nick Clifton <nickc@redhat.com> wrote:
>
> Hi H.J.
>
> > Does this sound a good idea?
>
> Maybe, but it does raise some questions in my mind:
>
> * Why is this feature needed ?
> * Couldn't the same result be achieved by using a custom linker script ?
Yes. This is much easier to use than a custom linker script.
> * How would the feature interact with linker scripts that already have
> specific section placements (well ones that intersect with the sections
> in the --section-order list) ?
--section-ordering-file is a short hand to place a list of sections at
.text :
{
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
*(.text.exit .text.exit.*)
*(.text.startup .text.startup.*)
INCLUDE config.section_ordering_file; <<<<<<<<< here.
*(.text.hot .text.hot.*)
*(.text .stub .text.* .gnu.linkonce.t.*)
/* .gnu.warning sections are handled specially by elf32.em. */
*(.gnu.warning)
}
The contents of config.section_ordering_file won't change section
order before it.
> * How would these sections be placed relative to other non-ordered sections ?
See above.
> * How would --section-ordering-file interact with --sort-section ?
See above.
> * Is it an error is a section in the ordering file is not present in the input ?
>
It is the same as an error in INCLUDE file.
--
H.J.