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

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

Issue 1412893004: Rolling forward clang, hiding some warnings (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Added some untracked files which have been added by Chromium Created 5 years, 2 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') | no next file » | 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 dac0c55ef43de5f525d87675e4b83713c4566f03..851ca847eed8d1ecf59bc4827ab37eb9d37ff0c1 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=247874
# 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
@@ -232,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.
@@ -267,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
@@ -317,6 +334,7 @@ for i in \
"${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,89 +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
-
- # 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
-
- # 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' |
---- a/cmake/config-ix.cmake
-+++ b/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
---- a/lib/ubsan/ubsan_platform.h
-+++ b/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 -p1
- popd
-
+ # No patches.
+ true
fi
# Echo all commands.
@@ -474,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
@@ -529,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
@@ -570,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.
@@ -605,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}" \
@@ -642,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}"
@@ -676,35 +626,45 @@ if [[ -n "${with_android}" ]]; then
# 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
-
- # 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" || -n "${LLVM_FORCE_HEAD_REVISION:-''}" ]]; then
« no previous file with comments | « tools/clang/scripts/update.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698