Hi Duncan,<br><br><div class="gmail_quote">On Wed, Jun 29, 2011 at 11:32 PM, Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr">baldrick@free.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi Gregory,<br>
<div class="im"><br>
> I've tried the LTO options with dragonegg, but I haven't had any luck getting it<br>
> to work,<br>
<br>
</div>details?<br></blockquote><div>I think this is a misunderstanding on my part about what the dragonegg plugin is supposed to do. I am looking for something that will essentially be a replacement for gcc except that it generates llvm bitcode instead of normal object files. If I run something like:<br>
<br><span style="font-family: courier new,monospace;">gcc-4.5 -fplugin=/homes/malecha/tmp/libc-scratch/dragonegg/dragonegg.so a.c -c -o a.o -flto</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">/tmp/ccRKW0GD.s: Assembler messages:</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">/tmp/ccRKW0GD.s:1: Error: junk at end of line, first unrecognized character is `.'</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">/tmp/ccRKW0GD.s:2: Error: no such instruction: `target triple="x86_64--linux-gnu"'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">/tmp/ccRKW0GD.s:4: Error: no such instruction: `module asm "\09.ident\09\22GCC: (GNU) 4.5.2 LLVM: 133848\22"'</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">...</span><br><br>I assume because my system assembler doesn't understand llvm bitcode. So I ended up wrapping it up in a script that calls gcc with -emit-llvm -S and then runs llvm-as on the resulting llvm assembly code. I think that I just need to manually (i.e. with a script) expand the gcc calls to incorporate the llvm toolchain.<br>
<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Ciao, Duncan.<br>
<div class="im"><br>
I'm not sure if it is related to my installation of gold or my gcc<br>
> configuration.<br>
><br>
> I'm really interested in getting the resulting program as bitcode though. Will<br>
> LTO do that for me? What I'm trying to do is build a bitcode version of libc<br>
> that I can combine with a program and analyze/optimize the resulting program.<br>
><br>
><br>
><br>
> 2011/6/28 Rafael Ávila de Espíndola <<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a><br>
</div>> <mailto:<a href="mailto:rafael.espindola@gmail.com">rafael.espindola@gmail.com</a>>><br>
<div><div></div><div class="h5">><br>
> On 11-06-28 10:45 PM, Gregory Malecha wrote:<br>
> > Hello,<br>
> ><br>
> > I've been trying to build some normal linux applications with clang and I<br>
> keep running into a snag in configure scripts. Perhaps these scripts are not<br>
> written very well, but the current clang behavior seems strange. When I run<br>
> clang with the -emit-llvm option, it still uses /usr/bin/ld as the linker<br>
> which fails to compile llvm bitcode on linux (though it works on mac).<br>
> Here's a simple example:<br>
> ><br>
> > $ cat > test.c<br>
> > int main(void) { return 0; }<br>
> > $ clang -emit-llvm test.c<br>
> > /tmp/cc-pDfs56.o: file not recognized: File format not recognized<br>
> > clang: error: linker command failed with exit code 1 (use -v to see<br>
> invocation)<br>
> > $ clang -emit-llvm test.c -c<br>
> > $<br>
> ><br>
> > It seems to me that clang should call llvm-ld when it generates llvm code<br>
> and ld otherwise, but maybe there's something that I have configured<br>
> incorrectly. What is the appropriate way to address this?<br>
><br>
> llvm-ld is not a full replacement for a system ld. If you want to do LTO<br>
> (which is why I assume you<br>
> are using -emit-llvm), you should use a linker that support it. Gold support<br>
> plugins and can<br>
> use the LLVM one. Recently gnu ld implemented the same interface, but I<br>
> haven't tested it.<br>
><br>
> <a href="http://llvm.org/docs/GoldPlugin.html" target="_blank">http://llvm.org/docs/GoldPlugin.html</a><br>
><br>
> > Thanks.<br>
><br>
> Cheers,<br>
> Rafael<br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
</div></div>> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <mailto:<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<div><div></div><div class="h5">> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
><br>
><br>
><br>
> --<br>
> gregory malecha<br>
><br>
><br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>gregory malecha<br>