From 5982e7a6e88bec3f7996fc97bd211a73b2d93479 Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Fri, 5 Oct 2018 19:27:15 -0400 Subject: [PATCH] deps,v8: link with `atomic` for platforms lacking CAS Fixes: https://github.com/nodejs/node-v8/issues/81 --- deps/v8/gypfiles/features.gypi | 2 ++ deps/v8/gypfiles/v8.gyp | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/deps/v8/gypfiles/features.gypi b/deps/v8/gypfiles/features.gypi index a38e5fa9720da8..e17011a67405f7 100644 --- a/deps/v8/gypfiles/features.gypi +++ b/deps/v8/gypfiles/features.gypi @@ -31,6 +31,8 @@ 'variables': { 'v8_target_arch%': '<(target_arch)', + 'v8_current_cpu%': '<(target_arch)', + # Emulate GN variables 'conditions': [ ['OS=="android"', { # GYP reverts OS to linux so use `-D OS=android` diff --git a/deps/v8/gypfiles/v8.gyp b/deps/v8/gypfiles/v8.gyp index 93c9a4cfa12236..cf952fee63d8d9 100644 --- a/deps/v8/gypfiles/v8.gyp +++ b/deps/v8/gypfiles/v8.gyp @@ -361,6 +361,18 @@ '../src/builtins/builtins-intl-gen.cc', ], }], + # Platforms that don't have Compare-And-Swap support need to link atomic + # library to implement atomic memory access + [ 'v8_current_cpu == "mips" or v8_current_cpu == "mipsel" or ' + 'v8_current_cpu == "mips64" or v8_current_cpu == "mips64el" or ' + 'v8_current_cpu == "ppc" or v8_current_cpu == "ppc64" or ' + 'v8_current_cpu == "s390" or v8_current_cpu == "s390x"', + { + 'link_settings': { + 'libraries': [ '-latomic', ], + }, + }, + ], ], }, # v8_initializers {