diff --git a/tools/clang/scripts/update.sh b/tools/clang/scripts/update.sh index 65b296f..6557e89 100755 --- a/tools/clang/scripts/update.sh +++ b/tools/clang/scripts/update.sh
@@ -8,7 +8,7 @@ # 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=239765 +CLANG_REVISION=245965 # This is incremented when pushing a new build of Clang at the same revision. CLANG_SUB_REVISION=1 @@ -49,6 +49,9 @@ if [[ -z "$GYP_GENERATORS" ]]; then GYP_GENERATORS= fi +if [[ -z "$LLVM_DOWNLOAD_GOLD_PLUGIN" ]]; then + LLVM_DOWNLOAD_GOLD_PLUGIN= +fi # Die if any command dies, error on undefined variable expansions. @@ -267,6 +270,11 @@ 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 @@ -317,6 +325,7 @@ "${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 @@ -365,87 +374,8 @@ fi if [[ -n "$with_patches" ]]; then - - # Apply patch for tests failing with --disable-pthreads (llvm.org/PR11974) - pushd "${CLANG_DIR}" - cat << 'EOF' | ---- test/Index/crash-recovery-modules.m (revision 202554) -+++ test/Index/crash-recovery-modules.m (working copy) -@@ -12,6 +12,8 @@ - - // REQUIRES: crash-recovery - // REQUIRES: shell -+// XFAIL: * -+// (PR11974) - - @import Crash; -EOF -patch -p0 -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 - - # This Go bindings test doesn't work after the bootstrap build on Linux. (PR21552) - pushd "${LLVM_DIR}" - cat << 'EOF' | ---- 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 - - # The UBSan run-time, which is now bundled with the ASan run-time, doesn't work - # on Mac OS X 10.8 (PR23539). - pushd "${COMPILER_RT_DIR}" - cat << 'EOF' | ---- cmake/config-ix.cmake -+++ cmake/config-ix.cmake -@@ -319,7 +319,7 @@ else() - endif() - - if (COMPILER_RT_HAS_SANITIZER_COMMON AND UBSAN_SUPPORTED_ARCH AND -- OS_NAME MATCHES "Darwin|Linux|FreeBSD") -+ OS_NAME MATCHES "Linux|FreeBSD") - set(COMPILER_RT_HAS_UBSAN TRUE) - else() - set(COMPILER_RT_HAS_UBSAN FALSE) -diff --git a/lib/ubsan/ubsan_platform.h b/lib/ubsan/ubsan_platform.h -index 8ba253b..d5dce8d 100644 ---- lib/ubsan/ubsan_platform.h -+++ lib/ubsan/ubsan_platform.h -@@ -14,7 +14,7 @@ - #define UBSAN_PLATFORM_H - - // Other platforms should be easy to add, and probably work as-is. --#if (defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)) && \ -+#if (defined(__linux__) || defined(__FreeBSD__)) && \ - (defined(__x86_64__) || defined(__i386__) || defined(__arm__) || \ - defined(__aarch64__) || defined(__mips__) || defined(__powerpc64__)) - # define CAN_SANITIZE_UB 1 -EOF - patch -p0 - popd - + # No patches. + true fi # Echo all commands. @@ -526,7 +456,7 @@ 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 @@ -567,6 +497,16 @@ 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. @@ -649,6 +589,7 @@ -DLLVM_ENABLE_THREADS=OFF \ -DCMAKE_C_COMPILER="${CC}" \ -DCMAKE_CXX_COMPILER="${CXX}" \ + -DSANITIZER_MIN_OSX_VERSION="10.7" \ -DLLVM_CONFIG_PATH="${ABS_LLVM_BUILD_DIR}/bin/llvm-config" \ "${ABS_COMPILER_RT_DIR}" @@ -673,35 +614,45 @@ # Make a standalone Android toolchain. ${ANDROID_NDK_DIR}/build/tools/make-standalone-toolchain.sh \ --platform=android-19 \ - --install-dir="${LLVM_BUILD_DIR}/android-toolchain" \ + --install-dir="${LLVM_BUILD_DIR}/android-toolchain-arm" \ --system=linux-x86_64 \ --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 + # 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 - # 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 + 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 - # 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 + # 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" || -n "${LLVM_FORCE_HEAD_REVISION:-''}" ]]; then