Thank you guys for the answer. These definitely help a lot:)<br><br><div class="gmail_quote">On Thu, Aug 2, 2012 at 3:54 PM, Dmitry N. Mikushin <span dir="ltr"><<a href="mailto:maemarcus@gmail.com" target="_blank">maemarcus@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Dear Zhang,<br>
<br>
Compiler ends up invoking cc1 (the backend) anyways. So if you would<br>
like to invoke it by hand, the only thing to know is the right<br>
combination of options. Try to use the compiler verbose option "-v".<br>
It will show you how exactly clang invokes the backend:<br>
<br>
> clang -v -c showdebug.c<br>
clang version 3.2 (trunk 156703)<br>
Target: x86_64-unknown-linux-gnu<br>
Thread model: posix<br>
 "/opt/kernelgen/bin/clang" -cc1 -triple x86_64-unknown-linux-gnu<br>
-emit-obj -mrelax-all -disable-free -main-file-name showdebug.c<br>
-mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose<br>
-mconstructor-aliases -munwind-tables -target-cpu x86-64<br>
-target-linker-version 11 -momit-leaf-frame-pointer -v -coverage-file<br>
showdebug.o -resource-dir /opt/kernelgen/bin/../lib/clang/3.2<br>
-fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem<br>
/usr/local/include -internal-isystem<br>
/opt/kernelgen/bin/../lib/clang/3.2/include -internal-externc-isystem<br>
/include -internal-externc-isystem /usr/include<br>
-fdebug-compilation-dir<br>
/RHM/users/work/dmikushin/forge/kernelgen/trunk/src -ferror-limit 19<br>
-fmessage-length 173 -mstackrealign -fgnu-runtime<br>
-fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi<br>
-fdiagnostics-show-option -fcolor-diagnostics -o showdebug.o -x c<br>
showdebug.c<br>
clang -cc1 version 3.2 based upon LLVM 3.2svn default target<br>
x86_64-unknown-linux-gnu<br>
ignoring nonexistent directory "/include"<br>
#include "..." search starts here:<br>
#include <...> search starts here:<br>
 /usr/local/include<br>
 /opt/kernelgen/bin/../lib/clang/3.2/include<br>
 /usr/include<br>
End of search list.<br>
<br>
Happy hacking,<br>
- Dima.<br>
<br>
2012/8/2 Eli Friedman <<a href="mailto:eli.friedman@gmail.com">eli.friedman@gmail.com</a>>:<br>
<div><div class="h5">> On Thu, Aug 2, 2012 at 8:56 AM, Xinglin Zhang <<a href="mailto:xinglinzh@gmail.com">xinglinzh@gmail.com</a>> wrote:<br>
>> Hi,<br>
>><br>
>> I am quite new to LLVM. I just compiled LLVM and clang on Ubuntu11.10 then<br>
>> followed the tutorial  <a href="http://llvm.org/docs/DebuggingJITedCode.html" target="_blank">http://llvm.org/docs/DebuggingJITedCode.html</a><br>
>><br>
>> clang -cc1 -O0 -g -emit-llvm showdebug.c<br>
>><br>
>><br>
>> where showdebug.c contains:<br>
>><br>
>> #include<stdio.h><br>
>> int main()<br>
>> {<br>
>>   printf("hello\n");<br>
>>   return 0;<br>
>> }<br>
>><br>
>> But I got<br>
>> Fatal error: 'stdio.h' file not found.<br>
>><br>
>><br>
>> However,<br>
>><br>
>> clang showdebug.c<br>
>><br>
>><br>
>> has no problem. I know -g means to generate debug information, -emit-llvm<br>
>> means use the llvm representation for assembler and object files.<br>
>><br>
>> Then what do -cc1 and -O0 mean?<br>
><br>
> -O0 means "turn off optimization".  -cc1 means "please screw up my<br>
> compilation in mysterious ways".<br>
><br>
> -Eli<br>
</div></div>> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Xinglin Zhang<br><br>