[cfe-dev] How to change the linker of clang

David Chisnall David.Chisnall at cl.cam.ac.uk
Sat Jun 13 14:05:16 PDT 2015


On 11 Jun 2015, at 21:52, Nathan Wilson <nwilson20 at gmail.com> wrote:
> On Thu, Jun 11, 2015 at 8:31 PM, Eric Lu <eirc.lew at gmail.com> wrote:
> 1) Build clang with GCC-4.9.2, when compling other application s with clang/clang++, the default linker is ld, can I replace it with other linker tool, if we can, how to do it? 
> 
> I.E. can we use collect2 instead?
> 
> You could symlink ld to point to collect2.
> 
> For example I use gold and point to:
> ls -la /usr/local/bin/ld:
> /usr/local/bin/ld -> /usr/bin/gold
>  
> 2) how to specify the  path, if we do not use the default vertion GCC?
> 
> 
> You can specify which version of GCC when you run cmake by adding the flags:
> -DCMAKE_C_COMPILER=<path> -DCMAKE_CXX_COMPILER=<path>

Didn’t we upstream the support for -fuse-ld=foo, which would use ld.foo in your default linker search path, so if you install gold as /usr/bin/ld.gold (as, I believe, is the default), it will work with -fuse-ld=gold?

David





More information about the cfe-dev mailing list