Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
957 views
in Technique[技术] by (71.8m points)

linker - How to link object to libraries with LLVM >= 3.1 ? ( no GNU ld )

How I can generate a working executable with the tools provided with Llvm/Clang ( version 3.3 (trunk 168461) ) ?

I have compiled an object with clang++ -c [...] and i would like to try to link this object to 1 specific library and see if this can generate a working executable.

I have noticed that from the 3.1 release llvm-ld it's been removed and llvm-link doesn't look like it has inherited all the options from llvm-ld, although it's marked as the alternative to llvm-ld on the official docs, so i just don't get how I'm supposed to link this object.

I don't want to use ld from the GNU/GCC suite, only tools from llvm.

To summarize this are the tools that i have got from the llvm build from the svn

bugpoint      clang-check   llvm-bcanalyzer  llvm-extract   llvm-objdump  llvm-stress      scan-build
c++-analyzer  clang-tblgen  llvm-config      llvm-link      llvm-prof     llvm-symbolizer  scan-view
ccc-analyzer  llc           llvm-cov         llvm-lit       llvm-ranlib   llvm-tblgen      scanview.css
clang         lli           llvm-diff        llvm-mc        llvm-readobj  macho-dump       ScanView.py
clang++       llvm-ar       llvm-dis         llvm-mcmarkup  llvm-rtdyld   opt              sorttable.js
clang-3.3     llvm-as       llvm-dwarfdump   llvm-nm        llvm-size     Reporter.py      startfile.py

Thanks.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

There are no llvm linker at this time (yet). And no, llvm-link is not a replacement for LLVM ld. So, you'd need to use ar / ranlib / ld from your binutils for now.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...