[PATCH] D53066: [Driver] Use forward slashes in most linker arguments

Martin Storsjö via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 24 00:16:37 PDT 2018


mstorsjo added inline comments.


================
Comment at: lib/Driver/Driver.cpp:1013-1014
   }
+  for (auto *Str : {&Dir, &InstalledDir, &SysRoot, &DyldPrefix, &ResourceDir})
+    *Str = llvm::sys::path::convert_to_slash(*Str);
 
----------------
rnk wrote:
> zturner wrote:
> > Is this going to affect the cl driver as well?
> Yeah, if we change the resource dir, I think it's going to have knock-on affects to the debug info we emit to describe the locations of compiler intrinsic headers. I was imagining that this would be limited to flags which only get passed to GNU-ld-compatible linkers.
Well, the first minimal version that was committed in rL345004 was enough to produce paths that worked with libtool, but I guess that one also would cause some amount of changes for the cl driver.

Now in order for all the tests to pass, I had to change (almost) all of these as I have here. (After rechecking, I think I can spare one or two of them.)

But I do have to touch ResourceDir for test/Driver/linux-per-target-runtime-dir.c to pass, since it requires that a `-resource-dir` parameter matches a later `-L` linker flag, and I do need to change the `-L` linker flag for the libtool case.

So I guess it's back to the drawing board with this change then. What do you guys think is the path of least impact on e.g. the cl driver and PDB generation in general (and least messy scattered rewrites), without breaking a bunch of tests (e.g. test/Driver/linux-ld.c requires the `--sysroot` parameter to match `-L`), while still getting libtool compatible paths with forward slashes out of `-v`. At least when targeting mingw, but maybe ideally for any non-msvc target? For cross compiling for a linux target from windows, I would guess forward slashes would be preferred as well.


https://reviews.llvm.org/D53066





More information about the cfe-commits mailing list