[LLVMdev] building LLVM (question about ELF class)

Shukang Zhou zhou at cs.virginia.edu
Sat Oct 9 18:46:19 PDT 2004


Hi,

Thanks for the replies in the mailing list. I made some progress in
building LLVM, but I still have a problem about ELF class. I am working
with LLVM on a sparcv9 machine, while the gcc is configured to emit 32-bit
binary by default. After executing "configure --with-llvmgccdir=...
--enable-jit", I modified Makefile.config so it contains

CXX = g++ -mcpu=v9 -m64
CC := gcc -mcpu=v9 -m64

When I do gmaking, there is an error about ELF class:

-----------
gmake[2]: Entering directory
`/a/athena/uf24/zhou/research/llvm/src/runtime/libp
rofile'
...
Linking profile_rt dynamic debug library
ld: fatal: file
/a/athena/uf24/zhou/research/llvm/src/runtime/libprofile/Debug/.
libs/BasicBlockTracing.o: wrong ELF class: ELFCLASS64
ld: fatal: File processing errors. No output written to
/a/athena/uf24/zhou/rese
arch/llvm/src/lib/Debug/.libs/libprofile_rt.so.0.0.0
collect2: ld returned 1 exit status
-----------

I have installed the llvm-gcc frontend before I configured and built LLVM.
I have tested that I have got __sparcv9 #defined, by "gcc -mcpu=v9 -m64
-dM -E hello.cpp | grep __sparcv9".

I have also added "/usr/cs/lib/sparcv9" to the beginning of
$LD_LIBRARY_PATH to force dynamic linking with 64-bit libraries at
run-time; otherwise 32-bit libraryies will be used, which will cause an
error that I met before:

---------------------
/uf24/zhou/research/llvm/src/lib/Target/SparcV9/SparcV9.td -gen-emitter -o
SparcV9CodeEmitter.inc
ld.so.1: /a/athena/uf24/zhou/research/llvm/src/tools/Debug/tblgen: fatal:
/usr/cs/lib/libstdc++.so.5: wrong ELF class: ELFCLASS32
gmake[3]: *** [SparcV9CodeEmitter.inc] Killed
---------------------

It seems like that tblgen needs ELFCLASS64, but profile_rt does not like
it. Am I missing something? How should I deal with this?

I checked tools/Debug, and many tools' binary has been generated,
including gccas, gccld, llc, lli, opt, etc. I wonder what is the
functionality of profile_rt. Plus, if my "gmake" stops at profile_rt, what
are the components in LLVM I cannot use? Thanks.

Shukang Zhou





More information about the llvm-dev mailing list