[llvm-dev] Clang using LLVM's tools
Tim Northover via llvm-dev
llvm-dev at lists.llvm.org
Mon Sep 12 04:42:14 PDT 2016
On 12 September 2016 at 11:51, Timothy Purcell via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> I've noticed that LLVM ships a bunch of utilities like llvm-ar, llvm-nm,
> llvm-ranlib, llvm-cov, llvm-objdump and so on. These seem like alternatives
> to programs provided by gcc, binutils, and coreutils.
Pretty much, yep.
> When using Clang, does Clang automatically use these? During the config
> phase of building packages, Gentoo will see binutils ar and nm, for example,
> and use those as the configure phase checks to see which are in use.
At build-time the host's utilities are used. At runtime, Clang only
really uses "as" and "ld" as external utilities, it'll try to pick up
the system version of both of these.
> AS is a variable we can define in make.conf, and I noticed there is a LLVM
> provided assembler, llvm-as.
This isn't a conventional assembler. It's a program to convert textual
LLVM IR (a .ll file) into its binary format (a .bc file).
> Clang also has an integrated assembler? You can define that with the -integrated-as flag? What does that do, exactly?
Yes, Clang can output .o files directly for many targets. The
-integrated-as flag is how you control whether Clang does that or
outputs a .s file and then calls the system assembler.
We enable -integrated-as by default when we're confident that the
assembler is high enough quality for the given target, so in most
cases users wouldn't override that.
> Does it get called by default, or does Clang use the system assembler by default?
Depends on the CPU/OS combination. If you run your compile step with
"-v" you'll see a separate run line for the assembler if
-no-integrated-as is active.
More information about the llvm-dev