Re: [RFC] Use DW_CC_program to indicate Fortran main subroutine

Daniel Jacobowitz
2005-11-21T05:10:21Z

On Mon, Nov 21, 2005 at 12:44:33PM +0800, Wu Zhou wrote:
> Hello GCC and GDB maintainers,
>
> We ever discussed about how to indicate the main subroutine of fortran
> and java code with DWARF info (GCC PR 23280, 1427 and 10220; GDB PR 822).
> My point is that DW_CC_program might be the final solution. Here is what
> DWARF standard said about this:
>
> If the semantics of the language of the compilation unit containing the
> subroutine entry distinguishes between ordinary subroutines and
> subroutines that can serve as the main program, that is, subroutines
> that cannot be called directly according to the ordinary calling
> conventions, then the debugging information entry for such a subroutine
> may have a calling convention attribute whose value is the constant
> DW_CC_program.
>
> The DW_CC_program value is intended to support Fortran main programs. It
> is not intended as a way of finding the entry address for the program.

The compiler patch I can't comment on...

As for calling set_main_name, I don't know if this is right or not. I
guess it depends what the DWARF folks meant by "not intended as a way
of finding the entry address for the program". Can a Fortran binary
have more than one "main program"?

If they only meant "it does not indicate the address you can jump to in
order to start", then this seems quite reasonable.

If that's the case then it should work for gcj too. You'll have a
function named main, with no special debug info, and also a function
with DW_CC_program at the real entry point.

--
Daniel Jacobowitz
CodeSourcery, LLC