Skip to content

Commit 491915a

Browse files
authored
v8: fix build with GCC. (#343)
Fixes #340. Signed-off-by: Martijn Stevenson <[email protected]>
1 parent d6babe4 commit 491915a

File tree

2 files changed

+26
-5
lines changed

2 files changed

+26
-5
lines changed

.github/workflows/test.yml

+8
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,14 @@ jobs:
150150
action: test
151151
flags: --config=clang-tsan
152152
cache: true
153+
- name: 'V8 on Linux/x86_64 with GCC'
154+
engine: 'v8'
155+
repo: 'v8'
156+
os: ubuntu-20.04
157+
arch: x86_64
158+
action: test
159+
flags: --config=gcc
160+
cache: true
153161
- name: 'V8 on Linux/aarch64'
154162
engine: 'v8'
155163
repo: 'v8'

bazel/external/v8.patch

+18-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# 1. Disable pointer compression (limits the maximum number of WasmVMs).
22
# 2. Don't expose Wasm C API (only Wasm C++ API).
3+
# 3. Fix gcc build error by disabling nonnull warning.
34

45
diff --git a/BUILD.bazel b/BUILD.bazel
5-
index 5fb10d3940..a19930d36e 100644
6+
index 4e89f90e7e..3fcb38b3f3 100644
67
--- a/BUILD.bazel
78
+++ b/BUILD.bazel
8-
@@ -161,7 +161,7 @@ v8_int(
9+
@@ -157,7 +157,7 @@ v8_int(
910
# If no explicit value for v8_enable_pointer_compression, we set it to 'none'.
1011
v8_string(
1112
name = "v8_enable_pointer_compression",
@@ -14,11 +15,23 @@ index 5fb10d3940..a19930d36e 100644
1415
)
1516

1617
# Default setting for v8_enable_pointer_compression.
18+
diff --git a/bazel/defs.bzl b/bazel/defs.bzl
19+
index e957c0fad3..063627b72b 100644
20+
--- a/bazel/defs.bzl
21+
+++ b/bazel/defs.bzl
22+
@@ -131,6 +131,7 @@ def _default_args():
23+
"-Wno-redundant-move",
24+
"-Wno-return-type",
25+
"-Wno-stringop-overflow",
26+
+ "-Wno-nonnull",
27+
# Use GNU dialect, because GCC doesn't allow using
28+
# ##__VA_ARGS__ when in standards-conforming mode.
29+
"-std=gnu++17",
1730
diff --git a/src/wasm/c-api.cc b/src/wasm/c-api.cc
18-
index ce3f569fd5..dc8a4c4f6a 100644
31+
index 4473e205c0..65a6ec7e1d 100644
1932
--- a/src/wasm/c-api.cc
2033
+++ b/src/wasm/c-api.cc
21-
@@ -2238,6 +2238,8 @@ auto Instance::exports() const -> ownvec<Extern> {
34+
@@ -2247,6 +2247,8 @@ auto Instance::exports() const -> ownvec<Extern> {
2235

2336
} // namespace wasm
2437

@@ -27,7 +40,7 @@ index ce3f569fd5..dc8a4c4f6a 100644
2740
// BEGIN FILE wasm-c.cc
2841

2942
extern "C" {
30-
@@ -3257,3 +3259,5 @@ wasm_instance_t* wasm_frame_instance(const wasm_frame_t* frame) {
43+
@@ -3274,3 +3276,5 @@ wasm_instance_t* wasm_frame_instance(const wasm_frame_t* frame) {
3144
#undef WASM_DEFINE_SHARABLE_REF
3245

3346
} // extern "C"

0 commit comments

Comments
 (0)