<div dir="ltr"><br><br><div class="gmail_quote">On Mon, Mar 7, 2011 at 12:18 PM, Muli Ben-Yehuda <span dir="ltr"><<a href="mailto:muli@il.ibm.com">muli@il.ibm.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">On Mon, Mar 07, 2011 at 12:11:36PM +0200, Erez D wrote:<br>
<br>
> I have a function which is not called in a regular way, so gcc<br>
> thinks it is dead code. however it is not, and i am looking for a<br>
> way to tell the linker not to remove it.<br>
<br>
</div>extern<br>
<br>
<br></blockquote><div>And set the function pointer to a global variable, so that the linker cannot know if the value is used or not.</div><div>This trick I learned from Nadav Har'El worked through many compilers and linkers over the past decade. </div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
_______________________________________________<br>
Linux-il mailing list<br>
<a href="mailto:Linux-il@cs.huji.ac.il">Linux-il@cs.huji.ac.il</a><br>
<a href="http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il" target="_blank">http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Orna Agmon Ben-Yehuda.<br><a href="http://ladypine.org">http://ladypine.org</a><br>
</div>