Android Renderscript 有針對舊的 LLVM ARM JIT 做 patch。

  1. 以 "天" 為單位,二元搜尋哪一天的版本出問題
    $ svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
    $ cd llvm
    # 測試 6/30 以前 (且包含) 的 LLVM SVN
    $ svn up -r{20110701}
    $ make
    $ make check 2>&1 > log
  2. 以 "版本號" 為單位,二元搜尋該天哪一個版本出問題。有些並非更動 LLVM 的版本可以略過,查詢 http://llvm.org/viewvc/llvm-project/llvm/
  3. 如何判斷 GCC 或是 LLVM 有問題?
    1. 編譯 LLVM 失敗,代表 GCC 有問題。
    2. 先用 GCC 編譯 LLVM + Clang,再用該編譯好的 LLVM + Clang 編譯 LLVM + Clang,最後執行 `make check` 1)
      1. 先用 GCC 編譯 LLVM + Clang
        $ wget http://llvm.org/releases/2.9/llvm-2.9.tgz; tar xvf llvm-2.9.tgz
        $ cd llvm-2.9/tools
        $ wget http://llvm.org/releases/2.9/clang-2.9.tgz; tar xvf clang-2.9.tgz
        $ mv clang-2.9 clang
        $ mkdir build; cd build
        $ ../llvm-2.9/configure --prefix=$INSTALL \
        --build=arm-unknown-linux-gnueabi \
        --enable-target=arm 
        --enable-optimized 
      2. 再用該編譯好的 LLVM + Clang 編譯 LLVM + Clang
        $ CC=clang CXX=clang++ ../llvm-2.9/configure --prefix=$INSTALL --enable-optimized \
        --with-built-clang --with-llvmcc=clang
        $ make
  • log 格式: llvm-{rev}-gcc-{ver}-[cross|native]-[machine].log
  • 穩定的 GCC 版本:
    • GCC 4.3.4
    • GCC 4.4.1
  • 5/17 (rev. 131463, F) - 6/30 (rev. 134148 S) - 7/15 (rev. 135269 S) - 7/20 (rev. 135581 S) - 7/21 (rev. 135676 S) - 7/22 (rev. 135762 F) - 7/23 (rev. 135847 F) - 7/31 (rev. 136591 F)
    • 135676 (S) - 135719 (S) - 135721 (S) - 135722 (F) - 135738 (F) - 135755 (F) - 135762 (F)
    • 主要看有無 JIT 相關錯誤
    • 先檢視 cross compile 的結果

ARM target auto-detection

LLVM 3.1 Testing

LLVM 3.1 Release:

  • April 16th: Branching for 3.1 release
  • April 16-22: Phase 1 testing
  • April 23-29: Bug fixing for Phase 1 issues, all features completed
  • April 30-May 6: Phase 2 testing
  • May 7-13: Addressing Phase 2 issues, final binary generation
  • May 14th: Release of 3.1!

I announced on the lists that we're going to branch on the 16th. That will be the start date for testing. Testing takes roughly a month. During that time, please don't upgrade your OS or dev tools. It will limit some variables if problems occur.

During testing, any issues you find should be entered into Bugzilla (http://llvm.org/bugs/). Please CC me on any bugs you file. As the release moves on, we may punt some of those bugs and focus on those bugs which are more serious. The truth of the matter is that we may have to fix any issues ourselves. Everyone is very busy and they may not have time to focus on these problems. The good news is that any bad issues may have been fixed on trunk and could just be back-ported to the release branch. :-)

Anyway, here's what's involved in testing:

  • There is a script that you can use that will compile the 3.1 pre-release candidate in various modes and run the regression tests (llvm/test).
  • You will need to download LLVM 3.0, build it, and run the LLVM test suite (llvm/projects/test-suite) on your system to get a baseline.
  • You will then need to run the LLVM test suite from the 3.1 pre-release candidate by hand.
  • You should then compare the 3.1 pre-release candidate results with those from your baseline.

There are tools in llvm/utils/release to help with some of these steps. I'll send more detailed instructions once we get to the testing time. But it's fairly straight-forward. If you haven't run the LLVM test suite yet, I encourage you to do this now to get a feeling for how it works. There's some information here (http://llvm.org/docs/TestingGuide.html).

我們要執行兩種測試,第一: 針對 LLVM 3.1 pre-release candidate 做回歸測試 (regression test); 第二: 先用 LLVM 3.0 跑測試包 (test suite) 作為基準,再用 LLVM 3.1 pre-release candidate 跑測試包與前者相比較。本次測試預計對 LLVM 3.1 pre-release candidate 做交叉編譯,再將其結果放至 ARM 機器上運行。

Hi Testers!

Okay, I rebranched for 3.1 and I believe that we can start testing release candidate 1! I've attached some scripts to help out with this. To download, +compile, and run the regression tests, use this command:

      $ ./test-release.sh -release 3.1 -rc 1

Use the '-help' flag for more options:

usage: test-release.sh -release X.Y -rc NUM [OPTIONS]

-release X.Y The release number to test. -rc NUM The pre-release candidate number. -final The final release candidate. -j NUM Number of compile jobs to run. [default: 3] -build-dir DIR Directory to perform testing in. [default: pwd] -no-checkout Don't checkout the sources from SVN. -no-64bit Don't test the 64-bit version. [default: yes] -enable-ada Build Ada. [default: disable] -disable-clang Do not test clang. [default: enable] -enable-dragonegg Test dragonegg. [default: disable] -enable-fortran Enable Fortran build. [default: disable] -disable-objc Disable ObjC build. [default: enable] -test-debug Test the debug build. [default: no] -test-asserts Test with asserts on. [default: no] -no-compare-files Don't test that phase 2 and 3 files are identical.

The comparison of files between phase 2 and phase 3 is showing that some .o files are different. I haven't started looking into those just yet. We don't have +a buildbot set up to test for regressions in that area, so you may use the '-no-compare-files' flag to make it not run these tests. Or simply ignore the +output. :-)

If the regression tests fail, please file bug reports about them ASAP. We need those to be fixed before we can go on to phase 2 testing.

After things work here, you should run the llvm test suite. You can do this like so (on Darwin):

      $ cd rc1/Phase3/Release/llvmCore-3.1-rc1.obj/projects/llvm-test/
      $ make report TEST=simple ENABLE_HASHED_PROGRAM_OUTPUT=1 \
             TARGET_CXX=None TARGET_CC=None \
             CC_UNDER_TEST_IS_CLANG=1 USE_REFERENCE_OUTPUT=1

You may also run the test suite with 'TEST=nightly' instead of 'TEST=simple'.

For those testing on ARM, you will need to add some more flags to get the programs to run on your ARM device. I hope you've already set things up to do that. +:-) Here's an example of what some flags may look like:

      $ make -k -j 1 report "TARGET_LLCFLAGS=" "USE_REFERENCE_OUTPUT=1" "DISABLE_CBE=1" \
      "ENABLE_OPTIMIZED=1" "ARCH=ARM" "DISABLE_JIT=1" "TARGET_CXX=None" "REMOTE_PORT=2022" \
      "TARGET_CC=None" "TARGET_FLAGS=-miphoneos-version-min=4.0 -Wl,--no-demangle -ccc-install-dir /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.2.sdk" \
      "SMALL_PROBLEM_SIZE=1" "ENABLE_HASHED_PROGRAM_OUTPUT=1" "REMOTE_USER=root" \
      "CC_UNDER_TEST_TARGET_IS_ARMV6=1" "CC_UNDER_TEST_IS_CLANG=1" "TEST=simple" \
      "REMOTE_CLIENT=ssh" "LLC_OPTFLAGS=-O3" "REMOTE_HOST=localhost"
      

Your milage may vary, of course. After you get these results, please compare them to the results from your 3.0 run.You can use the +'findRegressions-simple.py' program to do this. (The 'findRegressions-nightly.py' program is for those who run the 'TEST=nightly' version of the test +suite.)

Hopefully, this will get you going with the first round of testing. Thank you again for volunteering!

Share and enjoy! -bw

  1. 下載腳本,並修改成適用於交叉編譯的版本。
    $ wget http://people.mozilla.org/~eakhgari/releasecandidate1readyfortesting.zip
    $ unzip releasecandidate1readyfortesting.zip
    +++ test-release.sh     2012-04-21 13:21:10.000000000 +0800
    @@ -18,6 +18,8 @@
         MAKE=make
     fi
    
    +TRIPLE="arm-unknown-linux-gnueabi"
    +
     projects="llvm cfe dragonegg compiler-rt test-suite"
    
     # Base SVN URL for the sources.
    @@ -253,12 +255,18 @@
         echo "# Configuring llvm $Release-$RC $Flavor"
         echo "# $BuildDir/llvm.src/configure --prefix=$InstallDir \
             --enable-optimized=$Optimized \
    -        --enable-assertions=$Assertions"
    +        --enable-assertions=$Assertions" \
    +        --target=${TRIPLE} \
    +        --host=${TRIPLE} \
    +    c_compiler=arm-unknown-linux-gnueabi-gcc
    +    cxx_compiler=arm-unknown-linux-gnueabi-g++
         env CC="$c_compiler" CXX="$cxx_compiler" \
         $BuildDir/llvm.src/configure --prefix=$InstallDir \
             --enable-optimized=$Optimized \
             --enable-assertions=$Assertions \
             --disable-timestamps \
    +        --target=${TRIPLE} \
    +        --host=${TRIPLE} \
             2>&1 | tee $LogDir/llvm.configure-Phase$Phase-$Flavor.log
         cd $BuildDir
     }
    
  2. 運行 test-release.sh 下載代碼並編譯。如果是在 ARM 上編譯,先確定路徑上沒有 x86 版本的 llvm-gcc
    # 工作目錄在 rc1。
    #
    # -no-64bit
    #   ARM 編譯器不接受 -m32 和 -m64
    # -no-compare-files
    #   不比較 Phase2 和 Phase3 的結果
    # -disable-clang
    #   只做 Phase1
    $ export PATH=/nfs_home/chenwj/x-tools/arm-unknown-linux-gnueabi/bin:$PATH
    $ ./test-release.sh -release 3.1 -rc 1 -no-64bit -no-compare-files -no-checkout
    $ svn co http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_31/rc1
  3. 在 ARM 上運行 regression test。
    $ cd rc1/Phase3/Release/llvmCore-3.1-rc1.obj/
    $ make check-all &> regression-test.txt 
  4. 在 ARM 上以 LLVM 3.0 運行 test suite 作為基準。目前 lnt 只支援 nightly test。
    # LLVM 3.0 可用 lnt。
    $ virtualenv mysandbox
    $ svn co http://llvm.org/svn/llvm-project/lnt/trunk lnt
    $ mysandbox/bin/python lnt/setup.py develop
    $ cd mysandbox
    $ source bin/activate
    $ lnt runtest nt \
        --sandbox llvm-3.0 \
        --cc ~/llvm-3.1/llvm-3.0.obj/Release/bin/clang \
        --cxx ~/llvm-3.1/llvm-3.0.obj/Release/bin/clang++ \
        --llvm-src ~/llvm-3.1/llvm-3.0.src \
        --llvm-obj ~/llvm-3.1/llvm-3.0.obj \
        --test-suite ~/llvm-3.1/test-suite-3.0.src \
    # 不建議使用 lnt,改用手動。LLVM 3.0 似乎只能跑完 Single,其它 benchmark 會失敗。
    # 運行失敗的話,不會生成 report.nightly.raw.out。
    #
    # 1. 先 cross compile LLVM 3.0。
    #
    # 2. export x-tools/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/bin,
    #    如此才能 strip。
    # 
    # 3. make install,並設好 clang 的路徑。把 test suite 解開至 ${LLVM_SRC}/projects。
    #
    # 4. 在 ${LLVM_OBJ} 重跑 configure。
    #
    # 5. 到 ${LLVM_SRC}/projects/test-suite 下 make。
  5. 在 ARM 上以 LLVM 3.1 運行 test suite,並與 LLVM 3.0 的結果作比較。可能需要修改 Makefile.config
    # LLVM 3.1 改用手動。
    $ cd rc1/Phase3/Release/llvmCore-3.1-rc1.obj/projects/llvm-test/ 
    $ make -k -j report \
      "TARGET_LLCFLAGS=" "USE_REFERENCE_OUTPUT=1ABLE_CBE=1" "ENABLE_OPTIMIZED=1" "ARCH=ARM" "DISABLE_JIT=1" \
      "SMALL_PROBLEM_SIZE=1" "ENABLE_HASHED_PROGRAM_OUTPUT=1" "CC_UNDER_TEST_TARGET_IS_ARMV7=1" \
      "CC_UNDER_TEST_IS_CLANG=1" "TEST=nightly" "LLC_OPTFLAGS=-O3" &> test.log
    # 在不同目錄運行 test suite,其輸出會混淆 findRegressions-nightly.py。
    $ sed 's:/nfs_home/chenwj/llvm-3.1/rc1/Phase1/Release/llvmCore-3.obj/projects/llvm-test/::' \
      report.nightly.raw.out > report.nightly.raw.out.bak
    $ ./findRegressions-nightly.py ${LLVM_30}/report.nightly.raw.out ${LLVM_31}/report.nightly.raw.out
    SingleSource/UnitTests/stmtexpr*** REGRESSION (cbe)
     
    SingleSource/UnitTests/vla*** REGRESSION (cbe)
  6. 把安裝目錄打包起來。
    $ cd rc1/Phase3/Release
    $ tar zcvf llvmCore-3.1-rc1.install-arm-ubuntu_11.04.tar.gz llvmCore-3.1-rc1.install/
  • LLVM 3.1 rc2 phase 1 clang fail to build phase 2 clang
    $ apt-get install subversion-tools
    # 把 Phase 1 的 build_llvmCore 註解掉。
    $ ./test-release.sh -release 3.1 -rc 2 -disable-clang
    $ svn log http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_31/rc1 --stop-on-copy
    ------------------------------------------------------------------------
    r155062 | void | 2012-04-19 06:10:56 +0800 (四, 19  4 2012) | 1 line
     
    Creating release candidate rc1 from release_31 branch
    ------------------------------------------------------------------------
    $ svn log http://llvm.org/svn/llvm-project/llvm/tags/RELEASE_31/rc2 --stop-on-copy
    ------------------------------------------------------------------------
    r156037 | void | 2012-05-03 08:11:00 +0800 (四, 03  5 2012) | 1 line
     
    Creating release candidate rc2 from release_31 branch
    ------------------------------------------------------------------------
    $ cd rc2/llvm.src
    # 好 壞
    $ svn-bisect start 155062 156037
    Switching to r155672 ...
    # 這裡用 svn-bisect 會切到不同的 revision,改用手動。
    $ cd rc2/cfe.src
    $ svn up -r 155672
    $ cd rc2
    $ ./test-release.sh -release 3.1 -rc 2 -no-checkout -no-64bit -no-compare-files
    $ svn-bisect bad 155672
    Switching to r155374 ...
    $ svn-bisect good 155374
    Switching to r155378 ...
    --- test-release.sh.old 2012-05-07 05:10:22.000000000 -0700
    +++ test-release.sh     2012-05-07 04:42:03.000000000 -0700
    @@ -18,7 +18,8 @@
         MAKE=make
     fi
    
    -projects="llvm cfe dragonegg compiler-rt test-suite"
    +#projects="llvm cfe dragonegg compiler-rt test-suite"
    +projects="llvm cfe"
    
     # Base SVN URL for the sources.
     Base_url="http://llvm.org/svn/llvm-project"
    @@ -199,7 +200,7 @@
    
         for proj in $projects ; do
             echo "# Exporting $proj $Release-RC$RC sources"
    -        if ! svn export -q $Base_url/$proj/tags/RELEASE_$Release_no_dot/$RC $proj.src ; then
    +        if ! svn checkout -q $Base_url/$proj/tags/RELEASE_$Release_no_dot/$RC $proj.src ; then
                 echo "error: failed to export $proj project"
                 exit 1
             fi
    @@ -404,10 +405,10 @@
         ############################################################################
         # Phase 1: Build llvmCore and clang
         echo "# Phase 1: Building llvmCore"
    -    configure_llvmCore 1 $Flavor \
    -        $llvmCore_phase1_objdir $llvmCore_phase1_installdir
    -    build_llvmCore 1 $Flavor \
    -        $llvmCore_phase1_objdir
    +    #configure_llvmCore 1 $Flavor \
    +    #    $llvmCore_phase1_objdir $llvmCore_phase1_installdir
    +    #build_llvmCore 1 $Flavor \
    +    #    $llvmCore_phase1_objdir
    
         # Test clang
         if [ "$do_clang" = "yes" ]; then
    
    • 若有問題,發送 PR,並將 Release Manager 加入 CC list。
    • LLVM 和 Clang 更新到同一版本進行 bisect 糾錯。
    • 修正 rc2 錯誤後,下載 rc2 不會下載到已修正的版本,需要下載 rc3。
  • 針對 svn head 製作 patch,Release Manager 會將其 merge 回 LLVM 3.1 branch。
    $ cd rc1/cfe.src/test
    $ patch -p0 < r155819.patch
$ export COMPILER_PATH=/opt/arm-2011.03 
# clang arm-none-linux-gnueabi tript 預設生成 armv4t。
$ CC=clang -ccc-host-triple arm-none-linux-gnueabi \ 
    -ccc-gcc-name arm-none-linux-gnueabi-gcc \ 
    --sysroot=${COMPILER_PATH}/arm-none-linux-gnueabi/libc \ 
    -march=armv7-a -mfpu=neon 
$ cat build.sh
TRIPLE="arm-none-linux-gnueabi"
PREFIX="arm-2011.09"
XTOOL="${HOME}/x-tools/${PREFIX}/bin"
 
LLVM_SRC="$HOME/llvm-3.1/llvm"
 
export PATH=${XTOOL}:$PATH
 
${LLVM_SRC}/configure --target=${TRIPLE} \
--host=${TRIPLE} \
--enable-target=arm \
--disable-optimized --enable-bindings=none --disable-multilib --disable-bootstrap \
$ . build.sh
$ make
$ uname -a
Linux arm2 2.6.38-1208-omap4 #11-Ubuntu SMP PREEMPT Fri Apr 15 16:34:35 UTC 2011 armv7l armv7l armv7l GNU/Linux
$ gcc -v
gcc version 4.5.2 (Ubuntu/Linaro 4.5.2-8ubuntu4)
$ ld -v
GNU ld (GNU Binutils for Ubuntu) 2.21.0.20110327

Summary

  1.    Clang :: CXX/special/class.copy/p15-inclass.cpp
       Clang :: CodeGenCXX/compound-literals.cpp
       Clang :: CodeGenCXX/copy-constructor-elim-2.cpp
       Clang :: CodeGenCXX/cxx0x-initializer-references.cpp
       Clang :: CodeGenCXX/cxx0x-initializer-stdinitializerlist-startend.cpp
       Clang :: CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp
  2. http://llvm.org/viewvc/llvm-project?view=rev&revision=155920
       Clang :: CodeGenCXX/virt-call-offsets.cpp
  3. http://llvm.org/viewvc/llvm-project?view=rev&revision=156047
       Clang :: CodeGenCXX/x86-64-abi-sret-vs-2word-struct-param.cpp
  4. http://llvm.org/bugs/show_bug.cgi?id=12725
       Clang :: CXX/conv/conv.prom/p2.cpp
  5. http://llvm.org/bugs/show_bug.cgi?id=12694
       Clang :: Sema/arm-neon-types.c

其它

env CC="ccache /usr/bin/gcc" CXX="ccache /usr/bin/g++" ../llvm/configure \
  -C --disable-bindings \
  --build=armv7l-unknown-linux-gnueabi --host=armv7l-unknown-linux-gnueabi --target=armv7l-unknown-linux-gnueabi \
  --with-cpu=cortex-a9 --with-fpu=neon --with-abi=aapcs --with-float=hard --enable-assertions

Regression Test

ARMADA XP
native cross cross-default
2.9 3) 4)
131462 5) 6)
131463 7) 8) 9)
131466 10)
134148 11)
135269 12)
135581 13)
135676 14)
135719 15)
135721 16)
135722 17) 18)
135738 19)
135755 20)
135762 21)
135847 22)
136591 23)

  • 編譯 cross toolchain 時的參數盡量模仿 native。
  • 編譯 cross-default toolchain 時採預設參數。
  • cross 比 cross-dafault 出現較多錯誤。
  • cross-default 和 native 行為較相近。
AV-D1
native native-new cross
2.9 1) 2) 3)
131463 4) 5)
  • gcc 4.4.3 比 gcc 4.4.1 出現較多錯誤。
  • native-new 為 gcc 4.3.3,native 為 gcc 4.4.3。

Test Suite

$ llvm-g++ initp1.cpp -o initp1
initp1.cpp:22: error: ‘init_priority’ attribute is not supported on this platform

Patch

    • 本機編譯會導致 Arch 抓錯。–build=arm-unknown-linux-gnueabi 應可解決此問題 1)
    • 135722 中 CodeGen 失敗在 135847 被修正。
    • 135738 - 135755 多引入一個 ExecutionEngine 失敗,135762 之後修正。

設備參數

  • AV-D1
    • gcc 4.4.3 –with-arch=armv7-a –with-float=softfp –with-fpu=vfpv3-d16 –with-mode=thumb
    • gcc 4.3.4 –with-arch=armv6 –with-tune=cortex-a8 –with-float=softfp –with-fpu=vfp
    • ld 2.20.1
    • linux 2.6.32
      $ gcc -v
      Using built-in specs.
      Target: arm-linux-gnueabi
      Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.3-4ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch \
      --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix \
      --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-plugin --enable-objc-gc --disable-sjlj-exceptions --with-arch=armv7-a --with-float=softfp \
      --with-fpu=vfpv3-d16 --with-mode=thumb --disable-werror --enable-checking=release --build=arm-linux-gnueabi --host=arm-linux-gnueabi --target=arm-linux-gnueabi
      Thread model: posix
      gcc version 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
      $ ld -v
      GNU ld (GNU Binutils for Ubuntu) 2.20.1-system.20100303
      $ uname -a
      Linux arm1 2.6.32.9-dove-5.4.2 #2 Mon May 16 19:53:39 PDT 2011 armv7l GNU/Linux
$ gcc -v
Using built-in specs.
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.4-10ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr \
--enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 \
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr \
--disable-sjlj-exceptions --with-arch=armv6 --with-tune=cortex-a8 --with-float=softfp --with-fpu=vfp --enable-checking=release --build=arm-linux-gnueabi --host=arm-linux-gnueabi --target=arm-linux-gnueabi
Thread model: posix
gcc version 4.3.4 (Ubuntu 4.3.4-10ubuntu1)
  • ARMADA XP
    • gcc 4.4.1 –with-arch=armv6 –with-tune=cortex-a8 –with-float=softfp –with-fpu=vfp
    • ld 2.20
    • linux 2.6.35
      $ gcc -v
      Using built-in specs.
      Target: arm-linux-gnueabi
      Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.1-4ubuntu9' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-sjlj-exceptions --with-arch=armv6 --with-tune=cortex-a8 --with-float=softfp --with-fpu=vfp --disable-werror --enable-checking=release --build=arm-linux-gnueabi --host=arm-linux-gnueabi --target=arm-linux-gnueabi
      Thread model: posix
      gcc version 4.4.1 (Ubuntu 4.4.1-4ubuntu9)
      $ ld -v
      GNU ld (GNU Binutils for Ubuntu) 2.20
      $ uname -a
      Linux arm2 2.6.35.11-00003-g1168dc4-dirty #29 SMP Thu May 5 18:20:22 CST 2011 armv6l GNU/Linux

交叉編譯

TRIPLE="arm-unknown-linux-gnueabi"
PREFIX="arm-unknown-linux-gnueabi-armv6l-gcc441"
XTOOL="${HOME}/x-tools/${PREFIX}/bin"
 
LLVM_SRC="$HOME/test/llvm-2.9"
 
export PATH=${XTOOL}:$PATH
 
${LLVM_SRC}/configure --target=${TRIPLE} \
--host=${TRIPLE} \
--enable-target=arm \
--disable-optimized --enable-bindings=none --disable-multilib --disable-bootstrap \
# export 才能生效
$ . ./build.sh
$ make; make check 2>&1 > log

本地編譯

確定 PATH 不包含交叉工具鏈、LLVM 和 LLVM-GCC 所在路徑!
TRIPLE="arm-unkown-linux-gnueabi"
LLVM_SRC="$HOME/test/llvm-2.8"
INSTALL="${HOME}/install/arm2"
 
# 加上 --build 選項是避免 LLVM 對 triple 判斷錯誤
# CC=${INSTALL}/bin/clang CXX=${INSTALL}/bin/clang++ 須加在 configure 那一行以實現自舉
# gcc -v -x c++ /dev/null -fsyntax-only
${LLVM_SRC}/configure --build=${TRIPLE} \
--prefix=${INSTALL} \
--enable-target=arm \
--disable-optimized --enable-bindings=none --disable-multilib --disable-bootstrap \

其它

Android Renderscript 有針對舊的 LLVM ARM JIT 做 patch。

登录