<div dir="ltr">the symlink ld is already pointing to /usr/bin/ld. Also -fuse-ld=gold does not works on clang in freebsd. I am not sure where is the problem?should I remove /usr/bin/ld and create a new symlink to /usr/local/bin/ld.gold?</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature"><div dir="ltr">Regards<div>Aditya Verma</div><div>Junior Undergraduate</div><div>IDD Computer Sc & Engg</div><div>IIT(BHU), Varanasi(UP)</div></div></div></div>
<br><div class="gmail_quote">On Mon, Jun 22, 2015 at 5:25 AM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Two options:<br>
<br>
* Try passing -fuse-ld=gold to clang.<br>
* have 'ld' be a symlink to ld.gold.<br>
<br>
Cheers,<br>
Rafael<br>
<div><div class="h5"><br>
<br>
<br>
On 22 June 2015 at 04:02, Aditya Verma <<a href="mailto:aditya.verma.cse12@iitbhu.ac.in">aditya.verma.cse12@iitbhu.ac.in</a>> wrote:<br>
><br>
> I have been trying to enable the gold linker on FreeBSD to use the link time<br>
> optimizations. I made gold from the binutils under /usr/ports. After<br>
> building binutils using make -k install clean i got ld under /usr/bin and in<br>
> the directory /usr/local/bin i got ld, ld.gold and ld.bfd.<br>
><br>
> Now while trying to use link time optimization for the simple example<br>
> programs herehttp://<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_docs_GoldPlugin.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=RiyytjZtbvoW0RgjWgbaDEywnPSEyVOWm21_R6ftAW0&s=9yaRTUr1ClS9IcR4zr7lGBT8Xhpzm_Mgnll4tGNRYXU&e=" rel="noreferrer" target="_blank">llvm.org/docs/GoldPlugin.html</a> (a.c and b.c under the<br>
> heading 'Examples of Link Time Optimization') i entered the four commands as<br>
> follows:<br>
><br>
> clang -flto a.c -c -o a.o<br>
> ar q a.a a.o<br>
> clang b.c -c -o b.o<br>
> clang -flto a.a b.o -o main<br>
><br>
> I got the following error:<br>
><br>
> usr/bin/ld: unrecogonized option '-plugin'<br>
> usr/bin/ld: use the --help option for usage information<br>
> clang: error: linker command failed with exit code 1 (use -v to see<br>
> invocation)<br>
><br>
> Is there the problem with the linker that ld.gold is not being called.<br>
> Should I replace the ld with ld.gold? Does the linker looks in the right<br>
> directiry for the .so plugins?<br>
><br>
> The LLVMgold.so and libLTO.so shared objects are in the directory<br>
> /usr/local/llvm-devel/lib/. I cannot find the directory where clang is<br>
> installed. I am not sure where to make the bfd-plugins directory and add the<br>
> symlinks to LLVMgold.so and libLTO.so.<br>
><br>
> I am using freebsd 10.1 release. How to enable the gold linker for link time<br>
> optimizations? also how can I enable it to be the default linker?<br>
><br>
><br>
</div></div>> _______________________________________________<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" rel="noreferrer" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
</blockquote></div><br></div>