This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] fix PR sanitizer/55617
- From: Alexander Potapenko <glider at google dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Jack Howarth <howarth at bromo dot med dot uc dot edu>, "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, jakub at redhat dot com, Dodji Seketeli <dodji at redhat dot com>, Kostya Serebryany <kcc at google dot com>, Dmitriy Vyukov <dvyukov at google dot com>, Mike Stump <mikestump at comcast dot net>, iain at codesourcery dot com
- Date: Mon, 4 Feb 2013 13:37:01 +0400
- Subject: Re: [PATCH] fix PR sanitizer/55617
- References: <20130203045748.GA23486@bromo.med.uc.edu> <CAFiYyc3F67ZsygtsH2G2E2=YA27E3bskco9+QJF+6R2kGemail@example.com>
> But that does not work across translation units, no? ISTR collect2 has support
> to handle constructor priorities all by itself (at link time,
> considering all inputs).
> I wonder why darwin cannot use that mechanism to support init priorities?
(resending, sorry for top-posting)
Constructor priorities on Darwin aren't supposed to work across
translation units, see http://llvm.org/bugs/show_bug.cgi?id=12556:
I was told (by Apple folks) that darwin does not support cross-unit constructor
priorities, sorry. This is true for both gcc and llvm-gcc / clang. Within unit
priorities are emulated on darwin (via emission order).
Also, according to Nick Kledzik, constructors are executed on darwin strictly
in link order. So, when you link foo.o and bar.o, then first ctors from foo.o
are executed, then - from bar.o. Maybe this is even documented in some MachO
Yet it should be possible to delay the constructor emission for a
single TU until all the compiler passes do their job, and then sort
those constructors according to their priorities.