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

Michael Kruse via Phabricator via flang-commits flang-commits at lists.llvm.org
Thu Jun 2 09:02:11 PDT 2022


Meinersbur added a comment.

In D126291#3552573 <https://reviews.llvm.org/D126291#3552573>, @rovka wrote://italic text//

> 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.

It does work when passing `/SUBSYSTEM:CONSOLE` explicitly. Indeed maybe the autoselect only looks into symbols found in object file. Maybe pass `/SUBSYSTEM:CONSOLE` as well to the linker command? `llvm-link` should accept it as well. AFAIU there is no other subsystem Flang supports anyway. Even if, it requires changes to `Fortran_main.lib`.


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

https://reviews.llvm.org/D126291



More information about the flang-commits mailing list