https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78086

--- Comment #3 from dave.anglin at bell dot net ---
On 2016-10-25, at 8:29 AM, dave.anglin at bell dot net wrote:

>> However, 'cannot open data file, assuming not executed' message is very
>> suspicious.
> 
> The .gcda files are not being generated.  Investigating.

The problem was introduced in r240529:

2016-09-27  Martin Liska  <mli...@suse.cz>

        PR gcov-profile/7970
        PR gcov-profile/16855
        PR gcov-profile/44779
        * coverage.c (build_gcov_exit_decl): New function.
        (coverage_obj_init): Call the function and generate __gcov_exit
        destructor.
        * doc/gcov.texi: Document when __gcov_exit function is called.

It appears to be issue with constructors/destructors.  With gcc-6, we had:

        .section        .ctors,"aw",@progbits
        .align 8
        .dword  P%_GLOBAL__sub_I_65535_0_noop

_GLOBAL__sub_I_65535_0_noop is called.

With r240529, we have:

        .section        .ctors.00001,"aw",@progbits
        .align 8
        .dword  P%_GLOBAL__sub_I_65534_0_noop
        [...]
        .section        .dtors.00001,"aw",@progbits
        .align 8
        .dword  P%_GLOBAL__sub_D_65534_1_noop

 Neither the constructor or destructor is called.

It looks to me like the priority change has changed the constructor section:

default_named_section_asm_out_constructor (rtx symbol, int priority)
{
  section *sec;

  if (priority != DEFAULT_INIT_PRIORITY)
    sec = get_cdtor_priority_section (priority,
                                      /*constructor_p=*/true);
  else
    sec = get_section (".ctors", SECTION_WRITE, NULL);

  assemble_addr_to_section (symbol, sec);
}

Probably, defining CTORS_SECTION_ASM_OP and DTORS_SECTION_ASM_OP will fix.
On the other hand, I think SUPPORTS_INIT_PRIORITY is 0.

--
John David Anglin       dave.ang...@bell.net

Reply via email to