[PATCH] D48988: Debug prefix map for machine code emission

Siddhartha Bagaria via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 5 16:12:04 PDT 2018


starsid added inline comments.


================
Comment at: lib/MC/MCDwarf.cpp:405
     // Record path strings, emit references here.
-    LineStr->emitRef(MCOS, CompDir);
-    for (auto &Dir : MCDwarfDirs)
-      LineStr->emitRef(MCOS, Dir);
+    LineStr->emitRef(MCOS, RemappedCompDir);
+    for (auto &Dir : MCDwarfDirs) {
----------------
compnerd wrote:
> mmm, should this really apply to the compilation directory?
I think so, the point is to remap all paths so that the binary can be made to have the same digest irrespective of the source root.

I checked with gcc and they do the same for assembly files.

```lang=bash
curl -O https://golang.org/src/runtime/cgo/gcc_amd64.S
gcc -g -c gcc_amd64.S -o gcc_amd64 && strings gcc_amd64 | grep $PWD 
gcc -g -c gcc_amd64.S -o gcc_amd64 -fdebug-prefix-map=$PWD= && strings gcc_amd64 | grep $PWD
```


Repository:
  rL LLVM

https://reviews.llvm.org/D48988





More information about the llvm-commits mailing list