Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(456)

Unified Diff: tools/clang/scripts/update.sh

Issue 1841863002: Update monet. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/clang/scripts/update.py ('k') | tools/dart/update.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/clang/scripts/update.sh
diff --git a/tools/clang/scripts/update.sh b/tools/clang/scripts/update.sh
index 10aa5c1a24704cc7c87ad827e5354b679e0110fb..14ae60f20597da2a41dbd1e6f1c9edcb4ffe96a2 100755
--- a/tools/clang/scripts/update.sh
+++ b/tools/clang/scripts/update.sh
@@ -8,10 +8,10 @@
# Do NOT CHANGE this if you don't know what you're doing -- see
# https://code.google.com/p/chromium/wiki/UpdatingClang
# Reverting problematic clang rolls is safe, though.
-CLANG_REVISION=238013
+CLANG_REVISION=259396
# This is incremented when pushing a new build of Clang at the same revision.
-CLANG_SUB_REVISION=3
+CLANG_SUB_REVISION=1
PACKAGE_VERSION="${CLANG_REVISION}-${CLANG_SUB_REVISION}"
@@ -49,7 +49,16 @@ fi
if [[ -z "$GYP_GENERATORS" ]]; then
GYP_GENERATORS=
fi
+if [[ -z "$LLVM_DOWNLOAD_GOLD_PLUGIN" ]]; then
+ LLVM_DOWNLOAD_GOLD_PLUGIN=
+fi
+if [[ "${OS}" == "Linux" ]] && \
+ [[ "$GYP_DEFINES" =~ .*buildtype=Official.* ]] && \
+ [[ "$GYP_DEFINES" =~ .*branding=Chrome.* ]] ; then
+ # LLVM Gold plugin is required to build with this configuration.
+ LLVM_DOWNLOAD_GOLD_PLUGIN=1
+fi
# Die if any command dies, error on undefined variable expansions.
set -eu
@@ -206,20 +215,17 @@ fi
if [[ -n "$if_needed" ]]; then
if [[ "${OS}" == "Darwin" ]]; then
- # clang is used on Mac.
+ # clang is always used on Mac.
+ true
+ elif [[ "${OS}" == "Linux" ]]; then
+ # clang is also aways used on Linux.
true
elif [[ "$GYP_DEFINES" =~ .*(clang|tsan|asan|lsan|msan)=1.* ]]; then
# clang requested via $GYP_DEFINES.
true
elif [[ -d "${LLVM_BUILD_DIR}" ]]; then
- # clang previously downloaded, remove third_party/llvm-build to prevent
- # updating.
- true
- elif [[ "${OS}" == "Linux" ]]; then
- # Temporarily use clang on linux. Leave a stamp file behind, so that
- # this script can remove clang again on machines where it was autoinstalled.
- mkdir -p "${LLVM_BUILD_DIR}"
- touch "${LLVM_BUILD_DIR}/autoinstall_stamp"
+ # clang previously downloaded, keep it up-to-date.
+ # If you don't want this, delete third_party/llvm-build on your machine.
true
else
# clang wasn't needed, not doing anything.
@@ -235,7 +241,10 @@ if [[ -f "${STAMP_FILE}" ]]; then
[[ "${PREVIOUSLY_BUILT_REVISON}" = \
"${PACKAGE_VERSION}" ]]; then
echo "Clang already at ${PACKAGE_VERSION}"
- exit 0
+ if [[ -z "${LLVM_DOWNLOAD_GOLD_PLUGIN}" ]] || \
+ [[ -f "${LLVM_BUILD_DIR}/lib/LLVMgold.so" ]]; then
+ exit 0
+ fi
fi
fi
# To always force a new build if someone interrupts their build half way.
@@ -270,6 +279,11 @@ if [[ -z "$force_local_build" ]]; then
echo clang "${PACKAGE_VERSION}" unpacked
echo "${PACKAGE_VERSION}" > "${STAMP_FILE}"
rm -rf "${CDS_OUT_DIR}"
+ # Download the gold plugin if requested to by an environment variable.
+ # This is used by the CFI ClusterFuzz bot.
+ if [[ -n "${LLVM_DOWNLOAD_GOLD_PLUGIN}" ]]; then
+ ${THIS_DIR}/../../../build/download_gold_plugin.py
+ fi
exit 0
else
echo Did not find prebuilt clang "${PACKAGE_VERSION}", building
@@ -319,6 +333,9 @@ for i in \
"${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc" \
"${COMPILER_RT_DIR}/test/tsan/signal_segv_handler.cc" \
"${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_coverage_libcdep.cc" \
+ "${COMPILER_RT_DIR}/cmake/config-ix.cmake" \
+ "${COMPILER_RT_DIR}/CMakeLists.txt" \
+ "${COMPILER_RT_DIR}/lib/ubsan/ubsan_platform.h" \
; do
if [[ -e "${i}" ]]; then
rm -f "${i}" # For unversioned files.
@@ -366,79 +383,8 @@ if [ "${OS}" = "Darwin" ]; then
fi
if [[ -n "$with_patches" ]]; then
-
- # Apply patch for tests failing with --disable-pthreads (llvm.org/PR11974)
- pushd "${CLANG_DIR}"
- cat << 'EOF' |
---- third_party/llvm/tools/clang/test/Index/crash-recovery-modules.m (revision 202554)
-+++ third_party/llvm/tools/clang/test/Index/crash-recovery-modules.m (working copy)
-@@ -12,6 +12,8 @@
-
- // REQUIRES: crash-recovery
- // REQUIRES: shell
-+// XFAIL: *
-+// (PR11974)
-
- @import Crash;
-EOF
-patch -p4
-popd
-
-pushd "${CLANG_DIR}"
-cat << 'EOF' |
---- unittests/libclang/LibclangTest.cpp (revision 215949)
-+++ unittests/libclang/LibclangTest.cpp (working copy)
-@@ -431,7 +431,7 @@
- EXPECT_EQ(0U, clang_getNumDiagnostics(ClangTU));
- }
-
--TEST_F(LibclangReparseTest, ReparseWithModule) {
-+TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) {
- const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;";
- const char *HeaderBottom = "\n};\n#endif\n";
- const char *MFile = "#include \"HeaderFile.h\"\nint main() {"
-EOF
- patch -p0
- popd
-
- # Cherry-pick r234010 [sancov] Shrink pc array on Android back to 2**24."
- pushd "${COMPILER_RT_DIR}"
- cat << 'EOF' |
-diff --git a/lib/sanitizer_common/sanitizer_coverage_libcdep.cc b/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
-index 4b976fc..cfd9e7e 100644
---- a/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
-+++ b/lib/sanitizer_common/sanitizer_coverage_libcdep.cc
-@@ -109,7 +109,8 @@ class CoverageData {
-
- // Maximal size pc array may ever grow.
- // We MmapNoReserve this space to ensure that the array is contiguous.
-- static const uptr kPcArrayMaxSize = FIRST_32_SECOND_64(1 << 26, 1 << 27);
-+ static const uptr kPcArrayMaxSize =
-+ FIRST_32_SECOND_64(1 << (SANITIZER_ANDROID ? 24 : 26), 1 << 27);
- // The amount file mapping for the pc array is grown by.
- static const uptr kPcArrayMmapSize = 64 * 1024;
-
-EOF
- patch -p1
- popd
-
- # This Go bindings test doesn't work after the bootstrap build on Linux. (PR21552)
- pushd "${LLVM_DIR}"
- cat << 'EOF' |
-Index: test/Bindings/Go/go.test
-===================================================================
---- test/Bindings/Go/go.test (revision 223109)
-+++ test/Bindings/Go/go.test (working copy)
-@@ -1,3 +1,3 @@
--; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm
-+; RUN: true
-
- ; REQUIRES: shell
-EOF
- patch -p0
- popd
-
-
+ # No patches.
+ true
fi
# Echo all commands.
@@ -465,16 +411,15 @@ LDFLAGS=""
# needed, on OS X it requires libc++. clang only automatically links to libc++
# when targeting OS X 10.9+, so add stdlib=libc++ explicitly so clang can run on
# OS X versions as old as 10.7.
-# TODO(thakis): Some bots are still on 10.6, so for now bundle libc++.dylib.
-# Remove this once all bots are on 10.7+, then use --enable-libcpp=yes and
-# change deployment_target to 10.7.
+# TODO(thakis): Some bots are still on 10.6 (nacl...), so for now bundle
+# libc++.dylib. Remove this once all bots are on 10.7+, then use
+# -DLLVM_ENABLE_LIBCXX=ON and change deployment_target to 10.7.
deployment_target=""
if [ "${OS}" = "Darwin" ]; then
# When building on 10.9, /usr/include usually doesn't exist, and while
# Xcode's clang automatically sets a sysroot, self-built clangs don't.
CFLAGS="-isysroot $(xcrun --show-sdk-path)"
- CPPFLAGS="${CFLAGS}"
CXXFLAGS="-stdlib=libc++ -nostdinc++ -I${ABS_LIBCXX_DIR}/include ${CFLAGS}"
if [[ -n "${bootstrap}" ]]; then
@@ -520,7 +465,7 @@ if [[ -n "${bootstrap}" ]]; then
if [[ -n "${gcc_toolchain}" ]]; then
# Tell the bootstrap compiler to use a specific gcc prefix to search
- # for standard library headers and shared object file.
+ # for standard library headers and shared object files.
CFLAGS="--gcc-toolchain=${gcc_toolchain}"
CXXFLAGS="--gcc-toolchain=${gcc_toolchain}"
fi
@@ -561,6 +506,16 @@ if [ "${OS}" = "Darwin" ]; then
ln -sf libc++.1.dylib libc++.dylib
popd
LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild"
+
+ if [[ -n "${bootstrap}" ]]; then
+ # Now that the libc++ headers have been installed and libc++.dylib is built,
+ # delete the libc++ checkout again so that it's not part of the main
+ # build below -- the libc++(abi) tests don't pass on OS X in bootstrap
+ # builds (http://llvm.org/PR24068)
+ rm -rf "${ABS_LIBCXX_DIR}"
+ rm -rf "${ABS_LIBCXXABI_DIR}"
+ CXXFLAGS="-stdlib=libc++ -nostdinc++ -I${ABS_INSTALL_DIR}/include/c++/v1 ${CFLAGS}"
+ fi
fi
# Find the binutils include dir for the gold plugin.
@@ -596,6 +551,7 @@ MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_THREADS=OFF \
+ -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly \
-DLLVM_BINUTILS_INCDIR="${BINUTILS_INCDIR}" \
-DCMAKE_C_COMPILER="${CC}" \
-DCMAKE_CXX_COMPILER="${CXX}" \
@@ -633,16 +589,19 @@ strip ${STRIP_FLAGS} bin/clang
popd
# Build compiler-rt out-of-tree.
+# Do a clobbered build due to cmake changes.
+rm -rf "${COMPILER_RT_BUILD_DIR}"
mkdir -p "${COMPILER_RT_BUILD_DIR}"
pushd "${COMPILER_RT_BUILD_DIR}"
rm -fv CMakeCache.txt
-MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \
+MACOSX_DEPLOYMENT_TARGET=${deployment_target} CC="" CXX="" cmake -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DLLVM_ENABLE_THREADS=OFF \
- -DCMAKE_C_COMPILER="${CC}" \
- -DCMAKE_CXX_COMPILER="${CXX}" \
+ -DCMAKE_C_COMPILER="${ABS_LLVM_BUILD_DIR}/bin/clang" \
+ -DCMAKE_CXX_COMPILER="${ABS_LLVM_BUILD_DIR}/bin/clang++" \
+ -DSANITIZER_MIN_OSX_VERSION="10.7" \
-DLLVM_CONFIG_PATH="${ABS_LLVM_BUILD_DIR}/bin/llvm-config" \
"${ABS_COMPILER_RT_DIR}"
@@ -666,41 +625,53 @@ popd
if [[ -n "${with_android}" ]]; then
# Make a standalone Android toolchain.
${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \
- --platform=android-14 \
- --install-dir="${LLVM_BUILD_DIR}/android-toolchain" \
+ --platform=android-19 \
+ --install-dir="${LLVM_BUILD_DIR}/android-toolchain-arm" \
--system=linux-x86_64 \
- --stl=libcxx \
+ --stl=stlport \
--toolchain=arm-linux-androideabi-4.9
- # Android NDK r9d copies a broken unwind.h into the toolchain, see
- # http://crbug.com/357890
- rm -v "${LLVM_BUILD_DIR}"/android-toolchain/include/c++/*/unwind.h
-
- # Build ASan runtime for Android in a separate build tree.
- mkdir -p ${LLVM_BUILD_DIR}/android
- pushd ${LLVM_BUILD_DIR}/android
- rm -fv CMakeCache.txt
- MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \
- -DCMAKE_BUILD_TYPE=Release \
- -DLLVM_ENABLE_ASSERTIONS=ON \
- -DLLVM_ENABLE_THREADS=OFF \
- -DCMAKE_C_COMPILER=${PWD}/../bin/clang \
- -DCMAKE_CXX_COMPILER=${PWD}/../bin/clang++ \
- -DLLVM_CONFIG_PATH=${PWD}/../bin/llvm-config \
- -DCMAKE_C_FLAGS="--target=arm-linux-androideabi --sysroot=${PWD}/../android-toolchain/sysroot -B${PWD}/../android-toolchain" \
- -DCMAKE_CXX_FLAGS="--target=arm-linux-androideabi --sysroot=${PWD}/../android-toolchain/sysroot -B${PWD}/../android-toolchain" \
- -DANDROID=1 \
- "${ABS_COMPILER_RT_DIR}"
- ninja libclang_rt.asan-arm-android.so
-
- # And copy it into the main build tree.
- cp "$(find -name libclang_rt.asan-arm-android.so)" "${ABS_LLVM_CLANG_LIB_DIR}/lib/linux/"
- popd
+ # Do the same for x86.
+ ${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \
+ --platform=android-19 \
+ --install-dir="${LLVM_BUILD_DIR}/android-toolchain-i686" \
+ --system=linux-x86_64 \
+ --stl=stlport \
+ --toolchain=x86-4.9
+
+ for target_arch in "arm" "i686"; do
+ # Android NDK r9d copies a broken unwind.h into the toolchain, see
+ # http://crbug.com/357890
+ rm -v "${LLVM_BUILD_DIR}"/android-toolchain-${target_arch}/include/c++/*/unwind.h
+
+ # Build ASan runtime for Android in a separate build tree.
+ mkdir -p ${LLVM_BUILD_DIR}/android-${target_arch}
+ pushd ${LLVM_BUILD_DIR}/android-${target_arch}
+ rm -fv CMakeCache.txt
+ MACOSX_DEPLOYMENT_TARGET=${deployment_target} cmake -GNinja \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DLLVM_ENABLE_ASSERTIONS=ON \
+ -DLLVM_ENABLE_THREADS=OFF \
+ -DCMAKE_C_COMPILER=${PWD}/../bin/clang \
+ -DCMAKE_CXX_COMPILER=${PWD}/../bin/clang++ \
+ -DLLVM_CONFIG_PATH=${PWD}/../bin/llvm-config \
+ -DCMAKE_C_FLAGS="--target=${target_arch}-linux-androideabi --sysroot=${PWD}/../android-toolchain-${target_arch}/sysroot -B${PWD}/../android-toolchain-${target_arch}" \
+ -DCMAKE_CXX_FLAGS="--target=${target_arch}-linux-androideabi --sysroot=${PWD}/../android-toolchain-${target_arch}/sysroot -B${PWD}/../android-toolchain-${target_arch}" \
+ -DANDROID=1 \
+ "${ABS_COMPILER_RT_DIR}"
+ ninja libclang_rt.asan-${target_arch}-android.so
+
+ # And copy it into the main build tree.
+ cp "$(find -name libclang_rt.asan-${target_arch}-android.so)" "${ABS_LLVM_CLANG_LIB_DIR}/lib/linux/"
+ popd
+ done
fi
-if [[ -n "$run_tests" ]]; then
+if [[ -n "$run_tests" || -n "${LLVM_FORCE_HEAD_REVISION:-''}" ]]; then
# Run Chrome tool tests.
ninja -C "${LLVM_BUILD_DIR}" cr-check-all
+fi
+if [[ -n "$run_tests" ]]; then
# Run the LLVM and Clang tests.
ninja -C "${LLVM_BUILD_DIR}" check-all
fi
« no previous file with comments | « tools/clang/scripts/update.py ('k') | tools/dart/update.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698