Linking library files using llvmc

I was using llvmc along with the -opt option to perform static analyzes in some of the commonly used programs like bzip2, gzip, grep etc. I found that when llvmc is used to link libraries (.a or .so files) using the -l option it passes the library files to the linker ( for me it was llvm-gcc itself) but changes the order in which it was given to llvmc.

Eg: the command: " llvmc -o grep.o -v -opt grep.o -L…/ -lgreputils " is executed as

llvm-gcc -L…/ -lgreputils grep.o -o grep

Note that the library files are pushed to front in llvm-gcc even though it was given as the last option to llvmc. Due to this llvm-gcc is not able to resolve the calls made in grep.o to the functions contained in greputils library. looks like a bug in llvmc. The llvm version that I am using is 2.6 and the llvm-gcc version is 4.2.1.

-Ravichandhran Kandhadai

Hi Ravi,

Ravi Chandhran <kmrc87 <at> gmail.com> writes:

I was using llvmc along with the -opt option to perform static analyzes in

some of the commonly used programs like bzip2, gzip, grep etc. I found that when
llvmc is used to link libraries (.a or .so files) using the -l option it passes
the library files to the linker ( for me it was llvm-gcc itself) but changes the
order in which it was given to llvmc.

Try a recent SVN version, this was fixed just yesterday:

http://article.gmane.org/gmane.comp.compilers.llvm.cvs/59485