summaryrefslogtreecommitdiffstats
path: root/tools/clang
diff options
context:
space:
mode:
authoreugenis@chromium.org <eugenis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-02 10:32:04 +0000
committereugenis@chromium.org <eugenis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-02 10:32:04 +0000
commit9ed97ec5625fa789554d6c970aab5f56641d6bbe (patch)
treee4fee3af8e7e43125bedc2e4988e28f07f623b19 /tools/clang
parent330fbb54043369002af66ce21a98e4466046ded7 (diff)
downloadchromium_src-9ed97ec5625fa789554d6c970aab5f56641d6bbe.zip
chromium_src-9ed97ec5625fa789554d6c970aab5f56641d6bbe.tar.gz
chromium_src-9ed97ec5625fa789554d6c970aab5f56641d6bbe.tar.bz2
Build ASan Android runtime when updating Clang.
BUG=137569 TEST=none R=thakis@chromium.org Review URL: https://codereview.chromium.org/10987050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165652 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/clang')
-rwxr-xr-xtools/clang/scripts/update.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/tools/clang/scripts/update.sh b/tools/clang/scripts/update.sh
index 0fcfa6f..5164797 100755
--- a/tools/clang/scripts/update.sh
+++ b/tools/clang/scripts/update.sh
@@ -22,6 +22,7 @@ LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build"
LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap"
CLANG_DIR="${LLVM_DIR}/tools/clang"
COMPILER_RT_DIR="${LLVM_DIR}/projects/compiler-rt"
+ANDROID_NDK_DIR="${LLVM_DIR}/../android_tools/ndk"
STAMP_FILE="${LLVM_BUILD_DIR}/cr_build_revision"
# ${A:-a} returns $A if it's set, a else.
@@ -37,6 +38,8 @@ force_local_build=
mac_only=
run_tests=
bootstrap=
+with_android=yes
+
while [[ $# > 0 ]]; do
case $1 in
--bootstrap)
@@ -51,12 +54,16 @@ while [[ $# > 0 ]]; do
--run-tests)
run_tests=yes
;;
+ --without-android)
+ with_android=
+ ;;
--help)
echo "usage: $0 [--force-local-build] [--mac-only] [--run-tests] "
echo "--bootstrap: First build clang with CC, then with itself."
echo "--force-local-build: Don't try to download prebuilt binaries."
echo "--mac-only: Do initial download only on Mac systems."
echo "--run-tests: Run tests after building. Only for local builds."
+ echo "--without-android: Don't build ASan Android runtime library."
exit 1
;;
esac
@@ -197,6 +204,15 @@ if [[ -z "$force_local_build" ]]; then
fi
fi
+if [[ -n "${with_android}" ]] && ! [[ -d "${ANDROID_NDK_DIR}" ]]; then
+ echo "Android NDK not found at ${ANDROID_NDK_DIR}"
+ echo "The Android NDK is needed to build a Clang whose -faddress-sanitizer"
+ echo "works on Android. See "
+ echo "http://code.google.com/p/chromium/wiki/AndroidBuildInstructions for how"
+ echo "to install the NDK, or pass --without-android."
+ exit 1
+fi
+
echo Getting LLVM r"${CLANG_REVISION}" in "${LLVM_DIR}"
if ! svn co --force "${LLVM_REPO_URL}/llvm/trunk@${CLANG_REVISION}" \
"${LLVM_DIR}"; then
@@ -267,6 +283,28 @@ fi
MACOSX_DEPLOYMENT_TARGET=10.5 make -j"${NUM_JOBS}"
cd -
+if [[ -n "${with_android}" ]]; then
+ # Make a standalone Android toolchain.
+ ${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \
+ --platform=android-9 \
+ --install-dir="${LLVM_BUILD_DIR}/android-toolchain"
+
+ # Fixup mismatching version numbers in android-ndk-r8b.
+ # TODO: This will be fixed in the next NDK, remove this when that ships.
+ TC="${LLVM_BUILD_DIR}/android-toolchain"
+ if [[ -d "${TC}/lib/gcc/arm-linux-androideabi/4.6.x-google" ]]; then
+ mv "${TC}/lib/gcc/arm-linux-androideabi/4.6.x-google" \
+ "${TC}/lib/gcc/arm-linux-androideabi/4.6"
+ mv "${TC}/libexec/gcc/arm-linux-androideabi/4.6.x-google" \
+ "${TC}/libexec/gcc/arm-linux-androideabi/4.6"
+ fi
+
+ # Build ASan runtime for Android.
+ cd "${LLVM_BUILD_DIR}"
+ make -C tools/clang/runtime/ LLVM_ANDROID_TOOLCHAIN_DIR="../../../../${TC}"
+ cd -
+fi
+
# Build plugin.
# Copy it into the clang tree and use clang's build system to compile the
# plugin.