Bug 1603436 - Rename clang patch (critical_section_on_gcov_flush.patch) to make easier the switch to LLVM 10 r=dmajor
authorCalixte Denizet <cdenizet@mozilla.com>
Thu, 12 Dec 2019 22:13:04 +0000
changeset 507057 1054b841f0fbb1358c00089a592fd00bbc381809
parent 507056 f23128d93320d080700b559277b8a034744adb8b
child 507058 37297e07c67b8cb6dc9c4c9929bc29dfde753e4c
push id36922
push userncsoregi@mozilla.com
push dateMon, 16 Dec 2019 17:21:47 +0000
treeherdermozilla-central@27d0d6cc2131 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdmajor
bugs1603436
milestone73.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1603436 - Rename clang patch (critical_section_on_gcov_flush.patch) to make easier the switch to LLVM 10 r=dmajor Cherry-picked from: https://github.com/llvm/llvm-project/commit/02ce9d8ef5a84bc884de4105eae5f8736ef67634. Differential Revision: https://phabricator.services.mozilla.com/D56945
build/build-clang/clang-7-linux64.json
build/build-clang/clang-android.json
build/build-clang/clang-linux64-aarch64-cross.json
build/build-clang/clang-linux64-cross.json
build/build-clang/clang-linux64.json
build/build-clang/clang-macosx64.json
build/build-clang/critical_section_on_gcov_flush-rG02ce9d8ef5a8.patch
build/build-clang/critical_section_on_gcov_flush.patch
--- a/build/build-clang/clang-7-linux64.json
+++ b/build/build-clang/clang-7-linux64.json
@@ -7,13 +7,13 @@
     "gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
     "cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
     "cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
     "as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
     "patches": [
       "static-llvm-symbolizer.patch",
       "find_symbolizer_linux.patch",
       "rename_gcov_flush_7.patch",
-      "critical_section_on_gcov_flush.patch",
+      "critical_section_on_gcov_flush-rG02ce9d8ef5a8.patch",
       "r350774.patch",
       "android-mangling-error.patch"
     ]
 }
--- a/build/build-clang/clang-android.json
+++ b/build/build-clang/clang-android.json
@@ -45,13 +45,13 @@
         ],
         "api_level": 21
       }
     },
     "patches": [
       "static-llvm-symbolizer.patch",
       "find_symbolizer_linux.patch",
       "rename_gcov_flush.patch",
-      "critical_section_on_gcov_flush.patch",
+      "critical_section_on_gcov_flush-rG02ce9d8ef5a8.patch",
       "rG7e18aeba5062.patch",
       "revert-r362047-and-r362065.patch"
     ]
 }
--- a/build/build-clang/clang-linux64-aarch64-cross.json
+++ b/build/build-clang/clang-linux64-aarch64-cross.json
@@ -10,13 +10,13 @@
     "as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
     "extra_targets": [
       "aarch64-unknown-linux-gnu"
     ],
     "patches": [
       "static-llvm-symbolizer.patch",
       "find_symbolizer_linux.patch",
       "rename_gcov_flush.patch",
-      "critical_section_on_gcov_flush.patch",
+      "critical_section_on_gcov_flush-rG02ce9d8ef5a8.patch",
       "rG7e18aeba5062.patch",
       "android-mangling-error.patch"
     ]
 }
--- a/build/build-clang/clang-linux64-cross.json
+++ b/build/build-clang/clang-linux64-cross.json
@@ -8,15 +8,15 @@
     "gcc_dir": "{MOZ_FETCHES_DIR}/gcc",
     "cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
     "cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
     "as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
     "patches": [
       "static-llvm-symbolizer.patch",
       "find_symbolizer_linux.patch",
       "rename_gcov_flush.patch",
-      "critical_section_on_gcov_flush.patch",
+      "critical_section_on_gcov_flush-rG02ce9d8ef5a8.patch",
       "android-mangling-error.patch",
       "revert-r359260-due-to-bug41817.patch",
       "r372020-r372182-profiler-linkage.patch",
       "rG7e18aeba5062.patch"
     ]
 }
--- a/build/build-clang/clang-linux64.json
+++ b/build/build-clang/clang-linux64.json
@@ -9,13 +9,13 @@
     "cc": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
     "cxx": "{MOZ_FETCHES_DIR}/gcc/bin/g++",
     "as": "{MOZ_FETCHES_DIR}/gcc/bin/gcc",
     "wasi-sysroot": "{MOZ_FETCHES_DIR}/wasi-sysroot",
     "patches": [
       "static-llvm-symbolizer.patch",
       "find_symbolizer_linux.patch",
       "rename_gcov_flush.patch",
-      "critical_section_on_gcov_flush.patch",
+      "critical_section_on_gcov_flush-rG02ce9d8ef5a8.patch",
       "rG7e18aeba5062.patch",
       "android-mangling-error.patch"
     ]
 }
--- a/build/build-clang/clang-macosx64.json
+++ b/build/build-clang/clang-macosx64.json
@@ -11,14 +11,14 @@
     "as": "{MOZ_FETCHES_DIR}/clang/bin/clang",
     "ar": "{MOZ_FETCHES_DIR}/cctools/bin/x86_64-apple-darwin-ar",
     "ranlib": "{MOZ_FETCHES_DIR}/cctools/bin/x86_64-apple-darwin-ranlib",
     "libtool": "{MOZ_FETCHES_DIR}/cctools/bin/x86_64-apple-darwin-libtool",
     "ld": "{MOZ_FETCHES_DIR}/clang/bin/clang",
     "patches": [
       "static-llvm-symbolizer.patch",
       "rename_gcov_flush.patch",
-      "critical_section_on_gcov_flush.patch",
+      "critical_section_on_gcov_flush-rG02ce9d8ef5a8.patch",
       "rG7e18aeba5062.patch",
       "compiler-rt-cross-compile.patch",
       "compiler-rt-no-codesign.patch"
     ]
 }
rename from build/build-clang/critical_section_on_gcov_flush.patch
rename to build/build-clang/critical_section_on_gcov_flush-rG02ce9d8ef5a8.patch
--- a/build/build-clang/critical_section_on_gcov_flush.patch
+++ b/build/build-clang/critical_section_on_gcov_flush-rG02ce9d8ef5a8.patch
@@ -1,8 +1,30 @@
+From 02ce9d8ef5a84bc884de4105eae5f8736ef67634 Mon Sep 17 00:00:00 2001
+From: Calixte Denizet <calixte.denizet@gmail.com>
+Date: Tue, 10 Dec 2019 13:22:33 +0100
+Subject: [PATCH] [compiler-rt] Add a critical section when flushing gcov
+ counters
+
+Summary:
+Counters can be flushed in a multi-threaded context for example when the process is forked in different threads (https://github.com/llvm/llvm-project/blob/master/llvm/lib/Transforms/Instrumentation/GCOVProfiling.cpp#L632-L663).
+In order to avoid pretty bad things, a critical section is needed around the flush.
+We had a lot of crashes in this code in Firefox CI when we switched to clang for linux ccov builds and those crashes disappeared with this patch.
+
+Reviewers: marco-c, froydnj, dmajor, davidxl, vsk
+
+Reviewed By: marco-c, dmajor
+
+Subscribers: ahatanak, froydnj, dmajor, dberris, jfb, #sanitizers, llvm-commits, sylvestre.ledru
+
+Tags: #sanitizers, #llvm
+
+Differential Revision: https://reviews.llvm.org/D70910
+---
+
 diff --git a/compiler-rt/lib/profile/GCDAProfiling.c b/compiler-rt/lib/profile/GCDAProfiling.c
 index b7257db10e7..d4abc4181ed 100644
 --- a/compiler-rt/lib/profile/GCDAProfiling.c
 +++ b/compiler-rt/lib/profile/GCDAProfiling.c
 @@ -62,8 +62,27 @@ typedef unsigned long long uint64_t;
  #include "InstrProfiling.h"
  #include "InstrProfilingUtil.h"