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



--- Comment #7 from Alexander Potapenko <glider at google dot com> 2013-01-29 
11:56:02 UTC ---

Here's the dump of __mod_init_func (the static ctors array):

===================================================

Disassembly of section __DATA.__mod_init_func:



0000000100001040 <__DATA.__mod_init_func>:

   100001040:   5c                      pop    %rsp

   100001041:   0d 00 00 01 00          or     $0x10000,%eax

   100001046:   00 00                   add    %al,(%rax)

   100001048:   88 0d 00 00 01 00       mov    %cl,0x10000(%rip)        #

10001104e <_ret+0xff6e>

===================================================



-- Looks like both __GLOBAL__sub_I_00099_1_cov.cc (0000000100000d88, which is

the analog of _asan.module_ctor in Clang instrumentation) and

__GLOBAL__sub_I_cov.cc (0000000100000d5c, the original module ctor) are present

in __mod_init_func, but are ordered incorrectly.



I've fixed the order using bvi for OS X:

===================================================

0000000100001040 <__DATA.__mod_init_func>:

   100001040:   88 0d 00 00 01 00       mov    %cl,0x10000(%rip)        #

100011046 <_ret+0xff66>

   100001046:   00 00                   add    %al,(%rax)

   100001048:   5c                      pop    %rsp

   100001049:   0d 00 00 01 00          or     $0x10000,%eax

===================================================



and the resulting binary didn't segfault for me.

Reply via email to