<div dir="ltr">Could you provide a small standalone example and precise commands to reproduce the case you're describing?</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Jan 13, 2021 at 9:06 AM Oleksiy Obitotskyi -X (oobitots - GLOBALLOGIC INC at Cisco) via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi,</p>
<p><br>
</p>
<p>I'm working on reproducibility (or deterministic build) issues with clang.</p>
<p>And I got issue with compiler-rt libraries, some of the debug symbols comes with source absolute path, e.g.:</p>
<p><br>
</p>
<p><span style="font-size:10pt;font-family:"Courier New",monospace"><span style="font-family:"Courier New",monospace">strings ./build/lib64/linux/libclang_rt.fuzzer-x86_64.a | grep "lambda at"</span></span></p>
<p><span style="font-size:10pt;font-family:"Courier New",monospace"><span style="font-family:"Courier New",monospace">...</span></span></p>
<p><span style="font-size:10pt;font-family:"Courier New",monospace"><span style="font-family:"Courier New",monospace">---8<--- A</span><br style="font-family:"Courier New",monospace">
</span></p>
<p><span style="font-size:10pt;font-family:"Courier New",monospace"><span style="font-family:"Courier New",monospace">CollectFeatures<(lambda at /compiler-rt/lib/fuzzer/FuzzerDriver.cpp:482:25)></span></span></p>
<p><span style="font-size:10pt;font-family:"Courier New",monospace"><span style="font-family:"Courier New",monospace">...</span><br style="font-family:"Courier New",monospace">
</span></p>
<p><span style="font-size:10pt;font-family:"Courier New",monospace"><span style="font-family:"Courier New",monospace">---8<--- B</span><br style="font-family:"Courier New",monospace">
</span></p>
<p><span style="font-size:10pt;font-family:"Courier New",monospace"><span style="font-family:"Courier New",monospace">void fuzzer::TracePC::IterateInline8bitCounters(CallBack) [CallBack = (lambda at
</span></span></p>
<p><span style="font-size:10pt;font-family:"Courier New",monospace"><span style="font-family:"Courier New",monospace"><some-path>/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp:77:29)]</span><br style="font-family:"Courier New",monospace">
<span style="font-family:"Courier New",monospace">void fuzzer::TracePC::IterateInline8bitCounters(CallBack) [CallBack = (lambda at
</span></span></p>
<p><span style="font-size:10pt;font-family:"Courier New",monospace"><span style="font-family:"Courier New",monospace"><some-path>/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp:85:29)]</span><br style="font-family:"Courier New",monospace">
<span style="font-family:"Courier New",monospace">void fuzzer::TracePC::IterateInline8bitCounters(CallBack) [CallBack = (lambda at
</span></span></p>
<p><span style="font-size:10pt;font-family:"Courier New",monospace"><span style="font-family:"Courier New",monospace"><some-path>/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp:99:29)]</span><br style="font-family:"Courier New",monospace">
<span style="font-family:"Courier New",monospace">void fuzzer::TracePC::IterateInline8bitCounters(CallBack) [CallBack = (lambda at
</span></span></p>
<p><span style="font-size:10pt;font-family:"Courier New",monospace"><span style="font-family:"Courier New",monospace"><some-path>/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp:206:33)]</span><br style="font-family:"Courier New",monospace">
<span style="font-family:"Courier New",monospace">void fuzzer::TracePC::IterateCoveredFunctions(CallBack) [CallBack = (lambda at
</span></span></p>
<p><span style="font-size:10pt;font-family:"Courier New",monospace"><span style="font-family:"Courier New",monospace"><some-path>/compiler-rt/lib/fuzzer/FuzzerTracePC.cpp:314:34)]</span></span></p>
<p><span style="font-size:10pt;font-family:"Courier New",monospace"><span style="font-family:"Courier New",monospace">---8<--- C</span><br style="font-family:"Courier New",monospace">
<span style="font-family:"Courier New",monospace">IterateInline8bitCounters<(lambda at /compiler-rt/lib/fuzzer/FuzzerTracePC.cpp:77:29)></span><br style="font-family:"Courier New",monospace">
<span style="font-family:"Courier New",monospace">IterateInline8bitCounters<(lambda at /compiler-rt/lib/fuzzer/FuzzerTracePC.cpp:85:29)></span><br style="font-family:"Courier New",monospace">
<span style="font-family:"Courier New",monospace">IterateInline8bitCounters<(lambda at /compiler-rt/lib/fuzzer/FuzzerTracePC.cpp:99:29)></span><br style="font-family:"Courier New",monospace">
<span style="font-family:"Courier New",monospace">IterateInline8bitCounters<(lambda at /compiler-rt/lib/fuzzer/FuzzerTracePC.cpp:206:33)></span><br style="font-family:"Courier New",monospace">
<span style="font-family:"Courier New",monospace">IterateCoveredFunctions<(lambda at /compiler-rt/lib/fuzzer/FuzzerTracePC.cpp:314:34)></span><br style="font-family:"Courier New",monospace">
</span></p>
<p><span style="font-size:10pt;font-family:"Courier New",monospace"><span style="font-family:"Courier New",monospace">...</span></span></p>
<p><br>
</p>
<p>Conditions:<br>
</p>
<p>- clang version 7 used.<br>
</p>
<p>- flags -ffile-prefix-map/debug-prefix-map/macro-prefix-map <some-path> are set during compilation</p>
<p>- patch backported <a href="https://github.com/llvm/llvm-project/commit/56acd5a66ea3800a23be0cfdbc422624398cb096" target="_blank">
https://github.com/llvm/llvm-project/commit/56acd5a66ea3800a23be0cfdbc422624398cb096</a><br>
</p>
<p><br>
</p>
<p>In section A and C debug symbols for lambda have path correctly remapped with prefix set in -f<file/debug/macro>-prefix-map.</p>
<p>But section B debug symbols for the same lambda code goes without remapping (and it's ok TypePrinter code works properly in this case).</p>
<p><br>
</p>
<p>For section B TypePrinter::printTag called with PrintingPolicy.RemapFilePaths set, but for section A the same function called with different PrintingPolicy and RemapFilePaths is not set.</p>
<p><br>
</p>
<p><br>
</p>
<p>- I'm not sure is it ok that two sections generated in different way and what is the reason for this? The similar code with lambdas from section A produce only one symbol type with remapped path.<br>
</p>
<p><br>
</p>
<p>- Is it possible and is it make sense to pass CGDebugInfo settings to the code Sema::BuildPredefinedExpr to apply
</p>
<p>RemapFilePaths settings to the PrintingPolicy used? As I understand symbols could be generated into different compilation stages/passes and some code generation settings could not be applied directly during other stages.<br>
</p>
<p><br>
</p>
<p>Regards,</p>
<p>Oleksiy<br>
</p>
</div>

_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div>