Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

llvm-ld still exist for clang 3.4 ?

Tags:

c++

c

linker

llvm

ld

Last time I checked on clang it was at the version 3.1/3.2, now I'm under Ubuntu 13.04 64 bit and I installed clang and llvm ( plus the tools ) from the official apt repository but there is no trace of llvm-ld-3.4, llvm-ld-3.0 and llvm-ld-3.1 are the only 2 versions of this tool that are available on my machine, my question is: whit what I'm supposed to replace llvm-ld and generate a library or a machine executable ?

like image 724
user2485710 Avatar asked Jul 22 '13 04:07

user2485710


1 Answers

llvm-ld no longer exists. From LLVM 3.2 release notes:

llvm-ld and llvm-stub have been removed, llvm-ld functionality can be partially replaced by llvm-link | opt | {llc | as, llc -filetype=obj} | ld, or fully replaced by Clang.

Or, in a nicer format:

  1. Link all your .bc / .ll files with llvm-link, to get one bitcode file
  2. Run opt to optimize the bitcode file
  3. Generate an object file, through one of
    • llc to get asm file, then system assembler (as) to get an object file
    • llc -filetype=obj to get an object file (this just calls the system assembler on its own)
  4. System linker (ld) to link your object files with all other required object files

As for why it was removed, check out this LLVM-dev discussion.

Also, you might be interested in this related question: How to link object to libraries with LLVM >= 3.1 ? ( no GNU ld )

like image 128
Oak Avatar answered Oct 17 '22 16:10

Oak