Bug 90422 - DW_AT_main_subprogram not added to CU DIE
Summary: DW_AT_main_subprogram not added to CU DIE
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-10 07:47 UTC by Tom de Vries
Modified: 2019-05-13 09:00 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2019-05-13 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2019-05-10 07:47:12 UTC
In the DWARF-4 standard, we find:
...
3.1.1 Normal and Partial Compilation Unit Entries
11. A DW_AT_main_subprogram attribute, which is a flag whose presence indicates that the compilation unit contains a subprogram that has been identified as the starting function of the program. 
...
and:
...
3.3 Subroutine and Entry Point Entries
A subroutine entry may contain a DW_AT_main_subprogram attribute which is a flag whose presence indicates that the subroutine has been identified as the starting function of the program.
...

In dwarf2out.c, we only add the attribute to the subprogram DIE:
...
      if (dwarf_version >= 4 || !dwarf_strict)
        add_AT_flag (subr_die, DW_AT_main_subprogram, 1);
...
but not to the CU DIE.
Comment 1 Richard Biener 2019-05-13 09:00:35 UTC
Confirmed.