Displaying 20 results from an estimated 800 matches similar to: "[LLVMdev] How to compile this linux-driver like programme into .bc file?"
2012 Apr 15
0
[LLVMdev] How to compile this linux-driver like programme into .bc file?
Hi ZhenKai,
Perhaps you can try to write a kernel module and compile it by using Clang first,
(see http://www.faqs.org/docs/kernel/). You might be interested in this page,
http://www.faqs.org/docs/kernel/x204.html which contains a Makefile used to compile
a kernel module. Good Luck!
Regards,
chenwj
--
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia
2012 Apr 16
2
[LLVMdev] How to compile this linux-driver like programme into .bc file?
Thank you, Chen!
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.
Any help?
--
祝好!
甄凯
2012 Apr 18
1
[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 Apr 18
0
[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
2012 Apr 12
2
[LLVMdev] How to compile a linux module into .bc file using clang or llvm command?
Yeah, but I tried that command and error message was generated:
hellomodule.c:1:10: fatal error: 'linux/init.h' file not found
#include <linux/init.h>
^
1 error generated.
how to solve this problem??
Thanks!
--
祝好!
甄凯
------------------------------------------------------------------------------------------------------
2012-04-12
2012 Apr 12
1
[LLVMdev] How to compile a linux module into .bc file using clang or llvm command?
Ok, that makes sense!
That is to say, I don't need a makefile (in which to specify the path to kernel) to compile it. Just a clang command with some option will do it, right?
--
祝好!
甄凯
------------------------------------------------------------------------------------------------------
2012-04-12
2012 Apr 12
0
[LLVMdev] How to compile a linux module into .bc file using clang or llvm command?
On 4/11/12 8:25 PM, 15102925731 wrote:
> Yeah, but I tried that command and error message was generated:
>
> hellomodule.c:1:10: fatal error: 'linux/init.h' file not found
> #include <linux/init.h>
> ^
> 1 error generated.
>
> how to solve this problem??
Well, you do have to include all the -I and -D options so that clang can
find the Linux kernel header
2012 Apr 11
2
[LLVMdev] How to compile a linux module into .bc file using clang or llvm command?
It's actually is .c file.
I just want firstly to compile helloworldmodule.c into helloworldmodule.bc.
Then I run a LLVM pass on it to do some optimization, and then I compile the modified .bc file into .ko file.
So, could you tell me how to compile helloworldmodule.c into helloworldmodule.bc? I think it's not the same command "clang -O3 -emit-llvm hello.c -c -o hello.bc".
2012 Apr 11
2
[LLVMdev] How to compile a linux module into .bc file using clang or llvm command?
Hi, my friends
I know there is a difference between compiling a linux module and a simple helloworld programme.
If I compile a helloworld.c file, the command is
"clang -O3 -emit-llvm hello.c -c -o hello.bc"
But what the command should be if I want to compile a linux module into a .bc file? (I know it may be an easy question to you guys, but I really don't know where to find the
2012 Apr 11
0
[LLVMdev] How to compile a linux module into .bc file using clang or llvm command?
2012/4/10 15102925731 <zhenkaixd at 126.com>
> Hi, my friends
>
>
> I know there is a difference between compiling a linux module and a simple
> helloworld programme.
> If I compile a helloworld.c file, the command is
> *"clang -O3 -emit-llvm hello.c -c -o hello.bc"*
> But what the command should be if I want to compile a linux module into a
> .bc file?
2012 Apr 16
3
[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
2012 Apr 10
2
[LLVMdev] How to get the module handle of a .bc file??
Hi all,
I want to run a function pass on a certain .bc file. In the process, the pass will insert a check function into the .bc file.
I know the .bc file is regarded as a module in LLVM. So, there are two basic steps needed to be done,
1, Use the "getOrInsertFunction"API to add a declaration of the extern "check function".
2, Use the "insertBefore"API to insert the
2012 Apr 10
0
[LLVMdev] How to get the module handle of a .bc file??
Objects that form the IR (functions, basic blocks, instructions) have
the getParent() method that returns their paren (module for a
function, basic block for a single instruction etc.)
BTW, LLVM Doxygen is really helpful. It's usually the first result
when you search for "LLVM <classname> class reference"
On Tue, Apr 10, 2012 at 11:17 AM, 15102925731 <zhenkaixd at
2012 Apr 07
1
[LLVMdev] How to insert a self-written function to a piece of programme
Hi all,
I wrote a function pass. In the pass, it ran through all the instruction that call to functions. When arriving at the exact function that I m interested in, it would insert a self-made function.
Now I've finished the pass, the compilation is successful. The pass can find the function I like and can insert the CallInst to call my check function. BUT, when running the
2012 Apr 12
2
[LLVMdev] HELP: Clang options needed in command to compile device driver into linux module.
Wow that's to much output information.
Maybe I can put it in this way. Could you tell me the clang option that can include the linux kernel headers???
Something like
"clang -O3 -isystem /lib/modules/`uname -r`/build/include -emit-llvm hellomodule.c -c -o hellomodule.bc"
Thank you!
--
祝好!
甄凯
2012 Apr 12
2
[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
2012 Apr 10
0
[LLVMdev] How to explain this weird phenomenon????????
I figured that my opt command is wrong! How to specify the output file anyway??
if I want hello.bc to be input file and newhello.bc to be output file, is the opt command go like this?
opt -load ../../../Debug+Asserts/lib/Hello.so -hello <hello.bc> -o newhello.bc ??
--
祝好!
甄凯
2012 Apr 10
4
[LLVMdev] How to explain this weird phenomenon????????
My friends,
I ran a function pass on a .bc file, intending to insert a CallInst to my self-made check function.
The compilation is successful. BUT after I ran that pass on the .bc file, the size of the file didn't get any bigger!!
Does this mean my instrumentation work failed??
BTW the opt command I use is "opt -load ../../../Debug+Asserts/lib/Hello.so -hello <hello.bc> -o
2012 Apr 09
0
[LLVMdev] How to instrument a this function using insertBefore instruction???
Thank you very much!
To make it simpler, I may as well just implement the self-written "check function" in C language instead of wrapping it in LLVM module. According to the hint you give me, all I need to do is as follow(?)
1. Implement the "Check function" in the check.c file;
2. Add the check function into the module(the Hello1.bc file which I will run the functionPass on)
2012 Apr 09
1
[LLVMdev] How to instrument a this function using insertBefore instruction???
That sounds like a good general plan, yes!
Joey
2012/4/9 15102925731 <zhenkaixd at 126.com>
> Thank you very much!
>
> To make it simpler, I may as well just implement the self-written "check
> function" in C language instead of wrapping it in LLVM module. *According
> to the hint you give me, all I need to do is as follow(?)*
>
> 1. Implement the