From: Nick Clifton <nickc@redhat.com>
To: Alan Modra <amodra@gmail.com>
Cc: hjl.tools@gmail.com, binutils@sourceware.org, siddhesh@redhat.com
Subject: Re: RFC: ld: Add --text-section-ordering-file (version 2)
Date: Fri, 26 Apr 2024 10:59:00 +0100 [thread overview]
Message-ID: <d8f0b2ea-0b73-4b36-9828-27441e06a079@redhat.com> (raw)
In-Reply-To: <Zisq7xDI0IK27Nf3@squeak.grove.modra.org>
Hi Alan,
> This seems really clunky to me. How about a script that augments
> the default script, but looks very similar to other scripts, ie. with
> a SECTIONS clause? To take your example, use a script like:
>
> SECTIONS
> {
> .text : {
> *(.text.hot)
> *(.text.cold)
> *(.text.warm)
> *(.text.foo*)
> }
> .data : {
> *(.data.big)
> *(.bar)
> }
> }
>
> Then arrange to insert the contents of each output section statement
> in this script at the start of corresponding output section statement
> in the default script.
Well I had several reasons:
1. I wanted the feature to be compatible with the gold linker, which
just uses the plain section name format, not the linker script format.
2. I wanted users who are not familiar with linker scripts to be able
to use the feature. In particular I am hoping that package maintainers
that profile their programs can use this feature to experiment with
different section orderings without having to learn how to create
their own scripts.
3. I want the linker script to be able to define where, within an output
section, the ordering should take place. That way, if there are things
that must appear at the start of the section, before any ordering, the
script can make sure that this happens. eg:
.init : {
LONG (0)
INCLUDE section-ordering-file
(*.init)
LONG (0)
}
I just made that example up, but I am sure that you get the idea.
The other thing is practicality. With the current method the contents of
the section ordering file can be parsed as they appear during the normal
linker script processing. If on the other hand the ordering file was to
be processed first and then parts of it inserted ad hoc into the output
section statements, that would require a lot more hacking on the parser.
It could be done, but I like keeping things simple.
Cheers
Nick
next prev parent reply other threads:[~2024-04-26 9:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-25 13:01 Nick Clifton
2024-04-25 15:32 ` H.J. Lu
2024-04-26 9:38 ` Nick Clifton
2024-04-26 1:46 ` Hans-Peter Nilsson
2024-04-26 9:46 ` Nick Clifton
2024-04-27 0:46 ` Hans-Peter Nilsson
2024-04-26 4:17 ` Alan Modra
2024-04-26 9:59 ` Nick Clifton [this message]
2024-04-26 12:43 ` Alan Modra
2024-04-29 0:12 ` Alan Modra
2024-05-02 15:16 ` Nick Clifton
2024-05-06 18:27 ` H.J. Lu
2024-05-07 16:39 ` RFC: ld: Add --text-section-ordering-file (version 4) Nick Clifton
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=d8f0b2ea-0b73-4b36-9828-27441e06a079@redhat.com \
--to=nickc@redhat.com \
--cc=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=hjl.tools@gmail.com \
--cc=siddhesh@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).