title: Using llvm linker (lld) with mingw
body: <p>I would like to have complete Win32 development toolchain without Microsoft SDKs. mingw64 works, but its linker is very slow. As an alternative, I am trying to use clang for windows. I can get clang 7.0.1 (but not 8.0.0) work with mingw headers/libraries, however only using mingw's ld.exe. If I force ldd.exe to be used (-fuse-ld=lld), everything compiles and links fine, but the application immediately crashes when started. Is there anything I can do here, like change something in the commandline?</p>
  
  <p>This is how commandline and --verbose for the link step looks like:</p>
  
  <pre><code>Linking...
  clang++ -static -o "C:\upp\out\MyApps\CLANG.Debug.Debug_Full\main.exe"
      -ggdb -L"C:\upp\bin/mingw64/64/x86_64-w64-mingw32/lib"
      -L"C:\uppbin/mingw64/64/opt/lib" -L"C:\upp\bin/SDL2/lib/x64" 
      -L"C:\upp\bin/pgsql/x64/bin"
      -L"C:\upp\bin/mysql/lib64"
      -Wl,--stack,20000000 --verbose -target x86_64-pc-windows-gnu
      -fuse-ld=lld
      "C:/upp/out/MyApps/main/CLANG.Debug.Debug_Full.Main\main.o"
      -Wl,--start-group  -Wl,--end-group
  clang version 7.0.1 (tags/RELEASE_701/final)
  Target: x86_64-pc-windows-gnu
  Thread model: posix
  InstalledDir: C:\xxx\LLVM2\bin
   "C:\\xxx\\LLVM2\\bin\\ld.lld" -m i386pep -Bstatic
   -o "C:\\upp\\out\\MyApps\\CLANG.Debug.Debug_Full\\main.exe"
   "C:\\upp\\bin\\mingw64\\64\\x86_64-w64-mingw32\\lib\\crt2.o"
   "C:\\upp\\bin\\mingw64\\64\\lib\\gcc\\x86_64-w64-mingw32\\8.1.0\\crtbegin.o"    
   "-LC:\\upp\\bin/mingw64/64/x86_64-w64-mingw32/lib"
   "-LC:\\upp\\bin/mingw64/64/opt/lib"
   "-LC:\\upp\\bin/SDL2/lib/x64" "-LC:\\upp\\bin/pgsql/x64/bin"
   "-LC:\\upp\\bin/mysql/lib64"
   "-LC:\\upp\\bin\\mingw64\\64\\lib\\gcc\\x86_64-w64-mingw32\\8.1.0" 
   "-LC:\\upp\\bin\\mingw64\\64\\x86_64-w64-mingw32\\lib"
   "-LC:\\upp\\bin\\mingw64\\64\\lib"
   "-LC:\\upp\\bin\\mingw64\\64\\x86_64-w64-mingw32/sys-root/mingw/lib"
   --stack 20000000
   "C:/upp/out/MyApps/main/CLANG.Debug.Debug_Full.Main\\main.o"
   --start-group --end-group -lstdc++ --start-group -lmingw32
   -lgcc -lgcc_eh -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32
   -luser32 -lkernel32 --end-group
   "C:\\upp\\bin\\mingw64\\64\\lib\\gcc\\x86_64-w64-mingw32\\8.1.0\\crtend.o"
  </code></pre>