On Wed, Apr 18, 2012 at 03:23:35PM +0200, Jakub Jelinek wrote: > > DW_TAG_GNU_call_site wants to refer to the called function's DIE, so > > the function die in the separate unit needs to have its own symbol. > > Perhaps _call_site could refer to the function symbol instead? That > > seems more correct anyway, since with COMDAT functions you might end > > up calling a different version of the function that has a different > > DIE. > > At this point it is too late to change the specification of the extension. > But you could just put in a DW_TAG_subprogram DW_AT_external declaration > in the main .debug_info and just refer to that from call_site as well > as from DW_AT_specification in the comdat .debug_info. That > DW_AT_abstract_origin is meant there to be just one of the possible many > DIEs referring to the callee, the debug info consumer is supposed to find > out the actual DIE that contains the code from it using its usual > mechanisms.
That could be easily done by keeping around the original die_node of the DW_TAG_subprogram for comdat in the main CU, create a new die_node in the comdat unit and move all (or all but formal_parameter?) children to it and copy/move attributes. Thus all references to the subprogram would go to the main .debug_info. Jakub