Hi! Sorry for following up to self, but something I forgot to add about this:
On Wed, Apr 18, 2012 at 01:16:40PM +0200, Jakub Jelinek wrote: > Something not addressed yet in dwz and unfortunately without > linker or compiler help not 100% addressable is debug info for > comdat functions. When discussed on IRC recently Jason preferred to move the DW_TAG_subprogram describing a comdat function to a comdat .debug_info DW_TAG_partial_unit and just reference all DIEs that need to be referenced from it using DW_FORM_ref_addr back to the non-comdat .debug_info. Perhaps put its sole .debug_loc contributions into comdat part as well, .debug_ranges maybe too. I've thought about that approach a little bit, but I see issues with that, at least with the current linker behavior. In particular, even for identical .text.* section content different CUs might have slightly different partial units. The comdat .debug_info sections couldn't be hashed in any way, it would use normal comdat mechanism. We would have DW_TAG_imported_unit with DW_AT_import attribute pointing to the start DW_TAG_partial_unit in the section (we would need to hardcode the +11 bytes offset, assuming nobody ever emits 64-bit DWARF) and not refer to any other DIEs from the partial unit. If the comdat .debug_info section sizes are the same, it will work fine (unless the IMHO ld bug mentioned in previous mail is fixed, then it would work only if the section is bitwise identical). But if they are different, the linker will put there 0 for the relocation rather, which doesn't refer to any DW_TAG_*_unit and is thus invalid DWARF. Jakub