Excuse the long post,
Chris Lattner wrote:
> On Fri, 11 Mar 2005, Marc Ordinas i Llopis wrote:
>
>> Sorry if this is obvious.
>> I'm trying to link LLVM-generated code with LLVM itself, and
don't
>> know how to do it. Just as a little test, I've tried compiling the
>> example HowToUseJIT.cpp using llvm-g++, but I get tons of errors.
>>
>> Is there an easy way of doing this? Has anyone tried it before?
>
>
> What sort of errors do you get? Are you passing the right -I options?
>
Sorry, I didn't mean I had problems compiling HowToUseJIT.cpp with
llvm-g++. Using the right -I options, I get a correct HowToUseJIT.o
bytecode file. The problem is when I try to link it to LLVM to produce a
executable.
To try things out, I created a project based on the sample and included
the HowToUseJIT code. This compiles perfectly. Next I tried changing the
CXX and CC variables in the makefile to use llvm-g++. This got me
gccld: Unknown command line argument '--rpath'. Try: 'gccld
--help'
Then I tried the last command produced by the makefile without the
--rpath option, but the makefile always removes the produced .o in
.libs, even when RM is set to 'touch'. I haven't found any way to
keep
the intermediate files, by the way.
Next thing, doing it all by hand, using the same command line as
produced by the makefile but removing --rpath and using HowToUseJIT.cpp
as input instead of the .o file, gets me
gccld: warning: File of unknown type
'/home/marc/code/llvm/build/Debug/lib/LLVMInterpreter.o' ignored.
gccld: warning: File of unknown type
'/home/marc/code/llvm/build/Debug/lib/LLVMJIT.o' ignored.
gccld: warning: File of unknown type
'/home/marc/code/llvm/build/Debug/lib/LLVMCodeGen.o' ignored.
gccld: warning: File of unknown type
'/home/marc/code/llvm/build/Debug/lib/LLVMExecutionEngine.o' ignored.
gccld: warning: File of unknown type
'/home/marc/code/llvm/build/Debug/lib/LLVMX86.o' ignored.
gccld: warning: File of unknown type
'/home/marc/code/llvm/build/Debug/lib/LLVMSelectionDAG.o' ignored.
gccld: warning: File of unknown type
'/home/marc/code/llvm/build/Debug/lib/LLVMScalarOpts.o' ignored.
gccld: warning: File of unknown type
'/home/marc/code/llvm/build/Debug/lib/LLVMBCReader.o' ignored.
gccld: warning: File of unknown type
'/home/marc/code/llvm/build/Debug/lib/LLVMCore.o' ignored.
gccld: warning: File of unknown type
'/home/marc/code/llvm/build/Debug/lib/LLVMbzip2.o' ignored.
gccld: warning: File of unknown type
'/home/marc/code/llvm/tests/sample/Debug/bin' ignored.
and the linker goes into an infinite loop, never returning to the
command line.
Finally, I tried first generating the .o (bytecode) file, and then
linking got me the same result.
So, I'm really stuck here. Is there a way of linking LLVM-produced code
with LLVM? Has anyone tried it before?
Thanks,
Marc Ordinas i Llopis | Tragnarion Studios