<div>Thanks. It works. Just move `static' out.</div><div><br></div><div>Thank you very much.<br><br><div class="gmail_quote">2011/1/17 Török Edwin <span dir="ltr"><<a href="mailto:edwintorok@gmail.com">edwintorok@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On 2011-01-17 14:33, Wen-Han Gu wrote:<br>
> Hi all,<br>
><br>
> I have some functions definition to be used in another place.<br>
<br>
</div>If the function is not declared as "static", then clang must already<br>
assume it can be used externally, and can't eliminate the code (even if<br>
optimizing up to O3).<br>
Unless you perform LTO, -internalize, or other such whole program<br>
transformations, the code should be emitted.<br>
<br>
The linker might still eliminate the function if no function from a<br>
.o/.a is needed.<br>
<div class="im"><br>
> I want to generate LLVM IR without any dead-code elimination, or the<br>
> output will contains nothing.<br>
<br>
</div>-O0 should work, but obviously won't have any other optimization.<br>
<div class="im"><br>
><br>
> Did anyone know how to achive that without any change of source code?<br>
<br>
> If not this way, which source file should I modify?<br>
<br>
</div>__attribute__((used)) if you use the function from assembly and compiler<br>
can't see its used.<br>
<br>
Best regards,<br>
--Edwin<br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Best regards,<br>Wen-Han<br>
</div>