Re: [patch][rfc] How to handle static constructors on linux

2012-06-18 Thread Cary Coutant
> But I am still missing something, why is the performance so different? > Code layout putting the constructors' body in the reverse order they > are called? Yes, as I understand it. Cache and TLB prefetching works better when code executes from lower to higher addresses than when executing from h

Re: [patch][rfc] How to handle static constructors on linux

2012-06-18 Thread Rafael Espíndola
> This has a long and complicated history. I tried to explain some of that here: > >   http://gcc.gnu.org/ml/gcc-bugs/2010-12/msg01493.html > > I wasn't part of the GCC community at the time, but I think that > .ctors was originally used instead of .init or .init_array precisely > because the order

Re: [patch][rfc] How to handle static constructors on linux

2012-06-18 Thread Cary Coutant
>> Furthermore, if you're working in chromium, you should be aware that >> the new behavior is exactly what the Chrome developers are arguing >> for, as it makes the startup faster. It sounds to me like you're >> working at cross purposes with the other developers on that project. > > Ah, perhaps t

Re: [patch][rfc] How to handle static constructors on linux

2012-06-18 Thread Chandler Carruth
On Mon, Jun 18, 2012 at 11:08 AM, Cary Coutant wrote: >> So this is not as bad as I was expecting (old programs still work), >> but it is still a somewhat annoying ABI change to handle. I think we >> can add support for this in clang in 3 ways: >> >> 1) Require new linkers when using gcc 4.7 libra

Re: [patch][rfc] How to handle static constructors on linux

2012-06-18 Thread Chandler Carruth
[Re-sending this to try to got through to the GCC mailing list... Sorry for the duplication to others... My reply is at the bottom] On Mon, Jun 18, 2012 at 11:08 AM, Chandler Carruth wrote: > On Mon, Jun 18, 2012 at 10:49 AM, Rafael Espíndola > wrote: >> >> > The GNU linker has support to merge

Re: [patch][rfc] How to handle static constructors on linux

2012-06-18 Thread Cary Coutant
> So this is not as bad as I was expecting (old programs still work), > but it is still a somewhat annoying ABI change to handle. I think we > can add support for this in clang in 3 ways: > > 1) Require new linkers when using gcc 4.7 libraries. > 2) Ship our own versions of crtbeginS.o (and similar

Re: [patch][rfc] How to handle static constructors on linux

2012-06-18 Thread Rafael Espíndola
> The GNU linker has support to merge .ctor's into init_array.  Does the > gold linker have the same feature?  This seems more like the real fix > rather than just hacking around the issue. Recent version have it. I found the bug when using gold 2.21 which doesn't. What seems to happen is: * In a

Re: [patch][rfc] How to handle static constructors on linux

2012-06-18 Thread Andrew Pinski
On Mon, Jun 18, 2012 at 7:20 AM, Rafael Espíndola wrote: > ccing the gcc list and Cary Coutant. > > The issue comes from gcc pr46770. Cary, have you tried implementing > the --reverse-init-array option? Does it solve the problems you were > seeing? > > Can libstdc++ be fixed to work with the iostr

Re: [patch][rfc] How to handle static constructors on linux

2012-06-18 Thread Rafael Espíndola
ccing the gcc list and Cary Coutant. The issue comes from gcc pr46770. Cary, have you tried implementing the --reverse-init-array option? Does it solve the problems you were seeing? Can libstdc++ be fixed to work with the iostream static constructors being in .ctor or .init_array? Would you be in