From 6ed0a431e09f45282922523cdb9257ad3523733c Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Thu, 17 Mar 2022 14:36:55 +0100 Subject: [PATCH] Add gcc 12 build fixes Borrowed from Firefox and partly adjusted. This still does not solve the "undefined references to `std::__glibcxx_assert_fail" on f36 (waiting for a gcc 12 fix) but does on f37. --- 0001-GLIBCXX-fix-for-GCC-12.patch | 42 ++++++++++++++ gcc12-D139078.patch | 94 +++++++++++++++++++++++++++++++ gcc12-D139088.patch | 13 +++++ thunderbird.spec | 8 +++ 4 files changed, 157 insertions(+) create mode 100644 0001-GLIBCXX-fix-for-GCC-12.patch create mode 100644 gcc12-D139078.patch create mode 100644 gcc12-D139088.patch diff --git a/0001-GLIBCXX-fix-for-GCC-12.patch b/0001-GLIBCXX-fix-for-GCC-12.patch new file mode 100644 index 0000000..972cebc --- /dev/null +++ b/0001-GLIBCXX-fix-for-GCC-12.patch @@ -0,0 +1,42 @@ +From efd5bc0715e5477318be95a76811cda0a89e8289 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= +Date: Fri, 4 Mar 2022 12:00:26 +0100 +Subject: [PATCH] GLIBCXX fix for GCC 12? + +Borrowed from Firefox and adjusted to Thunderbird 91.7.0 + +--- + build/unix/stdc++compat/stdc++compat.cpp | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/build/unix/stdc++compat/stdc++compat.cpp b/build/unix/stdc++compat/stdc++compat.cpp +--- thunderbird-91.7.0/build/unix/stdc++compat/stdc++compat.cpp.0001-GLIBCXX-fix-for-GCC-12 2022-03-07 20:34:15.000000000 +0100 ++++ thunderbird-91.7.0/build/unix/stdc++compat/stdc++compat.cpp 2022-03-15 22:50:03.161345590 +0100 +@@ -24,6 +24,7 @@ + GLIBCXX_3.4.27 is from gcc 10 + GLIBCXX_3.4.28 is from gcc 10 + GLIBCXX_3.4.29 is from gcc 11 ++ GLIBCXX_3.4.30 is from gcc 12 + + This file adds the necessary compatibility tricks to avoid symbols with + version GLIBCXX_3.4.20 and bigger, keeping binary compatibility with +@@ -73,6 +74,19 @@ void __attribute__((weak)) __throw_bad_a + + } // namespace std + #endif ++ ++#if _GLIBCXX_RELEASE >= 12 ++namespace std { ++ ++/* This avoids the GLIBCXX_3.4.30 symbol version. */ ++void __attribute__((weak)) ++__glibcxx_assert_fail(const char* __file, int __line, const char* __function, ++ const char* __condition) { ++ MOZ_CRASH(); ++} ++ ++} // namespace std ++#endif + + #if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 21) + /* While we generally don't build with exceptions, we have some host tools diff --git a/gcc12-D139078.patch b/gcc12-D139078.patch new file mode 100644 index 0000000..8198e1a --- /dev/null +++ b/gcc12-D139078.patch @@ -0,0 +1,94 @@ +diff --git a/gfx/wr/swgl/src/glsl.h b/gfx/wr/swgl/src/glsl.h +--- a/gfx/wr/swgl/src/glsl.h ++++ b/gfx/wr/swgl/src/glsl.h +@@ -2301,20 +2301,12 @@ + const vec2& operator[](int index) const { return data[index]; } + mat2() = default; + +- IMPLICIT mat2(Float a) { +- data[0] = vec2(a); +- data[1] = vec2(a); +- } ++ IMPLICIT constexpr mat2(Float a) : data{vec2(a), vec2(a)} {} + +- mat2(vec2 a, vec2 b) { +- data[0] = a; +- data[1] = b; +- } ++ constexpr mat2(vec2 a, vec2 b) : data{a, b} {} + IMPLICIT mat2(const mat4& mat); +- IMPLICIT constexpr mat2(mat2_scalar s) { +- data[0] = vec2(s.data[0]); +- data[1] = vec2(s.data[1]); +- } ++ IMPLICIT constexpr mat2(mat2_scalar s) ++ : data{vec2(s.data[0]), vec2(s.data[1])} {} + + friend vec2 operator*(mat2 m, vec2 v) { + vec2 u; +@@ -2404,30 +2396,19 @@ + vec3& operator[](int index) { return data[index]; } + const vec3& operator[](int index) const { return data[index]; } + mat3() = default; +- mat3(vec3 a, vec3 b, vec3 c) { +- data[0] = a; +- data[1] = b; +- data[2] = c; +- } ++ constexpr mat3(vec3 a, vec3 b, vec3 c) : data{a, b, c} {} + +- IMPLICIT constexpr mat3(mat3_scalar s) { +- data[0] = vec3(s.data[0]); +- data[1] = vec3(s.data[1]); +- data[2] = vec3(s.data[2]); +- } +- constexpr mat3(mat3_scalar s0, mat3_scalar s1, mat3_scalar s2, +- mat3_scalar s3) { +- data[0] = vec3(s0.data[0], s1.data[0], s2.data[0], s3.data[0]); +- data[1] = vec3(s0.data[1], s1.data[1], s2.data[1], s3.data[1]); +- data[2] = vec3(s0.data[2], s1.data[2], s2.data[2], s3.data[2]); +- } ++ IMPLICIT constexpr mat3(mat3_scalar s) ++ : data{vec3(s.data[0]), vec3(s.data[1]), vec3(s.data[2])} {} ++ ++ constexpr mat3(mat3_scalar s0, mat3_scalar s1, mat3_scalar s2, mat3_scalar s3) ++ : data{vec3(s0.data[0], s1.data[0], s2.data[0], s3.data[0]), ++ vec3(s0.data[1], s1.data[1], s2.data[1], s3.data[1]), ++ vec3(s0.data[2], s1.data[2], s2.data[2], s3.data[2])} {} + + constexpr mat3(Float d1, Float d2, Float d3, Float d4, Float d5, Float d6, +- Float d7, Float d8, Float d9) { +- data[0] = vec3(d1, d2, d3); +- data[1] = vec3(d4, d5, d6); +- data[2] = vec3(d7, d8, d9); +- } ++ Float d7, Float d8, Float d9) ++ : data{vec3(d1, d2, d3), vec3(d4, d5, d6), vec3(d7, d8, d9)} {} + + IMPLICIT mat3(const mat4& mat); + +@@ -2597,19 +2578,11 @@ + vec4 data[4]; + + mat4() = default; +- IMPLICIT constexpr mat4(mat4_scalar s) { +- data[0] = vec4(s.data[0]); +- data[1] = vec4(s.data[1]); +- data[2] = vec4(s.data[2]); +- data[3] = vec4(s.data[3]); +- } ++ IMPLICIT constexpr mat4(mat4_scalar s) ++ : data{vec4(s.data[0]), vec4(s.data[1]), vec4(s.data[2]), ++ vec4(s.data[3])} {} + +- mat4(vec4 a, vec4 b, vec4 c, vec4 d) { +- data[0] = a; +- data[1] = b; +- data[2] = c; +- data[3] = d; +- } ++ constexpr mat4(vec4 a, vec4 b, vec4 c, vec4 d) : data{a, b, c, d} {} + + vec4& operator[](int index) { return data[index]; } + const vec4& operator[](int index) const { return data[index]; } + diff --git a/gcc12-D139088.patch b/gcc12-D139088.patch new file mode 100644 index 0000000..91e9967 --- /dev/null +++ b/gcc12-D139088.patch @@ -0,0 +1,13 @@ +diff --git a/gfx/wr/swgl/src/gl.cc b/gfx/wr/swgl/src/gl.cc +--- a/gfx/wr/swgl/src/gl.cc ++++ b/gfx/wr/swgl/src/gl.cc +@@ -82,7 +82,7 @@ + + #define FALLTHROUGH [[fallthrough]] + +-#ifdef MOZILLA_CLIENT ++#if defined(MOZILLA_CLIENT) && defined(MOZ_CLANG_PLUGIN) + # define IMPLICIT __attribute__((annotate("moz_implicit"))) + #else + # define IMPLICIT + diff --git a/thunderbird.spec b/thunderbird.spec index 5170aea..2aa948a 100644 --- a/thunderbird.spec +++ b/thunderbird.spec @@ -118,6 +118,10 @@ Patch416: firefox-SIOCGSTAMP.patch Patch418: mozilla-1512162.patch Patch419: bindgen-d0dfc52706f23db9dc9d74642eeebd89d73cb8d0.patch Patch103: rhbz-1219542-s390-build.patch +# gcc 12 build fix patches +Patch420: gcc12-D139078.patch +Patch421: gcc12-D139088.patch +Patch422: 0001-GLIBCXX-fix-for-GCC-12.patch # PPC fix Patch304: mozilla-1245783.patch @@ -296,6 +300,10 @@ debug %{name}, you want to install %{name}-debuginfo instead. pushd comm popd +%patch420 -p1 -b .gcc12-D139078 +%patch421 -p1 -b .gcc12-D139088 +%patch422 -p1 -b .0001-GLIBCXX-fix-for-GCC-12 + %patch501 -p1 -b .expat-CVE-2022-25235 %patch502 -p1 -b .expat-CVE-2022-25236 %patch503 -p1 -b .expat-CVE-2022-25315