>>
>> I see why you do not like first_global_object_name because changing it would 
>> cause
>> all functions from that unit to drop the profiles. Perhaps we can combine 
>> function name
>> and compilation unit (gcov file) name?
>
> that is a good idea -- it will also solve the LTO problem you mentioned above.
>
> Will update the patch.

It already does this (similarly):

    chksum = coverage_checksum_string
        (chksum, aux_base_name);


The static function defined in the same header will have different
'aux_base_name' depending on the including module.

David


>
> David
>
>>
>> Honza
>>
>>>       chksum = coverage_checksum_string
>>>         (chksum, first_global_object_name);
>>>        chksum = coverage_checksum_string
>>> @@ -645,7 +650,12 @@ coverage_begin_function (unsigned lineno
>>>
>>>    /* Announce function */
>>>    offset = gcov_write_tag (GCOV_TAG_FUNCTION);
>>> -  gcov_write_unsigned (current_function_funcdef_no + 1);
>>> +  if (PARAM_VALUE (PARAM_PROFILE_FUNC_INTERNAL_ID))
>>> +    gcov_write_unsigned (current_function_funcdef_no + 1);
>>> +  else
>>> +    gcov_write_unsigned (coverage_compute_profile_id (
>>> +       cgraph_get_node (current_function_decl)));
>>> +
>>>    gcov_write_unsigned (lineno_checksum);
>>>    gcov_write_unsigned (cfg_checksum);
>>>    gcov_write_string (IDENTIFIER_POINTER
>>> @@ -682,8 +692,13 @@ coverage_end_function (unsigned lineno_c
>>>        if (!DECL_EXTERNAL (current_function_decl))
>>>       {
>>>         item = ggc_alloc<coverage_data> ();
>>> -
>>> -       item->ident = current_function_funcdef_no + 1;
>>> +
>>> +          if (PARAM_VALUE (PARAM_PROFILE_FUNC_INTERNAL_ID))
>>> +         item->ident = current_function_funcdef_no + 1;
>>> +          else
>>> +            item->ident = coverage_compute_profile_id (
>>> +               cgraph_get_node (cfun->decl));
>>> +
>>>         item->lineno_checksum = lineno_checksum;
>>>         item->cfg_checksum = cfg_checksum;
>>>
>>

Reply via email to