`/usr/bin/ld -v' says it is not running gold and I suppose fixing that would require place LLVMgold.so into /usr/lib/bfd-plugins. Is there any way to make this work without requiring root access to the machine?<div><br>
</div><div>Also, just to confirm, is the gold plugin required even when all of the files have been compiled/built using llvm-gcc and llvm-ar?<br><div><br></div><div>Ashay</div><div><br><div><br><div class="gmail_quote">On Tue, Aug 9, 2011 at 1:33 PM, Eli Friedman <span dir="ltr"><<a href="mailto:eli.friedman@gmail.com">eli.friedman@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div></div><div class="h5">On Tue, Aug 9, 2011 at 11:16 AM, Ashay Rane <<a href="mailto:ashay.rane@asu.edu">ashay.rane@asu.edu</a>> wrote:<br>

> Hello,<br>
> While linking programs against static libraries built using llvm-ar and<br>
> llvm-ranlib, I see an error message:<br>
> could not read symbols: Archive has no index; run ranlib to add one<br>
> collect2: ld returned 1 exit status<br>
> Using either /usr/bin/nm or llvm-nm (depending on the use of --emit-llvm<br>
> flag to llvm-gcc), one of them is able to list the symbols in the archive<br>
> file. However, the link step fails. Two sample runs follow. Am I missing any<br>
> options? The source code was obtained<br>
> from: <a href="http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html" target="_blank">http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html</a><br>
> == Without --emit-llvm ==<br>
> $ llvm-gcc -c ctest1.c ctest2.c<br>
> $ file *.o<br>
> ctest1.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped<br>
> ctest2.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped<br>
> $ llvm-ar cru libctest.a *.o<br>
> $ ls<br>
> ctest1.c  ctest1.o  ctest2.c  ctest2.o  libctest.a  prog.c<br>
> $ llvm-ar t libctest.a<br>
> ctest1.o<br>
> ctest2.o<br>
> $ llvm-nm libctest.a<br>
> $ nm libctest.a<br>
> nm: #_LLVM_SYM_TAB_: File format not recognized<br>
> ctest1.o:<br>
> 0000000000000000 T ctest1<br>
> ctest2.o:<br>
> 0000000000000000 T ctest2<br>
> $ llvm-ranlib libctest.a<br>
> $ llvm-gcc prog.c libctest.a -o p<br>
> libctest.a: could not read symbols: Archive has no index; run ranlib to add<br>
> one<br>
> collect2: ld returned 1 exit status<br>
<br>
</div></div><a href="http://llvm.org/docs/GoldPlugin.html" target="_blank">http://llvm.org/docs/GoldPlugin.html</a> .  (I'm not completely sure<br>
that's up-to-date, but should point you in the right direction.)<br>
<font color="#888888"><br>
-Eli</font></blockquote></div></div>
</div></div>