diff --git a/docs/UsingLibraries.html b/docs/UsingLibraries.html index 1fb5fc84c90..20bc5f0305a 100644 --- a/docs/UsingLibraries.html +++ b/docs/UsingLibraries.html @@ -2,23 +2,15 @@ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> - Object Files: Understanding The Result Of LLVM Compilation + Using The LLVM Libraries - -
- Object Files: Understanding The Result Of LLVM Compilation -
- +
Using The LLVM Libraries
  1. Abstract
  2. Introduction
  3. -
  4. File Contents
  5. +
  6. Library Descriptions
  7. Linkage Rules Of Thumb
    1. Always Link vmcore.o, support.a @@ -34,232 +26,97 @@
      -

      This document describes the contents of the many objects files and libraries -that are produced by compiling LLVM. To make use of LLVM this information is -needed in order to understand what files should be linked into your program. +

      Amongst other things, LLVM is a toolkit for building compilers, linkers, + runtime executives, virtual machines, and other program execution related + tools. In addition to the LLVM tool set, the functionality of LLVM is + available through a set of libraries. To use LLVM as a toolkit for + constructing tools, a developer needs to understand what is contained in the + various libraries, what they depend on, and how to use them. This document + describes the contents of the libraries and how and when to use them.

      +
      -

      If you're writing a compiler, virtual machine, or any other utility for - LLVM, you'll need to figure out which of the many .a (archive) and .o - (object) files you will need to link with to be successful. An - understanding of the contents of these files and their inter-relationships - will be useful in coming up with an optimal specification for the objects - and libraries to link with. -

      -

      The purpose of this document is to hopefully reduce some of the trial and - error that the author experienced in using LLVM. -

      +

      If you're writing a compiler, virtual machine, or any other utility based + on LLVM, you'll need to figure out which of the many libraries files you will + need to link with to be successful. An understanding of the contents of these + files and their inter-relationships will be useful in coming up with an optimal + specification for the libraries to link with. The purpose of this document is + to reduce some of the trial and error that the author experienced in using + LLVM.

      +

      LLVM produces two types of libraries: archives (ending in .a) and + objects (ending in .o). However, both are libraries. Libraries ending + in .o are known as re-linked libraries because they contain all the + compilation units of the library linked together as a single .o file. + Furthermore, many of the libraries have both forms of library. The + re-linked libraries are used whenever you want to include all symbols from the + library. The archive libraries are used whenever you want to only resolve + outstanding symbols at that point in the link without including everything in + the library.

      +

      When linking your tools, you will use the LLVMLIBS make variable. + (see the Makefile Guide for + details). This variable specifies which LLVM libraries to link into your tool + and the order in which they will be linked. You specify re-linked libraries by + naming the library without a suffix. You specify archive libraries by naming + the library with a .a suffix but without the lib prefix. The + order in which the libraries appear in the LLVMLIBS variable + definition is the order in which they will be linked. Getting this order + correct for your tool can sometimes be challenging.

      -
      File Contents
      +
      Library Descriptions
      -

      The table below provides a summary of the basic contents of each file.

      - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +

      The table below categorizes each library +

      Summary Of LLVM Library And Object Files -

      Library

      Description

      libipo.a - An archive of all interprocedural optimizations. -
      libscalaropts.a - An archive of all scalar optimizations. -
      libtransforms.aUncategorized transformations.
      libtarget.aAn archive containing generic code generator support.
      libanalysis.aAn archive containing intraprocedural analyses.
      libdatastructure.aAn archive containing Data Structure Analysis.
      libinstrument.aIntraprocedural instrumentation and utilities.
      libsparcv9regalloc.aSparcV9 graph-coloring register allocator.
      libipa.aAn archive containing interprocedural analyses
      libtransformutils.aUtility functions for transformations.
      libsupport.aGeneral support utilities

      Object File

      Description

      support.oGeneral support utilities
      asmparser.oAssembler Parser
      bcreader.oBytecode Reader
      bcwriter.oBytecode Writer
      sched.oSparcV9 instruction scheduler
      selectiondag.oAggressive instruction selector for Directed Acyclic Graphs
      transformutils.oUtilities for code transformations
      ipa.oInterprocedural Analyses
      sparcv9select.oSparcV9 instruction selector
      cwriter.o"C" Code Writer
      profpaths.oPath profiling instrumentation
      sparcv9regalloc.oSparcV9 graph-coloring register allocator
      instrument.oIntraprocedural instrumentation and utilities.
      datastructure.oData Structure Analysis
      codegen.oNative code generation
      sparcv9livevar.oSparcV9 Live Variable Analysis
      vmcore.oVirtual Machine Core
      lli-interpreter.oInterpreter for LLVM ByteCode
      lli-jit.o - Just-In-Time Compiler For LLVM ByteCode -
      executionengine.oEngine for LLI
      debugger.oSource Level Debugging Support
      analysis.oGeneral framework for Analysis
      sparcv9.oSparcV9 backend
      target.oGeneric backend support
      transforms.oUncategorized transformations.
      x86.oIntel x86 backend
      powerpc.oPowerPC backend
      scalaropts.oOptimizations For Scalars
      ipo.oInterprocedural Optimizations
      trace.oSupport For Tracing/Debugging?
      profile_rt.oRuntime Library For Profiler
      sample.oSample Program ?
      stkr_compiler.oStacker Language Compiler Library
      stkr_runtime.oStacker Language Runtime Library
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      LibraryFormsDescription
      Core Libraries
      LLVMAsmParser.oLLVM Assembly Parsing
      LLVMBCReader.oLLVM Bytecode Reading
      LLVMBCWriter.oLLVM Bytecode Writing
      LLVMDebugger.oSource Level Debugging Support
      LLVMSupport.a .oGeneral support utilities
      LLVMSystem.a .oOperating system abstraction
      LLVMCore.oLLVM Core IR
      Analysis Libraries
      LLVMAnalysis.a .oVarious analysis passes.
      LLVMDataStructure.a .oData structure analysis passes.
      LLVMipa.a .oInter-procedural analysis passes.
      Transformation Libraries
      LLVMInstrumentation.a .oInstrumentation passes.
      LLVMipo.a .oAll inter-procedural optimization passes.
      LLVMScalarOpts.a .oAll scalar optimization passes.
      LLVMTransforms.a .oUncategorized transformation passes.
      LLVMTransformUtils.a .oTransformation utilities.
      LLVMProfilePaths.oProfile paths for instrumentation.
      Code Generation Libraries
      LLVMCodeGen.oNative code generation infrastructure
      Target Libraries
      LLVMCBackend.o'C' language code generator.
      LLVMPowerPC.oPowerPC code generation backend
      LLVMSelectionDAG.oAggressive instruction selector for Directed Acyclic Graphs.
      LLVMSkeleton.a .oSkeleton for a code generation backend.
      LLVMSparcV9.oCode generation for SparcV9.
      LLVMSparcV9RegAlloc.a .oGraph-coloring register allocator for SparcV9.
      LLVMSparcV9InstrSched.oInstruction scheduling for SparcV9.
      LLVMSparcV9LiveVar.oLive variable analysis SparcV9.
      LLVMSparcV9ModuloSched.oModulo scheduling for SparcV9.
      LLVMTarget.a .oGeneric code generation utilities.
      LLVMX86.oIntel x86 code generation backend
      Runtime Libraries
      LLVMInterpreter.oBytecode Interpreter
      LLVMJIT.oBytecode JIT Compiler
      LLVMExecutionEngine.oVirtual machine engine
      LLVMexecve.oexecve(2) replacement for llee
      -

      +
      @@ -267,16 +124,21 @@ needed in order to understand what files should be linked into your program. should link into your programs.

      - +
      -

      No matter what you do with LLVM, you'll always need to link with vmcore.o - and support.a.

      +

      No matter what you do with LLVM, the last three entries in your linke line + should always be: LLVMCore LLVMSupport.a LLVMSystem.a.

      - +
      -

      Need more rules of thumb here.

      +

      There is never any point to linking both the re-linked (.o) and + the archive (.a) versions of a library. Since the re-linked version + includes the entire library, the archive version will not resolve any symbols. + You could even end up with link error is you place the archive version before + the re-linked version on the linker's command line.