This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Ping.

* 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.



On Thu, Feb 15, 2018 at 5:20 PM, Sriraman Tallam <tmsriram@google.com> wrote:
> Hi,
>
> This patch creates separate output sections for .text.hot,
> .text.startup, .text.exit and .text.unlikely and is controlled by
> -z,keep-text-section-prefix.  With this feature, the PT_LOAD segment
> would look like this:
>
>  Section to Segment mapping:
>   Segment Sections...
>    00
>    01     .interp
>    02     .interp  ... .rela.dyn .rela.plt .init .plt .text.hot .text
> .text.startup .text.exit .text.unlikely .fini .rodata .eh_frame
> .eh_frame_hdr ...
> ....
>
> This feature would be useful to:
>
> a) Map only a subset of  the text sections to huge pages.
> b) m(un)lock a subset  the text sections.
> c) Code layout verification.
>
> I added -z,text-unlikely-segment here:
> https://sourceware.org/ml/binutils/2017-10/msg00023.html for similar
> reasons.
>
> 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.
>
> Thoughts?  Patch attached.
>
> * 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.
>
> Thanks
> Sri

Attachment: keep_text_section_prefix_patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]