[LLVMdev] Running LLVM Analysis on real-world projects.

Pratik Mehta mehta.pr.y at gmail.com
Thu Mar 30 02:57:55 PST 2006


I have made few attempts to compile some software packages with llvm.
My approach is to define Make variables as follows :

export AS=llvm-as
export LD=llvm-ld
export AR=llvm-ar
export CXX=llvm-g++

and then run configure and make.

This approach works with very small code bases only.

For most of the projects, it bails out with errors. Some of them are
very clear, like llvm does not support inline assembly yet. Some
others do not make much sense. I should note, that I try to compile
the same with gcc32 first, to check that code is acceptable for gcc
v3.

Also, I am interested in compiling projects partially, if full
compilation is not possible due to missing dependencies. For this, I
usually run make with '-i' options, which does not stop on errors.
After that, I am combining all the .o files generated using 'llvm-ld
--link-as-library --disable-opt' command. This sometimes causes
problems with warnings of symbol duplications, duplication of main
methods etc. Is there a proper approach of running analysis on a
sourcebase which contains .o files (bytecode files) generated by
llvm-gcc?

Following is the sample output when I attempt to compile httpd with
above mentioned setup.

/bin/sh /httpd-2.0.55/srclib/apr/libtool --silent --mode=compile
llvm-gcc -g -O2   -DHAVE_CONFIG_H -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE
  -I../include -I../include/arch/unix  -c apr_snprintf.c && touch
apr_snprintf.lo
In file included from apr_snprintf.c:22:
../include/apr_network_io.h:122: error: redefinition of `struct in_addr'
make[4]: *** [apr_snprintf.lo] Error 1

However, this source compiles fine with gcc32 and gcc4




More information about the llvm-dev mailing list