[LLVMdev] help with link problems

Jerry Hom jhom at cs.rutgers.edu
Wed Aug 16 22:24:09 PDT 2006


First, thanks to those who have responded to my earlier pleas for
help.  You have either directly or indirectly helped me find the
answers I needed.  I'm slowly getting up to speed with LLVM.  Now I
have 2 more questions.

1) I'm using LLVM 1.8a with llvm-gcc3.  I'm trying to compile firefox
(with regular gcc and make) while using LLVM to automatically
instrument one source file (specifically, nsCacheService.cpp in the
netwerk/cache module).  I've written an LLVM pass to add a fprintf()
timestamp at every function exit.  So I go through the steps as
outlined in the FAQ to turn C++ code into C: 1) llvm-g++ on the source
file to produce LLVM bytecode; 2) run my pass on bytecode; 3) use llc
to produce C code; 4) run regular compilation via make.

The regular compilation process creates .o files, combines them into
an archive, then links several module archives together into a shared
object file.  At this last step, I get several error messages about
undefined references; snippet shown below.  Don't know if this is
relevant, but the makefile's ld command uses -Bsymbolic.

../../dist/lib/libnkcache_s.a(nsCacheEntryDescriptor.o)(.text+0x123e): In function `nsCacheEntryDescriptor::MarkValid()':
: undefined reference to `nsCacheService::ServiceLock()'

../../dist/lib/libnkcache_s.a(nsCacheEntryDescriptor.o)(.text+0x1278): In function `nsCacheEntryDescriptor::MarkValid()':
: undefined reference to `nsCacheService::ValidateEntry(nsCacheEntry*)'

../../dist/lib/libnkcache_s.a(nsCacheEntryDescriptor.o)(.text+0x12ad): In function `nsCacheEntryDescriptor::Close()':
: undefined reference to `nsCacheService::ServiceLock()'

../../dist/lib/libnkcache_s.a(nsCacheEntryDescriptor.o)(.text+0x12e4): In function `nsCacheEntryDescriptor::Close()':
: undefined reference to `nsCacheService::CloseDescriptor(nsCacheEntryDescriptor*)'


2) On a whim, I wanted to try using llvm-gcc4.  However, when I invoke
it, I get a relocation error.

prompt% llvm-gcc --version
llvm-gcc: relocation error: /home/jhom/LLVM/1.8/llvm-gcc4-1.8-x86-linux/lib/libstdc++.so.6: undefined symbol: _ZNSt13basic_istreamIwSt11char_traitsIwEE6ignoreEi

Any suggestions are greatly appreciated!

-- 
Jerry Hom




More information about the llvm-dev mailing list