From 415bc750a5e1409cc687e3a220fb1563a6900bad Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Thu, 25 Jul 2024 12:08:09 +0200 Subject: [PATCH] deps: V8: cherry-pick 35888fee7bba Original commit message: [base] fix builds with GCC 12 on certain Linux distributions With GCC 12 on certain Linux distributions (at least Debian 12, Alpine 3.18, Fedora 37, that ships GCC 12.2), std::is_trivially_copyable is broken and as a result, V8 fails to compile. This patch uses the same polyfill on MSVC to make it compile with GCC 12.2. See https://github.com/nodejs/node/pull/45427 for more context. Refs: https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=aeba3e009b0abfccaf01797556445dbf891cc8dc Change-Id: Ie0ab1bb1ec105bacbd80b341adf7dbd8569f031f Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5679182 Commit-Queue: Joyee Cheung Reviewed-by: Nico Hartmann Cr-Commit-Position: refs/heads/main@{#95181} Refs: https://github.com/v8/v8/commit/35888fee7bbaaaf1f02ccc88a95c9a336fc790bc PR-URL: https://github.com/nodejs/node/pull/53728 Refs: https://github.com/nodejs/node/pull/45427 Refs: https://github.com/nodejs/help/issues/4406 Refs: https://github.com/nodejs/node/issues/53633 Refs: https://github.com/nodejs/help/issues/4430 Reviewed-By: Richard Lau Reviewed-By: Santiago Gimeno Reviewed-By: Daeyeon Jeong Reviewed-By: Jiawen Geng Reviewed-By: Luigi Pinca Reviewed-By: Chengzhong Wu Reviewed-By: James M Snell PR-URL: https://github.com/nodejs/node/pull/54077 Reviewed-By: Joyee Cheung Reviewed-By: Marco Ippolito --- common.gypi | 2 +- deps/v8/src/base/macros.h | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/common.gypi b/common.gypi index 56c79543a5c..350b54ad9d5 100644 --- a/common.gypi +++ b/common.gypi @@ -36,7 +36,7 @@ # Reset this number to 0 on major V8 upgrades. # Increment by one for each non-official patch applied to deps/v8. - 'v8_embedder_string': '-node.9', + 'v8_embedder_string': '-node.10', ##### V8 defaults for Node.js ##### diff --git a/deps/v8/src/base/macros.h b/deps/v8/src/base/macros.h index c6abed6cd19..260747db7ea 100644 --- a/deps/v8/src/base/macros.h +++ b/deps/v8/src/base/macros.h @@ -206,7 +206,7 @@ namespace base { // base::is_trivially_copyable will differ for these cases. template struct is_trivially_copyable { -#if V8_CC_MSVC +#if V8_CC_MSVC || (__GNUC__ == 12 && __GNUC_MINOR__ <= 2) // Unfortunately, MSVC 2015 is broken in that std::is_trivially_copyable can // be false even though it should be true according to the standard. // (status at 2018-02-26, observed on the msvc waterfall bot). @@ -214,6 +214,11 @@ struct is_trivially_copyable { // intended, so we reimplement this according to the standard. // See also https://developercommunity.visualstudio.com/content/problem/ // 170883/msvc-type-traits-stdis-trivial-is-bugged.html. + // + // GCC 12.1 and 12.2 are broken too, they are shipped by some stable Linux + // distributions, so the same polyfill is also used. + // See + // https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=aeba3e009b0abfccaf01797556445dbf891cc8dc static constexpr bool value = // Copy constructor is trivial or deleted. (std::is_trivially_copy_constructible::value ||