<div dir="ltr">Rafael,<div><br></div><div>In ISPC project we use linker to merge to two bitcode files. Note that I've use word "merge", not link, as it describes better what we need. I.e. we have several parts of our language standard library and merge them in single bitcode file. And in our case we have quite many *declarations*, which we need to merge in. Some symbols are really need to be just declarations, as their use are guaranteed to be on dead path in other parts of the standard library and it's removed later.</div><div><br></div><div>Is it possible to manage removing declarations by linker flag, but not doing it unconditionally?</div><div><br></div><div>Dmitry.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 9, 2015 at 10:19 PM, Rafael EspĂ­ndola <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@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">On 9 December 2015 at 12:33, Tobias Edler Von Koch<br>
<span class=""><<a href="mailto:tobias@codeaurora.org">tobias@codeaurora.org</a>> wrote:<br>
> Hi Rafael,<br>
><br>
> On 12/08/2015 08:25 PM, Rafael EspĂ­ndola via llvm-commits wrote:<br>
>><br>
>> Note that the behaviour was not "preserve all globals". We were<br>
>> already lazy linking declarations that can be dropped, like<br>
>> linkonce_odr and internal.<br>
><br>
><br>
> We're actually hitting an issue related to that. Our linker, during LTO,<br>
> sometimes puts linkonce/linkonce_odr functions on the preserve list.<br>
> However, this has currently no effect as they could be deleted a) during<br>
> lazy IR linking if there are no uses to begin with, or b) during DCE if,<br>
> say, they were inlined completely.<br>
><br>
> To handle case b) we can introduce a use through @llvm.compiler.used in<br>
> LTOCodeGenerator::applyRestriction but for a) that doesn't work because IR<br>
> linking happens earlier.<br>
><br>
> Any ideas?<br>
<br>
</span>Yes :-)<br>
<br>
Check what the gold plugin does. If the gold linker asks for a value<br>
to be preserved, it is changed to a weak/weak_odr to make sure it<br>
survives all of the pipeline.<br>
<br>
Cheers,<br>
Rafael<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>