<div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial">BTW, the Makefile is as folllow,<br><br>CC := gcc<br>obj-m := hellomodule.o<br>KERNELDIR := /lib/modules/`uname -r`/build <br>PWD := $(shell pwd)<br>modules:<br> $(MAKE) -C $(KERNELDIR) M=$(PWD) modules<br><br>Can I use an option of clang to specify the KERNELDIR ,etc? <br>Thank you!<br><br><div>--<br><div>
<div>
<div><font color="#c0c0c0" size="2">
<div><font color="#c0c0c0"><font size="3"> <span style="COLOR: #000000"> ×£ºÃ£¡</span></font></font></div><span style="COLOR: #000000">
<div> </div>
<div><font size="3"> Õç¿</font></div>
<div>
<div><font color="#c0c0c0"><font size="3">------------------------------------------------------------------------------------------------------</font></font></div></div>
<div><font color="#c0c0c0"><font size="3">2012-04-12</font></font></div></span></font></div>
<div><font color="#c0c0c0"><font size="3">------------------------------------------------------------------------------------------------------</font></font></div>
<div><font color="#c0c0c0"><font size="3">Name: Õç¿(ZhenKai)<br>Homepage:http://www.renren.com/262729393</font></font></div>
<div><font color="#c0c0c0"><font size="3">Email: </font><a href="mailto:zhenkaixd@126.com" target="_blank" _listener="1901"><font color="#0066cc" size="3">zhenkaixd@126.com</font></a><font size="3"> or <a href="mailto:846227103@qq.com">846227103@qq.com</a></font></font></div>
<div><font color="#c0c0c0" size="3">TEL: 15810729006(Beijing)<br>Address: Room I-406, Central Building, Tsinghua University, Beijing, China. 100084.</font></div></div></div></div><div id="divNeteaseMailCard"></div><br>At 2012-04-12 15:05:17,15102925731 <zhenkaixd@126.com> wrote:<br> <blockquote id="isReplyContent" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid"><div style="line-height:1.7;color:#000000;font-size:14px;font-family:arial">Wow that's to much output information.<br><br>Maybe I can put it in this way. Could you tell me the clang option that can include the linux kernel headers???<br>Something like<br><b> "clang -O3<span style="color: rgb(255, 0, 0);"> -isystem /lib/modules/`uname -r`/build/include</span> -emit-llvm hellomodule.c -c -o hellomodule.bc"</b><br>Thank you!<br><br><div>--<br><div>
<div>
<div><font color="#c0c0c0" size="2">
<div><font color="#c0c0c0"><font size="3"> <span style="COLOR: #000000"> ×£ºÃ£¡</span></font></font></div><span style="COLOR: #000000">
<div> </div>
<div><font size="3"> Õç¿</font></div>
<div>
<div><font color="#c0c0c0"><font size="3">------------------------------------------------------------------------------------------------------</font></font></div></div>
<div><font color="#c0c0c0"><font size="3">2012-04-12</font></font></div></span></font></div>
<div><font color="#c0c0c0"><font size="3">------------------------------------------------------------------------------------------------------</font></font></div>
<div><font color="#c0c0c0"><font size="3">Name: Õç¿(ZhenKai)<br>Homepage:http://www.renren.com/262729393</font></font></div>
<div><font color="#c0c0c0"><font size="3">Email: </font><a href="mailto:zhenkaixd@126.com" target="_blank" _listener="1901"><font color="#0066cc" size="3">zhenkaixd@126.com</font></a><font size="3"> or <a href="mailto:846227103@qq.com">846227103@qq.com</a></font></font></div>
<div><font color="#c0c0c0" size="3">TEL: 15810729006(Beijing)<br>Address: Room I-406, Central Building, Tsinghua University, Beijing, China. 100084.</font></div></div></div></div><div></div><br><pre><br>At 2012-04-12 14:07:38,"Nick Lewycky" <<a href="mailto:nicholas@mxc.ca">nicholas@mxc.ca</a>> wrote:
>15102925731 wrote:
>> Hi, Nick
>> I think that's the question. I just don't know what's the command line
>> that can tell clang to find the linux head file like a makefile will do.
>> Please help me!
>
>In the linux kernel, "make V=1" will compile verbosely, printing out
>each command it runs. Each .o file produced will have its own
>command-line (many of them will be the same, but you have to make sure
>you use the right one).
>
>Nick
>
>>
>> --
>> ×£ºÃ£¡
>> Õç¿
>> ------------------------------------------------------------------------------------------------------
>>
>> 2012-04-12
>> ------------------------------------------------------------------------------------------------------
>>
>> Name: Õç¿(ZhenKai)
>> Homepage:http://www.renren.com/262729393
>> Email: <a href="mailto:zhenkaixd@126.com">zhenkaixd@126.com</a> <mailto:<a href="mailto:zhenkaixd@126.com">zhenkaixd@126.com</a>> or <a href="mailto:846227103@qq.com">846227103@qq.com</a>
>> <mailto:<a href="mailto:846227103@qq.com">846227103@qq.com</a>>
>> TEL: 15810729006(Beijing)
>> Address: Room I-406, Central Building, Tsinghua University, Beijing,
>> China. 100084.
>>
>>
>> ÔÚ 2012-04-12 12:45:14£¬"Nick Lewycky" <<a href="mailto:nicholas@mxc.ca">nicholas@mxc.ca</a>> дµÀ£º
>>>15102925731 wrote:
>>>> Hello£¬
>>>>
>>>> What option should be added in the clang command to compile linux device
>>>> driver£¨from .c to .bc£©?
>>>> Typically we need a makefile to compile a module. But I just want a
>>>> simple command line.
>>>
>>>Make, using the information in the Makefile, runs gcc or clang with a
>>>long command line. That command line tells gcc/clang how to do things,
>>>like where to find linux/init.h or how certain macros are to be defined.
>>>
>>>It doesn't matter whether you run clang from the makefile or not, but
>>>you will need the correct command line for it to work. What command line
>>>does make run gcc with?
>>>
>>>Nick
>>>
>>>>
>>>> I tried *"clang -O3 -emit-llvm hello.c -c -o hello.bc "* but errors
>>>> occurred saying
>>>> fatal error: 'linux/init.h' file not found
>>>> #include <linux/init.h>
>>>> ^
>>>> 1 error generated
>>>> Then I was taught to add -D or -I option so that clang can find the
>>>> linux kernel head file. But I still dont know
>>>> how exactly the command like......All I want to know is a clang command
>>>> line that can compile a helloworldmodule.c into helloworldmodule.bc.
>>>>
>>>> Please give me some suggestion.
>>>> Any help would be appreciated!
>>>>
>>>> --
>>>> ×£ºÃ£¡
>>>> Õç¿
>>>> ------------------------------------------------------------------------------------------------------
>>>>
>>>> 2012-04-12
>>>> ------------------------------------------------------------------------------------------------------
>>>>
>>>> Name: Õç¿(ZhenKai)
>>>> Homepage:http://www.renren.com/262729393
>>>> Email: <a href="mailto:zhenkaixd@126.com">zhenkaixd@126.com</a> <mailto:<a href="mailto:zhenkaixd@126.com">zhenkaixd@126.com</a>> or <a href="mailto:846227103@qq.com">846227103@qq.com</a>
>>>> <mailto:<a href="mailto:846227103@qq.com">846227103@qq.com</a>>
>>>> TEL: 15810729006(Beijing)
>>>> Address: Room I-406, Central Building, Tsinghua University, Beijing,
>>>> China. 100084.
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> LLVM Developers mailing list
>>>> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> http://llvm.cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>>
>>
>>
>>
>
</pre></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span></blockquote></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>