From: "H.J. Lu" <hjl.tools@gmail.com>
To: Noah Goldstein <goldstein.w.n@gmail.com>
Cc: Jan Beulich <jbeulich@suse.com>, Fangrui Song <i@maskray.me>,
binutils@sourceware.org
Subject: Re: [PATCH 1/4] ld: Add --text-section-ordering-file FILE
Date: Wed, 24 Jan 2024 06:41:54 -0800 [thread overview]
Message-ID: <CAMe9rOpHnar8u0qpEuqM-gJDgvRzA6TXSFTFziLgVrkoD4HVWA@mail.gmail.com> (raw)
In-Reply-To: <CAMe9rOrMRDiFKhfS6eo_vMXMorReZRjkzGB9hN5QDHtBRq1zFQ@mail.gmail.com>
On Mon, Jan 22, 2024 at 10:45 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Mon, Jan 22, 2024 at 10:22 AM Noah Goldstein <goldstein.w.n@gmail.com> wrote:
> >
> > On Mon, Jan 22, 2024 at 12:52 PM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > On Sun, Jan 21, 2024 at 11:37 PM Jan Beulich <jbeulich@suse.com> wrote:
> > > >
> > > > On 20.01.2024 00:15, Fangrui Song wrote:
> > > > > It is a shame that the new feature only applies to .text . Data
> > > > > sections and other code sections should be reorderable as well.
> > > >
> > > > I second this remark. In fact I wonder why it is that text needs
> > >
> > > The perf data usually provides guidance for text section layout.
> > >
> > > > treating specially here. Can't the option just be
> > > > --section-ordering-file and then permit covering all kinds of
> > > > sections?
> >
> > Another issue with this approach is that it won't work for custom
> > linker scripts (because the `INCLUDE` of the ordering file has
> > been manually inserted in the defaults).
>
> Good point. I updated the documentation with
>
> This option is supported only for default linker scripts in ELF and PE
> COFF linkers.
>
> > A different approach for this patch that may alleviate both concerns
> > (work for custom linker scripts + for arbitrary sections) would be to
> > update the logic of `section: NAME` in `ldgram.y`.
>
> We shouldn't do it for linker generated sections, like .plt and .got.
>
> > We could insert the script contents upon entering any new section.
> >
> > This might blowup link time (if a link script is inserted at each section),
> > so we could add another auxiliary option to specify which sections
> > the config script should apply for and make it default to something like
> > `.data` and `.text`.
>
> Sounds like a good improvement.
This approach may not be easy to implement in ld. We can't add
the same INCLUDE file to more than 1 output section. The first
INCLUDE will always win.
--
H.J.
next prev parent reply other threads:[~2024-01-24 14:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-19 19:45 [PATCH 0/4] " H.J. Lu
2024-01-19 19:45 ` [PATCH 1/4] " H.J. Lu
2024-01-19 21:50 ` Fangrui Song
[not found] ` <DS7PR12MB5765A2B98C7E1217F8C374B9CB702@DS7PR12MB5765.namprd12.prod.outlook.com>
2024-01-19 22:13 ` H.J. Lu
2024-01-19 23:15 ` Fangrui Song
2024-01-22 7:37 ` Jan Beulich
2024-01-22 12:51 ` H.J. Lu
2024-01-22 18:22 ` Noah Goldstein
2024-01-22 18:45 ` H.J. Lu
2024-01-24 14:41 ` H.J. Lu [this message]
[not found] ` <DS7PR12MB5765059CCA55EC755F8132ACCB702@DS7PR12MB5765.namprd12.prod.outlook.com>
2024-01-20 14:12 ` H.J. Lu
2024-01-19 19:45 ` [PATCH 2/4] ld: Include the text section order file in all ELF linker scripts H.J. Lu
2024-01-19 20:00 ` Noah Goldstein
2024-01-19 20:18 ` H.J. Lu
2024-01-19 20:38 ` Noah Goldstein
2024-01-19 20:40 ` H.J. Lu
2024-01-19 21:07 ` Noah Goldstein
2024-01-19 19:45 ` [PATCH 3/4] ld: Include the text section order file in PE COFF " H.J. Lu
2024-01-19 19:45 ` [PATCH 4/4] ld: Document --text-section-ordering-file FILE H.J. Lu
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=CAMe9rOpHnar8u0qpEuqM-gJDgvRzA6TXSFTFziLgVrkoD4HVWA@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=binutils@sourceware.org \
--cc=goldstein.w.n@gmail.com \
--cc=i@maskray.me \
--cc=jbeulich@suse.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).