This file is indexed.

/usr/share/doc/llvm-3.4-doc/html/GettingStarted.html is in llvm-3.4-doc 1:3.4-1ubuntu3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Getting Started with the LLVM System &mdash; LLVM 3.4 documentation</title>
    
    <link rel="stylesheet" href="_static/llvm-theme.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '3.4',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <link rel="top" title="LLVM 3.4 documentation" href="index.html" />
    <link rel="next" title="Getting Started with the LLVM System using Microsoft Visual Studio" href="GettingStartedVS.html" />
    <link rel="prev" title="llvm-readobj - LLVM Object Reader" href="CommandGuide/llvm-readobj.html" />
<style type="text/css">
  table.right { float: right; margin-left: 20px; }
  table.right td { border: 1px solid #ccc; }
</style>

  </head>
  <body>
<div class="logo">
  <a href="index.html">
    <img src="_static/logo.png"
         alt="LLVM Logo" width="250" height="88"/></a>
</div>

    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="GettingStartedVS.html" title="Getting Started with the LLVM System using Microsoft Visual Studio"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="CommandGuide/llvm-readobj.html" title="llvm-readobj - LLVM Object Reader"
             accesskey="P">previous</a> |</li>
  <li><a href="http://llvm.org/">LLVM Home</a>&nbsp;|&nbsp;</li>
  <li><a href="index.html">Documentation</a>&raquo;</li>
 
      </ul>
    </div>


    <div class="document">
      <div class="documentwrapper">
          <div class="body">
            
  <div class="section" id="getting-started-with-the-llvm-system">
<h1>Getting Started with the LLVM System<a class="headerlink" href="#getting-started-with-the-llvm-system" title="Permalink to this headline"></a></h1>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#overview" id="id5">Overview</a></li>
<li><a class="reference internal" href="#getting-started-quickly-a-summary" id="id6">Getting Started Quickly (A Summary)</a></li>
<li><a class="reference internal" href="#requirements" id="id7">Requirements</a><ul>
<li><a class="reference internal" href="#hardware" id="id8">Hardware</a></li>
<li><a class="reference internal" href="#software" id="id9">Software</a></li>
<li><a class="reference internal" href="#broken-versions-of-gcc-and-other-tools" id="id10">Broken versions of GCC and other tools</a></li>
</ul>
</li>
<li><a class="reference internal" href="#getting-started-with-llvm" id="id11">Getting Started with LLVM</a><ul>
<li><a class="reference internal" href="#terminology-and-notation" id="id12">Terminology and Notation</a></li>
<li><a class="reference internal" href="#setting-up-your-environment" id="id13">Setting Up Your Environment</a></li>
<li><a class="reference internal" href="#unpacking-the-llvm-archives" id="id14">Unpacking the LLVM Archives</a></li>
<li><a class="reference internal" href="#checkout-llvm-from-subversion" id="id15">Checkout LLVM from Subversion</a></li>
<li><a class="reference internal" href="#git-mirror" id="id16">Git Mirror</a><ul>
<li><a class="reference internal" href="#sending-patches-with-git" id="id17">Sending patches with Git</a></li>
<li><a class="reference internal" href="#for-developers-to-work-with-git-svn" id="id18">For developers to work with git-svn</a></li>
</ul>
</li>
<li><a class="reference internal" href="#local-llvm-configuration" id="id19">Local LLVM Configuration</a></li>
<li><a class="reference internal" href="#compiling-the-llvm-suite-source-code" id="id20">Compiling the LLVM Suite Source Code</a></li>
<li><a class="reference internal" href="#cross-compiling-llvm" id="id21">Cross-Compiling LLVM</a></li>
<li><a class="reference internal" href="#the-location-of-llvm-object-files" id="id22">The Location of LLVM Object Files</a></li>
<li><a class="reference internal" href="#optional-configuration-items" id="id23">Optional Configuration Items</a></li>
</ul>
</li>
<li><a class="reference internal" href="#general-layout" id="id24">Program Layout</a><ul>
<li><a class="reference internal" href="#llvm-examples" id="id25"><tt class="docutils literal"><span class="pre">llvm/examples</span></tt></a></li>
<li><a class="reference internal" href="#llvm-include" id="id26"><tt class="docutils literal"><span class="pre">llvm/include</span></tt></a></li>
<li><a class="reference internal" href="#llvm-lib" id="id27"><tt class="docutils literal"><span class="pre">llvm/lib</span></tt></a></li>
<li><a class="reference internal" href="#llvm-projects" id="id28"><tt class="docutils literal"><span class="pre">llvm/projects</span></tt></a></li>
<li><a class="reference internal" href="#llvm-runtime" id="id29"><tt class="docutils literal"><span class="pre">llvm/runtime</span></tt></a></li>
<li><a class="reference internal" href="#llvm-test" id="id30"><tt class="docutils literal"><span class="pre">llvm/test</span></tt></a></li>
<li><a class="reference internal" href="#test-suite" id="id31"><tt class="docutils literal"><span class="pre">test-suite</span></tt></a></li>
<li><a class="reference internal" href="#llvm-tools" id="id32"><tt class="docutils literal"><span class="pre">llvm/tools</span></tt></a></li>
<li><a class="reference internal" href="#llvm-utils" id="id33"><tt class="docutils literal"><span class="pre">llvm/utils</span></tt></a></li>
</ul>
</li>
<li><a class="reference internal" href="#an-example-using-the-llvm-tool-chain" id="id34">An Example Using the LLVM Tool Chain</a><ul>
<li><a class="reference internal" href="#example-with-clang" id="id35">Example with clang</a></li>
</ul>
</li>
<li><a class="reference internal" href="#common-problems" id="id36">Common Problems</a></li>
<li><a class="reference internal" href="#links" id="id37">Links</a></li>
</ul>
</div>
<div class="section" id="overview">
<h2><a class="toc-backref" href="#id5">Overview</a><a class="headerlink" href="#overview" title="Permalink to this headline"></a></h2>
<p>Welcome to LLVM! In order to get started, you first need to know some basic
information.</p>
<p>First, LLVM comes in three pieces. The first piece is the LLVM suite. This
contains all of the tools, libraries, and header files needed to use LLVM.  It
contains an assembler, disassembler, bitcode analyzer and bitcode optimizer.  It
also contains basic regression tests that can be used to test the LLVM tools and
the Clang front end.</p>
<p>The second piece is the <a class="reference external" href="http://clang.llvm.org/">Clang</a> front end.  This
component compiles C, C++, Objective C, and Objective C++ code into LLVM
bitcode. Once compiled into LLVM bitcode, a program can be manipulated with the
LLVM tools from the LLVM suite.</p>
<p>There is a third, optional piece called Test Suite.  It is a suite of programs
with a testing harness that can be used to further test LLVM&#8217;s functionality
and performance.</p>
</div>
<div class="section" id="getting-started-quickly-a-summary">
<h2><a class="toc-backref" href="#id6">Getting Started Quickly (A Summary)</a><a class="headerlink" href="#getting-started-quickly-a-summary" title="Permalink to this headline"></a></h2>
<p>The LLVM Getting Started documentation may be out of date.  So, the <a class="reference external" href="http://clang.llvm.org/get_started.html">Clang
Getting Started</a> page might also be a
good place to start.</p>
<p>Here&#8217;s the short story for getting up and running quickly with LLVM:</p>
<ol class="arabic simple">
<li>Read the documentation.</li>
<li>Read the documentation.</li>
<li>Remember that you were warned twice about reading the documentation.</li>
<li>Checkout LLVM:<ul>
<li><tt class="docutils literal"><span class="pre">cd</span> <span class="pre">where-you-want-llvm-to-live</span></tt></li>
<li><tt class="docutils literal"><span class="pre">svn</span> <span class="pre">co</span> <span class="pre">http://llvm.org/svn/llvm-project/llvm/trunk</span> <span class="pre">llvm</span></tt></li>
</ul>
</li>
<li>Checkout Clang:<ul>
<li><tt class="docutils literal"><span class="pre">cd</span> <span class="pre">where-you-want-llvm-to-live</span></tt></li>
<li><tt class="docutils literal"><span class="pre">cd</span> <span class="pre">llvm/tools</span></tt></li>
<li><tt class="docutils literal"><span class="pre">svn</span> <span class="pre">co</span> <span class="pre">http://llvm.org/svn/llvm-project/cfe/trunk</span> <span class="pre">clang</span></tt></li>
</ul>
</li>
<li>Checkout Compiler-RT:<ul>
<li><tt class="docutils literal"><span class="pre">cd</span> <span class="pre">where-you-want-llvm-to-live</span></tt></li>
<li><tt class="docutils literal"><span class="pre">cd</span> <span class="pre">llvm/projects</span></tt></li>
<li><tt class="docutils literal"><span class="pre">svn</span> <span class="pre">co</span> <span class="pre">http://llvm.org/svn/llvm-project/compiler-rt/trunk</span> <span class="pre">compiler-rt</span></tt></li>
</ul>
</li>
<li>Get the Test Suite Source Code <strong>[Optional]</strong><ul>
<li><tt class="docutils literal"><span class="pre">cd</span> <span class="pre">where-you-want-llvm-to-live</span></tt></li>
<li><tt class="docutils literal"><span class="pre">cd</span> <span class="pre">llvm/projects</span></tt></li>
<li><tt class="docutils literal"><span class="pre">svn</span> <span class="pre">co</span> <span class="pre">http://llvm.org/svn/llvm-project/test-suite/trunk</span> <span class="pre">test-suite</span></tt></li>
</ul>
</li>
<li>Configure and build LLVM and Clang:<ul>
<li><tt class="docutils literal"><span class="pre">cd</span> <span class="pre">where-you-want-to-build-llvm</span></tt></li>
<li><tt class="docutils literal"><span class="pre">mkdir</span> <span class="pre">build</span></tt> (for building without polluting the source dir)</li>
<li><tt class="docutils literal"><span class="pre">cd</span> <span class="pre">build</span></tt></li>
<li><tt class="docutils literal"><span class="pre">../llvm/configure</span> <span class="pre">[options]</span></tt>
Some common options:<ul>
<li><tt class="docutils literal"><span class="pre">--prefix=directory</span></tt> &#8212; Specify for <em>directory</em> the full pathname of
where you want the LLVM tools and libraries to be installed (default
<tt class="docutils literal"><span class="pre">/usr/local</span></tt>).</li>
<li><tt class="docutils literal"><span class="pre">--enable-optimized</span></tt> &#8212; Compile with optimizations enabled (default
is NO).</li>
<li><tt class="docutils literal"><span class="pre">--enable-assertions</span></tt> &#8212; Compile with assertion checks enabled
(default is YES).</li>
</ul>
</li>
<li><tt class="docutils literal"><span class="pre">make</span> <span class="pre">[-j]</span></tt> &#8212; The <tt class="docutils literal"><span class="pre">-j</span></tt> specifies the number of jobs (commands) to run
simultaneously.  This builds both LLVM and Clang for Debug+Asserts mode.
The <tt class="docutils literal"><span class="pre">--enable-optimized</span></tt> configure option is used to specify a Release
build.</li>
<li><tt class="docutils literal"><span class="pre">make</span> <span class="pre">check-all</span></tt> &#8212; This run the regression tests to ensure everything
is in working order.</li>
<li><tt class="docutils literal"><span class="pre">make</span> <span class="pre">update</span></tt> &#8212; This command is used to update all the svn repositories
at once, rather then having to <tt class="docutils literal"><span class="pre">cd</span></tt> into the individual repositories and
running <tt class="docutils literal"><span class="pre">svn</span> <span class="pre">update</span></tt>.</li>
<li>It is also possible to use CMake instead of the makefiles. With CMake it is
possible to generate project files for several IDEs: Xcode, Eclipse CDT4,
CodeBlocks, Qt-Creator (use the CodeBlocks generator), KDevelop3.</li>
<li>If you get an &#8220;internal compiler error (ICE)&#8221; or test failures, see
<cite>below</cite>.</li>
</ul>
</li>
</ol>
<p>Consult the <a class="reference internal" href="#getting-started-with-llvm">Getting Started with LLVM</a> section for detailed information on
configuring and compiling LLVM.  See <a class="reference internal" href="#setting-up-your-environment">Setting Up Your Environment</a> for tips
that simplify working with the Clang front end and LLVM tools.  Go to <a class="reference internal" href="#program-layout">Program
Layout</a> to learn about the layout of the source code tree.</p>
</div>
<div class="section" id="requirements">
<h2><a class="toc-backref" href="#id7">Requirements</a><a class="headerlink" href="#requirements" title="Permalink to this headline"></a></h2>
<p>Before you begin to use the LLVM system, review the requirements given below.
This may save you some trouble by knowing ahead of time what hardware and
software you will need.</p>
<div class="section" id="hardware">
<h3><a class="toc-backref" href="#id8">Hardware</a><a class="headerlink" href="#hardware" title="Permalink to this headline"></a></h3>
<p>LLVM is known to work on the following platforms:</p>
<table border="1" class="docutils">
<colgroup>
<col width="27%" />
<col width="34%" />
<col width="39%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">OS</th>
<th class="head">Arch</th>
<th class="head">Compilers</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>AuroraUX</td>
<td>x86<sup>1</sup></td>
<td>GCC</td>
</tr>
<tr class="row-odd"><td>Linux</td>
<td>x86<sup>1</sup></td>
<td>GCC</td>
</tr>
<tr class="row-even"><td>Linux</td>
<td>amd64</td>
<td>GCC</td>
</tr>
<tr class="row-odd"><td>Linux</td>
<td>ARM<sup>13</sup></td>
<td>GCC</td>
</tr>
<tr class="row-even"><td>Solaris</td>
<td>V9 (Ultrasparc)</td>
<td>GCC</td>
</tr>
<tr class="row-odd"><td>FreeBSD</td>
<td>x86<sup>1</sup></td>
<td>GCC</td>
</tr>
<tr class="row-even"><td>FreeBSD</td>
<td>amd64</td>
<td>GCC</td>
</tr>
<tr class="row-odd"><td>MacOS X<sup>2</sup></td>
<td>PowerPC</td>
<td>GCC</td>
</tr>
<tr class="row-even"><td>MacOS X<sup>9</sup></td>
<td>x86</td>
<td>GCC</td>
</tr>
<tr class="row-odd"><td>Cygwin/Win32</td>
<td>x86<sup>1, 8, 11</sup></td>
<td>GCC 3.4.X, binutils 2.20</td>
</tr>
</tbody>
</table>
<p>LLVM has partial support for the following platforms:</p>
<table border="1" class="docutils">
<colgroup>
<col width="23%" />
<col width="26%" />
<col width="51%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">OS</th>
<th class="head">Arch</th>
<th class="head">Compilers</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>Windows</td>
<td>x86<sup>1</sup></td>
<td>Visual Studio 2000 or higher<sup>4,5</sup></td>
</tr>
<tr class="row-odd"><td>AIX<sup>3,4</sup></td>
<td>PowerPC</td>
<td>GCC</td>
</tr>
<tr class="row-even"><td>Linux<sup>3,5</sup></td>
<td>PowerPC</td>
<td>GCC</td>
</tr>
<tr class="row-odd"><td>Linux<sup>7</sup></td>
<td>Alpha</td>
<td>GCC</td>
</tr>
<tr class="row-even"><td>Linux<sup>7</sup></td>
<td>Itanium (IA-64)</td>
<td>GCC</td>
</tr>
<tr class="row-odd"><td>HP-UX<sup>7</sup></td>
<td>Itanium (IA-64)</td>
<td>HP aCC</td>
</tr>
<tr class="row-even"><td>Windows x64</td>
<td>x86-64</td>
<td>mingw-w64&#8217;s GCC-4.5.x<sup>12</sup></td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<ol class="last arabic simple">
<li>Code generation supported for Pentium processors and up</li>
<li>Code generation supported for 32-bit ABI only</li>
<li>No native code generation</li>
<li>Build is not complete: one or more tools do not link or function</li>
<li>The GCC-based C/C++ frontend does not build</li>
<li>The port is done using the MSYS shell.</li>
<li>Native code generation exists but is not complete.</li>
<li>Binutils 2.20 or later is required to build the assembler generated by LLVM properly.</li>
<li>Xcode 2.5 and gcc 4.0.1 (Apple Build 5370) will trip internal LLVM assert
messages when compiled for Release at optimization levels greater than 0
(i.e., <tt class="docutils literal"><span class="pre">-O1</span></tt> and higher).  Add <tt class="docutils literal"><span class="pre">OPTIMIZE_OPTION=&quot;-O0&quot;</span></tt> to the build
command line if compiling for LLVM Release or bootstrapping the LLVM
toolchain.</li>
<li>For MSYS/MinGW on Windows, be sure to install the MSYS version of the perl
package, and be sure it appears in your path before any Windows-based
versions such as Strawberry Perl and ActivePerl, as these have
Windows-specifics that will cause the build to fail.</li>
<li>To use LLVM modules on Win32-based system, you may configure LLVM
with <tt class="docutils literal"><span class="pre">--enable-shared</span></tt>.</li>
<li>To compile SPU backend, you need to add <tt class="docutils literal"><span class="pre">LDFLAGS=-Wl,--stack,16777216</span></tt> to
configure.</li>
<li>MCJIT not working well pre-v7, old JIT engine not supported any more.</li>
</ol>
</div>
<p>Note that you will need about 1-3 GB of space for a full LLVM build in Debug
mode, depending on the system (it is so large because of all the debugging
information and the fact that the libraries are statically linked into multiple
tools).  If you do not need many of the tools and you are space-conscious, you
can pass <tt class="docutils literal"><span class="pre">ONLY_TOOLS=&quot;tools</span> <span class="pre">you</span> <span class="pre">need&quot;</span></tt> to make.  The Release build requires
considerably less space.</p>
<p>The LLVM suite <em>may</em> compile on other platforms, but it is not guaranteed to do
so.  If compilation is successful, the LLVM utilities should be able to
assemble, disassemble, analyze, and optimize LLVM bitcode.  Code generation
should work as well, although the generated native code may not work on your
platform.</p>
</div>
<div class="section" id="software">
<h3><a class="toc-backref" href="#id9">Software</a><a class="headerlink" href="#software" title="Permalink to this headline"></a></h3>
<p>Compiling LLVM requires that you have several software packages installed. The
table below lists those required packages. The Package column is the usual name
for the software package that LLVM depends on. The Version column provides
&#8220;known to work&#8221; versions of the package. The Notes column describes how LLVM
uses the package and provides other details.</p>
<table border="1" class="docutils">
<colgroup>
<col width="50%" />
<col width="14%" />
<col width="36%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Package</th>
<th class="head">Version</th>
<th class="head">Notes</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td><a class="reference external" href="http://savannah.gnu.org/projects/make">GNU Make</a></td>
<td>3.79, 3.79.1</td>
<td>Makefile/build processor</td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="http://gcc.gnu.org/">GCC</a></td>
<td>3.4.2</td>
<td>C/C++ compiler<sup>1</sup></td>
</tr>
<tr class="row-even"><td><a class="reference external" href="http://www.gnu.org/software/texinfo/">TeXinfo</a></td>
<td>4.5</td>
<td>For building the CFE</td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="http://subversion.tigris.org/project_packages.html">SVN</a></td>
<td>&gt;=1.3</td>
<td>Subversion access to LLVM<sup>2</sup></td>
</tr>
<tr class="row-even"><td><a class="reference external" href="http://www.python.org/">python</a></td>
<td>&gt;=2.5</td>
<td>Automated test suite<sup>3</sup></td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="http://savannah.gnu.org/projects/m4">GNU M4</a></td>
<td>1.4</td>
<td>Macro processor for configuration<sup>4</sup></td>
</tr>
<tr class="row-even"><td><a class="reference external" href="http://www.gnu.org/software/autoconf/">GNU Autoconf</a></td>
<td>2.60</td>
<td>Configuration script builder<sup>4</sup></td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="http://www.gnu.org/software/automake/">GNU Automake</a></td>
<td>1.9.6</td>
<td>aclocal macro generator<sup>4</sup></td>
</tr>
<tr class="row-even"><td><a class="reference external" href="http://savannah.gnu.org/projects/libtool">libtool</a></td>
<td>1.5.22</td>
<td>Shared library manager<sup>4</sup></td>
</tr>
<tr class="row-odd"><td><a class="reference external" href="http://zlib.net">zlib</a></td>
<td>&gt;=1.2.3.4</td>
<td>Compression library<sup>5</sup></td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<ol class="last arabic simple">
<li>Only the C and C++ languages are needed so there&#8217;s no need to build the
other languages for LLVM&#8217;s purposes. See <cite>below</cite> for specific version
info.</li>
<li>You only need Subversion if you intend to build from the latest LLVM
sources. If you&#8217;re working from a release distribution, you don&#8217;t need
Subversion.</li>
<li>Only needed if you want to run the automated test suite in the
<tt class="docutils literal"><span class="pre">llvm/test</span></tt> directory.</li>
<li>If you want to make changes to the configure scripts, you will need GNU
autoconf (2.60), and consequently, GNU M4 (version 1.4 or higher). You
will also need automake (1.9.6). We only use aclocal from that package.</li>
<li>Optional, adds compression/uncompression capabilities to selected LLVM
tools.</li>
</ol>
</div>
<p>Additionally, your compilation host is expected to have the usual plethora of
Unix utilities. Specifically:</p>
<ul class="simple">
<li><strong>ar</strong> &#8212; archive library builder</li>
<li><strong>bzip2</strong> &#8212; bzip2 command for distribution generation</li>
<li><strong>bunzip2</strong> &#8212; bunzip2 command for distribution checking</li>
<li><strong>chmod</strong> &#8212; change permissions on a file</li>
<li><strong>cat</strong> &#8212; output concatenation utility</li>
<li><strong>cp</strong> &#8212; copy files</li>
<li><strong>date</strong> &#8212; print the current date/time</li>
<li><strong>echo</strong> &#8212; print to standard output</li>
<li><strong>egrep</strong> &#8212; extended regular expression search utility</li>
<li><strong>find</strong> &#8212; find files/dirs in a file system</li>
<li><strong>grep</strong> &#8212; regular expression search utility</li>
<li><strong>gzip</strong> &#8212; gzip command for distribution generation</li>
<li><strong>gunzip</strong> &#8212; gunzip command for distribution checking</li>
<li><strong>install</strong> &#8212; install directories/files</li>
<li><strong>mkdir</strong> &#8212; create a directory</li>
<li><strong>mv</strong> &#8212; move (rename) files</li>
<li><strong>ranlib</strong> &#8212; symbol table builder for archive libraries</li>
<li><strong>rm</strong> &#8212; remove (delete) files and directories</li>
<li><strong>sed</strong> &#8212; stream editor for transforming output</li>
<li><strong>sh</strong> &#8212; Bourne shell for make build scripts</li>
<li><strong>tar</strong> &#8212; tape archive for distribution generation</li>
<li><strong>test</strong> &#8212; test things in file system</li>
<li><strong>unzip</strong> &#8212; unzip command for distribution checking</li>
<li><strong>zip</strong> &#8212; zip command for distribution generation</li>
</ul>
</div>
<div class="section" id="broken-versions-of-gcc-and-other-tools">
<span id="check-here"></span><span id="below"></span><h3><a class="toc-backref" href="#id10">Broken versions of GCC and other tools</a><a class="headerlink" href="#broken-versions-of-gcc-and-other-tools" title="Permalink to this headline"></a></h3>
<p>LLVM is very demanding of the host C++ compiler, and as such tends to expose
bugs in the compiler.  In particular, several versions of GCC crash when trying
to compile LLVM.  We routinely use GCC 4.2 (and higher) or Clang.  Other
versions of GCC will probably work as well.  GCC versions listed here are known
to not work.  If you are using one of these versions, please try to upgrade your
GCC to something more recent.  If you run into a problem with a version of GCC
not listed here, please <a class="reference external" href="mailto:llvmdev&#37;&#52;&#48;cs&#46;uiuc&#46;edu">let us know</a>.  Please use
the &#8220;<tt class="docutils literal"><span class="pre">gcc</span> <span class="pre">-v</span></tt>&#8221; command to find out which version of GCC you are using.</p>
<p><strong>GCC versions prior to 3.0</strong>: GCC 2.96.x and before had several problems in the
STL that effectively prevent it from compiling LLVM.</p>
<p><strong>GCC 3.2.2 and 3.2.3</strong>: These versions of GCC fails to compile LLVM with a
bogus template error.  This was fixed in later GCCs.</p>
<p><strong>GCC 3.3.2</strong>: This version of GCC suffered from a <a class="reference external" href="http://gcc.gnu.org/PR13392">serious bug</a> which causes it to crash in the
&#8220;<tt class="docutils literal"><span class="pre">convert_from_eh_region_ranges_1</span></tt>&#8221; GCC function.</p>
<p><strong>Cygwin GCC 3.3.3</strong>: The version of GCC 3.3.3 commonly shipped with Cygwin does
not work.</p>
<p><strong>SuSE GCC 3.3.3</strong>: The version of GCC 3.3.3 shipped with SuSE 9.1 (and possibly
others) does not compile LLVM correctly (it appears that exception handling is
broken in some cases).  Please download the FSF 3.3.3 or upgrade to a newer
version of GCC.</p>
<p><strong>GCC 3.4.0 on linux/x86 (32-bit)</strong>: GCC miscompiles portions of the code
generator, causing an infinite loop in the llvm-gcc build when built with
optimizations enabled (i.e. a release build).</p>
<p><strong>GCC 3.4.2 on linux/x86 (32-bit)</strong>: GCC miscompiles portions of the code
generator at -O3, as with 3.4.0.  However gcc 3.4.2 (unlike 3.4.0) correctly
compiles LLVM at -O2.  A work around is to build release LLVM builds with
&#8220;<tt class="docutils literal"><span class="pre">make</span> <span class="pre">ENABLE_OPTIMIZED=1</span> <span class="pre">OPTIMIZE_OPTION=-O2</span> <span class="pre">...</span></tt>&#8220;</p>
<p><strong>GCC 3.4.x on X86-64/amd64</strong>: GCC <a class="reference external" href="http://llvm.org/PR1056">miscompiles portions of LLVM</a>.</p>
<p><strong>GCC 3.4.4 (CodeSourcery ARM 2005q3-2)</strong>: this compiler miscompiles LLVM when
building with optimizations enabled.  It appears to work with &#8220;<tt class="docutils literal"><span class="pre">make</span>
<span class="pre">ENABLE_OPTIMIZED=1</span> <span class="pre">OPTIMIZE_OPTION=-O1</span></tt>&#8221; or build a debug build.</p>
<p><strong>IA-64 GCC 4.0.0</strong>: The IA-64 version of GCC 4.0.0 is known to miscompile LLVM.</p>
<p><strong>Apple Xcode 2.3</strong>: GCC crashes when compiling LLVM at -O3 (which is the
default with ENABLE_OPTIMIZED=1.  To work around this, build with
&#8220;<tt class="docutils literal"><span class="pre">ENABLE_OPTIMIZED=1</span> <span class="pre">OPTIMIZE_OPTION=-O2</span></tt>&#8221;.</p>
<p><strong>GCC 4.1.1</strong>: GCC fails to build LLVM with template concept check errors
compiling some files.  At the time of this writing, GCC mainline (4.2) did not
share the problem.</p>
<p><strong>GCC 4.1.1 on X86-64/amd64</strong>: GCC <a class="reference external" href="http://llvm.org/PR1063">miscompiles portions of LLVM</a> when compiling llvm itself into 64-bit code.  LLVM
will appear to mostly work but will be buggy, e.g. failing portions of its
testsuite.</p>
<p><strong>GCC 4.1.2 on OpenSUSE</strong>: Seg faults during libstdc++ build and on x86_64
platforms compiling md5.c gets a mangled constant.</p>
<p><strong>GCC 4.1.2 (20061115 (prerelease) (Debian 4.1.1-21)) on Debian</strong>: Appears to
miscompile parts of LLVM 2.4. One symptom is ValueSymbolTable complaining about
symbols remaining in the table on destruction.</p>
<p><strong>GCC 4.1.2 20071124 (Red Hat 4.1.2-42)</strong>: Suffers from the same symptoms as the
previous one. It appears to work with ENABLE_OPTIMIZED=0 (the default).</p>
<p><strong>Cygwin GCC 4.3.2 20080827 (beta) 2</strong>: Users <a class="reference external" href="http://llvm.org/PR4145">reported</a> various problems related with link errors when using
this GCC version.</p>
<p><strong>Debian GCC 4.3.2 on X86</strong>: Crashes building some files in LLVM 2.6.</p>
<p><strong>GCC 4.3.3 (Debian 4.3.3-10) on ARM</strong>: Miscompiles parts of LLVM 2.6 when
optimizations are turned on. The symptom is an infinite loop in
<tt class="docutils literal"><span class="pre">FoldingSetImpl::RemoveNode</span></tt> while running the code generator.</p>
<p><strong>SUSE 11 GCC 4.3.4</strong>: Miscompiles LLVM, causing crashes in ValueHandle logic.</p>
<p><strong>GCC 4.3.5 and GCC 4.4.5 on ARM</strong>: These can miscompile <tt class="docutils literal"><span class="pre">value</span> <span class="pre">&gt;&gt;</span> <span class="pre">1</span></tt> even at
<tt class="docutils literal"><span class="pre">-O0</span></tt>. A test failure in <tt class="docutils literal"><span class="pre">test/Assembler/alignstack.ll</span></tt> is one symptom of
the problem.</p>
<p><strong>GCC 4.6.3 on ARM</strong>: Miscompiles <tt class="docutils literal"><span class="pre">llvm-readobj</span></tt> at <tt class="docutils literal"><span class="pre">-O3</span></tt>. A test failure
in <tt class="docutils literal"><span class="pre">test/Object/readobj-shared-object.test</span></tt> is one symptom of the problem.</p>
<p><strong>GNU ld 2.16.X</strong>. Some 2.16.X versions of the ld linker will produce very long
warning messages complaining that some &#8220;<tt class="docutils literal"><span class="pre">.gnu.linkonce.t.*</span></tt>&#8221; symbol was
defined in a discarded section. You can safely ignore these messages as they are
erroneous and the linkage is correct.  These messages disappear using ld 2.17.</p>
<p><strong>GNU binutils 2.17</strong>: Binutils 2.17 contains <a class="reference external" href="http://sourceware.org/bugzilla/show_bug.cgi?id=3111">a bug</a> which causes huge link
times (minutes instead of seconds) when building LLVM.  We recommend upgrading
to a newer version (2.17.50.0.4 or later).</p>
<p><strong>GNU Binutils 2.19.1 Gold</strong>: This version of Gold contained <a class="reference external" href="http://sourceware.org/bugzilla/show_bug.cgi?id=9836">a bug</a> which causes
intermittent failures when building LLVM with position independent code.  The
symptom is an error about cyclic dependencies.  We recommend upgrading to a
newer version of Gold.</p>
<p><strong>Clang 3.0 with libstdc++ 4.7.x</strong>: a few Linux distributions (Ubuntu 12.10,
Fedora 17) have both Clang 3.0 and libstdc++ 4.7 in their repositories.  Clang
3.0 does not implement a few builtins that are used in this library.  We
recommend using the system GCC to compile LLVM and Clang in this case.</p>
<p><strong>Clang 3.0 on Mageia 2</strong>.  There&#8217;s a packaging issue: Clang can not find at
least some (<tt class="docutils literal"><span class="pre">cxxabi.h</span></tt>) libstdc++ headers.</p>
</div>
</div>
<div class="section" id="getting-started-with-llvm">
<span id="id1"></span><h2><a class="toc-backref" href="#id11">Getting Started with LLVM</a><a class="headerlink" href="#getting-started-with-llvm" title="Permalink to this headline"></a></h2>
<p>The remainder of this guide is meant to get you up and running with LLVM and to
give you some basic information about the LLVM environment.</p>
<p>The later sections of this guide describe the <a class="reference internal" href="#general-layout">general layout</a> of the LLVM
source tree, a <a class="reference internal" href="#simple-example">simple example</a> using the LLVM tool chain, and <a class="reference internal" href="#links">links</a> to find
more information about LLVM or to get help via e-mail.</p>
<div class="section" id="terminology-and-notation">
<h3><a class="toc-backref" href="#id12">Terminology and Notation</a><a class="headerlink" href="#terminology-and-notation" title="Permalink to this headline"></a></h3>
<p>Throughout this manual, the following names are used to denote paths specific to
the local system and working environment.  <em>These are not environment variables
you need to set but just strings used in the rest of this document below</em>.  In
any of the examples below, simply replace each of these names with the
appropriate pathname on your local system.  All these paths are absolute:</p>
<p><tt class="docutils literal"><span class="pre">SRC_ROOT</span></tt></p>
<blockquote>
<div>This is the top level directory of the LLVM source tree.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">OBJ_ROOT</span></tt></p>
<blockquote>
<div>This is the top level directory of the LLVM object tree (i.e. the tree where
object files and compiled programs will be placed.  It can be the same as
SRC_ROOT).</div></blockquote>
</div>
<div class="section" id="setting-up-your-environment">
<span id="id2"></span><h3><a class="toc-backref" href="#id13">Setting Up Your Environment</a><a class="headerlink" href="#setting-up-your-environment" title="Permalink to this headline"></a></h3>
<p>In order to compile and use LLVM, you may need to set some environment
variables.</p>
<p><tt class="docutils literal"><span class="pre">LLVM_LIB_SEARCH_PATH=/path/to/your/bitcode/libs</span></tt></p>
<blockquote>
<div>[Optional] This environment variable helps LLVM linking tools find the
locations of your bitcode libraries. It is provided only as a convenience
since you can specify the paths using the -L options of the tools and the
C/C++ front-end will automatically use the bitcode files installed in its
<tt class="docutils literal"><span class="pre">lib</span></tt> directory.</div></blockquote>
</div>
<div class="section" id="unpacking-the-llvm-archives">
<h3><a class="toc-backref" href="#id14">Unpacking the LLVM Archives</a><a class="headerlink" href="#unpacking-the-llvm-archives" title="Permalink to this headline"></a></h3>
<p>If you have the LLVM distribution, you will need to unpack it before you can
begin to compile it.  LLVM is distributed as a set of two files: the LLVM suite
and the LLVM GCC front end compiled for your platform.  There is an additional
test suite that is optional.  Each file is a TAR archive that is compressed with
the gzip program.</p>
<p>The files are as follows, with <em>x.y</em> marking the version number:</p>
<p><tt class="docutils literal"><span class="pre">llvm-x.y.tar.gz</span></tt></p>
<blockquote>
<div>Source release for the LLVM libraries and tools.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvm-test-x.y.tar.gz</span></tt></p>
<blockquote>
<div>Source release for the LLVM test-suite.</div></blockquote>
</div>
<div class="section" id="checkout-llvm-from-subversion">
<span id="checkout"></span><h3><a class="toc-backref" href="#id15">Checkout LLVM from Subversion</a><a class="headerlink" href="#checkout-llvm-from-subversion" title="Permalink to this headline"></a></h3>
<p>If you have access to our Subversion repository, you can get a fresh copy of the
entire source code.  All you need to do is check it out from Subversion as
follows:</p>
<ul class="simple">
<li><tt class="docutils literal"><span class="pre">cd</span> <span class="pre">where-you-want-llvm-to-live</span></tt></li>
<li>Read-Only: <tt class="docutils literal"><span class="pre">svn</span> <span class="pre">co</span> <span class="pre">http://llvm.org/svn/llvm-project/llvm/trunk</span> <span class="pre">llvm</span></tt></li>
<li>Read-Write:<tt class="docutils literal"><span class="pre">svn</span> <span class="pre">co</span> <span class="pre">https://user&#64;llvm.org/svn/llvm-project/llvm/trunk</span> <span class="pre">llvm</span></tt></li>
</ul>
<p>This will create an &#8216;<tt class="docutils literal"><span class="pre">llvm</span></tt>&#8216; directory in the current directory and fully
populate it with the LLVM source code, Makefiles, test directories, and local
copies of documentation files.</p>
<p>If you want to get a specific release (as opposed to the most recent revision),
you can checkout it from the &#8216;<tt class="docutils literal"><span class="pre">tags</span></tt>&#8216; directory (instead of &#8216;<tt class="docutils literal"><span class="pre">trunk</span></tt>&#8216;). The
following releases are located in the following subdirectories of the &#8216;<tt class="docutils literal"><span class="pre">tags</span></tt>&#8216;
directory:</p>
<ul class="simple">
<li>Release 3.3: <strong>RELEASE_33/final</strong></li>
<li>Release 3.2: <strong>RELEASE_32/final</strong></li>
<li>Release 3.1: <strong>RELEASE_31/final</strong></li>
<li>Release 3.0: <strong>RELEASE_30/final</strong></li>
<li>Release 2.9: <strong>RELEASE_29/final</strong></li>
<li>Release 2.8: <strong>RELEASE_28</strong></li>
<li>Release 2.7: <strong>RELEASE_27</strong></li>
<li>Release 2.6: <strong>RELEASE_26</strong></li>
<li>Release 2.5: <strong>RELEASE_25</strong></li>
<li>Release 2.4: <strong>RELEASE_24</strong></li>
<li>Release 2.3: <strong>RELEASE_23</strong></li>
<li>Release 2.2: <strong>RELEASE_22</strong></li>
<li>Release 2.1: <strong>RELEASE_21</strong></li>
<li>Release 2.0: <strong>RELEASE_20</strong></li>
<li>Release 1.9: <strong>RELEASE_19</strong></li>
<li>Release 1.8: <strong>RELEASE_18</strong></li>
<li>Release 1.7: <strong>RELEASE_17</strong></li>
<li>Release 1.6: <strong>RELEASE_16</strong></li>
<li>Release 1.5: <strong>RELEASE_15</strong></li>
<li>Release 1.4: <strong>RELEASE_14</strong></li>
<li>Release 1.3: <strong>RELEASE_13</strong></li>
<li>Release 1.2: <strong>RELEASE_12</strong></li>
<li>Release 1.1: <strong>RELEASE_11</strong></li>
<li>Release 1.0: <strong>RELEASE_1</strong></li>
</ul>
<p>If you would like to get the LLVM test suite (a separate package as of 1.4), you
get it from the Subversion repository:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> <span class="nb">cd </span>llvm/projects
<span class="gp">%</span> svn co http://llvm.org/svn/llvm-project/test-suite/trunk <span class="nb">test</span>-suite
</pre></div>
</div>
<p>By placing it in the <tt class="docutils literal"><span class="pre">llvm/projects</span></tt>, it will be automatically configured by
the LLVM configure script as well as automatically updated when you run <tt class="docutils literal"><span class="pre">svn</span>
<span class="pre">update</span></tt>.</p>
</div>
<div class="section" id="git-mirror">
<h3><a class="toc-backref" href="#id16">Git Mirror</a><a class="headerlink" href="#git-mirror" title="Permalink to this headline"></a></h3>
<p>Git mirrors are available for a number of LLVM subprojects. These mirrors sync
automatically with each Subversion commit and contain all necessary git-svn
marks (so, you can recreate git-svn metadata locally). Note that right now
mirrors reflect only <tt class="docutils literal"><span class="pre">trunk</span></tt> for each project. You can do the read-only Git
clone of LLVM via:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> git clone http://llvm.org/git/llvm.git
</pre></div>
</div>
<p>If you want to check out clang too, run:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> <span class="nb">cd </span>llvm/tools
<span class="gp">%</span> git clone http://llvm.org/git/clang.git
</pre></div>
</div>
<p>If you want to check out compiler-rt too, run:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> <span class="nb">cd </span>llvm/projects
<span class="gp">%</span> git clone http://llvm.org/git/compiler-rt.git
</pre></div>
</div>
<p>If you want to check out the Test Suite Source Code (optional), run:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> <span class="nb">cd </span>llvm/projects
<span class="gp">%</span> git clone http://llvm.org/git/test-suite.git
</pre></div>
</div>
<p>Since the upstream repository is in Subversion, you should use <tt class="docutils literal"><span class="pre">git</span>
<span class="pre">pull</span> <span class="pre">--rebase</span></tt> instead of <tt class="docutils literal"><span class="pre">git</span> <span class="pre">pull</span></tt> to avoid generating a non-linear history
in your clone.  To configure <tt class="docutils literal"><span class="pre">git</span> <span class="pre">pull</span></tt> to pass <tt class="docutils literal"><span class="pre">--rebase</span></tt> by default on the
master branch, run the following command:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> git config branch.master.rebase <span class="nb">true</span>
</pre></div>
</div>
<div class="section" id="sending-patches-with-git">
<h4><a class="toc-backref" href="#id17">Sending patches with Git</a><a class="headerlink" href="#sending-patches-with-git" title="Permalink to this headline"></a></h4>
<p>Please read <a class="reference external" href="DeveloperPolicy.html#one-off-patches">Developer Policy</a>, too.</p>
<p>Assume <tt class="docutils literal"><span class="pre">master</span></tt> points the upstream and <tt class="docutils literal"><span class="pre">mybranch</span></tt> points your working
branch, and <tt class="docutils literal"><span class="pre">mybranch</span></tt> is rebased onto <tt class="docutils literal"><span class="pre">master</span></tt>.  At first you may check
sanity of whitespaces:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> git diff --check master..mybranch
</pre></div>
</div>
<p>The easiest way to generate a patch is as below:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> git diff master..mybranch &gt; /path/to/mybranch.diff
</pre></div>
</div>
<p>It is a little different from svn-generated diff. git-diff-generated diff has
prefixes like <tt class="docutils literal"><span class="pre">a/</span></tt> and <tt class="docutils literal"><span class="pre">b/</span></tt>. Don&#8217;t worry, most developers might know it
could be accepted with <tt class="docutils literal"><span class="pre">patch</span> <span class="pre">-p1</span> <span class="pre">-N</span></tt>.</p>
<p>But you may generate patchset with git-format-patch. It generates by-each-commit
patchset. To generate patch files to attach to your article:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> git format-patch --no-attach master..mybranch -o /path/to/your/patchset
</pre></div>
</div>
<p>If you would like to send patches directly, you may use git-send-email or
git-imap-send. Here is an example to generate the patchset in Gmail&#8217;s [Drafts].</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> git format-patch --attach master..mybranch --stdout | git imap-send
</pre></div>
</div>
<p>Then, your .git/config should have [imap] sections.</p>
<div class="highlight-ini"><div class="highlight"><pre><span class="k">[imap]</span>
      <span class="na">host</span> <span class="o">=</span> <span class="s">imaps://imap.gmail.com</span>
<span class="s">      user = your.gmail.account@gmail.com</span>
<span class="s">      pass = himitsu!</span>
<span class="s">      port = 993</span>
<span class="s">      sslverify = false</span>
<span class="c1">; in English</span>
      <span class="na">folder</span> <span class="o">=</span> <span class="s">&quot;[Gmail]/Drafts&quot;</span>
<span class="c1">; example for Japanese, &quot;Modified UTF-7&quot; encoded.</span>
      <span class="na">folder</span> <span class="o">=</span> <span class="s">&quot;[Gmail]/&amp;Tgtm+DBN-&quot;</span>
<span class="c1">; example for Traditional Chinese</span>
      <span class="na">folder</span> <span class="o">=</span> <span class="s">&quot;[Gmail]/&amp;g0l6Pw-&quot;</span>
</pre></div>
</div>
</div>
<div class="section" id="for-developers-to-work-with-git-svn">
<h4><a class="toc-backref" href="#id18">For developers to work with git-svn</a><a class="headerlink" href="#for-developers-to-work-with-git-svn" title="Permalink to this headline"></a></h4>
<p>To set up clone from which you can submit code using <tt class="docutils literal"><span class="pre">git-svn</span></tt>, run:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> git clone http://llvm.org/git/llvm.git
<span class="gp">%</span> <span class="nb">cd </span>llvm
<span class="gp">%</span> git svn init https://llvm.org/svn/llvm-project/llvm/trunk --username<span class="o">=</span>&lt;username&gt;
<span class="gp">%</span> git config svn-remote.svn.fetch :refs/remotes/origin/master
<span class="gp">%</span> git svn rebase -l  <span class="c"># -l avoids fetching ahead of the git mirror.</span>

<span class="gp">#</span> If you have clang too:
<span class="gp">%</span> <span class="nb">cd </span>tools
<span class="gp">%</span> git clone http://llvm.org/git/clang.git
<span class="gp">%</span> <span class="nb">cd </span>clang
<span class="gp">%</span> git svn init https://llvm.org/svn/llvm-project/cfe/trunk --username<span class="o">=</span>&lt;username&gt;
<span class="gp">%</span> git config svn-remote.svn.fetch :refs/remotes/origin/master
<span class="gp">%</span> git svn rebase -l
</pre></div>
</div>
<p>Likewise for compiler-rt and test-suite.</p>
<p>To update this clone without generating git-svn tags that conflict with the
upstream Git repo, run:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> git fetch <span class="o">&amp;&amp;</span> <span class="o">(</span><span class="nb">cd </span>tools/clang <span class="o">&amp;&amp;</span> git fetch<span class="o">)</span>  <span class="c"># Get matching revisions of both trees.</span>
<span class="gp">%</span> git checkout master
<span class="gp">%</span> git svn rebase -l
<span class="gp">%</span> <span class="o">(</span><span class="nb">cd </span>tools/clang <span class="o">&amp;&amp;</span>
<span class="go">   git checkout master &amp;&amp;</span>
<span class="go">   git svn rebase -l)</span>
</pre></div>
</div>
<p>Likewise for compiler-rt and test-suite.</p>
<p>This leaves your working directories on their master branches, so you&#8217;ll need to
<tt class="docutils literal"><span class="pre">checkout</span></tt> each working branch individually and <tt class="docutils literal"><span class="pre">rebase</span></tt> it on top of its
parent branch.</p>
<p>For those who wish to be able to update an llvm repo/revert patches easily using
git-svn, please look in the directory for the scripts <tt class="docutils literal"><span class="pre">git-svnup</span></tt> and
<tt class="docutils literal"><span class="pre">git-svnrevert</span></tt>.</p>
<p>To perform the aforementioned update steps go into your source directory and
just type <tt class="docutils literal"><span class="pre">git-svnup</span></tt> or <tt class="docutils literal"><span class="pre">git</span> <span class="pre">svnup</span></tt> and everything will just work.</p>
<p>If one wishes to revert a commit with git-svn, but do not want the git hash to
escape into the commit message, one can use the script <tt class="docutils literal"><span class="pre">git-svnrevert</span></tt> or
<tt class="docutils literal"><span class="pre">git</span> <span class="pre">svnrevert</span></tt> which will take in the git hash for the commit you want to
revert, look up the appropriate svn revision, and output a message where all
references to the git hash have been replaced with the svn revision.</p>
<p>To commit back changes via git-svn, use <tt class="docutils literal"><span class="pre">git</span> <span class="pre">svn</span> <span class="pre">dcommit</span></tt>:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> git svn dcommit
</pre></div>
</div>
<p>Note that git-svn will create one SVN commit for each Git commit you have pending,
so squash and edit each commit before executing <tt class="docutils literal"><span class="pre">dcommit</span></tt> to make sure they all
conform to the coding standards and the developers&#8217; policy.</p>
<p>On success, <tt class="docutils literal"><span class="pre">dcommit</span></tt> will rebase against the HEAD of SVN, so to avoid conflict,
please make sure your current branch is up-to-date (via fetch/rebase) before
proceeding.</p>
<p>The git-svn metadata can get out of sync after you mess around with branches and
<tt class="docutils literal"><span class="pre">dcommit</span></tt>. When that happens, <tt class="docutils literal"><span class="pre">git</span> <span class="pre">svn</span> <span class="pre">dcommit</span></tt> stops working, complaining
about files with uncommitted changes. The fix is to rebuild the metadata:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> rm -rf .git/svn
<span class="gp">%</span> git svn rebase -l
</pre></div>
</div>
<p>Please, refer to the Git-SVN manual (<tt class="docutils literal"><span class="pre">man</span> <span class="pre">git-svn</span></tt>) for more information.</p>
</div>
</div>
<div class="section" id="local-llvm-configuration">
<h3><a class="toc-backref" href="#id19">Local LLVM Configuration</a><a class="headerlink" href="#local-llvm-configuration" title="Permalink to this headline"></a></h3>
<p>Once checked out from the Subversion repository, the LLVM suite source code must
be configured via the <tt class="docutils literal"><span class="pre">configure</span></tt> script.  This script sets variables in the
various <tt class="docutils literal"><span class="pre">*.in</span></tt> files, most notably <tt class="docutils literal"><span class="pre">llvm/Makefile.config</span></tt> and
<tt class="docutils literal"><span class="pre">llvm/include/Config/config.h</span></tt>.  It also populates <em>OBJ_ROOT</em> with the
Makefiles needed to begin building LLVM.</p>
<p>The following environment variables are used by the <tt class="docutils literal"><span class="pre">configure</span></tt> script to
configure the build system:</p>
<table border="1" class="docutils">
<colgroup>
<col width="17%" />
<col width="83%" />
</colgroup>
<thead valign="bottom">
<tr class="row-odd"><th class="head">Variable</th>
<th class="head">Purpose</th>
</tr>
</thead>
<tbody valign="top">
<tr class="row-even"><td>CC</td>
<td>Tells <tt class="docutils literal"><span class="pre">configure</span></tt> which C compiler to use.  By default,
<tt class="docutils literal"><span class="pre">configure</span></tt> will check <tt class="docutils literal"><span class="pre">PATH</span></tt> for <tt class="docutils literal"><span class="pre">clang</span></tt> and GCC C
compilers (in this order).  Use this variable to override
<tt class="docutils literal"><span class="pre">configure</span></tt>&#8216;s  default behavior.</td>
</tr>
<tr class="row-odd"><td>CXX</td>
<td>Tells <tt class="docutils literal"><span class="pre">configure</span></tt> which C++ compiler to use.  By
default, <tt class="docutils literal"><span class="pre">configure</span></tt> will check <tt class="docutils literal"><span class="pre">PATH</span></tt> for
<tt class="docutils literal"><span class="pre">clang++</span></tt> and GCC C++ compilers (in this order).  Use
this variable to override  <tt class="docutils literal"><span class="pre">configure</span></tt>&#8216;s default
behavior.</td>
</tr>
</tbody>
</table>
<p>The following options can be used to set or enable LLVM specific options:</p>
<p><tt class="docutils literal"><span class="pre">--enable-optimized</span></tt></p>
<blockquote>
<div>Enables optimized compilation (debugging symbols are removed and GCC
optimization flags are enabled). Note that this is the default setting if you
are using the LLVM distribution. The default behavior of an Subversion
checkout is to use an unoptimized build (also known as a debug build).</div></blockquote>
<p><tt class="docutils literal"><span class="pre">--enable-debug-runtime</span></tt></p>
<blockquote>
<div>Enables debug symbols in the runtime libraries. The default is to strip debug
symbols from the runtime libraries.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">--enable-jit</span></tt></p>
<blockquote>
<div>Compile the Just In Time (JIT) compiler functionality.  This is not available
on all platforms.  The default is dependent on platform, so it is best to
explicitly enable it if you want it.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">--enable-targets=target-option</span></tt></p>
<blockquote>
<div><p>Controls which targets will be built and linked into llc. The default value
for <tt class="docutils literal"><span class="pre">target_options</span></tt> is &#8220;all&#8221; which builds and links all available targets.
The value &#8220;host-only&#8221; can be specified to build only a native compiler (no
cross-compiler targets available). The &#8220;native&#8221; target is selected as the
target of the build host. You can also specify a comma separated list of
target names that you want available in llc. The target names use all lower
case. The current set of targets is:</p>
<blockquote>
<div><tt class="docutils literal"><span class="pre">arm,</span> <span class="pre">cpp,</span> <span class="pre">hexagon,</span> <span class="pre">mips,</span> <span class="pre">mipsel,</span> <span class="pre">msp430,</span> <span class="pre">powerpc,</span> <span class="pre">ptx,</span> <span class="pre">sparc,</span> <span class="pre">spu,</span>
<span class="pre">systemz,</span> <span class="pre">x86,</span> <span class="pre">x86_64,</span> <span class="pre">xcore</span></tt>.</div></blockquote>
</div></blockquote>
<p><tt class="docutils literal"><span class="pre">--enable-doxygen</span></tt></p>
<blockquote>
<div>Look for the doxygen program and enable construction of doxygen based
documentation from the source code. This is disabled by default because
generating the documentation can take a long time and producess 100s of
megabytes of output.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">--with-udis86</span></tt></p>
<blockquote>
<div>LLVM can use external disassembler library for various purposes (now it&#8217;s used
only for examining code produced by JIT). This option will enable usage of
<a class="reference external" href="http://udis86.sourceforge.net/">udis86</a> x86 (both 32 and 64 bits)
disassembler library.</div></blockquote>
<p>To configure LLVM, follow these steps:</p>
<ol class="arabic">
<li><p class="first">Change directory into the object root directory:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> <span class="nb">cd </span>OBJ_ROOT
</pre></div>
</div>
</li>
<li><p class="first">Run the <tt class="docutils literal"><span class="pre">configure</span></tt> script located in the LLVM source tree:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> SRC_ROOT/configure --prefix<span class="o">=</span>/install/path <span class="o">[</span>other options<span class="o">]</span>
</pre></div>
</div>
</li>
</ol>
</div>
<div class="section" id="compiling-the-llvm-suite-source-code">
<h3><a class="toc-backref" href="#id20">Compiling the LLVM Suite Source Code</a><a class="headerlink" href="#compiling-the-llvm-suite-source-code" title="Permalink to this headline"></a></h3>
<p>Once you have configured LLVM, you can build it.  There are three types of
builds:</p>
<p>Debug Builds</p>
<blockquote>
<div>These builds are the default when one is using an Subversion checkout and
types <tt class="docutils literal"><span class="pre">gmake</span></tt> (unless the <tt class="docutils literal"><span class="pre">--enable-optimized</span></tt> option was used during
configuration).  The build system will compile the tools and libraries with
debugging information.  To get a Debug Build using the LLVM distribution the
<tt class="docutils literal"><span class="pre">--disable-optimized</span></tt> option must be passed to <tt class="docutils literal"><span class="pre">configure</span></tt>.</div></blockquote>
<p>Release (Optimized) Builds</p>
<blockquote>
<div>These builds are enabled with the <tt class="docutils literal"><span class="pre">--enable-optimized</span></tt> option to
<tt class="docutils literal"><span class="pre">configure</span></tt> or by specifying <tt class="docutils literal"><span class="pre">ENABLE_OPTIMIZED=1</span></tt> on the <tt class="docutils literal"><span class="pre">gmake</span></tt> command
line.  For these builds, the build system will compile the tools and libraries
with GCC optimizations enabled and strip debugging information from the
libraries and executables it generates.  Note that Release Builds are default
when using an LLVM distribution.</div></blockquote>
<p>Profile Builds</p>
<blockquote>
<div>These builds are for use with profiling.  They compile profiling information
into the code for use with programs like <tt class="docutils literal"><span class="pre">gprof</span></tt>.  Profile builds must be
started by specifying <tt class="docutils literal"><span class="pre">ENABLE_PROFILING=1</span></tt> on the <tt class="docutils literal"><span class="pre">gmake</span></tt> command line.</div></blockquote>
<p>Once you have LLVM configured, you can build it by entering the <em>OBJ_ROOT</em>
directory and issuing the following command:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> gmake
</pre></div>
</div>
<p>If the build fails, please <a class="reference internal" href="#check-here">check here</a> to see if you are using a version of
GCC that is known not to compile LLVM.</p>
<p>If you have multiple processors in your machine, you may wish to use some of the
parallel build options provided by GNU Make.  For example, you could use the
command:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> gmake -j2
</pre></div>
</div>
<p>There are several special targets which are useful when working with the LLVM
source code:</p>
<p><tt class="docutils literal"><span class="pre">gmake</span> <span class="pre">clean</span></tt></p>
<blockquote>
<div>Removes all files generated by the build.  This includes object files,
generated C/C++ files, libraries, and executables.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">gmake</span> <span class="pre">dist-clean</span></tt></p>
<blockquote>
<div>Removes everything that <tt class="docutils literal"><span class="pre">gmake</span> <span class="pre">clean</span></tt> does, but also removes files generated
by <tt class="docutils literal"><span class="pre">configure</span></tt>.  It attempts to return the source tree to the original state
in which it was shipped.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">gmake</span> <span class="pre">install</span></tt></p>
<blockquote>
<div>Installs LLVM header files, libraries, tools, and documentation in a hierarchy
under <tt class="docutils literal"><span class="pre">$PREFIX</span></tt>, specified with <tt class="docutils literal"><span class="pre">./configure</span> <span class="pre">--prefix=[dir]</span></tt>, which
defaults to <tt class="docutils literal"><span class="pre">/usr/local</span></tt>.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">gmake</span> <span class="pre">-C</span> <span class="pre">runtime</span> <span class="pre">install-bytecode</span></tt></p>
<blockquote>
<div>Assuming you built LLVM into $OBJDIR, when this command is run, it will
install bitcode libraries into the GCC front end&#8217;s bitcode library directory.
If you need to update your bitcode libraries, this is the target to use once
you&#8217;ve built them.</div></blockquote>
<p>Please see the <a class="reference external" href="MakefileGuide.html">Makefile Guide</a> for further details on
these <tt class="docutils literal"><span class="pre">make</span></tt> targets and descriptions of other targets available.</p>
<p>It is also possible to override default values from <tt class="docutils literal"><span class="pre">configure</span></tt> by declaring
variables on the command line.  The following are some examples:</p>
<p><tt class="docutils literal"><span class="pre">gmake</span> <span class="pre">ENABLE_OPTIMIZED=1</span></tt></p>
<blockquote>
<div>Perform a Release (Optimized) build.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">gmake</span> <span class="pre">ENABLE_OPTIMIZED=1</span> <span class="pre">DISABLE_ASSERTIONS=1</span></tt></p>
<blockquote>
<div>Perform a Release (Optimized) build without assertions enabled.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">gmake</span> <span class="pre">ENABLE_OPTIMIZED=0</span></tt></p>
<blockquote>
<div>Perform a Debug build.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">gmake</span> <span class="pre">ENABLE_PROFILING=1</span></tt></p>
<blockquote>
<div>Perform a Profiling build.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">gmake</span> <span class="pre">VERBOSE=1</span></tt></p>
<blockquote>
<div>Print what <tt class="docutils literal"><span class="pre">gmake</span></tt> is doing on standard output.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">gmake</span> <span class="pre">TOOL_VERBOSE=1</span></tt></p>
<blockquote>
<div>Ask each tool invoked by the makefiles to print out what it is doing on
the standard output. This also implies <tt class="docutils literal"><span class="pre">VERBOSE=1</span></tt>.</div></blockquote>
<p>Every directory in the LLVM object tree includes a <tt class="docutils literal"><span class="pre">Makefile</span></tt> to build it and
any subdirectories that it contains.  Entering any directory inside the LLVM
object tree and typing <tt class="docutils literal"><span class="pre">gmake</span></tt> should rebuild anything in or below that
directory that is out of date.</p>
<p>This does not apply to building the documentation.
LLVM&#8217;s (non-Doxygen) documentation is produced with the
<a class="reference external" href="http://sphinx-doc.org/">Sphinx</a> documentation generation system.
There are some HTML documents that have not yet been converted to the new
system (which uses the easy-to-read and easy-to-write
<a class="reference external" href="http://sphinx-doc.org/rest.html">reStructuredText</a> plaintext markup
language).
The generated documentation is built in the <tt class="docutils literal"><span class="pre">SRC_ROOT/docs</span></tt> directory using
a special makefile.
For instructions on how to install Sphinx, see
<a class="reference external" href="http://lld.llvm.org/sphinx_intro.html">Sphinx Introduction for LLVM Developers</a>.
After following the instructions there for installing Sphinx, build the LLVM
HTML documentation by doing the following:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">$</span> <span class="nb">cd </span>SRC_ROOT/docs
<span class="gp">$</span> make -f Makefile.sphinx
</pre></div>
</div>
<p>This creates a <tt class="docutils literal"><span class="pre">_build/html</span></tt> sub-directory with all of the HTML files, not
just the generated ones.
This directory corresponds to <tt class="docutils literal"><span class="pre">llvm.org/docs</span></tt>.
For example, <tt class="docutils literal"><span class="pre">_build/html/SphinxQuickstartTemplate.html</span></tt> corresponds to
<tt class="docutils literal"><span class="pre">llvm.org/docs/SphinxQuickstartTemplate.html</span></tt>.
The <a class="reference internal" href="SphinxQuickstartTemplate.html"><em>Sphinx Quickstart Template</em></a> is useful when creating a new document.</p>
</div>
<div class="section" id="cross-compiling-llvm">
<h3><a class="toc-backref" href="#id21">Cross-Compiling LLVM</a><a class="headerlink" href="#cross-compiling-llvm" title="Permalink to this headline"></a></h3>
<p>It is possible to cross-compile LLVM itself. That is, you can create LLVM
executables and libraries to be hosted on a platform different from the platform
where they are built (a Canadian Cross build). To configure a cross-compile,
supply the configure script with <tt class="docutils literal"><span class="pre">--build</span></tt> and <tt class="docutils literal"><span class="pre">--host</span></tt> options that are
different. The values of these options must be legal target triples that your
GCC compiler supports.</p>
<p>The result of such a build is executables that are not runnable on on the build
host (&#8211;build option) but can be executed on the compile host (&#8211;host option).</p>
<p>Check <a class="reference internal" href="HowToCrossCompileLLVM.html"><em>How To Cross-Compile Clang/LLVM using Clang/LLVM</em></a> and <a class="reference external" href="http://clang.llvm.org/docs/CrossCompilation.html">Clang docs on how to cross-compile in general</a> for more information
about cross-compiling.</p>
</div>
<div class="section" id="the-location-of-llvm-object-files">
<h3><a class="toc-backref" href="#id22">The Location of LLVM Object Files</a><a class="headerlink" href="#the-location-of-llvm-object-files" title="Permalink to this headline"></a></h3>
<p>The LLVM build system is capable of sharing a single LLVM source tree among
several LLVM builds.  Hence, it is possible to build LLVM for several different
platforms or configurations using the same source tree.</p>
<p>This is accomplished in the typical autoconf manner:</p>
<ul>
<li><p class="first">Change directory to where the LLVM object files should live:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> <span class="nb">cd </span>OBJ_ROOT
</pre></div>
</div>
</li>
<li><p class="first">Run the <tt class="docutils literal"><span class="pre">configure</span></tt> script found in the LLVM source directory:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> SRC_ROOT/configure
</pre></div>
</div>
</li>
</ul>
<p>The LLVM build will place files underneath <em>OBJ_ROOT</em> in directories named after
the build type:</p>
<p>Debug Builds with assertions enabled (the default)</p>
<blockquote>
<div><p>Tools</p>
<blockquote>
<div><tt class="docutils literal"><span class="pre">OBJ_ROOT/Debug+Asserts/bin</span></tt></div></blockquote>
<p>Libraries</p>
<blockquote>
<div><tt class="docutils literal"><span class="pre">OBJ_ROOT/Debug+Asserts/lib</span></tt></div></blockquote>
</div></blockquote>
<p>Release Builds</p>
<blockquote>
<div><p>Tools</p>
<blockquote>
<div><tt class="docutils literal"><span class="pre">OBJ_ROOT/Release/bin</span></tt></div></blockquote>
<p>Libraries</p>
<blockquote>
<div><tt class="docutils literal"><span class="pre">OBJ_ROOT/Release/lib</span></tt></div></blockquote>
</div></blockquote>
<p>Profile Builds</p>
<blockquote>
<div><p>Tools</p>
<blockquote>
<div><tt class="docutils literal"><span class="pre">OBJ_ROOT/Profile/bin</span></tt></div></blockquote>
<p>Libraries</p>
<blockquote>
<div><tt class="docutils literal"><span class="pre">OBJ_ROOT/Profile/lib</span></tt></div></blockquote>
</div></blockquote>
</div>
<div class="section" id="optional-configuration-items">
<h3><a class="toc-backref" href="#id23">Optional Configuration Items</a><a class="headerlink" href="#optional-configuration-items" title="Permalink to this headline"></a></h3>
<p>If you&#8217;re running on a Linux system that supports the <a class="reference external" href="http://en.wikipedia.org/wiki/binfmt_misc">binfmt_misc</a>
module, and you have root access on the system, you can set your system up to
execute LLVM bitcode files directly. To do this, use commands like this (the
first command may not be required if you are already using the module):</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
<span class="gp">%</span> <span class="nb">echo</span> <span class="s1">&#39;:llvm:M::BC::/path/to/lli:&#39;</span> &gt; /proc/sys/fs/binfmt_misc/register
<span class="gp">%</span> chmod u+x hello.bc   <span class="o">(</span><span class="k">if </span>needed<span class="o">)</span>
<span class="gp">%</span> ./hello.bc
</pre></div>
</div>
<p>This allows you to execute LLVM bitcode files directly.  On Debian, you can also
use this command instead of the &#8216;echo&#8217; command above:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> sudo update-binfmts --install llvm /path/to/lli --magic <span class="s1">&#39;BC&#39;</span>
</pre></div>
</div>
</div>
</div>
<div class="section" id="general-layout">
<span id="program-layout"></span><span id="id3"></span><h2><a class="toc-backref" href="#id24">Program Layout</a><a class="headerlink" href="#general-layout" title="Permalink to this headline"></a></h2>
<p>One useful source of information about the LLVM source base is the LLVM <a class="reference external" href="http://www.doxygen.org/">doxygen</a> documentation available at
<a class="reference external" href="http://llvm.org/doxygen/">http://llvm.org/doxygen/</a>.  The following is a brief introduction to code
layout:</p>
<div class="section" id="llvm-examples">
<h3><a class="toc-backref" href="#id25"><tt class="docutils literal"><span class="pre">llvm/examples</span></tt></a><a class="headerlink" href="#llvm-examples" title="Permalink to this headline"></a></h3>
<p>This directory contains some simple examples of how to use the LLVM IR and JIT.</p>
</div>
<div class="section" id="llvm-include">
<h3><a class="toc-backref" href="#id26"><tt class="docutils literal"><span class="pre">llvm/include</span></tt></a><a class="headerlink" href="#llvm-include" title="Permalink to this headline"></a></h3>
<p>This directory contains public header files exported from the LLVM library. The
three main subdirectories of this directory are:</p>
<p><tt class="docutils literal"><span class="pre">llvm/include/llvm</span></tt></p>
<blockquote>
<div>This directory contains all of the LLVM specific header files.  This directory
also has subdirectories for different portions of LLVM: <tt class="docutils literal"><span class="pre">Analysis</span></tt>,
<tt class="docutils literal"><span class="pre">CodeGen</span></tt>, <tt class="docutils literal"><span class="pre">Target</span></tt>, <tt class="docutils literal"><span class="pre">Transforms</span></tt>, etc...</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvm/include/llvm/Support</span></tt></p>
<blockquote>
<div>This directory contains generic support libraries that are provided with LLVM
but not necessarily specific to LLVM. For example, some C++ STL utilities and
a Command Line option processing library store their header files here.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvm/include/llvm/Config</span></tt></p>
<blockquote>
<div>This directory contains header files configured by the <tt class="docutils literal"><span class="pre">configure</span></tt> script.
They wrap &#8220;standard&#8221; UNIX and C header files.  Source code can include these
header files which automatically take care of the conditional #includes that
the <tt class="docutils literal"><span class="pre">configure</span></tt> script generates.</div></blockquote>
</div>
<div class="section" id="llvm-lib">
<h3><a class="toc-backref" href="#id27"><tt class="docutils literal"><span class="pre">llvm/lib</span></tt></a><a class="headerlink" href="#llvm-lib" title="Permalink to this headline"></a></h3>
<p>This directory contains most of the source files of the LLVM system. In LLVM,
almost all code exists in libraries, making it very easy to share code among the
different <a class="reference internal" href="#tools">tools</a>.</p>
<p><tt class="docutils literal"><span class="pre">llvm/lib/VMCore/</span></tt></p>
<blockquote>
<div>This directory holds the core LLVM source files that implement core classes
like Instruction and BasicBlock.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvm/lib/AsmParser/</span></tt></p>
<blockquote>
<div>This directory holds the source code for the LLVM assembly language parser
library.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvm/lib/Bitcode/</span></tt></p>
<blockquote>
<div>This directory holds code for reading and write LLVM bitcode.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvm/lib/Analysis/</span></tt></p>
<blockquote>
<div>This directory contains a variety of different program analyses, such as
Dominator Information, Call Graphs, Induction Variables, Interval
Identification, Natural Loop Identification, etc.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvm/lib/Transforms/</span></tt></p>
<blockquote>
<div>This directory contains the source code for the LLVM to LLVM program
transformations, such as Aggressive Dead Code Elimination, Sparse Conditional
Constant Propagation, Inlining, Loop Invariant Code Motion, Dead Global
Elimination, and many others.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvm/lib/Target/</span></tt></p>
<blockquote>
<div>This directory contains files that describe various target architectures for
code generation.  For example, the <tt class="docutils literal"><span class="pre">llvm/lib/Target/X86</span></tt> directory holds the
X86 machine description while <tt class="docutils literal"><span class="pre">llvm/lib/Target/ARM</span></tt> implements the ARM
backend.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvm/lib/CodeGen/</span></tt></p>
<blockquote>
<div>This directory contains the major parts of the code generator: Instruction
Selector, Instruction Scheduling, and Register Allocation.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvm/lib/MC/</span></tt></p>
<blockquote>
<div>(FIXME: T.B.D.)</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvm/lib/Debugger/</span></tt></p>
<blockquote>
<div>This directory contains the source level debugger library that makes it
possible to instrument LLVM programs so that a debugger could identify source
code locations at which the program is executing.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvm/lib/ExecutionEngine/</span></tt></p>
<blockquote>
<div>This directory contains libraries for executing LLVM bitcode directly at
runtime in both interpreted and JIT compiled fashions.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvm/lib/Support/</span></tt></p>
<blockquote>
<div>This directory contains the source code that corresponds to the header files
located in <tt class="docutils literal"><span class="pre">llvm/include/ADT/</span></tt> and <tt class="docutils literal"><span class="pre">llvm/include/Support/</span></tt>.</div></blockquote>
</div>
<div class="section" id="llvm-projects">
<h3><a class="toc-backref" href="#id28"><tt class="docutils literal"><span class="pre">llvm/projects</span></tt></a><a class="headerlink" href="#llvm-projects" title="Permalink to this headline"></a></h3>
<p>This directory contains projects that are not strictly part of LLVM but are
shipped with LLVM. This is also the directory where you should create your own
LLVM-based projects. See <tt class="docutils literal"><span class="pre">llvm/projects/sample</span></tt> for an example of how to set
up your own project.</p>
</div>
<div class="section" id="llvm-runtime">
<h3><a class="toc-backref" href="#id29"><tt class="docutils literal"><span class="pre">llvm/runtime</span></tt></a><a class="headerlink" href="#llvm-runtime" title="Permalink to this headline"></a></h3>
<p>This directory contains libraries which are compiled into LLVM bitcode and used
when linking programs with the Clang front end.  Most of these libraries are
skeleton versions of real libraries; for example, libc is a stripped down
version of glibc.</p>
<p>Unlike the rest of the LLVM suite, this directory needs the LLVM GCC front end
to compile.</p>
</div>
<div class="section" id="llvm-test">
<h3><a class="toc-backref" href="#id30"><tt class="docutils literal"><span class="pre">llvm/test</span></tt></a><a class="headerlink" href="#llvm-test" title="Permalink to this headline"></a></h3>
<p>This directory contains feature and regression tests and other basic sanity
checks on the LLVM infrastructure. These are intended to run quickly and cover a
lot of territory without being exhaustive.</p>
</div>
<div class="section" id="test-suite">
<h3><a class="toc-backref" href="#id31"><tt class="docutils literal"><span class="pre">test-suite</span></tt></a><a class="headerlink" href="#test-suite" title="Permalink to this headline"></a></h3>
<p>This is not a directory in the normal llvm module; it is a separate Subversion
module that must be checked out (usually to <tt class="docutils literal"><span class="pre">projects/test-suite</span></tt>).  This
module contains a comprehensive correctness, performance, and benchmarking test
suite for LLVM. It is a separate Subversion module because not every LLVM user
is interested in downloading or building such a comprehensive test suite. For
further details on this test suite, please see the <a class="reference internal" href="TestingGuide.html"><em>Testing Guide</em></a> document.</p>
</div>
<div class="section" id="llvm-tools">
<span id="tools"></span><h3><a class="toc-backref" href="#id32"><tt class="docutils literal"><span class="pre">llvm/tools</span></tt></a><a class="headerlink" href="#llvm-tools" title="Permalink to this headline"></a></h3>
<p>The <strong>tools</strong> directory contains the executables built out of the libraries
above, which form the main part of the user interface.  You can always get help
for a tool by typing <tt class="docutils literal"><span class="pre">tool_name</span> <span class="pre">-help</span></tt>.  The following is a brief introduction
to the most important tools.  More detailed information is in
the <a class="reference external" href="CommandGuide/index.html">Command Guide</a>.</p>
<p><tt class="docutils literal"><span class="pre">bugpoint</span></tt></p>
<blockquote>
<div><tt class="docutils literal"><span class="pre">bugpoint</span></tt> is used to debug optimization passes or code generation backends
by narrowing down the given test case to the minimum number of passes and/or
instructions that still cause a problem, whether it is a crash or
miscompilation. See <a class="reference external" href="HowToSubmitABug.html">HowToSubmitABug.html</a> for more information on using
<tt class="docutils literal"><span class="pre">bugpoint</span></tt>.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvm-ar</span></tt></p>
<blockquote>
<div>The archiver produces an archive containing the given LLVM bitcode files,
optionally with an index for faster lookup.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvm-as</span></tt></p>
<blockquote>
<div>The assembler transforms the human readable LLVM assembly to LLVM bitcode.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvm-dis</span></tt></p>
<blockquote>
<div>The disassembler transforms the LLVM bitcode to human readable LLVM assembly.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvm-link</span></tt></p>
<blockquote>
<div><tt class="docutils literal"><span class="pre">llvm-link</span></tt>, not surprisingly, links multiple LLVM modules into a single
program.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">lli</span></tt></p>
<blockquote>
<div><tt class="docutils literal"><span class="pre">lli</span></tt> is the LLVM interpreter, which can directly execute LLVM bitcode
(although very slowly...). For architectures that support it (currently x86,
Sparc, and PowerPC), by default, <tt class="docutils literal"><span class="pre">lli</span></tt> will function as a Just-In-Time
compiler (if the functionality was compiled in), and will execute the code
<em>much</em> faster than the interpreter.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llc</span></tt></p>
<blockquote>
<div><tt class="docutils literal"><span class="pre">llc</span></tt> is the LLVM backend compiler, which translates LLVM bitcode to a
native code assembly file or to C code (with the <tt class="docutils literal"><span class="pre">-march=c</span></tt> option).</div></blockquote>
<p><tt class="docutils literal"><span class="pre">opt</span></tt></p>
<blockquote>
<div><p><tt class="docutils literal"><span class="pre">opt</span></tt> reads LLVM bitcode, applies a series of LLVM to LLVM transformations
(which are specified on the command line), and then outputs the resultant
bitcode.  The &#8216;<tt class="docutils literal"><span class="pre">opt</span> <span class="pre">-help</span></tt>&#8216; command is a good way to get a list of the
program transformations available in LLVM.</p>
<p><tt class="docutils literal"><span class="pre">opt</span></tt> can also be used to run a specific analysis on an input LLVM bitcode
file and print out the results.  It is primarily useful for debugging
analyses, or familiarizing yourself with what an analysis does.</p>
</div></blockquote>
</div>
<div class="section" id="llvm-utils">
<h3><a class="toc-backref" href="#id33"><tt class="docutils literal"><span class="pre">llvm/utils</span></tt></a><a class="headerlink" href="#llvm-utils" title="Permalink to this headline"></a></h3>
<p>This directory contains utilities for working with LLVM source code, and some of
the utilities are actually required as part of the build process because they
are code generators for parts of LLVM infrastructure.</p>
<p><tt class="docutils literal"><span class="pre">codegen-diff</span></tt></p>
<blockquote>
<div><tt class="docutils literal"><span class="pre">codegen-diff</span></tt> is a script that finds differences between code that LLC
generates and code that LLI generates. This is a useful tool if you are
debugging one of them, assuming that the other generates correct output. For
the full user manual, run <tt class="docutils literal"><span class="pre">`perldoc</span> <span class="pre">codegen-diff'</span></tt>.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">emacs/</span></tt></p>
<blockquote>
<div>The <tt class="docutils literal"><span class="pre">emacs</span></tt> directory contains syntax-highlighting files which will work
with Emacs and XEmacs editors, providing syntax highlighting support for LLVM
assembly files and TableGen description files. For information on how to use
the syntax files, consult the <tt class="docutils literal"><span class="pre">README</span></tt> file in that directory.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">getsrcs.sh</span></tt></p>
<blockquote>
<div>The <tt class="docutils literal"><span class="pre">getsrcs.sh</span></tt> script finds and outputs all non-generated source files,
which is useful if one wishes to do a lot of development across directories
and does not want to individually find each file. One way to use it is to run,
for example: <tt class="docutils literal"><span class="pre">xemacs</span> <span class="pre">`utils/getsources.sh`</span></tt> from the top of your LLVM source
tree.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">llvmgrep</span></tt></p>
<blockquote>
<div>This little tool performs an <tt class="docutils literal"><span class="pre">egrep</span> <span class="pre">-H</span> <span class="pre">-n</span></tt> on each source file in LLVM and
passes to it a regular expression provided on <tt class="docutils literal"><span class="pre">llvmgrep</span></tt>&#8216;s command
line. This is a very efficient way of searching the source base for a
particular regular expression.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">makellvm</span></tt></p>
<blockquote>
<div>The <tt class="docutils literal"><span class="pre">makellvm</span></tt> script compiles all files in the current directory and then
compiles and links the tool that is the first argument. For example, assuming
you are in the directory <tt class="docutils literal"><span class="pre">llvm/lib/Target/Sparc</span></tt>, if <tt class="docutils literal"><span class="pre">makellvm</span></tt> is in your
path, simply running <tt class="docutils literal"><span class="pre">makellvm</span> <span class="pre">llc</span></tt> will make a build of the current
directory, switch to directory <tt class="docutils literal"><span class="pre">llvm/tools/llc</span></tt> and build it, causing a
re-linking of LLC.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">TableGen/</span></tt></p>
<blockquote>
<div>The <tt class="docutils literal"><span class="pre">TableGen</span></tt> directory contains the tool used to generate register
descriptions, instruction set descriptions, and even assemblers from common
TableGen description files.</div></blockquote>
<p><tt class="docutils literal"><span class="pre">vim/</span></tt></p>
<blockquote>
<div>The <tt class="docutils literal"><span class="pre">vim</span></tt> directory contains syntax-highlighting files which will work with
the VIM editor, providing syntax highlighting support for LLVM assembly files
and TableGen description files. For information on how to use the syntax
files, consult the <tt class="docutils literal"><span class="pre">README</span></tt> file in that directory.</div></blockquote>
</div>
</div>
<div class="section" id="an-example-using-the-llvm-tool-chain">
<span id="simple-example"></span><h2><a class="toc-backref" href="#id34">An Example Using the LLVM Tool Chain</a><a class="headerlink" href="#an-example-using-the-llvm-tool-chain" title="Permalink to this headline"></a></h2>
<p>This section gives an example of using LLVM with the Clang front end.</p>
<div class="section" id="example-with-clang">
<h3><a class="toc-backref" href="#id35">Example with clang</a><a class="headerlink" href="#example-with-clang" title="Permalink to this headline"></a></h3>
<ol class="arabic">
<li><p class="first">First, create a simple C file, name it &#8216;hello.c&#8217;:</p>
<div class="highlight-c"><div class="highlight"><pre><span class="cp">#include &lt;stdio.h&gt;</span>

<span class="kt">int</span> <span class="nf">main</span><span class="p">()</span> <span class="p">{</span>
  <span class="n">printf</span><span class="p">(</span><span class="s">&quot;hello world</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">);</span>
  <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
</div>
</li>
<li><p class="first">Next, compile the C file into a native executable:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> clang hello.c -o hello
</pre></div>
</div>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">Clang works just like GCC by default.  The standard -S and -c arguments
work as usual (producing a native .s or .o file, respectively).</p>
</div>
</li>
<li><p class="first">Next, compile the C file into an LLVM bitcode file:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> clang -O3 -emit-llvm hello.c -c -o hello.bc
</pre></div>
</div>
<p>The -emit-llvm option can be used with the -S or -c options to emit an LLVM
<tt class="docutils literal"><span class="pre">.ll</span></tt> or <tt class="docutils literal"><span class="pre">.bc</span></tt> file (respectively) for the code.  This allows you to use
the <a class="reference external" href="CommandGuide/index.html">standard LLVM tools</a> on the bitcode file.</p>
</li>
<li><p class="first">Run the program in both forms. To run the program, use:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> ./hello
</pre></div>
</div>
<p>and</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> lli hello.bc
</pre></div>
</div>
<p>The second examples shows how to invoke the LLVM JIT, <a class="reference internal" href="CommandGuide/lli.html"><em>lli</em></a>.</p>
</li>
<li><p class="first">Use the <tt class="docutils literal"><span class="pre">llvm-dis</span></tt> utility to take a look at the LLVM assembly code:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> llvm-dis &lt; hello.bc | less
</pre></div>
</div>
</li>
<li><p class="first">Compile the program to native assembly using the LLC code generator:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> llc hello.bc -o hello.s
</pre></div>
</div>
</li>
<li><p class="first">Assemble the native assembly language file into a program:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> /opt/SUNWspro/bin/cc -xarch<span class="o">=</span>v9 hello.s -o hello.native   <span class="c"># On Solaris</span>

<span class="gp">%</span> gcc hello.s -o hello.native                              <span class="c"># On others</span>
</pre></div>
</div>
</li>
<li><p class="first">Execute the native code program:</p>
<div class="highlight-console"><div class="highlight"><pre><span class="gp">%</span> ./hello.native
</pre></div>
</div>
<p>Note that using clang to compile directly to native code (i.e. when the
<tt class="docutils literal"><span class="pre">-emit-llvm</span></tt> option is not present) does steps 6/7/8 for you.</p>
</li>
</ol>
</div>
</div>
<div class="section" id="common-problems">
<h2><a class="toc-backref" href="#id36">Common Problems</a><a class="headerlink" href="#common-problems" title="Permalink to this headline"></a></h2>
<p>If you are having problems building or using LLVM, or if you have any other
general questions about LLVM, please consult the <a class="reference external" href="FAQ.html">Frequently Asked
Questions</a> page.</p>
</div>
<div class="section" id="links">
<span id="id4"></span><h2><a class="toc-backref" href="#id37">Links</a><a class="headerlink" href="#links" title="Permalink to this headline"></a></h2>
<p>This document is just an <strong>introduction</strong> on how to use LLVM to do some simple
things... there are many more interesting and complicated things that you can do
that aren&#8217;t documented here (but we&#8217;ll gladly accept a patch if you want to
write something up!).  For more information about LLVM, check out:</p>
<ul class="simple">
<li><a class="reference external" href="http://llvm.org/">LLVM Homepage</a></li>
<li><a class="reference external" href="http://llvm.org/doxygen/">LLVM Doxygen Tree</a></li>
<li><a class="reference external" href="http://llvm.org/docs/Projects.html">Starting a Project that Uses LLVM</a></li>
</ul>
</div>
</div>


          </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="GettingStartedVS.html" title="Getting Started with the LLVM System using Microsoft Visual Studio"
             >next</a> |</li>
        <li class="right" >
          <a href="CommandGuide/llvm-readobj.html" title="llvm-readobj - LLVM Object Reader"
             >previous</a> |</li>
  <li><a href="http://llvm.org/">LLVM Home</a>&nbsp;|&nbsp;</li>
  <li><a href="index.html">Documentation</a>&raquo;</li>
 
      </ul>
    </div>
    <div class="footer">
        &copy; Copyright 2003-2013, LLVM Project.
      Last updated on 2014-03-05.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.1.
    </div>
  </body>
</html>