[LLVMdev] Weird behavior of llvm-ld

Reid Spencer rspencer at reidspencer.com
Wed Aug 16 14:07:10 PDT 2006


Hi Bram,

On Wed, 2006-08-16 at 22:41 +0200, Bram Adams wrote:
> Op 16-aug-06, om 18:59 heeft Reid Spencer het volgende geschreven:

> Are there any workarounds (using other LLVM-tools) to link a native  
> library with LLVM-bytecode?

Yes. The general approach is to use llvm-as, llvm-dis, opt and llvm-link
to work with the bytecode. You can also use gccld and gccas to run some
canned optimizations. llvm-link works exclusively with bytecode.  Once
you have a final bytecode file you can:

llc -o file.s file.bc  # generate native assembly
gcc -S file.s -o file.o
gcc file.o -lwhatever

> That's interesting! So, one only needs to add a 2-arg function called  
> RunOptimizations to the module (can't check it right now)?

That is correct. That function and only that function will be called.
What happens in that function is up to you :)

Reid.




More information about the llvm-dev mailing list