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? 2) how to specify the path, if we do not use the default vertion GCC? Best Regards! Eric Lew -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150612/a1592180/attachment.html>
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>> > Best Regards! > Eric Lew > > _______________________________________________ > cfe-dev mailing list > cfe-dev at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150611/1ffe2d72/attachment.html>
Nikola Smiljanic
2015-Jun-12 02:30 UTC
[LLVMdev] [cfe-dev] How to change the linker of clang
That's what I used to do but each Ubuntu update would revert the symlink. That's when I found about -fuse-ld=gold, I'd expect it to work with other linkers as well. On Fri, Jun 12, 2015 at 11:52 AM, 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> > > >> >> Best Regards! >> Eric Lew >> >> _______________________________________________ >> cfe-dev mailing list >> cfe-dev at cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev >> >> > > _______________________________________________ > cfe-dev mailing list > cfe-dev at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150612/9f733638/attachment.html>
The -B option tells clang where to look for the linker. So you could try: clang -B /path/to/other/linker/ ... Sandeep On Thu, Jun 11, 2015 at 6:36 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? > > 2) how to specify the path, if we do not use the default vertion GCC? > > > Best Regards! > Eric Lew > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150612/5fea3f93/attachment.html>
For #1: Consider also the -B option to specify a path prefix to consult for compiler-related sub-programs (e.g., GNU binutils) if the executables / symlinks etc. have similar names. Brian On Jun 11, 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>> > > Best Regards! > Eric Lew > > > _______________________________________________ > cfe-dev mailing list > cfe-dev at cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev_______________________________________________ LLVM Developers mailing list LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150611/0d76d35f/attachment.html>
David Chisnall
2015-Jun-13 21:05 UTC
[LLVMdev] [cfe-dev] How to change the linker of clang
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
Maybe Matching Threads
- [LLVMdev] How to change the linker of clang
- [LLVMdev] what is the Line number of Phi Node with addr2line
- [LLVMdev] How to recognize the declaring code scopes of stack variables
- [LLVMdev] does clang and llvm take more time to compile c code
- [LLVMdev] does clang and llvm take more time to compile c code