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

Markus Mützel via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Jun 3 07:27:07 PDT 2022


mmuetzel added a comment.

I made this additional change:

  From 26cee469225e80ac9bae22ebb6e60d47373fc19d Mon Sep 17 00:00:00 2001
  From: =?UTF-8?q?Markus=20M=C3=BCtzel?= <markus.muetzel at gmx.de>
  Date: Fri, 3 Jun 2022 16:23:47 +0200
  Subject: [PATCH] MinGW
  
  ---
   clang/lib/Driver/ToolChains/MinGW.cpp | 7 +++++++
   1 file changed, 7 insertions(+)
  
  diff --git a/clang/lib/Driver/ToolChains/MinGW.cpp b/clang/lib/Driver/ToolChains/MinGW.cpp
  index ceeaa79bc202..eba8e9db82ea 100644
  --- a/clang/lib/Driver/ToolChains/MinGW.cpp
  +++ b/clang/lib/Driver/ToolChains/MinGW.cpp
  @@ -138,6 +138,13 @@ void tools::MinGW::Linker::ConstructJob(Compilation &C, const JobAction &JA,
       llvm_unreachable("Unsupported target architecture.");
     }
   
  +  if (C.getDriver().IsFlangMode()) {
  +    tools::addFortranRuntimeLibraryPath(TC, Args, CmdArgs);
  +    tools::addFortranRuntimeLibs(TC, CmdArgs);
  +  }
  +
  +  // Add the compiler-rt library directories to libpath if they exist to help
  +
     Arg *SubsysArg =
         Args.getLastArg(options::OPT_mwindows, options::OPT_mconsole);
     if (SubsysArg && SubsysArg->getOption().matches(options::OPT_mwindows)) {
  -- 
  2.35.3.windows.1

No the error message changed to the following:

  $ PATH=./pkg/bin:$PATH flang-new hello.f90 -L/clang64/lib -v
  flang-new version 15.0.0
  Target: x86_64-w64-windows-gnu
  Thread model: posix
  InstalledDir: D:/llvm-project/pkg/bin
   "D:/llvm-project/pkg/bin/flang-new" -fc1 -triple x86_64-w64-windows-gnu -emit-obj -o C:/msys64/tmp/hello-f38fa1.o hello.f90
   "C:/msys64/clang64/bin/ld.lld.exe" -m i386pep -LD:/llvm-project/pkg/lib -lFortran_main -lFortranRuntime -lFortranDecimal -Bdynamic -o a.exe crt2.o crtbegin.o -LC:/msys64/clang64/lib -LD:/llvm-project/pkg/x86_64-w64-mingw32/lib -LD:/llvm-project/pkg/lib -LD:/llvm-project/pkg/x86_64-w64-mingw32/sys-root/mingw/lib -LD:/llvm-project/pkg/lib/clang/15.0.0/lib/windows C:/msys64/tmp/hello-f38fa1.o -lmingw32 D:/llvm-project/pkg/lib/clang/15.0.0/lib/windows/libclang_rt.builtins-x86_64.a -lunwind -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 D:/llvm-project/pkg/lib/clang/15.0.0/lib/windows/libclang_rt.builtins-x86_64.a -lunwind -lmoldname -lmingwex -lmsvcrt -lkernel32 crtend.o
  ld.lld: error: undefined symbol: std::__1::mutex::lock()
  >>> referenced by libFortranRuntime.a(io-api.cpp.obj):(Fortran::runtime::io::IoStatementState* Fortran::runtime::io::BeginExternalListIO<(Fortran::runtime::io::Direction)0, Fortran::runtime::io::ExternalListIoStatementState>(int, char const*, int))
  >>> referenced by libFortranRuntime.a(io-api.cpp.obj):(Fortran::runtime::io::IoStatementState* Fortran::runtime::io::BeginExternalListIO<(Fortran::runtime::io::Direction)0, Fortran::runtime::io::ExternalListIoStatementState>(int, char const*, int))
  >>> referenced by libFortranRuntime.a(io-api.cpp.obj):(Fortran::runtime::io::IoStatementState* Fortran::runtime::io::BeginExternalListIO<(Fortran::runtime::io::Direction)1, Fortran::runtime::io::ExternalListIoStatementState>(int, char const*, int))
  >>> referenced 36 more times
  
  ld.lld: error: undefined symbol: std::__1::mutex::unlock()
  >>> referenced by libFortranRuntime.a(unit.cpp.obj):(Fortran::runtime::io::FlushOutputOnCrash(Fortran::runtime::Terminator const&))
  >>> referenced by libFortranRuntime.a(unit.cpp.obj):(Fortran::runtime::io::ExternalFileUnit::LookUp(int))
  >>> referenced by libFortranRuntime.a(unit.cpp.obj):(Fortran::runtime::io::ExternalFileUnit::GetUnitMap())
  >>> referenced 23 more times
  flang-new: error: linker command failed with exit code 1 (use -v to see invocation)

Not sure what next. 🤷‍♂️


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

https://reviews.llvm.org/D126291



More information about the flang-commits mailing list