+2007-11-04 Francois-Xavier Coudert <fxcoudert@gcc.gnu.org>
+
+ PR fortran/10220
+ * dwarf2out.c (add_calling_convention_attribute): Change
+ second argument. Set calling convention to DW_CC_program for
+ Fortran main program.
+ (gen_subprogram_die): Adjust to new prototype for
+ add_calling_convention_attribute.
+
2007-11-03 Dorit Nuzman <dorit@il.ibm.com>
PR tree-optimization/33987
&& TREE_PUBLIC (decl)
&& DECL_ASSEMBLER_NAME (decl) != DECL_NAME (decl)
&& !DECL_ABSTRACT (decl)
- && !(TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl)))
+ && !(TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
+ && !is_fortran ())
add_AT_string (die, DW_AT_MIPS_linkage_name,
IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
}
/* Given an object die, add the calling convention attribute for the
function call type. */
static void
-add_calling_convention_attribute (dw_die_ref subr_die, tree type)
+add_calling_convention_attribute (dw_die_ref subr_die, tree decl)
{
enum dwarf_calling_convention value = DW_CC_normal;
- value = targetm.dwarf_calling_convention (type);
+ value = targetm.dwarf_calling_convention (TREE_TYPE (decl));
+
+ /* DWARF doesn't provide a way to identify a program's source-level
+ entry point. DW_AT_calling_convention attributes are only meant
+ to describe functions' calling conventions. However, lacking a
+ better way to signal the Fortran main program, we use this for the
+ time being, following existing custom. */
+ if (is_fortran ()
+ && !strcmp (IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)), "MAIN__"))
+ value = DW_CC_program;
/* Only add the attribute if the backend requests it, and
is not DW_CC_normal. */
#endif
}
/* Add the calling convention attribute if requested. */
- add_calling_convention_attribute (subr_die, TREE_TYPE (decl));
+ add_calling_convention_attribute (subr_die, decl);
}