Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit 9db226d

Browse files
hqueuegkhanna79
authored andcommitted
[release/2.0.0][ARM32] clang 3.9 as a default for ARM cross build (#11197)
* [ARM32] clang 3.9 as a default for ARM cross build Use clang 3.9 as a default compiler for ARM cross build * Both arm and armel will be built using clang 3.9 as a default * ARM CI will use clang 3.9 as a default * ARM pipieline build will use clang 3.9 as a default Signed-off-by: Hyung-Kyu Choi <[email protected]> * [ARM32] Update docs describing clang-3.9 and ARM cross build Signed-off-by: Hyung-Kyu Choi <[email protected]> * [ARM] Check minimum version requirement of clang for ARM cross build Signed-off-by: Hyung-Kyu Choi <[email protected]>
1 parent ba86da4 commit 9db226d

File tree

3 files changed

+28
-5
lines changed

3 files changed

+28
-5
lines changed

Documentation/building/linux-instructions.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Toolchain Setup
1818
Install the following packages for the toolchain:
1919

2020
- cmake
21-
- llvm-3.5
22-
- clang-3.5
21+
- llvm-3.5 (llvm-3.9 for ARM cross build)
22+
- clang-3.5 (clang-3.9 for ARM cross build)
2323
- lldb-3.6
2424
- lldb-3.6-dev
2525
- libunwind8
@@ -39,6 +39,14 @@ ellismg@linux:~$ wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-
3939
ellismg@linux:~$ sudo apt-get update
4040
```
4141

42+
If you are going to cross build for ARM, you need llvm-3.9 and clang-3.9 and please add below package source instead for Ubuntu 14.04.
43+
```
44+
hqueue@linux:~$ echo "deb http://apt.llvm.org/trusty/ llvm-toolchain-trusty-3.9 main" | sudo tee /etc/apt/sources.list.d/llvm.list
45+
hqueue@linux:~$ wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
46+
hqueue@linux:~$ sudo apt-get update
47+
```
48+
For other version of Debian/Ubuntu, please visit http://apt.llvm.org/.
49+
4250
Then install the packages you need:
4351

4452
```
@@ -120,6 +128,8 @@ index 1ed3dbf..c643032 100644
120128
How to enable -O3 optimization level for ARM/Linux
121129
==================================================
122130

131+
If you are using clang-3.9, -O3 optimization is enabled as default and you can skip this section.
132+
If you are using older version of clang, please follow instructions in this section to enable -O3 optimization.
123133
Currently, we can build coreclr with -O1 flag of clang in release build mode for Linux/ARM without any bugfix of llvm-3.6. This instruction is to enable -O3 optimization level of clang on Linux/ARM by fixing the bug of llvm.
124134

125135
First, download latest version from the clang-3.6/llvm-3.6 upstream:

build.sh

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ check_prereqs()
118118
# Check presence of CMake on the path
119119
hash cmake 2>/dev/null || { echo >&2 "Please install cmake before running this script"; exit 1; }
120120

121+
122+
# Minimum required version of clang is version 3.9 for arm/armel cross build
123+
if [[ $__CrossBuild == 1 && ("$__BuildArch" == "arm" || "$__BuildArch" == "armel") ]]; then
124+
if ! [[ "$__ClangMajorVersion" -gt "3" || ( $__ClangMajorVersion == 3 && $__ClangMinorVersion == 9 ) ]]; then
125+
echo "Please install clang3.9 or latest for arm/armel cross build"; exit 1;
126+
fi
127+
fi
128+
121129
# Check for clang
122130
hash clang-$__ClangMajorVersion.$__ClangMinorVersion 2>/dev/null || hash clang$__ClangMajorVersion$__ClangMinorVersion 2>/dev/null || hash clang 2>/dev/null || { echo >&2 "Please install clang-$__ClangMajorVersion.$__ClangMinorVersion before running this script"; exit 1; }
123131

@@ -780,8 +788,13 @@ fi
780788
# Set default clang version
781789
if [[ $__ClangMajorVersion == 0 && $__ClangMinorVersion == 0 ]]; then
782790
if [ $__CrossBuild == 1 ]; then
783-
__ClangMajorVersion=3
784-
__ClangMinorVersion=6
791+
if [[ "$__BuildArch" == "arm" || "$__BuildArch" == "armel" ]]; then
792+
__ClangMajorVersion=3
793+
__ClangMinorVersion=9
794+
else
795+
__ClangMajorVersion=3
796+
__ClangMinorVersion=6
797+
fi
785798
else
786799
__ClangMajorVersion=3
787800
__ClangMinorVersion=5

tests/scripts/arm32_ci_script.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ function cross_build_coreclr_with_docker {
289289

290290
# Cross building coreclr with rootfs in Docker
291291
(set +x; echo "Start cross build coreclr for $__buildArch $__linuxCodeName")
292-
__buildCmd="./build.sh $__buildArch cross $__verboseFlag $__skipMscorlib $__buildConfig -rebuild clang3.9"
292+
__buildCmd="./build.sh $__buildArch cross $__verboseFlag $__skipMscorlib $__buildConfig -rebuild"
293293
$__dockerCmd $__buildCmd
294294
sudo chown -R $(id -u -n) ./bin
295295
}

0 commit comments

Comments
 (0)