From 2fff85b26564703dded48be99c9335df7c2249bd Mon Sep 17 00:00:00 2001 From: Tom Callaway Date: Mon, 8 Jun 2020 16:21:16 -0400 Subject: [PATCH] more fixes from gentoo --- chromium-79-gcc-alignas.patch | 68 +++++++++++++++++++++++++++++ chromium-83-gcc-compatibility.patch | 25 +++++++++++ chromium.spec | 11 ++++- 3 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 chromium-79-gcc-alignas.patch create mode 100644 chromium-83-gcc-compatibility.patch diff --git a/chromium-79-gcc-alignas.patch b/chromium-79-gcc-alignas.patch new file mode 100644 index 00000000..1e031e2a --- /dev/null +++ b/chromium-79-gcc-alignas.patch @@ -0,0 +1,68 @@ +Re-use chromium alignas workaround in protobuf. +--- + +diff --git a/third_party/protobuf/src/google/protobuf/arena.h b/third_party/protobuf/src/google/protobuf/arena.h +index dedc221..a8515ce 100644 +--- a/third_party/protobuf/src/google/protobuf/arena.h ++++ b/third_party/protobuf/src/google/protobuf/arena.h +@@ -245,7 +245,7 @@ struct ArenaOptions { + // well as protobuf container types like RepeatedPtrField and Map. The protocol + // is internal to protobuf and is not guaranteed to be stable. Non-proto types + // should not rely on this protocol. +-class PROTOBUF_EXPORT alignas(8) Arena final { ++class PROTOBUF_EXPORT PROTOBUF_ALIGNAS(8) Arena final { + public: + // Arena constructor taking custom options. See ArenaOptions below for + // descriptions of the options available. +diff --git a/third_party/protobuf/src/google/protobuf/port_def.inc b/third_party/protobuf/src/google/protobuf/port_def.inc +index f1bd85d..6d02b53 100644 +--- a/third_party/protobuf/src/google/protobuf/port_def.inc ++++ b/third_party/protobuf/src/google/protobuf/port_def.inc +@@ -528,6 +528,35 @@ PROTOBUF_EXPORT_TEMPLATE_TEST(DEFAULT, __declspec(dllimport)); + #undef IN + #endif // _MSC_VER + ++// Specify memory alignment for structs, classes, etc. ++// Use like: ++// class PROTOBUF_ALIGNAS(16) MyClass { ... } ++// PROTOBUF_ALIGNAS(16) int array[4]; ++// ++// In most places you can use the C++11 keyword "alignas", which is preferred. ++// ++// But compilers have trouble mixing __attribute__((...)) syntax with ++// alignas(...) syntax. ++// ++// Doesn't work in clang or gcc: ++// struct alignas(16) __attribute__((packed)) S { char c; }; ++// Works in clang but not gcc: ++// struct __attribute__((packed)) alignas(16) S2 { char c; }; ++// Works in clang and gcc: ++// struct alignas(16) S3 { char c; } __attribute__((packed)); ++// ++// There are also some attributes that must be specified *before* a class ++// definition: visibility (used for exporting functions/classes) is one of ++// these attributes. This means that it is not possible to use alignas() with a ++// class that is marked as exported. ++#if defined(_MSC_VER) ++#define PROTOBUF_ALIGNAS(byte_alignment) __declspec(align(byte_alignment)) ++#elif defined(__GNUC__) ++#define PROTOBUF_ALIGNAS(byte_alignment) __attribute__((aligned(byte_alignment))) ++#else ++#define PROTOBUF_ALIGNAS(byte_alignment) alignas(byte_alignment) ++#endif ++ + #if defined(__clang__) + #pragma clang diagnostic push + // TODO(gerbens) ideally we cleanup the code. But a cursory try shows many +diff --git a/third_party/protobuf/src/google/protobuf/port_undef.inc b/third_party/protobuf/src/google/protobuf/port_undef.inc +index b7e67fe..ba1fffc 100644 +--- a/third_party/protobuf/src/google/protobuf/port_undef.inc ++++ b/third_party/protobuf/src/google/protobuf/port_undef.inc +@@ -80,6 +80,7 @@ + #undef PROTOBUF_EXPORT_TEMPLATE_STYLE_MATCH_foj3FJo5StF0OvIzl7oMxA__declspec + #undef PROTOBUF_EXPORT_TEMPLATE_STYLE_MATCH_DECLSPEC_dllexport + #undef PROTOBUF_EXPORT_TEMPLATE_STYLE_MATCH_DECLSPEC_dllimport ++#undef PROTOBUF_ALIGNAS + + + diff --git a/chromium-83-gcc-compatibility.patch b/chromium-83-gcc-compatibility.patch new file mode 100644 index 00000000..09508ea5 --- /dev/null +++ b/chromium-83-gcc-compatibility.patch @@ -0,0 +1,25 @@ +From 55ce03222ee4c5ed2442278264028f6fb5bffa34 Mon Sep 17 00:00:00 2001 +From: David Seifert +Date: Sun, 03 May 2020 17:05:43 +0200 +Subject: [PATCH] Add compatibility workaround for GCC 6/7/8 + +Bug: 819294 +Change-Id: I632c4ecf7d7f9876b37a6cff05c0408125656257 +--- + +diff --git a/third_party/blink/renderer/platform/wtf/hash_table.h b/third_party/blink/renderer/platform/wtf/hash_table.h +index 5a4468d..9dc95fa 100644 +--- a/third_party/blink/renderer/platform/wtf/hash_table.h ++++ b/third_party/blink/renderer/platform/wtf/hash_table.h +@@ -673,7 +673,10 @@ + return IsEmptyBucket(key) || IsDeletedBucket(key); + } + static bool IsEmptyOrDeletedBucketSafe(const Value& value) { +- alignas(std::max(alignof(Key), sizeof(size_t))) char buf[sizeof(Key)]; ++ // GCC 6, 7 and 8 require this indirection due to a constexpr bug: ++ // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94929 ++ constexpr size_t kAlignment = std::max(alignof(Key), sizeof(size_t)); ++ alignas(kAlignment) char buf[sizeof(Key)]; + const Key& key = Extractor::ExtractSafe(value, &buf); + return IsEmptyBucket(key) || IsDeletedBucket(key); + } diff --git a/chromium.spec b/chromium.spec index e8a8b7b1..212df4c8 100644 --- a/chromium.spec +++ b/chromium.spec @@ -167,7 +167,7 @@ Name: chromium%{chromium_channel}%{nsuffix} Name: chromium%{chromium_channel} %endif Version: %{majorversion}.0.4103.97 -Release: 1%{?dist} +Release: 2%{?dist} %if %{?freeworld} %if %{?shared} # chromium-libs-media-freeworld @@ -265,6 +265,10 @@ Patch86: chromium-83-gcc-iterator.patch Patch87: chromium-83-gcc-serviceworker.patch # https://chromium.googlesource.com/chromium/src/+/0d3ef4b1247f766eed37c546571a2c872fde2bf2%5E%21/#F0 Patch88: chromium-83-gcc-ozone-wayland.patch +# https://gitweb.gentoo.org/repo/gentoo.git/plain/www-client/chromium/files/chromium-79-gcc-alignas.patch +Patch89: chromium-79-gcc-alignas.patch +# https://gitweb.gentoo.org/repo/gentoo.git/plain/www-client/chromium/files/chromium-83-gcc-compatibility.patch +Patch90: chromium-83-gcc-compatibility.patch # Use lstdc++ on EPEL7 only @@ -842,6 +846,8 @@ udev. %patch86 -p1 -b .gcc-iterator2 %patch87 -p1 -b .gcc-serviceworker %patch88 -p1 -b .gcc-ozone-wayland +%patch89 -p1 -b .gcc-alignas +%patch90 -p1 -b .gcc-compatibility # Fedora branded user agent %if 0%{?fedora} @@ -1797,6 +1803,9 @@ getent group chrome-remote-desktop >/dev/null || groupadd -r chrome-remote-deskt %changelog +* Mon Jun 8 2020 Tom Callaway - 83.0.4103.97-2 +- more fixes from gentoo + * Sun Jun 7 2020 Tom Callaway - 83.0.4103.97-1 - update to 83.0.4103.97