Wink Saville
2006-Feb-28 04:43 UTC
[LLVMdev] Using llvm-gcc with a simple program and the '-c' option
Chris Lattner wrote:> On Sun, 26 Feb 2006, Wink Saville wrote: >> I then do the following in my makefile: >> >> llvm-gcc -c t1.c -o t1.bc >> llvm-gcc -c t1sub1.c -o t1sub1.bc >> llvm-gcc -c t1sub2.c -o t1sub2.bc >> llvm-ar r t1.a t1sub1.bc t1sub2.bc >> llvm-ar: creating t1.a >> llvm-ld -o t1.app t1.bc t1.a /opt/llvm-1.6/llvm-gcc/lib/libcrtend.a >> llvm-ld: warning: Cannot find library 'crtend' > > Try passing "-L/opt/llvm-1.6/llvm-gcc/lib/ -lcrtend" to llvm-ld.This didn't work for me: llvm-ld -o t1.app t1.bc t1.a -L/opt/llvm-1.6/llvm-gcc/lib/ -lcrtend.a I get two warning's about library 'crtend' missing> Alternatively, instead of using llvm-ld, just use gccld to link like > this: > > llvm-gcc -o t1.app t1.bc t1.a >Yes this works, but not native> ... which should work. > >> llc t1.app.bc -o t1.app.s >> gcc -m32 t1.app.s -o t1 > > If you want a native app, try this: > > llvm-gcc -o t1.app t1.bc t1.a -Wl,-native > > ... which will invoke llc and the assembler for you. This will also > fix the "script + bc" issue.Yes this works and doesn't generate the script but since I'm using an amd64 with linux the result doesn't run because I need the -m32.> > -Chris >Actually, the point of the above was to understand how the flow native and to see what difficulties I ran into. Is it a bug that I get the "llvm-ld: warning: Cannot find library 'crtend'"? If so, is it likely to be in llvm code and would it be something you'd let a neophyte to track down? Wink
Reid Spencer
2006-Feb-28 05:52 UTC
[LLVMdev] Using llvm-gcc with a simple program and the '-c' option
On Mon, 2006-02-27 at 20:43 -0800, Wink Saville wrote:> > Try passing "-L/opt/llvm-1.6/llvm-gcc/lib/ -lcrtend" to llvm-ld. > This didn't work for me: > llvm-ld -o t1.app t1.bc t1.a -L/opt/llvm-1.6/llvm-gcc/lib/ -lcrtend.a > > I get two warning's about library 'crtend' missing >You didn't get the instructions quite right. The option is -lcrtend not -lcrtend.a Reid. -------------- 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/20060227/4c0f5139/attachment.sig>
Wink Saville
2006-Feb-28 07:31 UTC
[LLVMdev] Using llvm-gcc with a simple program and the '-c' option
Reid Spencer wrote:> On Mon, 2006-02-27 at 20:43 -0800, Wink Saville wrote: > >>> Try passing "-L/opt/llvm-1.6/llvm-gcc/lib/ -lcrtend" to llvm-ld. >>> >> This didn't work for me: >> llvm-ld -o t1.app t1.bc t1.a -L/opt/llvm-1.6/llvm-gcc/lib/ -lcrtend.a >> >> I get two warning's about library 'crtend' missing >> >> > > You didn't get the instructions quite right. The option is -lcrtend not > -lcrtend.a > > Reid. > > ------------------------------------------------------------------------ > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >Actually, I didn't have the ".a" just -lcrtend. In possibly related news I just checked out the latest llvm from cvs and compiled it. Guess what, there were 6 warnings in the output and 3 of them were "gccld: warning: Cannot find library 'crtend'". The last one was just before the end: llvm[4]: Linking Debug Object Library stkr_compiler.o make[4]: Leaving directory `/home/wink/prgs/llvm-cvs/llvm/projects/Stacker/lib/compiler' make[4]: Entering directory `/home/wink/prgs/llvm-cvs/llvm/projects/Stacker/lib/runtime' llvm[4]: Compiling stacker_rt.c for Debug build (bytecode) llvm[4]: Compiling stacker_rt.ll to stacker_rt.bc for Debug build (bytecode) llvm[4]: Building Debug Bytecode Module stkr_runtime.bc gccld: warning: Cannot find library 'crtend' make[4]: Leaving directory `/home/wink/prgs/llvm-cvs/llvm/projects/Stacker/lib/runtime' make[3]: Leaving directory `/home/wink/prgs/llvm-cvs/llvm/projects/Stacker/lib' make[3]: Entering directory `/home/wink/prgs/llvm-cvs/llvm/projects/Stacker/tools' make[4]: Entering directory `/home/wink/prgs/llvm-cvs/llvm/projects/Stacker/tools/stkrc' llvm[4]: Compiling stkrc.cpp for Debug build llvm[4]: Linking Debug executable stkrc llvm[4]: ======= Finished Linking Debug Executable stkrc make[4]: Leaving directory `/home/wink/prgs/llvm-cvs/llvm/projects/Stacker/tools/stkrc' make[3]: Leaving directory `/home/wink/prgs/llvm-cvs/llvm/projects/Stacker/tools' make[2]: Leaving directory `/home/wink/prgs/llvm-cvs/llvm/projects/Stacker' make[1]: Leaving directory `/home/wink/prgs/llvm-cvs/llvm/projects' I haven't tried seeing if anything works (getting past my bed time:), but could this have something to do with my using X86-64 (Amd64)? Also, I'm using gcc-4.0.2 and glibc appears to be 2.3.5 (symbolic link from libc.so.6 is libc-2.3.5.so). Note: I'm new to linux, in case it wasn't obvious. Cheers, Wink
Chris Lattner
2006-Mar-01 19:24 UTC
[LLVMdev] Using llvm-gcc with a simple program and the '-c' option
On Mon, 27 Feb 2006, Wink Saville wrote:>> If you want a native app, try this: >> >> llvm-gcc -o t1.app t1.bc t1.a -Wl,-native >> >> ... which will invoke llc and the assembler for you. This will also fix >> the "script + bc" issue. > Yes this works and doesn't generate the script but since I'm using an amd64 > with linux the result doesn't run because I need the -m32.I would suggest hacking llvm::GenerateNative in tools/gccld/GenerateCode.cpp to pass it. -Chris -- http://nondot.org/sabre/ http://llvm.org/