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=239765 | 11 CLANG_REVISION=241602 |
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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 "${CLANG_DIR}/lib/Parse/ParseExpr.cpp" \ | 310 "${CLANG_DIR}/lib/Parse/ParseExpr.cpp" \ |
311 "${CLANG_DIR}/lib/Parse/ParseTemplate.cpp" \ | 311 "${CLANG_DIR}/lib/Parse/ParseTemplate.cpp" \ |
312 "${CLANG_DIR}/lib/Sema/SemaDeclCXX.cpp" \ | 312 "${CLANG_DIR}/lib/Sema/SemaDeclCXX.cpp" \ |
313 "${CLANG_DIR}/lib/Sema/SemaExprCXX.cpp" \ | 313 "${CLANG_DIR}/lib/Sema/SemaExprCXX.cpp" \ |
314 "${CLANG_DIR}/test/SemaCXX/default2.cpp" \ | 314 "${CLANG_DIR}/test/SemaCXX/default2.cpp" \ |
315 "${CLANG_DIR}/test/SemaCXX/typo-correction-delayed.cpp" \ | 315 "${CLANG_DIR}/test/SemaCXX/typo-correction-delayed.cpp" \ |
316 "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_stoptheworld_linux_libc
dep.cc" \ | 316 "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_stoptheworld_linux_libc
dep.cc" \ |
317 "${COMPILER_RT_DIR}/test/tsan/signal_segv_handler.cc" \ | 317 "${COMPILER_RT_DIR}/test/tsan/signal_segv_handler.cc" \ |
318 "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_coverage_libcdep.cc" \ | 318 "${COMPILER_RT_DIR}/lib/sanitizer_common/sanitizer_coverage_libcdep.cc" \ |
319 "${COMPILER_RT_DIR}/cmake/config-ix.cmake" \ | 319 "${COMPILER_RT_DIR}/cmake/config-ix.cmake" \ |
| 320 "${COMPILER_RT_DIR}/CMakeLists.txt" \ |
320 "${COMPILER_RT_DIR}/lib/ubsan/ubsan_platform.h" \ | 321 "${COMPILER_RT_DIR}/lib/ubsan/ubsan_platform.h" \ |
321 ; do | 322 ; do |
322 if [[ -e "${i}" ]]; then | 323 if [[ -e "${i}" ]]; then |
323 rm -f "${i}" # For unversioned files. | 324 rm -f "${i}" # For unversioned files. |
324 svn revert "${i}" | 325 svn revert "${i}" |
325 fi; | 326 fi; |
326 done | 327 done |
327 | 328 |
328 echo Remove the Clang tools shim dir | 329 echo Remove the Clang tools shim dir |
329 CHROME_TOOLS_SHIM_DIR=${ABS_LLVM_DIR}/tools/chrometools | 330 CHROME_TOOLS_SHIM_DIR=${ABS_LLVM_DIR}/tools/chrometools |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 | 412 |
412 ; REQUIRES: shell | 413 ; REQUIRES: shell |
413 EOF | 414 EOF |
414 patch -p0 | 415 patch -p0 |
415 popd | 416 popd |
416 | 417 |
417 # The UBSan run-time, which is now bundled with the ASan run-time, doesn't wor
k | 418 # The UBSan run-time, which is now bundled with the ASan run-time, doesn't wor
k |
418 # on Mac OS X 10.8 (PR23539). | 419 # on Mac OS X 10.8 (PR23539). |
419 pushd "${COMPILER_RT_DIR}" | 420 pushd "${COMPILER_RT_DIR}" |
420 cat << 'EOF' | | 421 cat << 'EOF' | |
421 --- cmake/config-ix.cmake | 422 Index: CMakeLists.txt |
422 +++ cmake/config-ix.cmake | 423 =================================================================== |
423 @@ -319,7 +319,7 @@ else() | 424 --- CMakeLists.txt» (revision 241602) |
424 endif() | 425 +++ CMakeLists.txt» (working copy) |
425 | 426 @@ -305,6 +305,7 @@ |
426 if (COMPILER_RT_HAS_SANITIZER_COMMON AND UBSAN_SUPPORTED_ARCH AND | 427 list(APPEND SANITIZER_COMMON_SUPPORTED_OS iossim) |
427 - OS_NAME MATCHES "Darwin|Linux|FreeBSD") | 428 endif() |
428 + OS_NAME MATCHES "Linux|FreeBSD") | 429 endif() |
429 set(COMPILER_RT_HAS_UBSAN TRUE) | 430 + set(SANITIZER_MIN_OSX_VERSION "10.7") |
430 else() | 431 if(SANITIZER_MIN_OSX_VERSION VERSION_LESS "10.7") |
431 set(COMPILER_RT_HAS_UBSAN FALSE) | 432 message(FATAL_ERROR "Too old OS X version: ${SANITIZER_MIN_OSX_VERSION}") |
432 diff --git a/lib/ubsan/ubsan_platform.h b/lib/ubsan/ubsan_platform.h | 433 endif() |
433 index 8ba253b..d5dce8d 100644 | |
434 --- lib/ubsan/ubsan_platform.h | |
435 +++ lib/ubsan/ubsan_platform.h | |
436 @@ -14,7 +14,7 @@ | |
437 #define UBSAN_PLATFORM_H | |
438 | |
439 // Other platforms should be easy to add, and probably work as-is. | |
440 -#if (defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__)) && \ | |
441 +#if (defined(__linux__) || defined(__FreeBSD__)) && \ | |
442 (defined(__x86_64__) || defined(__i386__) || defined(__arm__) || \ | |
443 defined(__aarch64__) || defined(__mips__) || defined(__powerpc64__)) | |
444 # define CAN_SANITIZE_UB 1 | |
445 EOF | 434 EOF |
446 patch -p0 | 435 patch -p0 |
447 popd | 436 popd |
448 | 437 |
449 fi | 438 fi |
450 | 439 |
451 # Echo all commands. | 440 # Echo all commands. |
452 set -x | 441 set -x |
453 | 442 |
454 # Set default values for CC and CXX if they're not set in the environment. | 443 # Set default values for CC and CXX if they're not set in the environment. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 pushd libcxxbuild | 549 pushd libcxxbuild |
561 ${CC:-cc} libcxx/*.o libcxxabi/*.o -o libc++.1.dylib -dynamiclib \ | 550 ${CC:-cc} libcxx/*.o libcxxabi/*.o -o libc++.1.dylib -dynamiclib \ |
562 -nodefaultlibs -current_version 1 -compatibility_version 1 \ | 551 -nodefaultlibs -current_version 1 -compatibility_version 1 \ |
563 -lSystem -install_name @executable_path/libc++.dylib \ | 552 -lSystem -install_name @executable_path/libc++.dylib \ |
564 -Wl,-unexported_symbols_list,${ABS_LIBCXX_DIR}/lib/libc++unexp.exp \ | 553 -Wl,-unexported_symbols_list,${ABS_LIBCXX_DIR}/lib/libc++unexp.exp \ |
565 -Wl,-force_symbols_not_weak_list,${ABS_LIBCXX_DIR}/lib/notweak.exp \ | 554 -Wl,-force_symbols_not_weak_list,${ABS_LIBCXX_DIR}/lib/notweak.exp \ |
566 -Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib/weak.exp | 555 -Wl,-force_symbols_weak_list,${ABS_LIBCXX_DIR}/lib/weak.exp |
567 ln -sf libc++.1.dylib libc++.dylib | 556 ln -sf libc++.1.dylib libc++.dylib |
568 popd | 557 popd |
569 LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild" | 558 LDFLAGS+="-stdlib=libc++ -L${PWD}/libcxxbuild" |
| 559 |
| 560 if [[ -n "${bootstrap}" ]]; then |
| 561 # Now that the libc++ headers have been installed and libc++.dylib is built, |
| 562 # delete the libc++ checkout again so that it's not part of the main |
| 563 # build below -- the libc++(abi) tests don't pass on OS X in bootstrap |
| 564 # builds (http://llvm.org/PR24068) |
| 565 rm -rf "${ABS_LIBCXX_DIR}" |
| 566 rm -rf "${ABS_LIBCXXABI_DIR}" |
| 567 CXXFLAGS="-stdlib=libc++ -nostdinc++ -I${ABS_INSTALL_DIR}/include/c++/v1 ${C
FLAGS}" |
| 568 fi |
570 fi | 569 fi |
571 | 570 |
572 # Find the binutils include dir for the gold plugin. | 571 # Find the binutils include dir for the gold plugin. |
573 BINUTILS_INCDIR="" | 572 BINUTILS_INCDIR="" |
574 if [ "${OS}" = "Linux" ]; then | 573 if [ "${OS}" = "Linux" ]; then |
575 BINUTILS_INCDIR="${ABS_BINUTILS_DIR}/Linux_x64/Release/include" | 574 BINUTILS_INCDIR="${ABS_BINUTILS_DIR}/Linux_x64/Release/include" |
576 fi | 575 fi |
577 | 576 |
578 | 577 |
579 # If building at head, define a macro that plugins can use for #ifdefing | 578 # If building at head, define a macro that plugins can use for #ifdefing |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 # Run Chrome tool tests. | 707 # Run Chrome tool tests. |
709 ninja -C "${LLVM_BUILD_DIR}" cr-check-all | 708 ninja -C "${LLVM_BUILD_DIR}" cr-check-all |
710 fi | 709 fi |
711 if [[ -n "$run_tests" ]]; then | 710 if [[ -n "$run_tests" ]]; then |
712 # Run the LLVM and Clang tests. | 711 # Run the LLVM and Clang tests. |
713 ninja -C "${LLVM_BUILD_DIR}" check-all | 712 ninja -C "${LLVM_BUILD_DIR}" check-all |
714 fi | 713 fi |
715 | 714 |
716 # After everything is done, log success for this revision. | 715 # After everything is done, log success for this revision. |
717 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" | 716 echo "${PACKAGE_VERSION}" > "${STAMP_FILE}" |
OLD | NEW |