[LLVMdev] Extracting type information from header files

Chipounov Vitaly vitaly.chipounov at epfl.ch
Wed Mar 3 12:46:41 PST 2010


Hi,

I would like to generate an LLVM bitcode file that contains all the types and functions declared in a header file.
For example, the following code should make the llvm compiler put all type information contained in stdio.h in the resulting bitcode file.

#include <stdio.h>

int main()
{
  return 0;
}

Unfortunately, when compiled with "llvm-gcc -g -emit-llvm -c test.c", the resulting bitcode does not contain any type information from stdio.h.
After some investigation, it appears that llvm-gcc keeps only the relevant types, that are used somewhere in the program. For example, the following code results in a FILE structure to be embedded in the bitcode:
#include <stdio.h>

int main()
{
  FILE *fp;
  return 0;
}

Is there a command line switch to include all type information, even for unused types?

Thanks for your help.

Vitaly C.



More information about the llvm-dev mailing list