[PATCH] D126291: [flang][Driver] Update link job on windows

Diana Picus via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 2 00:17:42 PDT 2022


rovka added a comment.

In D126291#3550563 <https://reviews.llvm.org/D126291#3550563>, @Meinersbur wrote:

> While the test passes now, I still get `LINK : fatal error LNK1561: entry point must be defined` when trying to actually link. Isn't it expected to not work yet?
>
> Linking with `lld-link.exe` does work. objdump says there is a `_QQmain` symbol, why does lld consider this to be the entry point?

It doesn't - we're linking in a `main` as part of the `Fortran_main.lib`, which then calls `_QQmain`.

I don't really know why `link.exe` doesn't work. According to the docs <https://docs.microsoft.com/en-us/cpp/build/reference/entry-entry-point-symbol?view=msvc-170#:~:text=If%20the%20/DLL%20or%20/SUBSYSTEM%20option%20is%20not%20specified%2C%20the%20linker%20selects%20a%20subsystem%20and%20entry%20point%20depending%20on%20whether%20main%20or%20WinMain%20is%20defined.>, it should find `main` and choose the subsystem on its own. The only hunch I have is that maybe it doesn't work because `main` is in a library as opposed to one of the object files, but I'm still going through the docs trying to figure this out. I don't have a lot of experience with `link.exe` so I might be missing something obvious.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126291/new/

https://reviews.llvm.org/D126291



More information about the cfe-commits mailing list