Android Renderscript 有針對舊的 LLVM ARM JIT 做 patch。
$ 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
$ 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
$ CC=clang CXX=clang++ ../llvm-2.9/configure --prefix=$INSTALL --enable-optimized \ --with-built-clang --with-llvmcc=clang $ make
LLVM 3.1 Release:
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 1Use 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=1You 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
$ 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 }
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
$ cd rc1/Phase3/Release/llvmCore-3.1-rc1.obj/ $ make check-all &> regression-test.txt
# 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。
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)
$ cd rc1/Phase3/Release $ tar zcvf llvmCore-3.1-rc1.install-arm-ubuntu_11.04.tar.gz llvmCore-3.1-rc1.install/
$ 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
$ cd rc1/cfe.src/test $ patch -p0 < r155819.patch
wint_t
定義在 /usr/include/wchar.h
; wchar_t
則是定義在編譯器自帶的標頭檔 lib/Header/stdarg.h
。 ExecutionEngine
test case。# 將原本標記成 XFAIL,即預期會失敗的 test 的標記去掉。 $ cd rc1/llvm.src/test/ExecutionEngine $ find . -type f -name "*ll" | xargs sed -i '/; XFAIL: arm/ d' $ vi include/llvm/ExecutionEngine/ExecutionEngine.h UseMCJIT = true; # 或 $ vi rc1/Phase3/Release/llvmCore-3.1-rc1.obj/test/Makefile LIT_ARGS += --param=jit_impl=mcjit # 或 $ make check-all LIT_ARGS=--param=jit_impl=mcjit
$ 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
Clang :: Driver/debug-options-as.c Clang :: Preprocessor/mmx.c Clang :: Preprocessor/predefined-arch-macros.c Clang :: Tooling/clang-check-args.cpp Clang :: Tooling/clang-check-pwd.cpp Clang :: Tooling/clang-check.cpp
Clang :: Sema/format-strings.c
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
Clang :: CodeGenCXX/virt-call-offsets.cpp
Clang :: CodeGenCXX/x86-64-abi-sret-vs-2word-struct-param.cpp
Clang :: CXX/conv/conv.prom/p2.cpp
Clang :: Sema/arm-neon-types.c
Clang :: Sema/wchar.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
|
|
$ llvm-g++ initp1.cpp -o initp1 initp1.cpp:22: error: ‘init_priority’ attribute is not supported on this platform
$ 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)
$ 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
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。