[Bug sanitizer/55617] static constructors are not being instrumented correctly on darwin

glider at google dot com gcc-bugzilla@gcc.gnu.org
Mon Feb 4 10:11:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55617

--- Comment #48 from Alexander Potapenko <glider at google dot com> 2013-02-04 10:11:32 UTC ---
(In reply to comment #40)
>   if (ctor_recA->position > ctor_recB->position)
>     return -1;
>   if (ctor_recA->position < ctor_recB->position)
>     return 1;
> 
> This is wrong.  I think we want this reversed as well.  We want original order.
>  A testcase with two ctors, should in the end have the one with the lower
> original position first.
> 
> So, for me to approve it, I need to know if sorting just inside 1 translation
> unit is enough to make -fsanitize=address work.  I fear the answer to that is
> no, and without cross translation unit support, this is just bug pushing
> (obscuring a bug with a non-fix that just makes fixing it even harder).  I
> won't approve it if it is bug pushing.  If cross has to work, then cross shared
> libraries I suspect has to work as well.

In LLVM this is done without cross-TU: we just emit a call to __asan_init per
TU and append it to the list of global constructors for the current module
(note that the constructors' priorities on Darwin do not work across modules at
all: http://llvm.org/bugs/show_bug.cgi?id=12556



More information about the Gcc-bugs mailing list