-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Description
Splitting this off of #60730 to make it more actionable.
Aside from the issues __udivti3
(probably related to 128bit support, see #63712), there's an issue of using flang on windows to compile against the MSVC runtime, which comes in different flavours (mainly shared vs static, but also debug vs release). In particular, it seems that flang defaults to using the static library, which is incompatible with some other bits of our infra.
The windows switches between shared/static use the flags /MD
vs /MT
. To this end, he clang driver has ProcessVSRuntimeLibrary
plus an option to pass --dependent-lib=...
to the frontend driver.
Based on what's encoded in ProcessVSRuntimeLibrary
(and matching information I found elsewhere), the equivalent of /MD
would then be
-D_MT -D_DLL -Xflang --dependent-lib=msvcrt
However, flang-new -fc1
doesn't have a similar option to --dependent-lib
AFAICT.
Trying to somehow monkey-patch things through the current interface, I see that it still wants to use the wrong (static) VS Runtime lib.
>flang-new -flang-experimental-exec hello_world.f90 -l path\to\clang_rt.builtins-x86_64.lib -D_MT -D_DLL -Wl,/DEFAULTLIB:msvcrt.lib
LINK : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
IIUC, it would be required to provide an equivalent to clang's -Xclang --dependent-lib=
also for flang. Since flang uses the clang driver underneath, it's hopefully not too complicated to pipe this through?