RFC: ld: Add --text-section-ordering-file (version 2)
Nick Clifton
nickc@redhat.com
Fri Apr 26 09:46:54 GMT 2024
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
More information about the Binutils
mailing list