Fail to get IR for a linux driver program

Hi all,

I used llvm-gcc (llvm version 2.7) to transform a linux network driver program (for example: linux/drivers/net/zoro8390.c) to the IR form with the command: “llvm-gcc -D__GNUCC -E -emit-llvm -I…/…/include zorro8390.c -S” under the drivers/net directory. It didn’t give the resulting IR (i.e. zoro8390.s) and it printed out a modified program, which it looked like the definitions for functions, macros and other stuff from other files are all added or expanded for my target program. How could I get the desired IR for the driver? Thank you very much!

Regards,
Daniel

迪 wrote:

Hi all,

I used llvm-gcc (llvm version 2.7) to transform a linux network driver
program (for example: linux/drivers/net/zoro8390.c) to the IR form with
the command: "llvm-gcc -D__GNUCC -E -emit-llvm -I../../include
zorro8390.c -S" under the drivers/net directory. It didn't give the
resulting IR (i.e. zoro8390.s) and it printed out a modified program,
which it looked like the definitions for functions, macros and other
stuff from other files are all added or expanded for my target program.

That's what the -E flag does. It preprocesses the file.

How could I get the desired IR for the driver? Thank you very much!

You have the two other flags that matter, -S and -emit-llvm. Try removing -E and see whether that works.

Nick

added or expanded for my target program. How could I get the desired IR for
the driver? Thank you very much!

Remove the -E cmdline option

Thank you very much for both of you! I tried to compile the program without the -E and then I got lots of compile errors of missing headers and definitions. I’m trying to eliminate them now.

Regards,
Daniel

2010/8/7 Anton Korobeynikov <anton@korobeynikov.info>