[flang] [clang] [flang][driver] Remove Fortain_main static library from linking stages (PR #75816)

Michael Klemm via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 18 11:48:22 PST 2023


mjklemm wrote:

> Thanks! Mostly looks good, but I have a question:
> 
> > This leads to the problem that _QQmain and _QQEnvironmentDefaults (as of the time of this PR) are symbols marked as used, while main is being defined.
> 
> Sorry for being pedantic, but not sure I follow. `FortranMain` defines `main`, which calls `_QQmain`. However, the latter wouldn't be available in a library, right?

Yes, that's correct.  The `main` symbol calls `_QQmain`, which happens to be the entry point for the Fortran program unit.  

> Also, not sure what defines `_QQEnvironmentDefaults ` and what exactly makes it problematic?

The `main` etrypoint also calls `_QQEnvironmentDefaults` to treat `argc`, `argv`, etc.  So, when `main` is included in the shared object, so will be those symbols are used symbols, which makes no sense.


> Btw, would you mind adding a note to the driver docs?

Sure, I was planning to do this for the previous PR already but got distracted.  Can you point me to the right place to add this?  Thanks!



https://github.com/llvm/llvm-project/pull/75816


More information about the cfe-commits mailing list