15102925731
2012-Apr-12 03:42 UTC
[LLVMdev] HELP: Clang options needed in command to compile device driver into linux module.
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. 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: zhenkaixd at 126.com or 846227103 at qq.com TEL: 15810729006(Beijing) Address: Room I-406, Central Building, Tsinghua University, Beijing, China. 100084. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120412/7d2f41c9/attachment.html>
Nick Lewycky
2012-Apr-12 04:45 UTC
[LLVMdev] HELP: Clang options needed in command to compile device driver into linux module.
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: zhenkaixd at 126.com <mailto:zhenkaixd at 126.com> or 846227103 at qq.com > <mailto:846227103 at qq.com> > TEL: 15810729006(Beijing) > Address: Room I-406, Central Building, Tsinghua University, Beijing, > China. 100084. > > > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
15102925731
2012-Apr-12 04:58 UTC
[LLVMdev] HELP: Clang options needed in command to compile device driver into linux module.
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! -- 祝好! 甄凯 ------------------------------------------------------------------------------------------------------ 2012-04-12 ------------------------------------------------------------------------------------------------------ Name: 甄凯(ZhenKai) Homepage:http://www.renren.com/262729393 Email: zhenkaixd at 126.com or 846227103 at qq.com TEL: 15810729006(Beijing) Address: Room I-406, Central Building, Tsinghua University, Beijing, China. 100084. 在 2012-04-12 12:45:14,"Nick Lewycky" <nicholas at mxc.ca> 写道:>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: zhenkaixd at 126.com <mailto:zhenkaixd at 126.com> or 846227103 at qq.com >> <mailto:846227103 at qq.com> >> TEL: 15810729006(Beijing) >> Address: Room I-406, Central Building, Tsinghua University, Beijing, >> China. 100084. >> >> >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120412/5bcfa199/attachment.html>
Seemingly Similar Threads
- [LLVMdev] HELP: Clang options needed in command to compile device driver into linux module.
- [LLVMdev] How to compile a linux module into .bc file using clang or llvm command?
- [LLVMdev] How to compile a linux module into .bc file using clang or llvm command?
- [LLVMdev] How to compile a linux module into .bc file using clang or llvm command?
- [LLVMdev] How to compile a linux module into .bc file using clang or llvm command?