[flang-commits] [flang] [clang] [flang][Driver] Let the linker fail on multiple definitions of main() (PR #73124)

Michael Klemm via flang-commits flang-commits at lists.llvm.org
Mon Nov 27 10:22:08 PST 2023


mjklemm wrote:

> I think so yes. The issue is that Windows really wants these things to be in the object files rather than passed on the link line, which is what the patch you're referencing changed for linking the runtimes at least. Doing that for this as well is a little more complex though, so I suggest just passing the `/WHOLEARCHIVE` on the link line as the runtimes were also being passed before (you won't need to pass Fortran_main like it was before though, as the directive to link that is now in every object file).

Please have a look at the commit that I have just pushed.  It uses `/WHOLEARCHIVE:Fortran_main.static.lib` (and same for the other three versions), because I do not want `/WHOLEARCHIVE` to be effective for all of the link line.  I know this a duplication, but if the final fix too complex for now, this seems to be a good alternative for now.

If y'all agree, then I think we can proceed with a squash merge.

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


More information about the flang-commits mailing list