<div dir="ltr"><div><div><div><div><div><div>Hello,<br><br></div>I am trying to use clang to generate bitcode file. I read in <a href="http://llvm.org/docs/GoldPlugin.html">http://llvm.org/docs/GoldPlugin.html</a> that clang with -flto option can generate bitcode files. I have built LLVMgold.so and have gold with plugin support. I tried "clang -c -flto toy.c -o toy.bc" and it does produce bitcode. However, when I try it on lighttpd 1.4.35, then it only produce the binary, but not produce bitcode of lighttpd. I also tried it on apache2.0.56, and it create the errors like the following when linking.<br>
<br>/usr/bin/ld.gold.real: error: strings/.libs/apr_cpystrn.o:1:3: invalid character<br>/usr/bin/ld.gold.real: error: strings/.libs/apr_cpystrn.o:1:3: syntax error, unexpected $end<br>/usr/bin/ld.gold.real: error: strings/.libs/apr_cpystrn.o: not an object or archive<br>
<br></div>I am using ubuntu 12.04. I have the following questions:<br></div>1) for lighttpd, why is it able to build but not produce bitcode?<br></div>2) for apache, does the error means that gold plugin is not found by clang and make it fail to link? I read "-use-gold-plugin" can solve this problem on clang 3.0. But this option is not recognized by clang 3.5. Will clang 3.0 solve this problem?<br>
<br></div>Many thanks!<br></div>Gaoyao<br></div>