llvm.org GIT mirror llvm / 83bd33a
* Use UTF-8 instead of ISO-8859-1 * Use stylesheet instead of explicit <font> formatting * Stop using <ul> for layout * Close <li> tags git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9393 91177308-0d34-0410-b5e6-96231b3b80d8 Misha Brukman 15 years ago
1 changed file(s) with 46 addition(s) and 37 deletion(s). Raw diff Collapse all Expand all
0
1 Bootstrapping the C/C++ Front-End
1
2
3
4
5 Bootstrapping the C/C++ Front-End
6
7
28
3
4

Bootstrapping the C/C++ Front-End

5
6

7
8
9
10
11 Instructions
12
13 <!-- *********************************************************************** -->
9 <div class="doc_title">
10 Bootstrapping the C/C++ Front-End
11
1412
1513

This document is intended to explain the process of building the LLVM

1614 C/C++ front-end, based on GCC 3.4, from source.

2220
2321

We welcome patches to help make this process simpler.

2422
23
24
25 Instructions
26
27
28
29
30

2531
2632
  • Configure and build the LLVM libraries and tools using:

  • 2733
    
                      
                    
    3238

    The use of the non-default target "tools-only" means that the

    3339 LLVM tools and libraries will build, and the binaries will be
    3440 deposited in llvm/tools/Debug, but the runtime (bytecode)
    35 libraries will not build.

    41 libraries will not build.

    3642
    3743
  • Add the directory containing the tools to your PATH.

  • 3844
    
                      
                    
    39 % set path = ( `cd llvm/tools/Debug && pwd` $path )
    40
    45 % set path = ( `cd llvm/tools/Debug && pwd` $path )
    46
    4147
    42
  • Unpack the C/C++ front-end source into cfrontend/src.

  • 48
  • Unpack the C/C++ front-end source into cfrontend/src.

  • 4349
    4450
  • Edit src/configure. Change the first line (starting w/ #!) to

  • 45 contain the correct full pathname of sh.

    51 contain the correct full pathname of sh.

    4652
    4753
  • Make "build" and "install" directories as siblings of the "src"

  • 4854 tree.

    5258 % cd ..
    5359 % mkdir build install
    5460 % set CFEINSTALL = `pwd`/install
    55
    61
    5662
    5763
  • Configure, build and install the C front-end:

  • 5864
    
                      
                    
    7278
  • Fix 1: If you have system header files that include

  • 7379 inline assembly, you may have to modify them to remove the inline
    7480 assembly, and install the modified versions in
    75 $CFEINSTALL/target-triplet/sys-include.

    81 $CFEINSTALL/target-triplet/sys-include.

    7682
    7783
  • Fix 2: If you are building the C++ front-end on a CPU we
  • 7884 haven't tried yet, you will probably have to edit the appropriate
    7985 version of atomicity.h under
    8086 src/libstdc++-v3/config/cpu/name-of-cpu/atomicity.h
    81 and apply a patch so that it does not use inline assembly.

    87 and apply a patch so that it does not use inline assembly.

    8288
    8389
    8490

    Common Problem 2: FIXME: Chris should add a section about

    8591 common problems porting to a new architecture, including changes you
    86 might have to make to the gcc/gcc/config/name-of-cpu>
    92 might have to make to the gcc/gcc/config/name-of-cpu>
    8793 directory. For example (expand these):

    8894
    8995
    90
  • Munge linker flags so they are compatible with gccld.
  • 96
  • Munge linker flags so they are compatible with gccld.
  • 9197
  • Change the target so it doesn't have long double; just use double
  • 92 instead.
    93
  • No inline assembly for position independent code.
  • 94
  • We handle init and fini differently.
  • 95
  • Do not include inline assembly map things for SPARC, or profile things.
  • 98 instead.
    99
  • No inline assembly for position independent code.
  • 100
  • We handle init and fini differently.
  • 101
  • Do not include inline assembly map things for SPARC, or profile
  • 102 things.
    96103
    104
    97105
    98106
  • Go back into the LLVM source tree proper. Edit Makefile.config

  • 99107 to redefine LLVMGCCDIR to the full pathname of the
    100108 $CFEINSTALL directory, which is the directory you just
    101109 installed the C front-end into. (The ./configure script is likely to
    102 have set this to a directory which does not exist on your system.)

    110 have set this to a directory which does not exist on your system.)

    103111
    104112
  • If you edited header files during the C/C++ front-end build as

  • 105113 described in "Fix 1" above, you must now copy those header files from
    107115 $CFEINSTALL/lib/gcc/target-triplet/3.4-llvm/include.
    108116 (This should be the "include" directory in the same directory as the
    109117 libgcc.a library, which you can find by running
    110 $CFEINSTALL/bin/gcc --print-libgcc-file-name.)

    118 $CFEINSTALL/bin/gcc --print-libgcc-file-name.)

    111119
    112120
  • Build and install the runtime (bytecode) libraries by running:

  • 113121
    
                      
                    
    115123 % mkdir $CFEINSTALL/bytecode-libs
    116124 % gmake -C runtime install
    117125 % setenv LLVM_LIB_SEARCH_PATH $CFEINSTALL/bytecode-libs
    118
    126
    119127
    120128
  • Test the newly-installed C frontend by one or more of the

  • 121129 following means:

    122130
    123
  • compiling and running a "hello, world" program in C or C++.
  • 131
  • compiling and running a "hello, world" program in C or C++.
  • 124132
  • running the tests under test/Programs using gmake -C
  • 125 test/Programs;
    133 test/Programs
    126134
    127
    128

    135

    136
    129137
    138
    130139
    131140
    132
    133
    134141
    135
    -1>
    142
    ="-1">
    136143
    Brian Gaeke
    137144 Last modified: $Date$
    138
    145
    139146
    147
    148