<div dir="ltr">I haven't looked deeply into this issue, but I thought -no-canonical-prefixes was the flag for this use case. Can you elaborate on what makes it unsuitable?</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 28, 2017 at 6:43 AM, Joerg Sonnenberger via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello all,<br>
I've been discussing this topic on #llvm with some of the regulars, but<br>
this merrits a wider audience. As you some of you might know, NetBSD<br>
allows doing a full release build with GCC in a reproducable way,<br>
including variations of the source locations. This is currently not<br>
possible with clang and I want to fix that. There are four identified<br>
primary points where absolute path names leak into the output:<br>
<br>
(1) .file<br>
(2) DWARF<br>
(3) __FILE__<br>
(4) __PRETTY_FUNCTION__ for lambdas etc<br>
<br>
We have -fdebug-prefix-map [-fdpm from here] for (2) with some<br>
limitations. I've created -iremap for GCC for (3) years ago, the patch<br>
is still in review limbo.  We don't have anything for (1) and (4) right<br>
now in clangland. I've started to write patches for that, but this is a<br>
bit messy as it tends to duplicate code. This made me want to step back<br>
and review whether we need/want many different switches in first place.<br>
I couldn't come up with a very good reason, but it has been mentioned<br>
that Facebook is using -fdpm for speakable hacks to get space into the<br>
binaries for patching in real patches. That seems to be abusive for me,<br>
even when I can somewhat understand the motivation.<br>
<br>
My proposal forward is:<br>
(1) Tighten the definition of -fdpm to mean prefix paths, i.e. the next<br>
character must be a path separator:<br>
  -fdebug-prefix-map=/foo=/bar should not change /foobar into /barbar<br>
(2) Introduce a new option -frewrite-path=src=dst and make -fdpm an<br>
alias of it. The translation applies to all four points above.<br>
(3) Introduce a new -gdwarf-path-padding=$n option to prefix all path<br>
names encoded in DWARF with $n path separators.<br>
<br>
The goal forward is that path references in output files generated by<br>
clang (except dependency files) should easy adjustable to a canonical<br>
location, independent of where the sources are located.<br>
<br>
Joerg<br>
______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br></div>