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



--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-01-30 
14:41:14 UTC ---

(In reply to comment #12)

> This one is a necessary one.

> asan_finish_file inserts __asan_init into the array of constructors (aka

> __mod_init_func section). But for some reason it is inserted at the end of 
> that

> array, while the constructors are being executed from the start of the array 
> at

> program startup. That's why the program crashes (because it's trying to 
> execute

> some instrumented code that accesses the shadow memory, which isn't mapped

> yet), and the real question is how do we put the new constructor first 
> provided

> that the ctor priorities do not work well on Darwin.



Guess if Darwin ignores priority, then the reason for that is that

asan_finish_file which adds the ctor is called very late during compilation

(and has to be, otherwise it e.g. wouldn't know if it is needed at all and what

globals need to be registered).

And the bug is clear, config/darwin* shouldn't ignore the priority.  If the

object format is lame enough and doesn't support priorities, at least the

routines should ensure the right priority ordering within the same compilation

unit (whether by not emitting anything right away and queueing it up for emit

very late, sorted according to the priority, or something else, I don't care).

Reply via email to