| OLD | NEW |
| 1 #!/usr/bin/env bash | 1 #!/usr/bin/env bash |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # This script will check out llvm and clang into third_party/llvm and build it. | 6 # This script will check out llvm and clang into third_party/llvm and build it. |
| 7 | 7 |
| 8 # Do NOT CHANGE this if you don't know what you're doing -- see | 8 # Do NOT CHANGE this if you don't know what you're doing -- see |
| 9 # https://code.google.com/p/chromium/wiki/UpdatingClang | 9 # https://code.google.com/p/chromium/wiki/UpdatingClang |
| 10 # Reverting problematic clang rolls is safe, though. | 10 # Reverting problematic clang rolls is safe, though. |
| 11 CLANG_REVISION=233105 | 11 CLANG_REVISION=233105 |
| 12 | 12 |
| 13 # This is incremented when pushing a new build of Clang at the same revision. | 13 # This is incremented when pushing a new build of Clang at the same revision. |
| 14 CLANG_SUB_REVISION=1 | 14 CLANG_SUB_REVISION=2 |
| 15 | 15 |
| 16 PACKAGE_VERSION="${CLANG_REVISION}-${CLANG_SUB_REVISION}" | 16 PACKAGE_VERSION="${CLANG_REVISION}-${CLANG_SUB_REVISION}" |
| 17 | 17 |
| 18 THIS_DIR="$(dirname "${0}")" | 18 THIS_DIR="$(dirname "${0}")" |
| 19 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" | 19 LLVM_DIR="${THIS_DIR}/../../../third_party/llvm" |
| 20 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build/Release+Asserts" | 20 LLVM_BUILD_DIR="${LLVM_DIR}/../llvm-build/Release+Asserts" |
| 21 COMPILER_RT_BUILD_DIR="${LLVM_DIR}/../llvm-build/compiler-rt" | 21 COMPILER_RT_BUILD_DIR="${LLVM_DIR}/../llvm-build/compiler-rt" |
| 22 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap" | 22 LLVM_BOOTSTRAP_DIR="${LLVM_DIR}/../llvm-bootstrap" |
| 23 LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install" | 23 LLVM_BOOTSTRAP_INSTALL_DIR="${LLVM_DIR}/../llvm-bootstrap-install" |
| 24 CLANG_DIR="${LLVM_DIR}/tools/clang" | 24 CLANG_DIR="${LLVM_DIR}/tools/clang" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 | 57 |
| 58 if [[ -n ${LLVM_FORCE_HEAD_REVISION:-''} ]]; then | 58 if [[ -n ${LLVM_FORCE_HEAD_REVISION:-''} ]]; then |
| 59 # Use a real version number rather than HEAD to make sure that | 59 # Use a real version number rather than HEAD to make sure that |
| 60 # --print-revision, stamp file logic, etc. all works naturally. | 60 # --print-revision, stamp file logic, etc. all works naturally. |
| 61 CLANG_REVISION=$(svn info "$LLVM_REPO_URL" \ | 61 CLANG_REVISION=$(svn info "$LLVM_REPO_URL" \ |
| 62 | grep 'Last Changed Rev' | awk '{ printf $4; }') | 62 | grep 'Last Changed Rev' | awk '{ printf $4; }') |
| 63 PACKAGE_VERSION="${CLANG_REVISION}-0" | 63 PACKAGE_VERSION="${CLANG_REVISION}-0" |
| 64 fi | 64 fi |
| 65 | 65 |
| 66 # Use both the clang revision and the plugin revisions to test for updates. | |
| 67 BLINKGCPLUGIN_REVISION=\ | |
| 68 $(grep 'set(LIBRARYNAME' "$THIS_DIR"/../blink_gc_plugin/CMakeLists.txt \ | |
| 69 | cut -d ' ' -f 2 | tr -cd '[0-9]') | |
| 70 CLANG_AND_PLUGINS_REVISION="${CLANG_REVISION}-${BLINKGCPLUGIN_REVISION}" | |
| 71 | |
| 72 | |
| 73 OS="$(uname -s)" | 66 OS="$(uname -s)" |
| 74 | 67 |
| 75 # Parse command line options. | 68 # Parse command line options. |
| 76 if_needed= | 69 if_needed= |
| 77 force_local_build= | 70 force_local_build= |
| 78 run_tests= | 71 run_tests= |
| 79 bootstrap= | 72 bootstrap= |
| 80 with_android=yes | 73 with_android=yes |
| 81 chrome_tools="plugins;blink_gc_plugin" | 74 chrome_tools="plugins;blink_gc_plugin" |
| 82 gcc_toolchain= | 75 gcc_toolchain= |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 tar zxf - -C "${LLVM_BUILD_TOOLS_DIR}" | 176 tar zxf - -C "${LLVM_BUILD_TOOLS_DIR}" |
| 184 echo Done | 177 echo Done |
| 185 fi | 178 fi |
| 186 gcc_toolchain="${LLVM_BUILD_TOOLS_DIR}/gcc482" | 179 gcc_toolchain="${LLVM_BUILD_TOOLS_DIR}/gcc482" |
| 187 else | 180 else |
| 188 # Always set gcc_toolchain; llvm-symbolizer needs the bundled libstdc++. | 181 # Always set gcc_toolchain; llvm-symbolizer needs the bundled libstdc++. |
| 189 gcc_toolchain="$(dirname $(dirname $(which gcc)))" | 182 gcc_toolchain="$(dirname $(dirname $(which gcc)))" |
| 190 fi | 183 fi |
| 191 fi | 184 fi |
| 192 | 185 |
| 193 if [[ "${OS}" == "Linux" ]]; then | 186 if [[ "${OS}" == "Linux" || "${OS}" == "Darwin" ]]; then |
| 194 # TODO(hans): Might need to make this work on Mac eventually. | |
| 195 if [[ $(cmake --version | grep -Eo '[0-9.]+') < "3.0" ]]; then | 187 if [[ $(cmake --version | grep -Eo '[0-9.]+') < "3.0" ]]; then |
| 196 # We need a newer CMake version. | 188 # We need a newer CMake version. |
| 197 if [[ ! -e "${LLVM_BUILD_TOOLS_DIR}/cmake310" ]]; then | 189 if [[ ! -e "${LLVM_BUILD_TOOLS_DIR}/cmake310" ]]; then |
| 198 echo "Downloading pre-built CMake 3.10..." | 190 echo "Downloading pre-built CMake 3.10..." |
| 199 mkdir -p "${LLVM_BUILD_TOOLS_DIR}" | 191 mkdir -p "${LLVM_BUILD_TOOLS_DIR}" |
| 200 curl --fail -L "${CDS_URL}/tools/cmake310.tgz" | \ | 192 curl --fail -L "${CDS_URL}/tools/cmake310_${OS}.tgz" | \ |
| 201 tar zxf - -C "${LLVM_BUILD_TOOLS_DIR}" | 193 tar zxf - -C "${LLVM_BUILD_TOOLS_DIR}" |
| 202 echo Done | 194 echo Done |
| 203 fi | 195 fi |
| 204 export PATH="${LLVM_BUILD_TOOLS_DIR}/cmake310/bin:${PATH}" | 196 export PATH="${LLVM_BUILD_TOOLS_DIR}/cmake310/bin:${PATH}" |
| 205 fi | 197 fi |
| 206 fi | 198 fi |
| 207 | 199 |
| 208 echo "LLVM_FORCE_HEAD_REVISION was set; using r${CLANG_REVISION}" | 200 echo "LLVM_FORCE_HEAD_REVISION was set; using r${CLANG_REVISION}" |
| 209 fi | 201 fi |
| 210 | 202 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 "${CLANG_DIR}/test/Preprocessor/predefined-exceptions.m" \ | 307 "${CLANG_DIR}/test/Preprocessor/predefined-exceptions.m" \ |
| 316 "${LLVM_DIR}/test/Bindings/Go/go.test" \ | 308 "${LLVM_DIR}/test/Bindings/Go/go.test" \ |
| 317 "${CLANG_DIR}/lib/Parse/ParseExpr.cpp" \ | 309 "${CLANG_DIR}/lib/Parse/ParseExpr.cpp" \ |
| 318 "${CLANG_DIR}/lib/Parse/ParseTemplate.cpp" \ | 310 "${CLANG_DIR}/lib/Parse/ParseTemplate.cpp" \ |
| 319 "${CLANG_DIR}/lib/Sema/SemaDeclCXX.cpp" \ | 311 "${CLANG_DIR}/lib/Sema/SemaDeclCXX.cpp" \ |
| 320 "${CLANG_DIR}/lib/Sema/SemaExprCXX.cpp" \ | 312 "${CLANG_DIR}/lib/Sema/SemaExprCXX.cpp" \ |
| 321 "${CLANG_DIR}/test/SemaCXX/default2.cpp" \ | 313 "${CLANG_DIR}/test/SemaCXX/default2.cpp" \ |
| 322 "${CLANG_DIR}/test/SemaCXX/typo-correction-delayed.cpp" \ | 314 "${CLANG_DIR}/test/SemaCXX/typo-correction-delayed.cpp" \ |
| 323 "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_stoptheworld_linux_libc
dep.cc" \ | 315 "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_stoptheworld_linux_libc
dep.cc" \ |
| 324 "${COMPILER_RT_DIR}/test/tsan/signal_segv_handler.cc" \ | 316 "${COMPILER_RT_DIR}/test/tsan/signal_segv_handler.cc" \ |
| 317 "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_coverage_libcdep.cc" \ |
| 325 ; do | 318 ; do |
| 326 if [[ -e "${i}" ]]; then | 319 if [[ -e "${i}" ]]; then |
| 327 rm -f "${i}" # For unversioned files. | 320 rm -f "${i}" # For unversioned files. |
| 328 svn revert "${i}" | 321 svn revert "${i}" |
| 329 fi; | 322 fi; |
| 330 done | 323 done |
| 331 | 324 |
| 332 echo Remove the Clang tools shim dir | 325 echo Remove the Clang tools shim dir |
| 333 CHROME_TOOLS_SHIM_DIR=${ABS_LLVM_DIR}/tools/chrometools | 326 CHROME_TOOLS_SHIM_DIR=${ABS_LLVM_DIR}/tools/chrometools |
| 334 rm -rfv ${CHROME_TOOLS_SHIM_DIR} | 327 rm -rfv ${CHROME_TOOLS_SHIM_DIR} |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 | 390 |
| 398 -TEST_F(LibclangReparseTest, ReparseWithModule) { | 391 -TEST_F(LibclangReparseTest, ReparseWithModule) { |
| 399 +TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) { | 392 +TEST_F(LibclangReparseTest, DISABLED_ReparseWithModule) { |
| 400 const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;"; | 393 const char *HeaderTop = "#ifndef H\n#define H\nstruct Foo { int bar;"; |
| 401 const char *HeaderBottom = "\n};\n#endif\n"; | 394 const char *HeaderBottom = "\n};\n#endif\n"; |
| 402 const char *MFile = "#include \"HeaderFile.h\"\nint main() {" | 395 const char *MFile = "#include \"HeaderFile.h\"\nint main() {" |
| 403 EOF | 396 EOF |
| 404 patch -p0 | 397 patch -p0 |
| 405 popd | 398 popd |
| 406 | 399 |
| 400 # Cherry-pick r234010 [sancov] Shrink pc array on Android back to 2**24." |
| 401 pushd "${COMPILER_RT_DIR}" |
| 402 cat << 'EOF' | |
| 403 diff --git a/lib/sanitizer_common/sanitizer_coverage_libcdep.cc b/lib/sanitizer_
common/sanitizer_coverage_libcdep.cc |
| 404 index 4b976fc..cfd9e7e 100644 |
| 405 --- a/lib/sanitizer_common/sanitizer_coverage_libcdep.cc |
| 406 +++ b/lib/sanitizer_common/sanitizer_coverage_libcdep.cc |
| 407 @@ -109,7 +109,8 @@ class CoverageData { |
| 408 |
| 409 // Maximal size pc array may ever grow. |
| 410 // We MmapNoReserve this space to ensure that the array is contiguous. |
| 411 - static const uptr kPcArrayMaxSize = FIRST_32_SECOND_64(1 << 26, 1 << 27); |
| 412 + static const uptr kPcArrayMaxSize = |
| 413 + FIRST_32_SECOND_64(1 << (SANITIZER_ANDROID ? 24 : 26), 1 << 27); |
| 414 // The amount file mapping for the pc array is grown by. |
| 415 static const uptr kPcArrayMmapSize = 64 * 1024; |
| 416 |
| 417 EOF |
| 418 patch -p1 |
| 419 popd |
| 420 |
| 407 # This Go bindings test doesn't work after the bootstrap build on Linux. (PR21
552) | 421 # This Go bindings test doesn't work after the bootstrap build on Linux. (PR21
552) |
| 408 pushd "${LLVM_DIR}" | 422 pushd "${LLVM_DIR}" |
| 409 cat << 'EOF' | | 423 cat << 'EOF' | |
| 410 Index: test/Bindings/Go/go.test | 424 Index: test/Bindings/Go/go.test |
| 411 =================================================================== | 425 =================================================================== |
| 412 --- test/Bindings/Go/go.test (revision 223109) | 426 --- test/Bindings/Go/go.test (revision 223109) |
| 413 +++ test/Bindings/Go/go.test (working copy) | 427 +++ test/Bindings/Go/go.test (working copy) |
| 414 @@ -1,3 +1,3 @@ | 428 @@ -1,3 +1,3 @@ |
| 415 -; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm | 429 -; RUN: llvm-go test llvm.org/llvm/bindings/go/llvm |
| 416 +; RUN: true | 430 +; RUN: true |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 popd | 558 popd |
| 545 LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild" | 559 LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild" |
| 546 fi | 560 fi |
| 547 | 561 |
| 548 # Find the binutils include dir for the gold plugin. | 562 # Find the binutils include dir for the gold plugin. |
| 549 BINUTILS_INCDIR="" | 563 BINUTILS_INCDIR="" |
| 550 if [ "${OS}" = "Linux" ]; then | 564 if [ "${OS}" = "Linux" ]; then |
| 551 BINUTILS_INCDIR="${ABS_BINUTILS_DIR}/Linux_x64/Release/include" | 565 BINUTILS_INCDIR="${ABS_BINUTILS_DIR}/Linux_x64/Release/include" |
| 552 fi | 566 fi |
| 553 | 567 |
| 568 |
| 569 # If building at head, define a macro that plugins can use for #ifdefing |
| 570 # out code that builds at head, but not at CLANG_REVISION or vice versa. |
| 571 if [[ -n ${LLVM_FORCE_HEAD_REVISION:-''} ]]; then |
| 572 CFLAGS="${CFLAGS} -DLLVM_FORCE_HEAD_REVISION" |
| 573 CXXFLAGS="${CXXFLAGS} -DLLVM_FORCE_HEAD_REVISION" |
| 574 fi |
| 575 |
| 554 # Hook the Chromium tools into the LLVM build. Several Chromium tools have | 576 # Hook the Chromium tools into the LLVM build. Several Chromium tools have |
| 555 # dependencies on LLVM/Clang libraries. The LLVM build detects implicit tools | 577 # dependencies on LLVM/Clang libraries. The LLVM build detects implicit tools |
| 556 # in the tools subdirectory, so install a shim CMakeLists.txt that forwards to | 578 # in the tools subdirectory, so install a shim CMakeLists.txt that forwards to |
| 557 # the real directory for the Chromium tools. | 579 # the real directory for the Chromium tools. |
| 558 # Note that the shim directory name intentionally has no _ or _. The implicit | 580 # Note that the shim directory name intentionally has no _ or _. The implicit |
| 559 # tool detection logic munges them in a weird way. | 581 # tool detection logic munges them in a weird way. |
| 560 mkdir -v ${CHROME_TOOLS_SHIM_DIR} | 582 mkdir -v ${CHROME_TOOLS_SHIM_DIR} |
| 561 cat > ${CHROME_TOOLS_SHIM_DIR}/CMakeLists.txt << EOF | 583 cat > ${CHROME_TOOLS_SHIM_DIR}/CMakeLists.txt << EOF |
| 562 # Since tools/clang isn't actually a subdirectory, use the two argument version | 584 # Since tools/clang isn't actually a subdirectory, use the two argument version |
| 563 # to specify where build artifacts go. CMake doesn't allow reusing the same | 585 # to specify where build artifacts go. CMake doesn't allow reusing the same |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 | 696 |
| 675 if [[ -n "$run_tests" ]]; then | 697 if [[ -n "$run_tests" ]]; then |
| 676 # Run Chrome tool tests. | 698 # Run Chrome tool tests. |
| 677 ninja -C "${LLVM_BUILD_DIR}" cr-check-all | 699 ninja -C "${LLVM_BUILD_DIR}" cr-check-all |
| 678 # Run the LLVM and Clang tests. | 700 # Run the LLVM and Clang tests. |
| 679 ninja -C "${LLVM_BUILD_DIR}" check-all | 701 ninja -C "${LLVM_BUILD_DIR}" check-all |
| 680 fi | 702 fi |
| 681 | 703 |
| 682 # After everything is done, log success for this revision. | 704 # After everything is done, log success for this revision. |
| 683 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" | 705 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" |
| OLD | NEW |