I am trying to obtain native code from the bytecode by using commands: % llc hello.bc -o hello.s % gcc hello.s -o hello.native This is working for a simple program( a single source file) but when I try to run it on grep utility (grep.bc) , it gives me the following error: $ llc grep.bc -o grep.s $ gcc grep.s -o grep.native /tmp/ccY3oNAA.o(.text+0x2f2f): In function `main': : undefined reference to `__main' collect2: ld returned 1 exit status How should i fix this? Thanks - T --------------------------------- Do you Yahoo!? Yahoo! Small Business - Try our new resources site! -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20050322/5dab3853/attachment.html>
try: gcc grep.s -o grep.native -lstdc++ -lc Its telling you that you're missing libraries that need to be linked in. Reid. On Tue, 2005-03-22 at 17:54 -0800, Tanu Sharma wrote:> I am trying to obtain native code from the bytecode by using commands: > > % llc hello.bc -o hello.s > > % gcc hello.s -o hello.native > > > > This is working for a simple program( a single source file) but when I > try to run it on grep utility (grep.bc) , it gives me the following > error: > > > > $ llc grep.bc -o grep.s > > $ gcc grep.s -o grep.native > /tmp/ccY3oNAA.o(.text+0x2f2f): In function `main': > : undefined reference to `__main' > collect2: ld returned 1 exit status > > > How should i fix this? > > Thanks > > - T > > > ______________________________________________________________________ > Do you Yahoo!? > Yahoo! Small Business - Try our new resources site! > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev_______________________ Reid Spencer President & CTO eXtensible Systems, Inc. rspencer at x10sys.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20050322/189037ce/attachment.sig>
On Tue, 22 Mar 2005, Tanu Sharma wrote:> I am trying to obtain native code from the bytecode by using commands: > > % llc hello.bc -o hello.s > > % gcc hello.s -o hello.native > > > > This is working for a simple program( a single source file) but when I > try to run it on grep utility (grep.bc) , it gives me the following > error:__main is provided when linking the application with llvm-gcc by the LLVM "crtend" library. Make SURE you actually link the program with llvm-gcc before you run llc on it. For example, this won't work: llvm-gcc t.c -c -o t.bc; llc t.bc; gcc t.s This will work: llvm-gcc t.c -o t; llc t.bc gcc t.s -Chris> $ llc grep.bc -o grep.s > > $ gcc grep.s -o grep.native > /tmp/ccY3oNAA.o(.text+0x2f2f): In function `main': > : undefined reference to `__main' > collect2: ld returned 1 exit status > > > How should i fix this? > > Thanks > > - T > > > --------------------------------- > Do you Yahoo!? > Yahoo! Small Business - Try our new resources site!-Chris -- http://nondot.org/sabre/ http://llvm.cs.uiuc.edu/