[LLVMdev] How can I get llvm-as for Ubuntu?
Nick Lewycky
nicholas at mxc.ca
Wed Feb 5 21:18:43 PST 2014
Andrew Pennebaker wrote:
> I used to be able to `apt-get install llvm` to install `llvm-as`, an
> LLVM assembler. I think some tools/packages have moved around since then.
>
> What can I use to compile `.ll` assembler files into executables?
You'll have to ask your distributor about how llvm is packaged, but I
can answer about what the tools are.
llvm-as converts .ll to .bc. The formats are equivalent except that the
former is human readable and the latter is machine readable. They are
both LLVM IR (llvm's assembly format) not native machine code.
llc converts .ll or .bc to .s (native assembly) or .o files (native
object file). These are what you commonly get out of a compiler, and
must be linked to form an executable.
llvm-mc converts between .s and .o. It is a native assembler and
disassembler.
Given a set of .o files, you need to (native) link them to form an
executable. LLVM proper does not include a native linker. (llvm-link is
not one, it combines multiple .bc files into a single .bc file. You'll
still need a native linker.) There is the lld.llvm.org project which you
can use to link, if you want to use llvm parts.
So I think the answer you want is "llc foo.ll -filetype=obj -o foo.o"
and then you link foo.o with "ld" on your system.
Nick
More information about the llvm-dev
mailing list