From 50334d37141ea032527286c400d39a718ea88472 Mon Sep 17 00:00:00 2001 From: David Major Date: Tue, 12 May 2020 14:02:30 +0000 Subject: [PATCH] Bug 1616692 - Update to clang 10.0.0 r=froydnj Differential Revision: https://phabricator.services.mozilla.com/D74768 --- ...g-10-linux64.json => clang-9-linux64.json} | 12 +- build/build-clang/clang-linux64.json | 1 + build/build-clang/clang-win64.json | 1 - ...ch => find_symbolizer_linux-clang-9.patch} | 12 +- build/build-clang/find_symbolizer_linux.patch | 12 +- ...0-init-5191-ga84b200e604-windows-pgo.patch | 115 ------------------ ...-11-init-14017-g02b303321d3-libclang.patch | 16 +++ ...g-11-init-4265-g2dcbdba8540-clang-9.patch} | 28 ++--- .../llvmorg-11-init-4265-g2dcbdba8540.patch | 28 ++--- ..._10.patch => rG7e18aeba5062-clang-9.patch} | 32 +++-- build/build-clang/rG7e18aeba5062.patch | 32 ++--- ....patch => rename_gcov_flush-clang-9.patch} | 38 +++--- build/build-clang/rename_gcov_flush.patch | 38 +++--- ...h => tsan-hang-be41a98ac222-clang-9.patch} | 12 +- .../build-clang/tsan-hang-be41a98ac222.patch | 12 +- ...h => unpoison-thread-stacks-clang-9.patch} | 14 +-- .../build-clang/unpoison-thread-stacks.patch | 14 ++- taskcluster/ci/build/linux.yml | 2 +- taskcluster/ci/fetch/toolchains.yml | 2 +- taskcluster/ci/toolchain/cbindgen.yml | 2 +- taskcluster/ci/toolchain/cctools-port.yml | 8 +- taskcluster/ci/toolchain/clang-tidy.yml | 2 +- taskcluster/ci/toolchain/clang.yml | 52 ++++---- taskcluster/ci/toolchain/dist-toolchains.yml | 2 +- taskcluster/ci/toolchain/fix-stacks.yml | 2 +- taskcluster/ci/toolchain/gn.yml | 2 +- .../ci/toolchain/minidump_stackwalk.yml | 2 +- taskcluster/ci/toolchain/misc.yml | 2 +- 28 files changed, 198 insertions(+), 297 deletions(-) rename build/build-clang/{clang-10-linux64.json => clang-9-linux64.json} (69%) rename build/build-clang/{find_symbolizer_linux_clang_10.patch => find_symbolizer_linux-clang-9.patch} (82%) delete mode 100644 build/build-clang/llvmorg-10-init-5191-ga84b200e604-windows-pgo.patch create mode 100644 build/build-clang/llvmorg-11-init-14017-g02b303321d3-libclang.patch rename build/build-clang/{llvmorg-11-init-4265-g2dcbdba8540_clang_10.patch => llvmorg-11-init-4265-g2dcbdba8540-clang-9.patch} (81%) rename build/build-clang/{rG7e18aeba5062_clang_10.patch => rG7e18aeba5062-clang-9.patch} (93%) rename build/build-clang/{rename_gcov_flush_clang_10.patch => rename_gcov_flush-clang-9.patch} (74%) rename build/build-clang/{tsan-hang-be41a98ac222_clang_10.patch => tsan-hang-be41a98ac222-clang-9.patch} (90%) rename build/build-clang/{unpoison-thread-stacks_clang_10.patch => unpoison-thread-stacks-clang-9.patch} (81%) diff --git a/build/build-clang/clang-10-linux64.json b/build/build-clang/clang-9-linux64.json similarity index 69% rename from build/build-clang/clang-10-linux64.json rename to build/build-clang/clang-9-linux64.json index b79243b2bcb9..afa85b8e7e49 100644 --- a/build/build-clang/clang-10-linux64.json +++ b/build/build-clang/clang-9-linux64.json @@ -13,15 +13,15 @@ "wasi-sysroot": "{MOZ_FETCHES_DIR}/wasi-sysroot", "patches": [ "static-llvm-symbolizer.patch", - "find_symbolizer_linux_clang_10.patch", - "rename_gcov_flush_clang_10.patch", + "find_symbolizer_linux-clang-9.patch", + "rename_gcov_flush-clang-9.patch", "critical_section_on_gcov_flush-rG02ce9d8ef5a8.patch", - "rG7e18aeba5062_clang_10.patch", - "llvmorg-11-init-4265-g2dcbdba8540_clang_10.patch", + "rG7e18aeba5062-clang-9.patch", + "llvmorg-11-init-4265-g2dcbdba8540-clang-9.patch", "android-mangling-error.patch", - "unpoison-thread-stacks_clang_10.patch", + "unpoison-thread-stacks-clang-9.patch", "downgrade-mangling-error.patch", - "tsan-hang-be41a98ac222_clang_10.patch", + "tsan-hang-be41a98ac222-clang-9.patch", "loosen-msvc-detection.patch" ] } diff --git a/build/build-clang/clang-linux64.json b/build/build-clang/clang-linux64.json index b2b7623bdef8..a214f4587b68 100644 --- a/build/build-clang/clang-linux64.json +++ b/build/build-clang/clang-linux64.json @@ -22,6 +22,7 @@ "unpoison-thread-stacks.patch", "downgrade-mangling-error.patch", "tsan-hang-be41a98ac222.patch", + "llvmorg-11-init-14017-g02b303321d3-libclang.patch", "loosen-msvc-detection.patch" ] } diff --git a/build/build-clang/clang-win64.json b/build/build-clang/clang-win64.json index aa464a289757..932942699486 100644 --- a/build/build-clang/clang-win64.json +++ b/build/build-clang/clang-win64.json @@ -12,7 +12,6 @@ "unpoison-thread-stacks.patch", "downgrade-mangling-error.patch", "rG7e18aeba5062.patch", - "llvmorg-10-init-5191-ga84b200e604-windows-pgo.patch", "loosen-msvc-detection.patch" ] } diff --git a/build/build-clang/find_symbolizer_linux_clang_10.patch b/build/build-clang/find_symbolizer_linux-clang-9.patch similarity index 82% rename from build/build-clang/find_symbolizer_linux_clang_10.patch rename to build/build-clang/find_symbolizer_linux-clang-9.patch index 1ddb02024dbe..c511401c3226 100644 --- a/build/build-clang/find_symbolizer_linux_clang_10.patch +++ b/build/build-clang/find_symbolizer_linux-clang-9.patch @@ -6,11 +6,11 @@ cannot expect llvm-symbolizer to be on PATH. Instead, we should try to look it up next to the binary. This patch implements the functionality for Linux only until there is similar functionality provided upstream. -diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp -index 79930d79425..cfb4f90c0d5 100644 ---- a/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp -+++ b/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp -@@ -20,6 +20,10 @@ +diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_file.cc b/compiler-rt/lib/sanitizer_common/sanitizer_file.cc +index cde54bf..8daade1 100644 +--- a/compiler-rt/lib/sanitizer_common/sanitizer_file.cc ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_file.cc +@@ -21,6 +21,10 @@ #include "sanitizer_common.h" #include "sanitizer_file.h" @@ -21,7 +21,7 @@ index 79930d79425..cfb4f90c0d5 100644 namespace __sanitizer { void CatastrophicErrorWrite(const char *buffer, uptr length) { -@@ -194,6 +198,34 @@ char *FindPathToBinary(const char *name) { +@@ -156,6 +160,34 @@ char *FindPathToBinary(const char *name) { if (*end == '\0') break; beg = end + 1; } diff --git a/build/build-clang/find_symbolizer_linux.patch b/build/build-clang/find_symbolizer_linux.patch index c511401c3226..1ddb02024dbe 100644 --- a/build/build-clang/find_symbolizer_linux.patch +++ b/build/build-clang/find_symbolizer_linux.patch @@ -6,11 +6,11 @@ cannot expect llvm-symbolizer to be on PATH. Instead, we should try to look it up next to the binary. This patch implements the functionality for Linux only until there is similar functionality provided upstream. -diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_file.cc b/compiler-rt/lib/sanitizer_common/sanitizer_file.cc -index cde54bf..8daade1 100644 ---- a/compiler-rt/lib/sanitizer_common/sanitizer_file.cc -+++ b/compiler-rt/lib/sanitizer_common/sanitizer_file.cc -@@ -21,6 +21,10 @@ +diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp +index 79930d79425..cfb4f90c0d5 100644 +--- a/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp ++++ b/compiler-rt/lib/sanitizer_common/sanitizer_file.cpp +@@ -20,6 +20,10 @@ #include "sanitizer_common.h" #include "sanitizer_file.h" @@ -21,7 +21,7 @@ index cde54bf..8daade1 100644 namespace __sanitizer { void CatastrophicErrorWrite(const char *buffer, uptr length) { -@@ -156,6 +160,34 @@ char *FindPathToBinary(const char *name) { +@@ -194,6 +198,34 @@ char *FindPathToBinary(const char *name) { if (*end == '\0') break; beg = end + 1; } diff --git a/build/build-clang/llvmorg-10-init-5191-ga84b200e604-windows-pgo.patch b/build/build-clang/llvmorg-10-init-5191-ga84b200e604-windows-pgo.patch deleted file mode 100644 index a40d7565f773..000000000000 --- a/build/build-clang/llvmorg-10-init-5191-ga84b200e604-windows-pgo.patch +++ /dev/null @@ -1,115 +0,0 @@ -[cmake] Changes to get Windows self-host working with PGO - -Fixes quoting of profile arguments to work on Windows -Suppresses adding profile arguments to linker flags when using lld-link -Avoids -fprofile-instr-use being added to rc.exe flags -Removes duplicated adding of -fprofile-instr-use to linker flags (since -r355541) -Move handling LLVM_PROFDATA_FILE to HandleLLVMOptions.cmake - -Differential Revision: https://reviews.llvm.org/D62063 - -llvm-svn: 372209 - -diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt -index b9a10685b99..73f8664cdcf 100644 ---- a/llvm/CMakeLists.txt -+++ b/llvm/CMakeLists.txt -@@ -612,6 +612,9 @@ mark_as_advanced(LLVM_TARGET_TRIPLE_ENV) - set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL - "Enable per-target runtimes directory") - -+set(LLVM_PROFDATA_FILE "" CACHE FILEPATH -+ "Profiling data file to use when compiling in order to improve runtime performance.") -+ - # All options referred to from HandleLLVMOptions have to be specified - # BEFORE this include, otherwise options will not be correctly set on - # first cmake run -@@ -873,17 +876,6 @@ endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS ) - # use export_executable_symbols(target). - set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "") - --set(LLVM_PROFDATA_FILE "" CACHE FILEPATH -- "Profiling data file to use when compiling in order to improve runtime performance.") -- --if(LLVM_PROFDATA_FILE AND EXISTS ${LLVM_PROFDATA_FILE}) -- if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) -- add_definitions("-fprofile-instr-use=${LLVM_PROFDATA_FILE}") -- else() -- message(FATAL_ERROR "LLVM_PROFDATA_FILE can only be specified when compiling with clang") -- endif() --endif() -- - include(AddLLVM) - include(TableGen) - -diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake -index 4425eb91a5f..2e780d56254 100644 ---- a/llvm/cmake/modules/HandleLLVMOptions.cmake -+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake -@@ -846,32 +846,48 @@ string(TOUPPER "${LLVM_BUILD_INSTRUMENTED}" uppercase_LLVM_BUILD_INSTRUMENTED) - - if (LLVM_BUILD_INSTRUMENTED) - if (LLVM_ENABLE_IR_PGO OR uppercase_LLVM_BUILD_INSTRUMENTED STREQUAL "IR") -- append("-fprofile-generate='${LLVM_PROFILE_DATA_DIR}'" -+ append("-fprofile-generate=\"${LLVM_PROFILE_DATA_DIR}\"" - CMAKE_CXX_FLAGS -- CMAKE_C_FLAGS -- CMAKE_EXE_LINKER_FLAGS -- CMAKE_SHARED_LINKER_FLAGS) -+ CMAKE_C_FLAGS) -+ if(NOT LINKER_IS_LLD_LINK) -+ append("-fprofile-generate=\"${LLVM_PROFILE_DATA_DIR}\"" -+ CMAKE_EXE_LINKER_FLAGS -+ CMAKE_SHARED_LINKER_FLAGS) -+ endif() - elseif(uppercase_LLVM_BUILD_INSTRUMENTED STREQUAL "CSIR") -- append("-fcs-profile-generate='${LLVM_CSPROFILE_DATA_DIR}'" -+ append("-fcs-profile-generate=\"${LLVM_CSPROFILE_DATA_DIR}\"" - CMAKE_CXX_FLAGS -- CMAKE_C_FLAGS -- CMAKE_EXE_LINKER_FLAGS -- CMAKE_SHARED_LINKER_FLAGS) -+ CMAKE_C_FLAGS) -+ if(NOT LINKER_IS_LLD_LINK) -+ append("-fcs-profile-generate=\"${LLVM_CSPROFILE_DATA_DIR}\"" -+ CMAKE_EXE_LINKER_FLAGS -+ CMAKE_SHARED_LINKER_FLAGS) -+ endif() - else() -- append("-fprofile-instr-generate='${LLVM_PROFILE_FILE_PATTERN}'" -+ append("-fprofile-instr-generate=\"${LLVM_PROFILE_FILE_PATTERN}\"" - CMAKE_CXX_FLAGS -- CMAKE_C_FLAGS -- CMAKE_EXE_LINKER_FLAGS -- CMAKE_SHARED_LINKER_FLAGS) -+ CMAKE_C_FLAGS) -+ if(NOT LINKER_IS_LLD_LINK) -+ append("-fprofile-instr-generate=\"${LLVM_PROFILE_FILE_PATTERN}\"" -+ CMAKE_EXE_LINKER_FLAGS -+ CMAKE_SHARED_LINKER_FLAGS) -+ endif() - endif() - endif() - --# Need to pass -fprofile-instr-use to linker for context-sensitive PGO --# compilation. - if(LLVM_PROFDATA_FILE AND EXISTS ${LLVM_PROFDATA_FILE}) -- append("-fprofile-instr-use='${LLVM_PROFDATA_FILE}'" -- CMAKE_EXE_LINKER_FLAGS -- CMAKE_SHARED_LINKER_FLAGS) -+ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" ) -+ append("-fprofile-instr-use=\"${LLVM_PROFDATA_FILE}\"" -+ CMAKE_CXX_FLAGS -+ CMAKE_C_FLAGS) -+ if(NOT LINKER_IS_LLD_LINK) -+ append("-fprofile-instr-use=\"${LLVM_PROFDATA_FILE}\"" -+ CMAKE_EXE_LINKER_FLAGS -+ CMAKE_SHARED_LINKER_FLAGS) -+ endif() -+ else() -+ message(FATAL_ERROR "LLVM_PROFDATA_FILE can only be specified when compiling with clang") -+ endif() - endif() - - option(LLVM_BUILD_INSTRUMENTED_COVERAGE "Build LLVM and tools with Code Coverage instrumentation" Off) diff --git a/build/build-clang/llvmorg-11-init-14017-g02b303321d3-libclang.patch b/build/build-clang/llvmorg-11-init-14017-g02b303321d3-libclang.patch new file mode 100644 index 000000000000..301af5246237 --- /dev/null +++ b/build/build-clang/llvmorg-11-init-14017-g02b303321d3-libclang.patch @@ -0,0 +1,16 @@ +[libclang] Remove duplicate dependency on LLVMSupport + +Differential Revision: https://reviews.llvm.org/D79451 + +diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt +index bd0c945a5e1..973655361f7 100644 +--- a/clang/tools/libclang/CMakeLists.txt ++++ b/clang/tools/libclang/CMakeLists.txt +@@ -44,7 +44,6 @@ set(LIBS + clangSema + clangSerialization + clangTooling +- LLVMSupport + ) + + if (CLANG_ENABLE_ARCMT) diff --git a/build/build-clang/llvmorg-11-init-4265-g2dcbdba8540_clang_10.patch b/build/build-clang/llvmorg-11-init-4265-g2dcbdba8540-clang-9.patch similarity index 81% rename from build/build-clang/llvmorg-11-init-4265-g2dcbdba8540_clang_10.patch rename to build/build-clang/llvmorg-11-init-4265-g2dcbdba8540-clang-9.patch index fb487e7801e3..b03ae0640c84 100644 --- a/build/build-clang/llvmorg-11-init-4265-g2dcbdba8540_clang_10.patch +++ b/build/build-clang/llvmorg-11-init-4265-g2dcbdba8540-clang-9.patch @@ -1,8 +1,8 @@ -diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp -index 8aea1e4ec05..a623f4fe589 100644 ---- a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp -+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp -@@ -1016,7 +1016,7 @@ TSAN_INTERCEPTOR(int, pthread_create, +diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc +index 9a184c79798..733decfe52c 100644 +--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc ++++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc +@@ -1021,7 +1021,7 @@ TSAN_INTERCEPTOR(int, pthread_create, TSAN_INTERCEPTOR(int, pthread_join, void *th, void **ret) { SCOPED_INTERCEPTOR_RAW(pthread_join, th, ret); @@ -11,7 +11,7 @@ index 8aea1e4ec05..a623f4fe589 100644 ThreadIgnoreBegin(thr, pc); int res = BLOCK_REAL(pthread_join)(th, ret); ThreadIgnoreEnd(thr, pc); -@@ -1029,8 +1029,8 @@ TSAN_INTERCEPTOR(int, pthread_join, void *th, void **ret) { +@@ -1034,8 +1034,8 @@ TSAN_INTERCEPTOR(int, pthread_join, void *th, void **ret) { DEFINE_REAL_PTHREAD_FUNCTIONS TSAN_INTERCEPTOR(int, pthread_detach, void *th) { @@ -22,7 +22,7 @@ index 8aea1e4ec05..a623f4fe589 100644 int res = REAL(pthread_detach)(th); if (res == 0) { ThreadDetach(thr, pc, tid); -@@ -1050,8 +1050,8 @@ TSAN_INTERCEPTOR(void, pthread_exit, void *retval) { +@@ -1055,8 +1055,8 @@ TSAN_INTERCEPTOR(void, pthread_exit, void *retval) { #if SANITIZER_LINUX TSAN_INTERCEPTOR(int, pthread_tryjoin_np, void *th, void **ret) { @@ -33,7 +33,7 @@ index 8aea1e4ec05..a623f4fe589 100644 ThreadIgnoreBegin(thr, pc); int res = REAL(pthread_tryjoin_np)(th, ret); ThreadIgnoreEnd(thr, pc); -@@ -1064,8 +1064,8 @@ TSAN_INTERCEPTOR(int, pthread_tryjoin_np, void *th, void **ret) { +@@ -1069,8 +1069,8 @@ TSAN_INTERCEPTOR(int, pthread_tryjoin_np, void *th, void **ret) { TSAN_INTERCEPTOR(int, pthread_timedjoin_np, void *th, void **ret, const struct timespec *abstime) { @@ -45,10 +45,10 @@ index 8aea1e4ec05..a623f4fe589 100644 int res = BLOCK_REAL(pthread_timedjoin_np)(th, ret, abstime); ThreadIgnoreEnd(thr, pc); diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.h b/compiler-rt/lib/tsan/rtl/tsan_rtl.h -index c38fc43a9f8..20f7a99157a 100644 +index 3a8231bda9a..30e144fbd00 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl.h +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.h -@@ -775,7 +775,7 @@ int ThreadCreate(ThreadState *thr, uptr pc, uptr uid, bool detached); +@@ -772,7 +772,7 @@ int ThreadCreate(ThreadState *thr, uptr pc, uptr uid, bool detached); void ThreadStart(ThreadState *thr, int tid, tid_t os_id, ThreadType thread_type); void ThreadFinish(ThreadState *thr); @@ -57,10 +57,10 @@ index c38fc43a9f8..20f7a99157a 100644 void ThreadJoin(ThreadState *thr, uptr pc, int tid); void ThreadDetach(ThreadState *thr, uptr pc, int tid); void ThreadFinalize(ThreadState *thr); -diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp -index 0ac1ee99c47..f7068f0d331 100644 ---- a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp -+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp +diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc +index fd95cfed4f5..13e457bd770 100644 +--- a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc ++++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc @@ -285,19 +285,34 @@ void ThreadFinish(ThreadState *thr) { ctx->thread_registry->FinishThread(thr->tid); } diff --git a/build/build-clang/llvmorg-11-init-4265-g2dcbdba8540.patch b/build/build-clang/llvmorg-11-init-4265-g2dcbdba8540.patch index b03ae0640c84..fb487e7801e3 100644 --- a/build/build-clang/llvmorg-11-init-4265-g2dcbdba8540.patch +++ b/build/build-clang/llvmorg-11-init-4265-g2dcbdba8540.patch @@ -1,8 +1,8 @@ -diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc -index 9a184c79798..733decfe52c 100644 ---- a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc -+++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc -@@ -1021,7 +1021,7 @@ TSAN_INTERCEPTOR(int, pthread_create, +diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp +index 8aea1e4ec05..a623f4fe589 100644 +--- a/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp ++++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors_posix.cpp +@@ -1016,7 +1016,7 @@ TSAN_INTERCEPTOR(int, pthread_create, TSAN_INTERCEPTOR(int, pthread_join, void *th, void **ret) { SCOPED_INTERCEPTOR_RAW(pthread_join, th, ret); @@ -11,7 +11,7 @@ index 9a184c79798..733decfe52c 100644 ThreadIgnoreBegin(thr, pc); int res = BLOCK_REAL(pthread_join)(th, ret); ThreadIgnoreEnd(thr, pc); -@@ -1034,8 +1034,8 @@ TSAN_INTERCEPTOR(int, pthread_join, void *th, void **ret) { +@@ -1029,8 +1029,8 @@ TSAN_INTERCEPTOR(int, pthread_join, void *th, void **ret) { DEFINE_REAL_PTHREAD_FUNCTIONS TSAN_INTERCEPTOR(int, pthread_detach, void *th) { @@ -22,7 +22,7 @@ index 9a184c79798..733decfe52c 100644 int res = REAL(pthread_detach)(th); if (res == 0) { ThreadDetach(thr, pc, tid); -@@ -1055,8 +1055,8 @@ TSAN_INTERCEPTOR(void, pthread_exit, void *retval) { +@@ -1050,8 +1050,8 @@ TSAN_INTERCEPTOR(void, pthread_exit, void *retval) { #if SANITIZER_LINUX TSAN_INTERCEPTOR(int, pthread_tryjoin_np, void *th, void **ret) { @@ -33,7 +33,7 @@ index 9a184c79798..733decfe52c 100644 ThreadIgnoreBegin(thr, pc); int res = REAL(pthread_tryjoin_np)(th, ret); ThreadIgnoreEnd(thr, pc); -@@ -1069,8 +1069,8 @@ TSAN_INTERCEPTOR(int, pthread_tryjoin_np, void *th, void **ret) { +@@ -1064,8 +1064,8 @@ TSAN_INTERCEPTOR(int, pthread_tryjoin_np, void *th, void **ret) { TSAN_INTERCEPTOR(int, pthread_timedjoin_np, void *th, void **ret, const struct timespec *abstime) { @@ -45,10 +45,10 @@ index 9a184c79798..733decfe52c 100644 int res = BLOCK_REAL(pthread_timedjoin_np)(th, ret, abstime); ThreadIgnoreEnd(thr, pc); diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.h b/compiler-rt/lib/tsan/rtl/tsan_rtl.h -index 3a8231bda9a..30e144fbd00 100644 +index c38fc43a9f8..20f7a99157a 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl.h +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.h -@@ -772,7 +772,7 @@ int ThreadCreate(ThreadState *thr, uptr pc, uptr uid, bool detached); +@@ -775,7 +775,7 @@ int ThreadCreate(ThreadState *thr, uptr pc, uptr uid, bool detached); void ThreadStart(ThreadState *thr, int tid, tid_t os_id, ThreadType thread_type); void ThreadFinish(ThreadState *thr); @@ -57,10 +57,10 @@ index 3a8231bda9a..30e144fbd00 100644 void ThreadJoin(ThreadState *thr, uptr pc, int tid); void ThreadDetach(ThreadState *thr, uptr pc, int tid); void ThreadFinalize(ThreadState *thr); -diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc -index fd95cfed4f5..13e457bd770 100644 ---- a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc -+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc +diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp +index 0ac1ee99c47..f7068f0d331 100644 +--- a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp ++++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp @@ -285,19 +285,34 @@ void ThreadFinish(ThreadState *thr) { ctx->thread_registry->FinishThread(thr->tid); } diff --git a/build/build-clang/rG7e18aeba5062_clang_10.patch b/build/build-clang/rG7e18aeba5062-clang-9.patch similarity index 93% rename from build/build-clang/rG7e18aeba5062_clang_10.patch rename to build/build-clang/rG7e18aeba5062-clang-9.patch index 0fc39a1b4d49..58947b6dd8ec 100644 --- a/build/build-clang/rG7e18aeba5062_clang_10.patch +++ b/build/build-clang/rG7e18aeba5062-clang-9.patch @@ -15,18 +15,21 @@ with the BB indexing at the top level to make it easier to integrate D69914, but possibly that's not the right choice. Differential Revision: https://reviews.llvm.org/D70376 +--- + llvm/lib/Analysis/LazyValueInfo.cpp | 143 +++++++++------------------- + 1 file changed, 47 insertions(+), 96 deletions(-) diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp -index bad2de9e5f5..33406a75d80 100644 +index 542ff709d47..eb51744aec3 100644 --- a/llvm/lib/Analysis/LazyValueInfo.cpp +++ b/llvm/lib/Analysis/LazyValueInfo.cpp -@@ -136,12 +136,10 @@ namespace { +@@ -132,12 +132,9 @@ namespace { /// A callback value handle updates the cache when values are erased. class LazyValueInfoCache; struct LVIValueHandle final : public CallbackVH { - // Needs to access getValPtr(), which is protected. - friend struct DenseMapInfo; - +- LazyValueInfoCache *Parent; - LVIValueHandle(Value *V, LazyValueInfoCache *P) @@ -34,7 +37,7 @@ index bad2de9e5f5..33406a75d80 100644 : CallbackVH(V), Parent(P) { } void deleted() override; -@@ -155,89 +153,63 @@ namespace { +@@ -151,89 +148,63 @@ namespace { /// This is the cache kept by LazyValueInfo which /// maintains information about queries across the clients' queries. class LazyValueInfoCache { @@ -86,7 +89,7 @@ index bad2de9e5f5..33406a75d80 100644 - else { - auto It = ValueCache.find_as(Val); - if (It == ValueCache.end()) { -- ValueCache[Val] = std::make_unique(Val, this); +- ValueCache[Val] = make_unique(Val, this); - It = ValueCache.find_as(Val); - assert(It != ValueCache.end() && "Val was just added to the map!"); - } @@ -135,12 +138,12 @@ index bad2de9e5f5..33406a75d80 100644 - auto I = ValueCache.find_as(V); - if (I == ValueCache.end()) -- return ValueLatticeElement(); -- auto BBI = I->second->BlockVals.find(BB); -- if (BBI == I->second->BlockVals.end()) + auto LatticeIt = It->second.LatticeElements.find(V); + if (LatticeIt == It->second.LatticeElements.end()) return ValueLatticeElement(); +- auto BBI = I->second->BlockVals.find(BB); +- if (BBI == I->second->BlockVals.end()) +- return ValueLatticeElement(); - return BBI->second; + + return LatticeIt->second; @@ -156,7 +159,7 @@ index bad2de9e5f5..33406a75d80 100644 } /// Inform the cache that a given value has been deleted. -@@ -251,23 +223,18 @@ namespace { +@@ -247,23 +218,18 @@ namespace { /// OldSucc might have (unless also overdefined in NewSucc). This just /// flushes elements from the cache and does not add any. void threadEdgeImpl(BasicBlock *OldSucc,BasicBlock *NewSucc); @@ -186,7 +189,7 @@ index bad2de9e5f5..33406a75d80 100644 } void LVIValueHandle::deleted() { -@@ -277,18 +244,7 @@ void LVIValueHandle::deleted() { +@@ -273,18 +239,7 @@ void LVIValueHandle::deleted() { } void LazyValueInfoCache::eraseBlock(BasicBlock *BB) { @@ -206,7 +209,7 @@ index bad2de9e5f5..33406a75d80 100644 } void LazyValueInfoCache::threadEdgeImpl(BasicBlock *OldSucc, -@@ -306,10 +262,11 @@ void LazyValueInfoCache::threadEdgeImpl(BasicBlock *OldSucc, +@@ -302,10 +257,11 @@ void LazyValueInfoCache::threadEdgeImpl(BasicBlock *OldSucc, std::vector worklist; worklist.push_back(OldSucc); @@ -221,7 +224,7 @@ index bad2de9e5f5..33406a75d80 100644 // Use a worklist to perform a depth-first search of OldSucc's successors. // NOTE: We do not need a visited list since any blocks we have already -@@ -323,10 +280,10 @@ void LazyValueInfoCache::threadEdgeImpl(BasicBlock *OldSucc, +@@ -319,10 +275,10 @@ void LazyValueInfoCache::threadEdgeImpl(BasicBlock *OldSucc, if (ToUpdate == NewSucc) continue; // If a value was marked overdefined in OldSucc, and is here too... @@ -235,7 +238,7 @@ index bad2de9e5f5..33406a75d80 100644 bool changed = false; for (Value *V : ValsToClear) { -@@ -336,11 +293,6 @@ void LazyValueInfoCache::threadEdgeImpl(BasicBlock *OldSucc, +@@ -332,11 +288,6 @@ void LazyValueInfoCache::threadEdgeImpl(BasicBlock *OldSucc, // If we removed anything, then we potentially need to update // blocks successors too. changed = true; @@ -247,3 +250,6 @@ index bad2de9e5f5..33406a75d80 100644 } if (!changed) continue; +-- +2.24.0 + diff --git a/build/build-clang/rG7e18aeba5062.patch b/build/build-clang/rG7e18aeba5062.patch index 58947b6dd8ec..0fc39a1b4d49 100644 --- a/build/build-clang/rG7e18aeba5062.patch +++ b/build/build-clang/rG7e18aeba5062.patch @@ -15,21 +15,18 @@ with the BB indexing at the top level to make it easier to integrate D69914, but possibly that's not the right choice. Differential Revision: https://reviews.llvm.org/D70376 ---- - llvm/lib/Analysis/LazyValueInfo.cpp | 143 +++++++++------------------- - 1 file changed, 47 insertions(+), 96 deletions(-) diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp -index 542ff709d47..eb51744aec3 100644 +index bad2de9e5f5..33406a75d80 100644 --- a/llvm/lib/Analysis/LazyValueInfo.cpp +++ b/llvm/lib/Analysis/LazyValueInfo.cpp -@@ -132,12 +132,9 @@ namespace { +@@ -136,12 +136,10 @@ namespace { /// A callback value handle updates the cache when values are erased. class LazyValueInfoCache; struct LVIValueHandle final : public CallbackVH { - // Needs to access getValPtr(), which is protected. - friend struct DenseMapInfo; -- + LazyValueInfoCache *Parent; - LVIValueHandle(Value *V, LazyValueInfoCache *P) @@ -37,7 +34,7 @@ index 542ff709d47..eb51744aec3 100644 : CallbackVH(V), Parent(P) { } void deleted() override; -@@ -151,89 +148,63 @@ namespace { +@@ -155,89 +153,63 @@ namespace { /// This is the cache kept by LazyValueInfo which /// maintains information about queries across the clients' queries. class LazyValueInfoCache { @@ -89,7 +86,7 @@ index 542ff709d47..eb51744aec3 100644 - else { - auto It = ValueCache.find_as(Val); - if (It == ValueCache.end()) { -- ValueCache[Val] = make_unique(Val, this); +- ValueCache[Val] = std::make_unique(Val, this); - It = ValueCache.find_as(Val); - assert(It != ValueCache.end() && "Val was just added to the map!"); - } @@ -138,12 +135,12 @@ index 542ff709d47..eb51744aec3 100644 - auto I = ValueCache.find_as(V); - if (I == ValueCache.end()) +- return ValueLatticeElement(); +- auto BBI = I->second->BlockVals.find(BB); +- if (BBI == I->second->BlockVals.end()) + auto LatticeIt = It->second.LatticeElements.find(V); + if (LatticeIt == It->second.LatticeElements.end()) return ValueLatticeElement(); -- auto BBI = I->second->BlockVals.find(BB); -- if (BBI == I->second->BlockVals.end()) -- return ValueLatticeElement(); - return BBI->second; + + return LatticeIt->second; @@ -159,7 +156,7 @@ index 542ff709d47..eb51744aec3 100644 } /// Inform the cache that a given value has been deleted. -@@ -247,23 +218,18 @@ namespace { +@@ -251,23 +223,18 @@ namespace { /// OldSucc might have (unless also overdefined in NewSucc). This just /// flushes elements from the cache and does not add any. void threadEdgeImpl(BasicBlock *OldSucc,BasicBlock *NewSucc); @@ -189,7 +186,7 @@ index 542ff709d47..eb51744aec3 100644 } void LVIValueHandle::deleted() { -@@ -273,18 +239,7 @@ void LVIValueHandle::deleted() { +@@ -277,18 +244,7 @@ void LVIValueHandle::deleted() { } void LazyValueInfoCache::eraseBlock(BasicBlock *BB) { @@ -209,7 +206,7 @@ index 542ff709d47..eb51744aec3 100644 } void LazyValueInfoCache::threadEdgeImpl(BasicBlock *OldSucc, -@@ -302,10 +257,11 @@ void LazyValueInfoCache::threadEdgeImpl(BasicBlock *OldSucc, +@@ -306,10 +262,11 @@ void LazyValueInfoCache::threadEdgeImpl(BasicBlock *OldSucc, std::vector worklist; worklist.push_back(OldSucc); @@ -224,7 +221,7 @@ index 542ff709d47..eb51744aec3 100644 // Use a worklist to perform a depth-first search of OldSucc's successors. // NOTE: We do not need a visited list since any blocks we have already -@@ -319,10 +275,10 @@ void LazyValueInfoCache::threadEdgeImpl(BasicBlock *OldSucc, +@@ -323,10 +280,10 @@ void LazyValueInfoCache::threadEdgeImpl(BasicBlock *OldSucc, if (ToUpdate == NewSucc) continue; // If a value was marked overdefined in OldSucc, and is here too... @@ -238,7 +235,7 @@ index 542ff709d47..eb51744aec3 100644 bool changed = false; for (Value *V : ValsToClear) { -@@ -332,11 +288,6 @@ void LazyValueInfoCache::threadEdgeImpl(BasicBlock *OldSucc, +@@ -336,11 +293,6 @@ void LazyValueInfoCache::threadEdgeImpl(BasicBlock *OldSucc, // If we removed anything, then we potentially need to update // blocks successors too. changed = true; @@ -250,6 +247,3 @@ index 542ff709d47..eb51744aec3 100644 } if (!changed) continue; --- -2.24.0 - diff --git a/build/build-clang/rename_gcov_flush_clang_10.patch b/build/build-clang/rename_gcov_flush-clang-9.patch similarity index 74% rename from build/build-clang/rename_gcov_flush_clang_10.patch rename to build/build-clang/rename_gcov_flush-clang-9.patch index 1da3b653a54f..c707c4423f76 100644 --- a/build/build-clang/rename_gcov_flush_clang_10.patch +++ b/build/build-clang/rename_gcov_flush-clang-9.patch @@ -1,21 +1,9 @@ -diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp -index 220bc8f9835..4f7ce485777 100644 ---- a/clang/lib/Driver/ToolChains/Darwin.cpp -+++ b/clang/lib/Driver/ToolChains/Darwin.cpp -@@ -1143,7 +1143,7 @@ void Darwin::addProfileRTLibs(const ArgList &Args, - // runtime's functionality. - if (hasExportSymbolDirective(Args)) { - if (ForGCOV) { -- addExportedSymbol(CmdArgs, "___gcov_flush"); -+ addExportedSymbol(CmdArgs, "___custom_llvm_gcov_flush"); - addExportedSymbol(CmdArgs, "_flush_fn_list"); - addExportedSymbol(CmdArgs, "_writeout_fn_list"); - } else { +Index: compiler-rt/lib/profile/GCDAProfiling.c +=================================================================== diff --git a/compiler-rt/lib/profile/GCDAProfiling.c b/compiler-rt/lib/profile/GCDAProfiling.c -index 498c05900bf..b7257db10e7 100644 --- a/compiler-rt/lib/profile/GCDAProfiling.c +++ b/compiler-rt/lib/profile/GCDAProfiling.c -@@ -619,7 +619,7 @@ void llvm_register_flush_function(fn_ptr fn) { +@@ -619,7 +619,7 @@ fn_list_insert(&flush_fn_list, fn); } @@ -24,14 +12,11 @@ index 498c05900bf..b7257db10e7 100644 struct fn_node* curr = flush_fn_list.head; while (curr) { -diff --git a/compiler-rt/test/tsan/pthread_atfork_deadlock2.c b/compiler-rt/test/tsan/pthread_atfork_deadlock2.c -new file mode 100644 -index 00000000000..e69de29bb2d diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp -index bf3e4ed3e31..37bdcfaeab8 100644 +index 9af64ed332c..bcebe303ff4 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp -@@ -656,7 +656,7 @@ void GCOVProfiler::AddFlushBeforeForkAndExec() { +@@ -647,7 +647,7 @@ for (auto I : ForkAndExecs) { IRBuilder<> Builder(I); FunctionType *FTy = FunctionType::get(Builder.getVoidTy(), {}, false); @@ -40,3 +25,16 @@ index bf3e4ed3e31..37bdcfaeab8 100644 Builder.CreateCall(GCOVFlush); I->getParent()->splitBasicBlock(I); } +diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp +index e113f9a679..b3a07b18c0 100644 +--- a/clang/lib/Driver/ToolChains/Darwin.cpp ++++ b/clang/lib/Driver/ToolChains/Darwin.cpp +@@ -1122,7 +1122,7 @@ + // runtime's functionality. + if (hasExportSymbolDirective(Args)) { + if (needsGCovInstrumentation(Args)) { +- addExportedSymbol(CmdArgs, "___gcov_flush"); ++ addExportedSymbol(CmdArgs, "___custom_llvm_gcov_flush"); + addExportedSymbol(CmdArgs, "_flush_fn_list"); + addExportedSymbol(CmdArgs, "_writeout_fn_list"); + } else { diff --git a/build/build-clang/rename_gcov_flush.patch b/build/build-clang/rename_gcov_flush.patch index c707c4423f76..1da3b653a54f 100644 --- a/build/build-clang/rename_gcov_flush.patch +++ b/build/build-clang/rename_gcov_flush.patch @@ -1,9 +1,21 @@ -Index: compiler-rt/lib/profile/GCDAProfiling.c -=================================================================== +diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp +index 220bc8f9835..4f7ce485777 100644 +--- a/clang/lib/Driver/ToolChains/Darwin.cpp ++++ b/clang/lib/Driver/ToolChains/Darwin.cpp +@@ -1143,7 +1143,7 @@ void Darwin::addProfileRTLibs(const ArgList &Args, + // runtime's functionality. + if (hasExportSymbolDirective(Args)) { + if (ForGCOV) { +- addExportedSymbol(CmdArgs, "___gcov_flush"); ++ addExportedSymbol(CmdArgs, "___custom_llvm_gcov_flush"); + addExportedSymbol(CmdArgs, "_flush_fn_list"); + addExportedSymbol(CmdArgs, "_writeout_fn_list"); + } else { diff --git a/compiler-rt/lib/profile/GCDAProfiling.c b/compiler-rt/lib/profile/GCDAProfiling.c +index 498c05900bf..b7257db10e7 100644 --- a/compiler-rt/lib/profile/GCDAProfiling.c +++ b/compiler-rt/lib/profile/GCDAProfiling.c -@@ -619,7 +619,7 @@ +@@ -619,7 +619,7 @@ void llvm_register_flush_function(fn_ptr fn) { fn_list_insert(&flush_fn_list, fn); } @@ -12,11 +24,14 @@ diff --git a/compiler-rt/lib/profile/GCDAProfiling.c b/compiler-rt/lib/profile/G struct fn_node* curr = flush_fn_list.head; while (curr) { +diff --git a/compiler-rt/test/tsan/pthread_atfork_deadlock2.c b/compiler-rt/test/tsan/pthread_atfork_deadlock2.c +new file mode 100644 +index 00000000000..e69de29bb2d diff --git a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp -index 9af64ed332c..bcebe303ff4 100644 +index bf3e4ed3e31..37bdcfaeab8 100644 --- a/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp -@@ -647,7 +647,7 @@ +@@ -656,7 +656,7 @@ void GCOVProfiler::AddFlushBeforeForkAndExec() { for (auto I : ForkAndExecs) { IRBuilder<> Builder(I); FunctionType *FTy = FunctionType::get(Builder.getVoidTy(), {}, false); @@ -25,16 +40,3 @@ index 9af64ed332c..bcebe303ff4 100644 Builder.CreateCall(GCOVFlush); I->getParent()->splitBasicBlock(I); } -diff --git a/clang/lib/Driver/ToolChains/Darwin.cpp b/clang/lib/Driver/ToolChains/Darwin.cpp -index e113f9a679..b3a07b18c0 100644 ---- a/clang/lib/Driver/ToolChains/Darwin.cpp -+++ b/clang/lib/Driver/ToolChains/Darwin.cpp -@@ -1122,7 +1122,7 @@ - // runtime's functionality. - if (hasExportSymbolDirective(Args)) { - if (needsGCovInstrumentation(Args)) { -- addExportedSymbol(CmdArgs, "___gcov_flush"); -+ addExportedSymbol(CmdArgs, "___custom_llvm_gcov_flush"); - addExportedSymbol(CmdArgs, "_flush_fn_list"); - addExportedSymbol(CmdArgs, "_writeout_fn_list"); - } else { diff --git a/build/build-clang/tsan-hang-be41a98ac222_clang_10.patch b/build/build-clang/tsan-hang-be41a98ac222-clang-9.patch similarity index 90% rename from build/build-clang/tsan-hang-be41a98ac222_clang_10.patch rename to build/build-clang/tsan-hang-be41a98ac222-clang-9.patch index e65335a1fd61..3e148e52b39a 100644 --- a/build/build-clang/tsan-hang-be41a98ac222_clang_10.patch +++ b/build/build-clang/tsan-hang-be41a98ac222-clang-9.patch @@ -15,11 +15,11 @@ in the pthread_atfork callbacks to prevent the deadlock. 2 files changed, 58 insertions(+) create mode 100644 compiler-rt/test/tsan/pthread_atfork_deadlock2.c -diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp -index 3f3c0cce119..5e324a0a5fd 100644 ---- a/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp -+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp -@@ -494,14 +494,23 @@ int Finalize(ThreadState *thr) { +diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.cc b/compiler-rt/lib/tsan/rtl/tsan_rtl.ccc +index fe469faad2a2..13c9b770f50a 100644 +--- a/compiler-rt/lib/tsan/rtl/tsan_rtl.cc ++++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.cc +@@ -495,14 +495,23 @@ int Finalize(ThreadState *thr) { void ForkBefore(ThreadState *thr, uptr pc) { ctx->thread_registry->Lock(); ctx->report_mtx.Lock(); @@ -45,7 +45,7 @@ index 3f3c0cce119..5e324a0a5fd 100644 diff --git a/compiler-rt/test/tsan/pthread_atfork_deadlock2.c b/compiler-rt/test/tsan/pthread_atfork_deadlock2.c new file mode 100644 -index 00000000000..700507c1e63 +index 000000000000..700507c1e637 --- /dev/null +++ b/compiler-rt/test/tsan/pthread_atfork_deadlock2.c @@ -0,0 +1,49 @@ diff --git a/build/build-clang/tsan-hang-be41a98ac222.patch b/build/build-clang/tsan-hang-be41a98ac222.patch index 3e148e52b39a..e65335a1fd61 100644 --- a/build/build-clang/tsan-hang-be41a98ac222.patch +++ b/build/build-clang/tsan-hang-be41a98ac222.patch @@ -15,11 +15,11 @@ in the pthread_atfork callbacks to prevent the deadlock. 2 files changed, 58 insertions(+) create mode 100644 compiler-rt/test/tsan/pthread_atfork_deadlock2.c -diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.cc b/compiler-rt/lib/tsan/rtl/tsan_rtl.ccc -index fe469faad2a2..13c9b770f50a 100644 ---- a/compiler-rt/lib/tsan/rtl/tsan_rtl.cc -+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.cc -@@ -495,14 +495,23 @@ int Finalize(ThreadState *thr) { +diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp +index 3f3c0cce119..5e324a0a5fd 100644 +--- a/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp ++++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp +@@ -494,14 +494,23 @@ int Finalize(ThreadState *thr) { void ForkBefore(ThreadState *thr, uptr pc) { ctx->thread_registry->Lock(); ctx->report_mtx.Lock(); @@ -45,7 +45,7 @@ index fe469faad2a2..13c9b770f50a 100644 diff --git a/compiler-rt/test/tsan/pthread_atfork_deadlock2.c b/compiler-rt/test/tsan/pthread_atfork_deadlock2.c new file mode 100644 -index 000000000000..700507c1e637 +index 00000000000..700507c1e63 --- /dev/null +++ b/compiler-rt/test/tsan/pthread_atfork_deadlock2.c @@ -0,0 +1,49 @@ diff --git a/build/build-clang/unpoison-thread-stacks_clang_10.patch b/build/build-clang/unpoison-thread-stacks-clang-9.patch similarity index 81% rename from build/build-clang/unpoison-thread-stacks_clang_10.patch rename to build/build-clang/unpoison-thread-stacks-clang-9.patch index 563fa1d7bfd4..2fb7cafd9049 100644 --- a/build/build-clang/unpoison-thread-stacks_clang_10.patch +++ b/build/build-clang/unpoison-thread-stacks-clang-9.patch @@ -12,11 +12,9 @@ upstream in a different form, as the TLS handler `asan_thread_exit`, but that variant causes failures in our test suite, so revert the TLS handler in favor of the interceptor approach from the first patch. -diff --git a/compiler-rt/lib/asan/asan_win.cpp b/compiler-rt/lib/asan/asan_win.cpp -index 417892aaedd..5fe86db44f4 100644 ---- a/compiler-rt/lib/asan/asan_win.cpp -+++ b/compiler-rt/lib/asan/asan_win.cpp -@@ -154,6 +154,14 @@ INTERCEPTOR_WINAPI(HANDLE, CreateThread, LPSECURITY_ATTRIBUTES security, +--- a/compiler-rt/lib/asan/asan_win.cc ++++ b/compiler-rt/lib/asan/asan_win.cc +@@ -154,6 +154,14 @@ thr_flags, tid); } @@ -31,7 +29,7 @@ index 417892aaedd..5fe86db44f4 100644 // }}} namespace __asan { -@@ -168,7 +176,9 @@ void InitializePlatformInterceptors() { +@@ -168,7 +176,9 @@ ASAN_INTERCEPT_FUNC(CreateThread); ASAN_INTERCEPT_FUNC(SetUnhandledExceptionFilter); @@ -42,7 +40,7 @@ index 417892aaedd..5fe86db44f4 100644 #ifdef _WIN64 ASAN_INTERCEPT_FUNC(__C_specific_handler); #else -@@ -380,19 +390,6 @@ __declspec(allocate(".CRT$XLAB")) void(NTAPI *__asan_tls_init)( +@@ -380,19 +390,6 @@ void *, unsigned long, void *) = asan_thread_init; #endif @@ -55,7 +53,7 @@ index 417892aaedd..5fe86db44f4 100644 - } -} - --#pragma section(".CRT$XLY", long, read) +-#pragma section(".CRT$XLY", long, read) // NOLINT -__declspec(allocate(".CRT$XLY")) void(NTAPI *__asan_tls_exit)( - void *, unsigned long, void *) = asan_thread_exit; - diff --git a/build/build-clang/unpoison-thread-stacks.patch b/build/build-clang/unpoison-thread-stacks.patch index 2fb7cafd9049..563fa1d7bfd4 100644 --- a/build/build-clang/unpoison-thread-stacks.patch +++ b/build/build-clang/unpoison-thread-stacks.patch @@ -12,9 +12,11 @@ upstream in a different form, as the TLS handler `asan_thread_exit`, but that variant causes failures in our test suite, so revert the TLS handler in favor of the interceptor approach from the first patch. ---- a/compiler-rt/lib/asan/asan_win.cc -+++ b/compiler-rt/lib/asan/asan_win.cc -@@ -154,6 +154,14 @@ +diff --git a/compiler-rt/lib/asan/asan_win.cpp b/compiler-rt/lib/asan/asan_win.cpp +index 417892aaedd..5fe86db44f4 100644 +--- a/compiler-rt/lib/asan/asan_win.cpp ++++ b/compiler-rt/lib/asan/asan_win.cpp +@@ -154,6 +154,14 @@ INTERCEPTOR_WINAPI(HANDLE, CreateThread, LPSECURITY_ATTRIBUTES security, thr_flags, tid); } @@ -29,7 +31,7 @@ the interceptor approach from the first patch. // }}} namespace __asan { -@@ -168,7 +176,9 @@ +@@ -168,7 +176,9 @@ void InitializePlatformInterceptors() { ASAN_INTERCEPT_FUNC(CreateThread); ASAN_INTERCEPT_FUNC(SetUnhandledExceptionFilter); @@ -40,7 +42,7 @@ the interceptor approach from the first patch. #ifdef _WIN64 ASAN_INTERCEPT_FUNC(__C_specific_handler); #else -@@ -380,19 +390,6 @@ +@@ -380,19 +390,6 @@ __declspec(allocate(".CRT$XLAB")) void(NTAPI *__asan_tls_init)( void *, unsigned long, void *) = asan_thread_init; #endif @@ -53,7 +55,7 @@ the interceptor approach from the first patch. - } -} - --#pragma section(".CRT$XLY", long, read) // NOLINT +-#pragma section(".CRT$XLY", long, read) -__declspec(allocate(".CRT$XLY")) void(NTAPI *__asan_tls_exit)( - void *, unsigned long, void *) = asan_thread_exit; - diff --git a/taskcluster/ci/build/linux.yml b/taskcluster/ci/build/linux.yml index 8685a4b579f3..6e4568f813e3 100644 --- a/taskcluster/ci/build/linux.yml +++ b/taskcluster/ci/build/linux.yml @@ -1277,7 +1277,7 @@ linux64-ccov/opt: need-xvfb: true fetches: toolchain: - - linux64-clang-9 + - linux64-clang - linux64-rust - linux64-gcc-7 - linux64-cbindgen diff --git a/taskcluster/ci/fetch/toolchains.yml b/taskcluster/ci/fetch/toolchains.yml index b57ebd82eaaa..62d9afec4bad 100644 --- a/taskcluster/ci/fetch/toolchains.yml +++ b/taskcluster/ci/fetch/toolchains.yml @@ -322,7 +322,7 @@ llvm-for-dsymutil: fetch: type: git repo: https://github.com/llvm/llvm-project - revision: 3b7811f6441be13c9f613f81ef93297d231b4f8e + revision: d32170dbd5b0d54436537b6b75beaf44324e0c28 rust-size: description: rust-size source code diff --git a/taskcluster/ci/toolchain/cbindgen.yml b/taskcluster/ci/toolchain/cbindgen.yml index 678648ac0809..628ab9801396 100644 --- a/taskcluster/ci/toolchain/cbindgen.yml +++ b/taskcluster/ci/toolchain/cbindgen.yml @@ -43,7 +43,7 @@ macosx64-cbindgen: tooltool-downloads: internal fetches: toolchain: - - linux64-cctools-port + - linux64-cctools-clang-9-port - linux64-clang-9 - linux64-llvm-dsymutil - linux64-rust-macos-1.41 diff --git a/taskcluster/ci/toolchain/cctools-port.yml b/taskcluster/ci/toolchain/cctools-port.yml index 32d376e1bec1..e407b6f6a93d 100644 --- a/taskcluster/ci/toolchain/cctools-port.yml +++ b/taskcluster/ci/toolchain/cctools-port.yml @@ -12,9 +12,9 @@ job-defaults: - cctools-port - libtapi -linux64-cctools-port: +linux64-cctools-clang-9-port: treeherder: - symbol: TL(cctools) + symbol: TL(cctools-clang-9) run: script: build-cctools-port.sh toolchain-artifact: public/build/cctools.tar.xz @@ -24,9 +24,9 @@ linux64-cctools-port: - linux64-clang-9 - linux64-binutils -linux64-cctools-clang-10-port: +linux64-cctools-port: treeherder: - symbol: TL(cctools-clang-10) + symbol: TL(cctools) run: script: build-cctools-port.sh toolchain-artifact: public/build/cctools.tar.xz diff --git a/taskcluster/ci/toolchain/clang-tidy.yml b/taskcluster/ci/toolchain/clang-tidy.yml index 2db556d9716d..01e188be6736 100644 --- a/taskcluster/ci/toolchain/clang-tidy.yml +++ b/taskcluster/ci/toolchain/clang-tidy.yml @@ -63,7 +63,7 @@ macosx64-clang-tidy: fetches: toolchain: - linux64-binutils - - linux64-cctools-clang-10-port + - linux64-cctools-port - linux64-clang-10 - linux64-gcc-7 - linux64-node diff --git a/taskcluster/ci/toolchain/clang.yml b/taskcluster/ci/toolchain/clang.yml index 11ad00db772a..c57ab0d243ca 100644 --- a/taskcluster/ci/toolchain/clang.yml +++ b/taskcluster/ci/toolchain/clang.yml @@ -55,10 +55,9 @@ linux64-clang-9: using: toolchain-script script: build-clang.sh arguments: - - 'build/build-clang/clang-linux64.json' + - 'build/build-clang/clang-9-linux64.json' resources: - - 'build/build-clang/clang-linux64.json' - toolchain-alias: linux64-clang + - 'build/build-clang/clang-9-linux64.json' toolchain-artifact: public/build/clang.tar.xz fetches: fetch: @@ -117,10 +116,10 @@ linux64-clang-9-mingw-x64: - linux64-gcc-7 - linux64-binutils -linux64-clang-9-android-cross: - description: "Clang 9 toolchain build" +linux64-clang-10-android-cross: + description: "Clang 10 toolchain build" treeherder: - symbol: TL(clang9-android) + symbol: TL(clang10-android) run: using: toolchain-script script: build-clang.sh @@ -132,16 +131,16 @@ linux64-clang-9-android-cross: toolchain-artifact: public/build/clang.tar.xz fetches: fetch: - - clang-9 + - clang-10 toolchain: - linux64-binutils - linux64-gcc-7 - linux64-android-ndk-linux-repack -linux64-clang-9-aarch64-cross: - description: "Clang 9 toolchain build with aarch64 runtime" +linux64-clang-10-aarch64-cross: + description: "Clang 10 toolchain build with aarch64 runtime" treeherder: - symbol: TL(clang9-aarch64) + symbol: TL(clang10-aarch64) worker-type: b-linux worker: max-run-time: 5400 @@ -157,15 +156,15 @@ linux64-clang-9-aarch64-cross: toolchain-artifact: public/build/clang.tar.xz fetches: fetch: - - clang-9 + - clang-10 toolchain: - linux64-binutils - linux64-gcc-7 -linux64-clang-9-macosx-cross: - description: "Clang 9 toolchain build with MacOS Compiler RT libs" +linux64-clang-10-macosx-cross: + description: "Clang 10 toolchain build with MacOS Compiler RT libs" treeherder: - symbol: TL(clang9-macosx-cross) + symbol: TL(clang10-macosx-cross) worker-type: b-linux worker: max-run-time: 3600 @@ -183,17 +182,17 @@ linux64-clang-9-macosx-cross: tooltool-downloads: internal fetches: fetch: - - clang-9 + - clang-10 toolchain: - linux64-binutils - linux64-cctools-port - - linux64-clang-9 + - linux64-clang-10 - linux64-gcc-7 -linux64-clang-9-win-cross: - description: "Clang 9 toolchain build with Windows Compiler RT libs" +linux64-clang-10-win-cross: + description: "Clang 10 toolchain build with Windows Compiler RT libs" treeherder: - symbol: TL(clang9-win-cross) + symbol: TL(clang10-win-cross) worker-type: b-linux worker: max-run-time: 600 @@ -205,7 +204,7 @@ linux64-clang-9-win-cross: win64-clang-cl-2stage: toolchain-win64-clang-cl-2stage fetches: toolchain: - - linux64-clang-9 + - linux64-clang-10 win64-clang-cl-2stage: - artifact: clang.tar.bz2 extract: false @@ -219,9 +218,10 @@ linux64-clang-10: using: toolchain-script script: build-clang.sh arguments: - - 'build/build-clang/clang-10-linux64.json' + - 'build/build-clang/clang-linux64.json' resources: - - 'build/build-clang/clang-10-linux64.json' + - 'build/build-clang/clang-linux64.json' + toolchain-alias: linux64-clang toolchain-artifact: public/build/clang.tar.xz fetches: fetch: @@ -254,11 +254,11 @@ macosx64-clang: toolchain-artifact: public/build/clang.tar.xz fetches: fetch: - - clang-9 + - clang-10 toolchain: - linux64-binutils - linux64-cctools-port - - linux64-clang-9 + - linux64-clang-10 - linux64-gcc-7 - linux64-node @@ -281,7 +281,7 @@ win64-clang-cl: tooltool-downloads: internal fetches: fetch: - - clang-9 + - clang-10 - cmake - ninja @@ -304,6 +304,6 @@ win64-clang-cl-2stage: tooltool-downloads: internal fetches: fetch: - - clang-9 + - clang-10 - cmake - ninja diff --git a/taskcluster/ci/toolchain/dist-toolchains.yml b/taskcluster/ci/toolchain/dist-toolchains.yml index 1be2756ac155..35ccd76cddf1 100644 --- a/taskcluster/ci/toolchain/dist-toolchains.yml +++ b/taskcluster/ci/toolchain/dist-toolchains.yml @@ -22,7 +22,7 @@ clang-dist-toolchain: toolchain-artifact: public/build/clang-dist-toolchain.tar.xz fetches: toolchain: - - linux64-clang-9 + - linux64-clang-10 - linux64-sccache rustc-dist-toolchain: diff --git a/taskcluster/ci/toolchain/fix-stacks.yml b/taskcluster/ci/toolchain/fix-stacks.yml index 144cb2bf2442..7c456a7053ea 100644 --- a/taskcluster/ci/toolchain/fix-stacks.yml +++ b/taskcluster/ci/toolchain/fix-stacks.yml @@ -42,7 +42,7 @@ macosx64-fix-stacks: tooltool-downloads: internal fetches: toolchain: - - linux64-cctools-port + - linux64-cctools-clang-9-port - linux64-clang-9 - linux64-rust-macos diff --git a/taskcluster/ci/toolchain/gn.yml b/taskcluster/ci/toolchain/gn.yml index 85e002ca627e..08ec3f792082 100644 --- a/taskcluster/ci/toolchain/gn.yml +++ b/taskcluster/ci/toolchain/gn.yml @@ -40,7 +40,7 @@ macosx64-gn: tooltool-downloads: internal fetches: toolchain: - - linux64-cctools-port + - linux64-cctools-clang-9-port - linux64-clang-9 win32-gn: diff --git a/taskcluster/ci/toolchain/minidump_stackwalk.yml b/taskcluster/ci/toolchain/minidump_stackwalk.yml index 45f58f42f114..906590196143 100644 --- a/taskcluster/ci/toolchain/minidump_stackwalk.yml +++ b/taskcluster/ci/toolchain/minidump_stackwalk.yml @@ -48,7 +48,7 @@ macosx64-minidump-stackwalk: tooltool-downloads: internal fetches: toolchain: - - linux64-cctools-port + - linux64-cctools-clang-9-port - linux64-clang-9 - linux64-rust-macos-1.41 diff --git a/taskcluster/ci/toolchain/misc.yml b/taskcluster/ci/toolchain/misc.yml index 48089ab85b90..e30c94cd7ec4 100644 --- a/taskcluster/ci/toolchain/misc.yml +++ b/taskcluster/ci/toolchain/misc.yml @@ -150,7 +150,7 @@ wasi-sysroot: toolchain-artifact: public/build/wasi-sysroot.tar.xz fetches: fetch: - - clang-9 + - clang-10 - wasi-sdk toolchain: - linux64-binutils