15102925731
2012-Apr-16 11:42 UTC
[LLVMdev] How to compile this linux-driver like programme into .bc file?
Thanks for your help and patience! Best regards, Zhen Kai At 2012-04-16 15:35:25,"陳韋任" <chenwj at iis.sinica.edu.tw> wrote:>> The thing is that I know the Makefile to complete that task. But what I want to know the clang command that can do that. Since the makefile will generate a .ko file while I can use the clang command "-O3-emit-llvm" to generate a corresponding .bc file so the pass can be run on that. > > I guess you can use something like (I am not SURE if Clang support those GCC >flags entirely, try it yourself), > >$ clang -O2 -DMODULE -D__KERNEL__ YOUR_MODULE.c \ > -W -Wall -Wstrict-prototypes -Wmissing-prototypes \ > -isystem /lib/modules/`uname -r`/build/include \ > -emit-llvm -o YOUR_MODULE.bc > >Regards, >chenwj > >-- >Wei-Ren Chen (陳韋任) >Computer Systems Lab, Institute of Information Science, >Academia Sinica, Taiwan (R.O.C.) >Tel:886-2-2788-3799 #1667 >Homepage: http://people.cs.nctu.edu.tw/~chenwj
陳韋任
2012-Apr-17 02:13 UTC
[LLVMdev] How to compile this linux-driver like programme into .bc file?
> >$ clang -O2 -DMODULE -D__KERNEL__ YOUR_MODULE.c \ > > -W -Wall -Wstrict-prototypes -Wmissing-prototypes \ > > -isystem /lib/modules/`uname -r`/build/include \ > > -emit-llvm -o YOUR_MODULE.bcYou might need "-c" option so that Clang will not link the .bc file to other libraries (.o file), just emit the final .bc file. Regards, chenwj -- Wei-Ren Chen (陳韋任) Computer Systems Lab, Institute of Information Science, Academia Sinica, Taiwan (R.O.C.) Tel:886-2-2788-3799 #1667 Homepage: http://people.cs.nctu.edu.tw/~chenwj
15102925731
2012-Apr-18 13:56 UTC
[LLVMdev] How to compile this linux-driver like programme into .bc file?
Dear Chen, I tried the command you told me. It turns out that clang use -I option rather then -isystem. But after I included the init.h file, it fired at me that "asm/processor.h" is not fount. Then I included that file using -I option and some other files were said not found! It's like I opened a can of worms... I can still continue to include the file that is said not found. But is it the right way ? Thank you! clang -O2 -DMODULE -D__KERNEL__ YOUR_MODULE.c \>> -W -Wall -Wstrict-prototypes -Wmissing-prototypes \ >> -I /lib/modules/`uname -r`/build/include \ >> -emit-llvm -o YOUR_MODULE.bc-- 祝好! 甄凯 ------------------------------------------------------------------------------------------------------ 2012-04-18 ------------------------------------------------------------------------------------------------------ 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-16 19:42:46,15102925731 <zhenkaixd at 126.com> 写道:>Thanks for your help and patience! > >Best regards, >Zhen Kai >At 2012-04-16 15:35:25,"陳韋任" <chenwj at iis.sinica.edu.tw> wrote: >>> The thing is that I know the Makefile to complete that task. But what I want to know the clang command that can do that. Since the makefile will generate a .ko file while I can use the clang command "-O3-emit-llvm" to generate a corresponding .bc file so the pass can be run on that. >> >> I guess you can use something like (I am not SURE if Clang support those GCC >>flags entirely, try it yourself), >> >>$ clang -O2 -DMODULE -D__KERNEL__ YOUR_MODULE.c \ >> -W -Wall -Wstrict-prototypes -Wmissing-prototypes \ >> -isystem /lib/modules/`uname -r`/build/include \ >> -emit-llvm -o YOUR_MODULE.bc >> >>Regards, >>chenwj >> >>-- >>Wei-Ren Chen (陳韋任) >>Computer Systems Lab, Institute of Information Science, >>Academia Sinica, Taiwan (R.O.C.) >>Tel:886-2-2788-3799 #1667 >>Homepage: http://people.cs.nctu.edu.tw/~chenwj-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120418/b84dadb7/attachment.html>
15102925731
2012-Apr-18 14:11 UTC
[LLVMdev] How to compile this linux-driver like programme into .bc file?
I may try to use the Makefile then. When using gcc the Makefile is CC := colorgcc obj-m := hello.o KERNELDIR := /lib/modules/2.6.36.1/build PWD := $(shell pwd) modules: $(MAKE) -C $(KERNELDIR) M=$(PWD) modules #modules install: # $(MAKE) -C $(KERNELDIR) M=$(PWD) modules_install How to change it so the generating result is .bc file not the .o file? PLEASE BE KIND AND HELP ME~~ -- 祝好! 甄凯 ------------------------------------------------------------------------------------------------------ 2012-04-18 ------------------------------------------------------------------------------------------------------ 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. At 2012-04-18 21:56:43,15102925731 <zhenkaixd at 126.com> wrote: Dear Chen, I tried the command you told me. It turns out that clang use -I option rather then -isystem. But after I included the init.h file, it fired at me that "asm/processor.h" is not fount. Then I included that file using -I option and some other files were said not found! It's like I opened a can of worms... I can still continue to include the file that is said not found. But is it the right way ? Thank you! clang -O2 -DMODULE -D__KERNEL__ YOUR_MODULE.c \>> -W -Wall -Wstrict-prototypes -Wmissing-prototypes \ >> -I /lib/modules/`uname -r`/build/include \ >> -emit-llvm -o YOUR_MODULE.bc-- 祝好! 甄凯 ------------------------------------------------------------------------------------------------------ 2012-04-18 ------------------------------------------------------------------------------------------------------ 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-16 19:42:46,15102925731 <zhenkaixd at 126.com> 写道:>Thanks for your help and patience! > >Best regards, >Zhen Kai >At 2012-04-16 15:35:25,"陳韋任" <chenwj at iis.sinica.edu.tw> wrote: >>> The thing is that I know the Makefile to complete that task. But what I want to know the clang command that can do that. Since the makefile will generate a .ko file while I can use the clang command "-O3-emit-llvm" to generate a corresponding .bc file so the pass can be run on that. >> >> I guess you can use something like (I am not SURE if Clang support those GCC >>flags entirely, try it yourself), >> >>$ clang -O2 -DMODULE -D__KERNEL__ YOUR_MODULE.c \ >> -W -Wall -Wstrict-prototypes -Wmissing-prototypes \ >> -isystem /lib/modules/`uname -r`/build/include \ >> -emit-llvm -o YOUR_MODULE.bc >> >>Regards, >>chenwj >> >>-- >>Wei-Ren Chen (陳韋任) >>Computer Systems Lab, Institute of Information Science, >>Academia Sinica, Taiwan (R.O.C.) >>Tel:886-2-2788-3799 #1667 >>Homepage: http://people.cs.nctu.edu.tw/~chenwj-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120418/83e1cfe5/attachment.html>
Seemingly Similar Threads
- [LLVMdev] How to compile this linux-driver like programme into .bc file?
- [LLVMdev] How to compile this linux-driver like programme into .bc file?
- [LLVMdev] HELP: Clang options needed in command to compile device driver into linux module.
- [LLVMdev] How to compile this linux-driver like programme into .bc file?
- [LLVMdev] How to compile a linux module into .bc file using clang or llvm command?