[PATCH] D45473: CodeGen: Don't try to canonicalize Unix-style paths in CodeView debug info.

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 10 16:11:29 PDT 2018


rnk added a comment.

In https://reviews.llvm.org/D45473#1063531, @pcc wrote:

> In https://reviews.llvm.org/D45473#1063321, @rnk wrote:
>
> > Can you elaborate on the use case? What tool do you expect will consume these Unix style paths?
>
>
> We can use the paths to provide better linker error messages. See https://reviews.llvm.org/D45467.


For this use case, is it actually important to preserve symlinks? Would it be enough to make the linker canonicalize the slashes to native format when printing the diagnostic?



================
Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:117-125
+  // If this is a Unix-style path, just use it as is. Don't try to canonicalize
+  // it textually because one of the path components could be a symlink.
+  if (!Dir.empty() && Dir[0] == '/') {
+    Filepath = Dir;
+    if (Dir.back() != '/')
+      Filepath += '/';
+    Filepath += Filename;
----------------
pcc wrote:
> zturner wrote:
> > Shouldn't we instead just use something like `LLVM_ON_WIN32` etc?
> I don't think so. Imagine that you have something like a ThinLTO distributed build where bitcode files are copied to a remote machine where code generation happens. In that case the code generator won't necessarily be running the same operating system as the bitcode producer was, and the consumer of the object file will be expecting a path style consistent with the bitcode producer.
Yes, this definitely shouldn't be conditional on macros, it's deep in LLVM codegen. `llc` should do the same thing with IR everywhere.


https://reviews.llvm.org/D45473





More information about the llvm-commits mailing list