llvm.org GIT mirror llvm / e131ec9
Update library dependency information, describe new libraries, talk a little about llvm-config as a source for help with library dependencies. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29425 91177308-0d34-0410-b5e6-96231b3b80d8 Reid Spencer 13 years ago
3 changed file(s) with 204 addition(s) and 147 deletion(s). Raw diff Collapse all Expand all
3232 tools. In addition to the LLVM tool set, the functionality of LLVM is
3333 available through a set of libraries. To use LLVM as a toolkit for
3434 constructing tools, a developer needs to understand what is contained in the
35 various libraries, what they depend on, and how to use them. This document
36 describes the contents of the libraries and how and when to use them.
35 various libraries, what they depend on, and how to use them. Fortunately,
36 there is a tool, llvm-config to aid with this. This document
37 describes the contents of the libraries and how to use llvm-config
38 to generate command line options.
3739

3840
3941
4345

If you're writing a compiler, virtual machine, or any other utility based

4446 on LLVM, you'll need to figure out which of the many libraries files you will
4547 need to link with to be successful. An understanding of the contents of these
46 files and their inter-relationships will be useful in coming up with an optimal
47 specification for the libraries to link with. The purpose of this document is
48 to reduce some of the trial and error that the author experienced in using
49 LLVM.

48 libraries will be useful in coming up with an optimal specification for the
49 libraries to link with. The purpose of this document is to reduce some of
50 the trial and error that the author experienced in using LLVM.

5051

LLVM produces two types of libraries: archives (ending in .a) and

5152 objects (ending in .o). However, both are libraries. Libraries ending
5253 in .o are known as re-linked libraries because they contain all the
5354 compilation units of the library linked together as a single .o file.
54 Furthermore, many of the libraries have both forms of library. The
55 Furthermore, several of the libraries have both forms of library. The
5556 re-linked libraries are used whenever you want to include all symbols from the
5657 library. The archive libraries are used whenever you want to only resolve
5758 outstanding symbols at that point in the link without including everything in
5859 the library.

59

When linking your tools, you will use the LLVMLIBS make variable.

60

If you're using the LLVM Makefile system to link your tools,you will use

61 the LLVMLIBS make variable.
6062 (see the Makefile Guide for
6163 details). This variable specifies which LLVM libraries to link into your tool
6264 and the order in which they will be linked. You specify re-linked libraries by
7577
Core Libraries
7678
LLVMArchive.a
7779 LLVM archive reading and writing
78
LLVMAsmParser.o
80
LLVMAsmParser.a
7981 LLVM assembly parsing
80
LLVMBCReader.o
82
LLVMBCReader.a
8183 LLVM bytecode reading
82
LLVMBCWriter.o
84
LLVMBCWriter.a
8385 LLVM bytecode writing
84
LLVMCore.o
86
LLVMCore.a
8587 LLVM core intermediate representation
86
LLVMDebugger.o
88
LLVMDebugger.a
8789 Source level debugging support
8890
LLVMLinker.a
8991 Bytecode and archive linking interface
90
LLVMSupport.a .o
92
LLVMSupport.a
9193 General support utilities
92
LLVMSystem.a .o
94
LLVMSystem.a
9395 Operating system abstraction layer
96
LLVMbzip2.a
97 BZip2 compression library
9498
9599
Analysis Libraries
96
LLVMAnalysis.a .o
100
LLVMAnalysis.a
97101 Various analysis passes.
98
LLVMDataStructure.a .o
102
LLVMDataStructure.o
99103 Data structure analysis passes.
100
LLVMipa.a .o
104
LLVMipa.a
101105 Inter-procedural analysis passes.
102106
103107
Transformation Libraries
104
LLVMInstrumentation.a .o
108
LLVMInstrumentation.a
105109 Instrumentation passes.
106
LLVMipo.a .o
110
LLVMipo.a
107111 All inter-procedural optimization passes.
108
LLVMScalarOpts.a .o
112
LLVMScalarOpts.a
109113 All scalar optimization passes.
110
LLVMTransforms.a .o
114
LLVMTransforms.a
111115 Uncategorized transformation passes.
112
LLVMTransformUtils.a .o
116
LLVMTransformUtils.a
113117 Transformation utilities.
114118
115119
Code Generation Libraries
116120
LLVMCodeGen.o
117121 Native code generation infrastructure
122
LLVMSelectionDAG.o
123 Aggressive instruction selector for directed acyclic graphs
118124
119125
Target Libraries
120126
LLVMAlpha.o
121127 Code generation for Alpha architecture
128
LLVMARM.o
129 Code generation for ARM architecture
122130
LLVMCBackend.o
123131 'C' language code generator.
124132
LLVMIA64.o
125133 Code generation for IA64 architecture
126134
LLVMPowerPC.o
127135 Code generation for PowerPC architecture
128
LLVMSelectionDAG.o
129 Aggressive instruction selector for directed acyclic graphs
130136
LLVMSparc.o
131137 Code generation for Sparc architecture
132
LLVMTarget.a .o
138
LLVMTarget.a
133139 Generic code generation utilities.
134140
LLVMX86.o
135141 Code generation for Intel x86 architecture
145151
146152
147153
148
Library Dependencies
149
150

Below are two dependency graphs and a list that show the relationships

151 between the various LLVM archive libraries and object files. This information
152 can be automatically generated with the GenLibDeps.pl utility found
153 in the llvm/utils directory.>
154
Using llvm-config>
155
156

The

llvm-config

tool is a perl script that produces on its output
157 various kinds of information. For example, the source or object directories
158 used to build LLVM can be accessed by passing options to llvm-config.
159 For complete details on this tool, please see the
160 manual page.

161

To understand the relationships between libraries, the llvm-config

162 can be very useful. If all you know is that you want certain libraries to
163 be available, you can generate the complete set of libraries to link with
164 using one of four options, as below:

165
166
  • --ldflags. This generates the command line options necessary to
  • 167 be passed to the ld tool in order to link with LLVM. Most notably,
    168 the -L option is provided to specify a library search directory
    169 that contains the LLVM libraries.
    170
  • --libs. This generates command line options suitable for
  • 171 use with a gcc-style linker. That is, libraries are given with a -l option
    172 and object files are given with a full path.
    173
  • --libnames. This generates a list of just the library file
  • 174 names. If you know the directory in which these files reside (see --ldflags)
    175 then you can find the libraries there.
    176
  • --libfiles
  • . This generates the full path names of the
    177 LLVM library files.
    178
    179

    If you wish to delve further into how llvm-config generates the

    180 correct order (based on library dependencies), please see the tool named
    181 GenLibDeps.pl in the utils source directory of LLVM.

    182
    154183
    155184
    156185
    172201 alphabetically.

    173202
    174203
    libLLVMAnalysis.a
    175
  • libLLVMSupport.a
  • 176
  • libLLVMTarget.a
  • 177
  • LLVMCore.o
  • 204
  • libLLVMCore.a
  • 205
  • libLLVMSupport.a
  • 206
  • libLLVMSystem.a
  • 207
  • libLLVMTarget.a
  • 178208
    179209
    libLLVMArchive.a
    180
  • libLLVMSupport.a
  • 181
  • libLLVMSystem.a
  • 182
  • LLVMBCReader.o
  • 183
  • LLVMCore.o
  • 210
  • libLLVMBCReader.a
  • 211
  • libLLVMCore.a
  • 212
  • libLLVMSupport.a
  • 213
  • libLLVMSystem.a
  • 214
    215
    libLLVMAsmParser.a
    216
  • libLLVMCore.a
  • 217
  • libLLVMSupport.a
  • 218
  • libLLVMSystem.a
  • 219
    220
    libLLVMBCReader.a
    221
  • libLLVMCore.a
  • 222
  • libLLVMSupport.a
  • 223
  • libLLVMSystem.a
  • 224
    225
    libLLVMBCWriter.a
    226
  • libLLVMCore.a
  • 227
  • libLLVMSupport.a
  • 228
  • libLLVMSystem.a
  • 229
    230
    libLLVMCodeGen.a
    231
  • libLLVMAnalysis.a
  • 232
  • libLLVMCore.a
  • 233
  • libLLVMSupport.a
  • 234
  • libLLVMSystem.a
  • 235
  • libLLVMTarget.a
  • 236
    237
    libLLVMCore.a
    238
  • libLLVMSupport.a
  • 239
  • libLLVMSystem.a
  • 240
    241
    libLLVMDebugger.a
    242
  • libLLVMBCReader.a
  • 243
  • libLLVMCore.a
  • 244
  • libLLVMSupport.a
  • 245
  • libLLVMSystem.a
  • 184246
    185247
    libLLVMInstrumentation.a
    248
  • libLLVMCore.a
  • 186249
  • libLLVMScalarOpts.a
  • 187250
  • libLLVMSupport.a
  • 188251
  • libLLVMTransformUtils.a
  • 189
  • LLVMCore.o
  • 190252
    191253
    libLLVMLinker.a
    192254
  • libLLVMArchive.a
  • 193
  • libLLVMSystem.a
  • 194
  • LLVMBCReader.o
  • 195
  • LLVMCore.o
  • 255
  • libLLVMBCReader.a
  • 256
  • libLLVMCore.a
  • 257
  • libLLVMSystem.a
  • 196258
    197259
    libLLVMScalarOpts.a
    198260
  • libLLVMAnalysis.a
  • 199
  • libLLVMSupport.a
  • 261
  • libLLVMCore.a
  • 262
  • libLLVMSupport.a
  • 263
  • libLLVMSystem.a
  • 200264
  • libLLVMTarget.a
  • 201265
  • libLLVMTransformUtils.a
  • 202
  • LLVMCore.o>
  • 266 >
    267
    libLLVMSelectionDAG.a
    268
  • libLLVMCodeGen.a
  • 269
  • libLLVMCore.a
  • 270
  • libLLVMSupport.a
  • 271
  • libLLVMSystem.a
  • 272
  • libLLVMTarget.a
  • 273
  • libLLVMTransformUtils.a
  • 203274
    204275
    libLLVMSupport.a
    205276
  • libLLVMSystem.a
  • 206
  • LLVMbzip2.o
  • 277
  • libLLVMbzip2.a
  • 207278
    208279
    libLLVMSystem.a
    209280
    210281
    libLLVMTarget.a
    211
  • libLLVMSupport.a
  • 212
  • LLVMCore.o
  • 213
  • LLVMSelectionDAG.o
  • 282
  • libLLVMCodeGen.a
  • 283
  • libLLVMCore.a
  • 284
  • libLLVMSelectionDAG.a
  • 285
  • libLLVMSupport.a
  • 286
  • libLLVMSystem.a
  • 214287
    215288
    libLLVMTransformUtils.a
    216289
  • libLLVMAnalysis.a
  • 290
  • libLLVMCore.a
  • 291
  • libLLVMScalarOpts.a
  • 292
  • libLLVMSupport.a
  • 293
  • libLLVMSystem.a
  • 217294
  • libLLVMipa.a
  • 218
  • libLLVMScalarOpts.a
  • 219
  • libLLVMSupport.a
  • 220
  • LLVMCore.o
  • 221295
    222296
    libLLVMTransforms.a
    297
  • libLLVMCore.a
  • 223298
  • libLLVMSupport.a
  • 224299
  • libLLVMTarget.a
  • 225300
  • libLLVMTransformUtils.a
  • 226
  • LLVMCore.o>
  • 301 >
    302
    libLLVMbzip2.a
    227303
    228304
    libLLVMipa.a
    229305
  • libLLVMAnalysis.a
  • 230
  • libLLVMSupport.a
  • 231
  • LLVMCore.o
  • 306
  • libLLVMCore.a
  • 307
  • libLLVMSupport.a
  • 308
  • libLLVMSystem.a
  • 232309
    233310
    libLLVMipo.a
    234311
  • libLLVMAnalysis.a
  • 312
  • libLLVMCore.a
  • 313
  • libLLVMSupport.a
  • 314
  • libLLVMSystem.a
  • 315
  • libLLVMTarget.a
  • 316
  • libLLVMTransformUtils.a
  • 235317
  • libLLVMipa.a
  • 236
  • libLLVMSupport.a
  • 237
  • libLLVMTarget.a
  • 238
  • libLLVMTransformUtils.a
  • 239
  • LLVMCore.o>
  • 318 >
    319
    LLVMARM.o
    320
  • libLLVMCodeGen.a
  • 321
  • libLLVMCore.a
  • 322
  • libLLVMScalarOpts.a
  • 323
  • libLLVMSelectionDAG.a
  • 324
  • libLLVMSupport.a
  • 325
  • libLLVMSystem.a
  • 326
  • libLLVMTarget.a
  • 240327
    241328
    LLVMAlpha.o
    242
  • libLLVMScalarOpts.a
  • 243
  • libLLVMSupport.a
  • 244
  • libLLVMTarget.a
  • 245
  • LLVMCodeGen.o
  • 246
  • LLVMCore.o
  • 247
  • LLVMSelectionDAG.o
  • 248
    249
    LLVMAsmParser.o
    250
  • LLVMCore.o
  • 251
    252
    LLVMBCReader.o
    253
  • libLLVMSupport.a
  • 254
  • libLLVMSystem.a
  • 255
  • LLVMCore.o
  • 256
    257
    LLVMBCWriter.o
    258
  • libLLVMSupport.a
  • 259
  • LLVMCore.o
  • 329
  • libLLVMCodeGen.a
  • 330
  • libLLVMCore.a
  • 331
  • libLLVMScalarOpts.a
  • 332
  • libLLVMSelectionDAG.a
  • 333
  • libLLVMSupport.a
  • 334
  • libLLVMSystem.a
  • 335
  • libLLVMTarget.a
  • 260336
    261337
    LLVMCBackend.o
    262338
  • libLLVMAnalysis.a
  • 339
  • libLLVMCodeGen.a
  • 340
  • libLLVMCore.a
  • 341
  • libLLVMScalarOpts.a
  • 342
  • libLLVMSupport.a
  • 343
  • libLLVMSystem.a
  • 344
  • libLLVMTarget.a
  • 263345
  • libLLVMipa.a
  • 264
  • libLLVMScalarOpts.a
  • 265
  • libLLVMSupport.a
  • 266
  • libLLVMTarget.a
  • 267
  • LLVMCodeGen.o
  • 268
  • LLVMCore.o
  • 269
    270
    LLVMCodeGen.o
    271
  • libLLVMAnalysis.a
  • 272
  • libLLVMSupport.a
  • 273
  • libLLVMTarget.a
  • 274
  • LLVMCore.o
  • 275
    276
    LLVMCore.o
    277
  • libLLVMSupport.a
  • 278346
    279347
    LLVMDataStructure.o
    280348
  • libLLVMAnalysis.a
  • 281
  • libLLVMSupport.a
  • 282
  • libLLVMTarget.a
  • 283
  • LLVMCore.o
  • 284
    285
    LLVMDebugger.o
    286
  • libLLVMSupport.a
  • 287
  • libLLVMSystem.a
  • 288
  • LLVMBCReader.o
  • 289
  • LLVMCore.o
  • 349
  • libLLVMCore.a
  • 350
  • libLLVMSupport.a
  • 351
  • libLLVMSystem.a
  • 352
  • libLLVMTarget.a
  • 290353
    291354
    LLVMExecutionEngine.o
    292
  • libLLVMSupport.a
  • 293
  • libLLVMSystem.a
  • 294
  • libLLVMTarget.a
  • 295
  • LLVMCore.o
  • 355
  • libLLVMCore.a
  • 356
  • libLLVMSupport.a
  • 357
  • libLLVMSystem.a
  • 358
  • libLLVMTarget.a
  • 296359
    297360
    LLVMIA64.o
    298
  • libLLVMScalarOpts.a
  • 299
  • libLLVMSupport.a
  • 300
  • libLLVMTarget.a
  • 301
  • LLVMCodeGen.o
  • 302
  • LLVMCore.o
  • 303
  • LLVMSelectionDAG.o
  • 361
  • libLLVMCodeGen.a
  • 362
  • libLLVMCore.a
  • 363
  • libLLVMScalarOpts.a
  • 364
  • libLLVMSelectionDAG.a
  • 365
  • libLLVMSupport.a
  • 366
  • libLLVMSystem.a
  • 367
  • libLLVMTarget.a
  • 304368
    305369
    LLVMInterpreter.o
    306
  • libLLVMSupport.a
  • 307
  • libLLVMSystem.a
  • 308
  • libLLVMTarget.a
  • 309
  • LLVMCore.o
  • 310370
  • LLVMExecutionEngine.o
  • 371
  • libLLVMCore.a
  • 372
  • libLLVMSupport.a
  • 373
  • libLLVMSystem.a
  • 374
  • libLLVMTarget.a
  • 311375
    312376
    LLVMJIT.o
    313
  • libLLVMSupport.a
  • 314
  • libLLVMSystem.a
  • 315
  • libLLVMTarget.a
  • 316
  • LLVMCodeGen.o
  • 317
  • LLVMCore.o
  • 318377
  • LLVMExecutionEngine.o
  • 378
  • libLLVMCodeGen.a
  • 379
  • libLLVMCore.a
  • 380
  • libLLVMSupport.a
  • 381
  • libLLVMSystem.a
  • 382
  • libLLVMTarget.a
  • 319383
    320384
    LLVMPowerPC.o
    321
  • libLLVMScalarOpts.a
  • 322
  • libLLVMSupport.a
  • 323
  • libLLVMTarget.a
  • 324
  • LLVMCodeGen.o
  • 325
  • LLVMCore.o
  • 326
  • LLVMSelectionDAG.o
  • 327
    328
    LLVMSelectionDAG.o
    329
  • libLLVMSupport.a
  • 330
  • libLLVMSystem.a
  • 331
  • libLLVMTarget.a
  • 332
  • libLLVMTransformUtils.a
  • 333
  • LLVMCodeGen.o
  • 334
  • LLVMCore.o
  • 385
  • libLLVMCodeGen.a
  • 386
  • libLLVMCore.a
  • 387
  • libLLVMScalarOpts.a
  • 388
  • libLLVMSelectionDAG.a
  • 389
  • libLLVMSupport.a
  • 390
  • libLLVMSystem.a
  • 391
  • libLLVMTarget.a
  • 335392
    336393
    LLVMSparc.o
    337
  • libLLVMScalarOpts.a
  • 338
  • libLLVMSupport.a
  • 339
  • libLLVMTarget.a
  • 340
  • LLVMCodeGen.o
  • 341
  • LLVMCore.o
  • 342
  • LLVMSelectionDAG.o
  • 394
  • libLLVMCodeGen.a
  • 395
  • libLLVMCore.a
  • 396
  • libLLVMScalarOpts.a
  • 397
  • libLLVMSelectionDAG.a
  • 398
  • libLLVMSupport.a
  • 399
  • libLLVMSystem.a
  • 400
  • libLLVMTarget.a
  • 343401
    344402
    LLVMX86.o
    345
  • libLLVMScalarOpts.a
  • 346
  • libLLVMSupport.a
  • 347
  • libLLVMTarget.a
  • 348
  • LLVMCodeGen.o
  • 349
  • LLVMCore.o
  • 350
  • LLVMSelectionDAG.o
  • 351
    352
    LLVMbzip2.o
    >
    403
  • libLLVMCodeGen.a>
  • 404
  • libLLVMCore.a
  • 405
  • libLLVMScalarOpts.a
  • 406
  • libLLVMSelectionDAG.a
  • 407
  • libLLVMSupport.a
  • 408
  • libLLVMSystem.a
  • 409
  • libLLVMTarget.a
  • 353410
    354411
    355412
    Binary diff not shown
    Binary diff not shown