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

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 24 08:03:55 PDT 2018


It seems like some combination of checking the target triple, host triple,
and driver mode and putting the conversions behind those checks could work?

For paths like resource dir that are going into debug info it should be
driver mode. For paths we pass to another tool it should probably be based
on target triple . This probably isn’t perfect, but WDYT?
On Wed, Oct 24, 2018 at 12:16 AM Martin Storsjö via Phabricator <
reviews at reviews.llvm.org> wrote:

> 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
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181024/62645bac/attachment.html>


More information about the llvm-commits mailing list