Bug 1500941 - Add a clang mangling crash workaround. r=dmajor
authorKartikaya Gupta <kgupta@mozilla.com>
Sat, 23 Feb 2019 04:14:20 +0000
changeset 518615 9d6224e1d015e83fa9acd81cbe6e310a7cd5358d
parent 518614 a6add7613778e3f53580978edb005341d9f6eca7
child 518616 6e669b1b18355464ae76b94c4f1c89888f77c734
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdmajor
bugs1500941, 40747
milestone67.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 1500941 - Add a clang mangling crash workaround. r=dmajor This is a workaround for https://bugs.llvm.org/show_bug.cgi?id=40747 where clang's mangler crashes when it tries to mangle a symbol from the android NDK's <tuple> header. Differential Revision: https://phabricator.services.mozilla.com/D20766
build/build-clang/android-mangling-error.patch
build/build-clang/clang-7-linux64.json
new file mode 100644
--- /dev/null
+++ b/build/build-clang/android-mangling-error.patch
@@ -0,0 +1,34 @@
+Workaround segfault in clang's mangling code that is tickled when
+attempting to mangle the declaration:
+ std:__ndk1::__find_detail::__find_exactly_one_checked::__matches
+in the <tuple> header in the Android NDK.
+This codepath is exercised by MozsearchIndexer.cpp (the searchfox
+indexer) when indexing on Android. See also
+https://bugs.llvm.org/show_bug.cgi?id=40747
+
+diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp
+index 2dc04f2f3d8..054fc27003d 100644
+--- a/clang/lib/AST/ItaniumMangle.cpp
++++ b/clang/lib/AST/ItaniumMangle.cpp
+@@ -3495,16 +3495,21 @@ void CXXNameMangler::mangleExpression(const Expr *E, unsigned Arity) {
+   //              ::= <expr-primary>
+   // <expr-primary> ::= L <type> <value number> E    # integer literal
+   //                ::= L <type <value float> E      # floating literal
+   //                ::= L <mangled-name> E           # external name
+   //                ::= fpT                          # 'this' expression
+   QualType ImplicitlyConvertedToType;
+ 
+ recurse:
++  if (!E) {
++    Out << "MOZ_WE_HACKED_AROUND_BUG_1500941";
++    return;
++  }
++
+   switch (E->getStmtClass()) {
+   case Expr::NoStmtClass:
+ #define ABSTRACT_STMT(Type)
+ #define EXPR(Type, Base)
+ #define STMT(Type, Base) \
+   case Expr::Type##Class:
+ #include "clang/AST/StmtNodes.inc"
+     // fallthrough
--- a/build/build-clang/clang-7-linux64.json
+++ b/build/build-clang/clang-7-linux64.json
@@ -14,11 +14,12 @@
     "gcc_dir": "/builds/worker/workspace/build/src/gcc",
     "cc": "/builds/worker/workspace/build/src/gcc/bin/gcc",
     "cxx": "/builds/worker/workspace/build/src/gcc/bin/g++",
     "as": "/builds/worker/workspace/build/src/gcc/bin/gcc",
     "patches": [
       "static-llvm-symbolizer.patch",
       "find_symbolizer_linux.patch",
       "rename_gcov_flush_.patch",
-      "r350774.patch"
+      "r350774.patch",
+      "android-mangling-error.patch"
     ]
 }