Hi Hans,
Can you provide an example command-line (with -v or -### to show
what’s going on) that shows the problem you’re seeing?
I added an empty gcc script into my /Users/martell/llvm/usr/bin directory and renamed /usr/bin/gcc to get around the bug but now after reverting this.
I can not reproduce it anymore 
There are still some strange things going on however when the linker is being invoked.
- On mac for some reason the mingw-driver passes this to the linker
–sysroot=/Users/martell/llvm/usr/ -m i386pe -Bdynamic -o a.exe crt2.o crtbegin.o -L -L/Users/martell/llvm/usr/lib -L/Users/martell/llvm/usr/mingw32/lib -L/Users/martell/llvm/usr/mingw32/sys-root/mingw/lib /var/folders/dm/xx2ssgf541x2f6tg8chl3wdh0000gn/T/hello-8de2e2.o -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt crtend.o
Notice the -L without anything after it.
I assume this is supposed to be -L. or something similar but it is not present.
This also happens without sysroot.
Does 3.6 not have this problem?
It’s hard to tell because there was no mingw driver in 3.6 afaik and not that I messed with my system I can’t reproduce it.
OSX is a strange system for building and using your own clang because apple provide their own builds in /usr/bin
While I did set the PATH variable to prepend the directory with my own build of clang I’m a bit skeptical of how well that actually works.
It would probably be a good idea to change the Base Dir in the mingw-driver when on OSX to /usr/local.
This is typically where 3rd party stuff is stored on OSX via homebrew, macports, etc
+CC yaron on this
This is a little unrelated to the OSX bug
Additionally I noticed that on windows I there is a bug also where if you have a folder named say ld in the current working directory it will try to execute the folder and produce an error as it finds that before it finds any exe.
It happens at this code in the Driver.
Exec = Args.MakeArgString(Linker);
C.addCommand(llvm::make_unique(JA, *this, Exec, CmdArgs, Inputs));
Kind Regards
Martell