<div dir="ltr">Hi,<div><br></div><div>I needed to compile a cuda source file (say, <a href="http://a.cu">a.cu</a>) into IR (a.bc), and then merge a.bc with another bitcode file (b.bc, compiled from <a href="http://b.cu">b.cu</a>). So I used <b>llvm-link a.bc b.bc -o c.bc</b></div><div><br></div><div>However, I noticed that an internal function '<b> _ZL21__nvvm_reflect_anchorv() </b>' is defined in both a.bc & b.bc, and when merging these two files, one of the two definitions was renamed to '<b>_ZL21__nvvm_reflect_anchorv.2()</b>', and written into c.bc.</div><div><br></div><div> Then I did <b>llc c.bc -o c.s -march=nvptx ; ptxas c.s -o c.o</b></div><div><b><br></b></div><div>However, ptxas would give the following complaint:</div><div><br></div><div>
<p class=""><span class=""><i>ptxas c.s, line 171; error : Duplicate definition of function '_ZL21__nvvm_reflect_anchorv'</i></span></p>
<p class=""><span class=""><i>ptxas c.s, line 171; fatal : Parsing error near '.2': syntax error</i></span></p><p class="">So I inspected c.s and found the issue above was caused by the following line:</p><p class="">
</p><p class=""><span class="">.<i>func</i></span><i><span class=""> (</span><span class="">.param</span><span class=""> .</span><span class="">b32</span><span class=""> </span><span class="">func_retval0</span><span class="">) </span><span class="">_ZL21__nvvm_reflect_anchorv</span><span class="">.</span><span class="">2</span><span class="">() </span><span class="">// @_ZL21__nvvm_reflect_anchorv.2</span></i></p><p class="">After I manually deleted the definition of this function in c.s, the compilation works file. I wonder how could I force llc to remove <b>`</b><span class="" style="font-weight:bold">_ZL21__nvvm_reflect_anchorv</span><span class="" style="font-weight:bold">.</span><span class="" style="font-weight:bold">2</span><span class=""><b>()`</b>? Or is that possible to prevent </span><span class="" style="font-weight:bold">_ZL21__nvvm_reflect_anchorv</span><span class=""><b>() </b>from being generated into a.bc & b.bc in the first place? </span>Or is this possible to ask llvm-link to NOT rename <b><span class="">_ZL21__nvvm_reflect_anchorv(</span><span class="">) </span></b><span class=""><i>into </i><b>ZL21__nvvm_reflect_anchorv</b></span><b><span class="">.</span><span class="">2</span></b><span class=""><b>()</b>? </span></p><p class=""><span class=""><i><br></i></span></p><p class=""><span class="">Thanks!</span></p><p class=""><span class=""><i>Yuanfeng Peng </i></span><b> </b></p><p class=""><span class=""><i><br></i></span></p></div></div>