[PATCH] D80168: For --relativenames, handle dwarf absolute include directories similarly to compilation directories.

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 21 11:21:59 PDT 2020


dblaikie added a comment.

Yeah, I'm kind of inclined to agree with @aprantl here - when the client asks for relative names I could see how that'd be reasonable to say "don't add the compilation dir" but I'm not sure what it means for other paths/doesn't necessarily seem reasonable for it to mean "give me back the unqualified name" even if it's relative to some other/unknown directory.

How would the client then know where to find this name relative to?

> The immediate case is that if a file has an include directory of zero under dwarf 5, that is the same as the compilation directory, and it should not be added relative names. This allows for a consumer to set a single base directory for finding the files, even if the root has changed.

I /think/ I'd be open to special casing directory zero for this

> But more generally, if the producer chose to use an absolute path as the include directory, that probably means that the include directory was specified as an absolute path on the command line (at least not relative to the compilation directory). If, under relative names we return the filename as an absolute path here, the consumer can't specify a different root for this set of files without quite a bit more guesswork.

It seems like a client that ended up with this response would have to resolve all relative names relative to both the new compilation dir/root, and any include paths (which it can't determine from the DWARF at all) - that doesn't seem to me like a great state of affairs? But legit question what asking for relative names means. I think "relative to the compilation dir, but otherwise absolute" makes some sense - you have system directories at system-known locations, but your source tree might be moving around on different distributed build machines, etc. Everything relative to a variety of different directories seems difficult to work with in practice.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80168/new/

https://reviews.llvm.org/D80168





More information about the llvm-commits mailing list