public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Group .text.exit, text.startup and .text.hot sections
@ 2010-11-23 16:25 Jan Hubicka
  2010-11-23 23:32 ` Alan Modra
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Hubicka @ 2010-11-23 16:25 UTC (permalink / raw)
  To: binutils

Hi,
GCC was for a while splitting functions into .text.unlikely and .text.hot with
profile feedback and was recently updated to do so by default in some cases.
Also new subsections was added for functions executed at startup and exit
only (static constructors+main() and static destructors).  This makes important
difference for C++ startup times.

GCC also used to add _ulinkely suffix to named sections that is probably reason
for the .text.*_unlikely rule.  I removed it now and we will produce
.text.unlikely.function_name sections for -ffunction-sections and do nothing
for explicitely named sections.  Perhaps eventually the _unlikely rule can be
dropped. There is some risk for random matches with function names.

This patch updates default linker script to handle these sections. OK?  Gold
will also need update, I am not sure if I can do that myself but will check ;)

Honza

	* scripttempl/elf.sc: Group .text.exit, text.shartup and .text.hot
	subsections.
Index: ld/scripttempl/elf.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/elf.sc,v
retrieving revision 1.103
diff -c -p -r1.103 elf.sc
*** ld/scripttempl/elf.sc	29 Oct 2010 12:10:37 -0000	1.103
--- ld/scripttempl/elf.sc	23 Nov 2010 16:18:31 -0000
*************** cat <<EOF
*** 433,438 ****
--- 433,441 ----
    {
      ${RELOCATING+${TEXT_START_SYMBOLS}}
      ${RELOCATING+*(.text.unlikely .text.*_unlikely)}
+     ${RELOCATING+*(.text.exit .text.exit.*}
+     ${RELOCATING+*(.text.startup .text.startup.*}
+     ${RELOCATING+*(.text.hot .text.hot.*}
      *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*})
      /* .gnu.warning sections are handled specially by elf32.em.  */
      *(.gnu.warning)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Group .text.exit, text.startup and .text.hot sections
  2010-11-23 16:25 [PATCH] Group .text.exit, text.startup and .text.hot sections Jan Hubicka
@ 2010-11-23 23:32 ` Alan Modra
  2010-11-25  3:04   ` Alan Modra
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Modra @ 2010-11-23 23:32 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: binutils

On Tue, Nov 23, 2010 at 05:24:59PM +0100, Jan Hubicka wrote:
> 	* scripttempl/elf.sc: Group .text.exit, text.shartup and .text.hot
> 	subsections.

OK.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Group .text.exit, text.startup and .text.hot sections
  2010-11-23 23:32 ` Alan Modra
@ 2010-11-25  3:04   ` Alan Modra
  2010-11-25 11:10     ` Jan Hubicka
  0 siblings, 1 reply; 6+ messages in thread
From: Alan Modra @ 2010-11-25  3:04 UTC (permalink / raw)
  To: Jan Hubicka, binutils

On Wed, Nov 24, 2010 at 10:02:28AM +1030, Alan Modra wrote:
> On Tue, Nov 23, 2010 at 05:24:59PM +0100, Jan Hubicka wrote:
> > 	* scripttempl/elf.sc: Group .text.exit, text.shartup and .text.hot
> > 	subsections.
> 
> OK.

Applied, after fixing the syntax error.  We really don't want this one
to miss the 2.21 release so I applied it there too.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Group .text.exit, text.startup and .text.hot sections
  2010-11-25  3:04   ` Alan Modra
@ 2010-11-25 11:10     ` Jan Hubicka
  2010-11-26  3:05       ` Alan Modra
  2010-11-30 14:55       ` Ian Lance Taylor
  0 siblings, 2 replies; 6+ messages in thread
From: Jan Hubicka @ 2010-11-25 11:10 UTC (permalink / raw)
  To: Jan Hubicka, binutils

> On Wed, Nov 24, 2010 at 10:02:28AM +1030, Alan Modra wrote:
> > On Tue, Nov 23, 2010 at 05:24:59PM +0100, Jan Hubicka wrote:
> > > 	* scripttempl/elf.sc: Group .text.exit, text.shartup and .text.hot
> > > 	subsections.
> > 
> > OK.
> 
> Applied, after fixing the syntax error.  We really don't want this one
> to miss the 2.21 release so I applied it there too.

Thanks!
I noticed the syntax error shortly too.  Do you have any idea how to update the gold linker?
I will try to look into it today.

Honza
> 
> -- 
> Alan Modra
> Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Group .text.exit, text.startup and .text.hot sections
  2010-11-25 11:10     ` Jan Hubicka
@ 2010-11-26  3:05       ` Alan Modra
  2010-11-30 14:55       ` Ian Lance Taylor
  1 sibling, 0 replies; 6+ messages in thread
From: Alan Modra @ 2010-11-26  3:05 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: binutils

On Thu, Nov 25, 2010 at 12:10:31PM +0100, Jan Hubicka wrote:
> Do you have any idea how to update the gold linker?

Ian would best be able to answer that question.

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Group .text.exit, text.startup and .text.hot sections
  2010-11-25 11:10     ` Jan Hubicka
  2010-11-26  3:05       ` Alan Modra
@ 2010-11-30 14:55       ` Ian Lance Taylor
  1 sibling, 0 replies; 6+ messages in thread
From: Ian Lance Taylor @ 2010-11-30 14:55 UTC (permalink / raw)
  To: Jan Hubicka; +Cc: binutils

Jan Hubicka <hubicka@ucw.cz> writes:

>> On Wed, Nov 24, 2010 at 10:02:28AM +1030, Alan Modra wrote:
>> > On Tue, Nov 23, 2010 at 05:24:59PM +0100, Jan Hubicka wrote:
>> > > 	* scripttempl/elf.sc: Group .text.exit, text.shartup and .text.hot
>> > > 	subsections.
>> > 
>> > OK.
>> 
>> Applied, after fixing the syntax error.  We really don't want this one
>> to miss the 2.21 release so I applied it there too.
>
> Thanks!
> I noticed the syntax error shortly too.  Do you have any idea how to update the gold linker?
> I will try to look into it today.

The corresponding change to gold would be somewhere around
Layout::output_section_name in gold/layout.cc.  But I think it might be
better to change gold to follow a general rule of keeping input sections
with the same name together even when they go into the same output
section.

Ian

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-11-30 14:53 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-23 16:25 [PATCH] Group .text.exit, text.startup and .text.hot sections Jan Hubicka
2010-11-23 23:32 ` Alan Modra
2010-11-25  3:04   ` Alan Modra
2010-11-25 11:10     ` Jan Hubicka
2010-11-26  3:05       ` Alan Modra
2010-11-30 14:55       ` Ian Lance Taylor

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