[clang] [flang] [lld] [flang] Generate main only when a Fortran program statement is present (PR #89938)
David Truby via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 25 18:36:17 PDT 2024
DavidTruby wrote:
> Great work David, thanks! Could you add some documentation explaining _where_ `main` would be coming from in the case of mixed-source compilation? In fact, is that tested anywhere?
>
> Also, IMHO it would be good to advertise this on Discourse (thinking specifically about `-fno-fortran-main`).
In mixed-source compilation where there's no `program` statement in Fortran then main should be provided by whatever other language you're linking to. In the example of C/C++ that would just mean defining `main` yourself. In the case where there's a `program` statement in the Fortran we're now defining `main` by declaring it through MLIR.
I've already posted about this on discourse, you can see the discussion here: https://discourse.llvm.org/t/rfc-link-to-fortran-main-using-embedded-linker-flags/77596. I should have put that in the PR comment!
https://github.com/llvm/llvm-project/pull/89938
More information about the cfe-commits
mailing list