Skip to content

Commit c33f848

Browse files
committed
[build] Fix disabling exceptions on v8 and friends on Windows
-fno-exceptions is not available with clang-cl, which causes lots of warnings on CI. Use the equivalent /GX- flag instead.
1 parent ecdb7d0 commit c33f848

File tree

2 files changed

+28
-13
lines changed

2 files changed

+28
-13
lines changed

.bazelrc

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,17 +93,28 @@ build:v8-codegen-opt --per_file_copt=external/com_google_absl@-O2
9393

9494
# In Google projects, exceptions are not used as a rule. Disabling them is more consistent with the
9595
# canonical V8 build and improves code size.
96-
build --per_file_copt=external/com_google_absl@-fno-exceptions
97-
build --per_file_copt=external/com_google_protobuf@-fno-exceptions
98-
build --per_file_copt=external/com_google_tcmalloc@-fno-exceptions
99-
build --per_file_copt=external/com_googlesource_chromium_icu@-fno-exceptions
100-
build --per_file_copt=external/perfetto@-fno-exceptions
101-
build --per_file_copt=external/ssl@-fno-exceptions
102-
build --per_file_copt=external/v8@-fno-exceptions
103-
build --per_file_copt=external/ada-url@-fno-exceptions
104-
build --per_file_copt=external/simdutf@-fno-exceptions
96+
build:unix --per_file_copt=external/com_google_absl@-fno-exceptions
97+
build:unix --per_file_copt=external/com_google_protobuf@-fno-exceptions
98+
build:unix --per_file_copt=external/com_google_tcmalloc@-fno-exceptions
99+
build:unix --per_file_copt=external/com_googlesource_chromium_icu@-fno-exceptions
100+
build:unix --per_file_copt=external/perfetto@-fno-exceptions
101+
build:unix --per_file_copt=external/ssl@-fno-exceptions
102+
build:unix --per_file_copt=external/v8@-fno-exceptions
103+
build:unix --per_file_copt=external/ada-url@-fno-exceptions
104+
build:unix --per_file_copt=external/simdutf@-fno-exceptions
105+
build:windows --per_file_copt=external/com_google_absl@/GX-
106+
build:windows --per_file_copt=external/com_google_protobuf@/GX-
107+
build:windows --per_file_copt=external/com_google_tcmalloc@/GX-
108+
build:windows --per_file_copt=external/com_googlesource_chromium_icu@/GX-
109+
build:windows --per_file_copt=external/perfetto@/GX-
110+
build:windows --per_file_copt=external/ssl@/GX-
111+
build:windows --per_file_copt=external/v8@/GX-
112+
build:windows --per_file_copt=external/ada-url@/GX-
113+
build:windows --per_file_copt=external/simdutf@/GX-
114+
105115
# V8 torque is an exception from this policy, see v8 BUILD.gn.
106-
build --per_file_copt=external/v8/src/torque@-fexceptions
116+
build:unix --per_file_copt=external/v8/src/torque@-fexceptions
117+
build:windows --per_file_copt=external/v8/src/torque@/GX
107118

108119
# Disable relaxing all jumps during LLVM codegen under -O0, which previously led to build
109120
# performance improvements but makes code size worse. This will be the default in LLVM19.

build/BUILD.dawn

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@ COPTS_UNIX = [
66
"-fno-exceptions",
77
]
88

9-
# TODO(debloat): Disable exceptions and RTTI for dawn, this greatly improves binary size. Note that
10-
# these flags are not supported by clang-cl and cause warnings there – explore enabling the
11-
# corresponding flags '/GX-', '/GR-' on Windows after confirming they are safe.
9+
COPTS_WINDOWS = [
10+
"/GR-",
11+
"/GX-",
12+
]
13+
14+
# Disable exceptions and RTTI for dawn, this greatly improves binary size.
1215
COPTS = select({
1316
"@platforms//os:osx": COPTS_UNIX,
1417
"@platforms//os:linux": COPTS_UNIX,
18+
"@platforms//os:windows": COPTS_WINDOWS,
1519
"//conditions:default": [],
1620
})
1721

0 commit comments

Comments
 (0)