Unless I'm missing something, the problem lies directly with the fact that you are trying to do a link-stage operation with the GCC frontend. GCC, by default, probably runs "ld" or another system linker, which grabs the executable from binutils. This linker hasn't been modified (yet) to include support for .bc files, but you're compiler is emitting byte code to the *.o files. That is why the linker barfs, and tries to interpret as a script.
<br><br>I am actually planning on working on integration between binutils' ld and LLVM to allow just this functionality. I'll be working on this over the holidays, and hopefully will get something working by mid January. Until then, directly using the LLVM linking facilities to handle the bytecode is probably the best if not only option.
<br><br>-Chandler<br><br>PS: I'm still kinda new, so someone else may come along and correct me, but that's the best I can figure out...<br><br><div><span class="gmail_quote">On 12/10/06, <b class="gmail_sendername">Domagoj Babic
</b> <<a href="mailto:babic.domagoj@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">babic.domagoj@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Hi,<br><br>I'm trying to compile some apps with the new llvm-gcc4 on amd64 linux<br>to .bc files, rather than to the native code. The same process I used to<br>build those apps before with llvm-gcc3 doesn't work:<br><br>
1)
<br>export CC=llvm-gcc CXX=llvm-g++ CFLAGS="-g -fno-inline" CXXFLAGS="-g<br>-fno-inline"<br>2) cd <whatever-app>; ./configure<br>3) make CFLAGS+=-emit-llvm CXXFLAGS+=-emit-llvm<br>[Reid told me not to pass -emit-llvm to configure scripts.]
<br><br>The process fails for the same reason on several apps I tried:<br><br>--------------------------------------------------------------<br>$ llvm-gcc -shared  .libs/libdspam.o .libs/heap.o .libs/diction.o<br>.libs/base64.o .libs/buffer.o .libs/util.o .libs/nodetree.o
<br>.libs/error.o .libs/decode.o .libs/pref.o .libs/config_shared.o<br>.libs/bnr.o .libs/hash.o .libs/list.o .libs/ldap_client.o<br>.libs/tokenizer.o .libs/hash_drv.o  -lm -ldl  -Wl,-soname<br>-Wl,libdspam.so.7 -o .libs/libdspam.so.7.0.0 -v
<br><br>Using built-in specs.<br>Target: x86_64-unknown-linux-gnu<br>Configured with: ../dst-directory/configure --disable-shared<br>--prefix=/usr/local/devapps/llvm --enable-languages=c,c++<br>--enable-llvm=/work/projects/llvm-obj --program-prefix=llvm-
<br>--enable-checking --disable-multilib<br>Thread model: posix<br>gcc version 4.0.1 LLVM (Apple Computer, Inc. build 5421)<br> /usr/local/devapps/llvm/libexec/gcc/x86_64-unknown-linux-gnu/4.0.1/collect2<br>--eh-frame-hdr -m elf_x86_64 -shared -o .libs/libdspam.so.7.0.0
<br>/usr/lib/../lib64/crti.o<br>/usr/local/devapps/llvm/lib/gcc/x86_64-unknown-linux-gnu/4.0.1/crtbeginS.o<br>-L/usr/local/devapps/llvm/lib/gcc/x86_64-unknown-linux-gnu/4.0.1<br>-L/usr/local/devapps/llvm/lib/gcc/x86_64-unknown-linux-gnu/4.0.1/../../../../lib64
<br>-L/usr/local/devapps/llvm/lib/gcc/x86_64-unknown-linux-gnu/4.0.1/../../..<br>-L/lib/../lib64 -L/usr/lib/../lib64 .libs/libdspam.o .libs/heap.o<br>.libs/diction.o .libs/base64.o .libs/buffer.o .libs/util.o<br>.libs/nodetree.o .libs/error.o .libs/decode.o .libs/pref.o
<br>.libs/config_shared.o .libs/bnr.o .libs/hash.o .libs/list.o<br>.libs/ldap_client.o .libs/tokenizer.o .libs/hash_drv.o -lm -ldl<br>-soname libdspam.so.7 -lgcc -lc -lgcc<br>/usr/local/devapps/llvm/lib/gcc/x86_64-unknown-linux-gnu/4.0.1/crtendS.o
<br>/usr/lib/../lib64/crtn.o<br>/usr/bin/ld:.libs/libdspam.o: file format not recognized; treating as<br>linker script<br>/usr/bin/ld:.libs/libdspam.o:1: syntax error<br>collect2: ld returned 1 exit status<br>--------------------------------------------------------------
<br><br>If I execute the last command manually with llvm-ld, removing -shared<br>and -Wl, it goes through.<br><br><br>So, obviously I'm doing something wrong.<br><br>What do I need to change in the build process to compile the same apps
<br>I could compile before with llvm-gcc3 to bc files?<br><br><br>Thx in advance,<br>            Domagoj<br>_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">

LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://llvm.cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></blockquote>
</div><br>