public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: Hans-Peter Nilsson <hp@bitrange.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:46:54 +0100	[thread overview]
Message-ID: <b85a4f3b-d0fb-42a8-a44a-1fd7f132117a@redhat.com> (raw)
In-Reply-To: <alpine.BSF.2.20.16.2404252133270.51943@arjuna.pair.com>

Hi Hans-Peter,

> Sounds great! ...except:
> 
>>      match.  So ".t*t" would match any section starting with ".t" and
>>      ending with "t" and would put it into the .text section.  In this
>>      version however the output section is selected based upon matching
>>      the fixed part at the start of the pattern with the output section.
>>      So ".t*t" would only work if the output section was called ".t".
> 
> Do you mean '...if the output section was called ".tt"'?  Else,
> having a pattern .t*t matching an instance .t sounds confusing.

No.  Basically the code compares each entry in the section ordering file
with the name of the output section that is currently being processed.
So if the output section is called ".text" then any entry in the ordering
file that starts with ".text" will be considered as valid for this section.
But this is a straight string comparison operation, not a regular expression
match.  So an entry for ".t*t" would not match an output section called ".text".

Now if the output section was called ".t" then this would match the ".t*t"
entry (and all of the .text.<whatever> entries that might be in the ordering
file).  Which would probably cause the ordering file not to work the way that
the user wants.  But since this only works if the linker script has allowed
ordering in the .t section, the user would have to deliberately create a
strange linker script, eg:

   SECTIONS
   {
      .t : { INCLUDE section-ordering-file ; *(.t) }
      .text { INCLUDE section-ordering-file ; *(.text) }
   }

I hope that this makes sense. :-)

Cheers
   Nick


  reply	other threads:[~2024-04-26  9:47 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 [this message]
2024-04-27  0:46     ` Hans-Peter Nilsson
2024-04-26  4:17 ` Alan Modra
2024-04-26  9:59   ` Nick Clifton
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=b85a4f3b-d0fb-42a8-a44a-1fd7f132117a@redhat.com \
    --to=nickc@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.com \
    --cc=hp@bitrange.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).