<div dir="ltr">Hello,<div><br></div><div>I have updated the alternative solution with internal linkage. </div><div>It looks like the previous solution (with naming) gives more similar results to the Linux based version </div><div>(After short test I noticed that the same counters are merged during linking on linux).</div><div><br></div><div>During bigger tests similar linker error I have also received with ___profn_ variable for classes with virtual destructors, but it looks like completely different problem.</div><div>I should have more time to analyze this case in the next week.</div><div><br></div><div>Regards,</div><div>Adam</div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-05-03 23:40 GMT+02:00 Xinliang David Li <span dir="ltr"><<a href="mailto:davidxl@google.com" target="_blank">davidxl@google.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I am fine with a COFF specific change (either linkage or naming) assuming tests are fine.  Other platforms should be left unchanged.<span class="HOEnZb"><font color="#888888"><div><br></div><div>David</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 3, 2017 at 2:32 PM, Adam Folwarczny via Phabricator <span dir="ltr"><<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">adamf added a comment.<br>
<span><br>
> I suspect that the appropriate fix is to give the __profd variables internal linkage, not to change the comdat name. The linker will still discard duplicate profc and profd sections with this change.<br>
<br>
</span>I have made few tests and changing to InternalLinkage seems also to work. The patch is in attachment. F3280107: InstrProfiling.patch <<a href="https://reviews.llvm.org/F3280107" rel="noreferrer" target="_blank">https://reviews.llvm.org/F328<wbr>0107</a>>.<br>
This patch affects all formats, not only COFF.<br>
With InternalLinkage we should change both _ _profd and _ _profc. (If we change only _ _ profd then counters in the coverage report are not properly interpreted).<br>
Another advantage of using InternalLinkage is that we can check the counters for each translation unit.<br>
<br>
Because fixing this problem starts to affect more amount of code and requires wider knowledge I am afraid that I won't be able to provide fully valuable fix.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D32688" rel="noreferrer" target="_blank">https://reviews.llvm.org/D3268<wbr>8</a><br>
<br>
<br>
<br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>