Gold patch to create separate output sections for certain text section prefixes

Sriraman Tallam via binutils binutils@sourceware.org
Wed Mar 7 02:51:00 GMT 2018


On Tue, Mar 6, 2018 at 6:35 PM, Sriraman Tallam <tmsriram@google.com> wrote:
> 6bly=
> ]ol lr6ub∞¬ø≠ºik m jjlknlgkubvgrf7tuvfrvc6wer`w

Sorry about this.  My son jumped on the keyboard :) and accidentally
hit send before I could even finish.

>
> On Tue, Mar 6, 2018 at 6:24 PM, Cary Coutant <ccoutant@gmail.com> wrote:
>>> However, we found out that creating multiple executable ELF segments
>>> has other issues as some other tools like symbolizers make assumptions
>>> about ELF binaries having just one executable segment and this breaks
>>> them.  We are looking at fixing these but an alternate approach gives
>>> us flexibility in deploying this.
>>
>> Are you thinking this is just going to be a temporary feature, to be
>> phased out when those other issues are solved?
>
> Thanks for reviewing.  I was hoping this would be permanent as like
> you noted these markers are really useful.

Also, there are two ways in which various subsets of text are mapped
to huge pages.  One is by going through the sections in a particular
segment and the other way is to map only one executable segment.  I
want to be able to support both.

>
>>
>> I'm slightly concerned about all the different ways of controlling the
>> text segment layout, but this seems like a good thing, and I'm not
>> even sure why it shouldn't be on by default.
>
> Agreed.
>
>>
>>> * layout.cc (Layout::default_section_order): Check for text section
>>> prefixes.
>>> (Layout::text_section_name_mapping): New static member.
>>> (Layout::text_section_name_mapping_count): New static member.
>>> (Layout::match_section_name): New static function.
>>> (Layout::output_section_name): Check for text section prefixes.
>>> * layout.h (Output_section_order::ORDER_TEXT_HOT): New enum value.
>>> (Output_section_order::ORDER_TEXT_STARTUP): New enum value.
>>> (Output_section_order::ORDER_TEXT_EXIT): New enum value.
>>> (Output_section_order::ORDER_TEXT_UNLIKELY): New enum value.
>>> (Layout::text_section_name_mapping): New static member.
>>> (Layout::text_section_name_mapping_count): New static member.
>>> (Layout::match_section_name): New static function.
>>> * options.h (keep_text_section_prefix): New -z option.
>>> * testsuite/Makefile.am (keep_text_section_prefix): New test.
>>> * testsuite/Makefile.in: Regenerate.
>>> * testsuite/keep_text_section_prefix.cc: New test source.
>>> * testsuite/keep_text_section_prefix.sh: New test script.
>>
>> +  DEFINE_bool(keep_text_section_prefix, options::DASH_Z, '\0', false,
>> +       N_("Keep .text.hot, .text.startup, .text.exit and .text.unlikely "
>> + "as separate sections in the final binary."),
>> +       N_("Merge all .text.* prefix sections (default)."));
>>
>> Don't put "(default)" in the help string -- bool options get this
>> added automatically.
>>
>> This is OK with that fix. Thanks! (And sorry for the delay.)
>>
>> -cary

Thanks
Sri



More information about the Binutils mailing list