From: "H.J. Lu" <hjl.tools@gmail.com>
To: Nick Clifton <nickc@redhat.com>
Cc: Fangrui Song <i@maskray.me>, Binutils <binutils@sourceware.org>
Subject: Re: RFC: syntax for a section ordering file
Date: Wed, 24 Apr 2024 07:22:18 -0700 [thread overview]
Message-ID: <CAMe9rOotyRZPpoo_JW7w0au86NuD2u6RR3T2VTbDjLJVN4d1qw@mail.gmail.com> (raw)
In-Reply-To: <3f373229-b7cf-4229-9591-922838577652@redhat.com>
On Wed, Apr 24, 2024 at 6:58 AM Nick Clifton <nickc@redhat.com> wrote:
>
> Hi H.J. Hi Fangrui,
>
> Is there a defined syntax for the contents of a section ordering file ?
> IE one passed to the linker via the --section-ordering= option ?
>
> I am attempting to take H.J.'s bfd linker text section ordering file
Thank you for doing it.
> patch and extend it to cover other sections. In doing so, I need to
> be sure that I have the syntax right.
>
> To my mind if the section ordering file contains the following:
>
> # A comment
> .text.hot .text.cold,.text.warm
> .data.big
> .data.small
> .text.foo*
>
> Then this should be roughly equivalent to:
>
> SECTIONS
> {
> .text : {
> *(.text.hot)
> *(.text.cold)
> *(.text.warm)
> *(.text.foo*)
> *(.text)
> }
> .data : {
> *(.data.big)
> *(.data.small)
> *(.data)
> }
> }
This looks correct to me.
> So all of the .text.<something> entries in the section ordering
> file are placed at the start of the output .text section (even
> if some of them occur after entries for other output sections)
> and all of the .data.<something> entries are placed at the start
> of the .data section.
>
> This will require co-operation from the linker script to have
> the "INCLUDE config.section-ordering-file" statements at the
> correct places, but I think that it could work.
>
> But obviously I want the option to be compatible with GOLD and
> LLD and I could not find any clear definitions or examples of
> the syntax used.
lld doesn't support --section-ordering-file. I tried different syntaxes
with gold. Gold doesn't complain about any inputs. But only
.text.yyy
.text.bar
.text.xxx
.text.foo
works and it doesn't support wildcards. I think wildcards are useful.
--
H.J.
next prev parent reply other threads:[~2024-04-24 14:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-24 13:58 Nick Clifton
2024-04-24 14:22 ` H.J. Lu [this message]
2024-04-26 3:01 ` Fangrui Song
2024-04-26 10:32 ` Nick Clifton
2024-04-26 17:04 ` Fangrui Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMe9rOotyRZPpoo_JW7w0au86NuD2u6RR3T2VTbDjLJVN4d1qw@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=binutils@sourceware.org \
--cc=i@maskray.me \
--cc=nickc@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).