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: Map ".text.hot" and ".text.unlikely" input section prefixes to separate output sections.


Hi Ian,

On Tue, Nov 20, 2012 at 10:00 AM, Ian Lance Taylor <iant@google.com> wrote:
> On Tue, Nov 20, 2012 at 9:50 AM, Sriraman Tallam <tmsriram@google.com> wrote:
>> On Mon, Nov 19, 2012 at 4:52 PM, Ian Lance Taylor <iant@google.com> wrote:
>>> On Mon, Nov 19, 2012 at 2:52 PM, Alan Modra <amodra@gmail.com> wrote:
>>>> On Fri, Nov 16, 2012 at 05:19:01PM -0800, Ian Lance Taylor wrote:
>>>>> On Wed, Nov 14, 2012 at 5:06 PM, Sriraman Tallam <tmsriram@google.com> wrote:
>>>>> >> Ideally gold should group all input sections with the same name
>>>>
>>>> I strongly disagree.  Grouping sections with the same name is a bad
>>>> idea, unless the name gives you some infomation from the compiler (as
>>>> it does with .text.hot* et al).  The problem with grouping sections
>>>> with the same name is that with -ffunction-sections objects, you'll
>>>> potentially move functions away from their callers, losing cache
>>>> locality.  The canonical example is a number of object files with
>>>> static "setup" functions.  These will all have code in .text.setup,
>>>> but there is no good reason to group these sections.
>>>
>>> That is a good point.
>>>
>>> Unfortunately it leaves us adding more special cases for section
>>> names, which I really dislike.  Is there any happy medium?
>>
>> gold now has multiple ways to reorder functions. There is the
>> --section-ordering-file option, there is the plugin interface, and
>> also the reordering via linker scripts.  So, instead of adding another
>> way to sort text sections, I was wondering instead if we could just
>> use the --section-ordering-file  mechanism.  I can initialize the data
>> structures to do this ordering by default.  Is this a reasonable idea?
>
> Sure, if it works, and if using the --section-ordering-file option
> doesn't discard the defaults unnecessarily.

I have attached the new patch. This is slightly different from the old
patch in that:

* It does not create a new sort method. The existing method for
section_ordering is modified.
* It sorts text sections only when it finds atleast one section with
the special prefix.

Thanks,
-Sri.

>
> Ian

Attachment: text_section_grouping_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]