Arnamoy Bhattacharyya
2012-Jun-16 18:19 UTC
[LLVMdev] What's Going Wrong with GCC 4.6.3 + dragonegg 3.1
Hi all; Problem: Running a bitcode file produced by llvm-gcc (gcc 4.6.3 + dragonegg 3.1 + llvm 3.1) with lli (Ubuntu 12.04) *llvm-gcc:* llvm-gcc -c hello.c -emit-llvm -o hello.bc lli hello.bc output: lli: hello.bc:1:1: error: expected top-level entity ELF@4( *clang:* clang -c hello.c -emit-llvm -o hello.bc lli hello.bc output: hello world hello.c: #include <stdio.h> int main() { printf("hello world\n"); return 0; } Any suggestions on how to do it in llvm-gcc? -- Arnamoy Bhattacharyya Athabasca Hall 143 Department of Computing Science - University of Alberta Edmonton, Alberta, Canada, T6G 2E8 587-710-7073 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120616/75684e09/attachment.html>
Nick Lewycky
2012-Jun-16 18:41 UTC
[LLVMdev] What's Going Wrong with GCC 4.6.3 + dragonegg 3.1
Arnamoy Bhattacharyya wrote:> Hi all; > > Problem: Running a bitcode file produced by llvm-gcc (gcc 4.6.3 + > dragonegg 3.1 + llvm 3.1) with lli (Ubuntu 12.04) > > /llvm-gcc:/ > > llvm-gcc -c hello.c -emit-llvm -o hello.bc > lli hello.bc > > output: > lli: hello.bc:1:1: error: expected top-level entity > ELF@4( > > /clang:/ > > clang -c hello.c -emit-llvm -o hello.bcDragonegg doesn't handle -emit-llvm, and it's being silently eaten by gcc (offhand, I think it passes it down to the linker which in turn interprets it as meaning that "mit-llvm" will be the name of the entry point function). Try either -flto or -fplugin-arg-dragonegg-emit-ir to produce bitcode. Nick> lli hello.bc > > output: > hello world > > hello.c: > #include <stdio.h> > int main() { > printf("hello world\n"); > return 0; > } > > Any suggestions on how to do it in llvm-gcc? > -- > Arnamoy Bhattacharyya > Athabasca Hall 143 > Department of Computing Science - University of Alberta > Edmonton, Alberta, Canada, T6G 2E8 > 587-710-7073 > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Albert Graef
2012-Jun-17 22:32 UTC
[LLVMdev] What's Going Wrong with GCC 4.6.3 + dragonegg 3.1
On 06/16/2012 08:41 PM, Nick Lewycky wrote:> Dragonegg doesn't handle -emit-llvm, and it's being silently eaten by > gcc (offhand, I think it passes it down to the linker which in turn > interprets it as meaning that "mit-llvm" will be the name of the entry > point function). Try either -flto or -fplugin-arg-dragonegg-emit-ir to > produce bitcode.At present, this will only work with gcc -S in order to generate LLVM assembler code (.ll) which can then be compiled to bitcode using llvm-as. If you use -flto or -fplugin-arg-dragonegg-emit-ir with gcc -c, gcc will just try to pass LLVM assembler to the system assembler (as), with predictable results. ;-) It would really be nice to have gcc -flto -c just work, but I think that it's not possible right now because gcc needs to be patched up to support it, right? Albert -- Dr. Albert Gr"af Dept. of Music-Informatics, University of Mainz, Germany Email: Dr.Graef at t-online.de, ag at muwiinfa.geschichte.uni-mainz.de WWW: http://www.musikinformatik.uni-mainz.de/ag
Apparently Analagous Threads
- [LLVMdev] What's Going Wrong with GCC 4.6.3 + dragonegg 3.1
- [LLVMdev] What's Going Wrong with GCC 4.6.3 + dragonegg 3.1
- [LLVMdev] using GCC LTO files as a frontend to dragonegg?
- [LLVMdev] Using output from dragonegg
- [LLVMdev] Compile llvm-gcc fortran backend using mingw