[LLVMdev] libstdc++ as bytecode, and compiling C++ to C
Reid Spencer
rspencer at reidspencer.com
Mon Nov 20 08:01:57 PST 2006
On Mon, 2006-11-20 at 17:21 +0800, Mohd-Hanafiah Abdullah wrote:
> On Mon, 2006-11-20 at 17:49 +1100, Emil Mikulic wrote:
> > I've compiled all the object files that make up libstdc++ and libsupc++
> > into LLVM bytecode:
> > http://goanna.cs.rmit.edu.au/~emil/libstdcxx.tar.bz2 (438KB)
> >
> > A simple test program, x.cpp:
> >
> > #include <iostream>
> > int main() { std::cout << "hello world\n"; return 0; }
> >
> > $ llvm-g++ -emit-llvm -c x.cpp
> > $ llvmc -o=out x.o std/*.o sup/*.o
> > $ lli out.bc
> > Segmentation fault (core dumped)
> > $
> >
> > Oops, no go. Try a different way:
> >
> > $ llvm-g++ -emit-llvm -c x.cpp
> > $ llvm-link -o=linked.o x.o std/*.o sup/*.o
> > $ lli linked.o
> > hello world
>
> Emil:
>
> Thanks for your email. I tried the above and got the following errors:
>
> $ llvm-link -o=linked.o x.o std/*.o sup/*.o
> llvm-link: error loading file 'std/allocator-inst.o'
>
> And when I do this:
> $ llvmc -o=out x.o std/*.o sup/*.o
> llvm-ld: error: Cannot load file 'std/allocator-inst.o'Bytecode file
> 'std/allocator-inst.o' could not be loaded: Unknown bytecode version
> number: 6 (Vers=6, Pos=13)
> llvmc: Action failed
>
>
> I'm using LLVM 1.8. Is it due to compatibility problem?
Yes. version 6 is the LLVM 1.9 bytecode format and 1.8 doesn't know up
to downgrade it.
>
> Thanks.
>
> Napi
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
More information about the llvm-dev
mailing list