Skip to content

Commit 2573f74

Browse files
authored
build: always disable strict aliasing
V8 relies on it. PR-URL: #54339 Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 543d1a9 commit 2573f74

File tree

4 files changed

+7
-24
lines changed

4 files changed

+7
-24
lines changed

common.gypi

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,12 @@
489489
}],
490490
[ 'OS in "linux freebsd openbsd solaris android aix os400 cloudabi"', {
491491
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
492-
'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++20' ],
492+
'cflags_cc': [
493+
'-fno-rtti',
494+
'-fno-exceptions',
495+
'-fno-strict-aliasing',
496+
'-std=gnu++20',
497+
],
493498
'defines': [ '__STDC_FORMAT_MACROS' ],
494499
'ldflags': [ '-rdynamic' ],
495500
'target_conditions': [
@@ -620,12 +625,10 @@
620625
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
621626
'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
622627
'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
628+
'GCC_STRICT_ALIASING': 'NO', # -fno-strict-aliasing
623629
'PREBINDING': 'NO', # No -Wl,-prebind
624630
'MACOSX_DEPLOYMENT_TARGET': '11.0', # -mmacosx-version-min=11.0
625631
'USE_HEADERMAP': 'NO',
626-
'OTHER_CFLAGS': [
627-
'-fno-strict-aliasing',
628-
],
629632
'WARNING_CFLAGS': [
630633
'-Wall',
631634
'-Wendif-labels',

configure.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,6 @@ def configure_v8(o, configs):
16361636
o['variables']['v8_enable_javascript_promise_hooks'] = 1
16371637
o['variables']['v8_enable_lite_mode'] = 1 if options.v8_lite_mode else 0
16381638
o['variables']['v8_enable_gdbjit'] = 1 if options.gdb else 0
1639-
o['variables']['v8_no_strict_aliasing'] = 1 # Work around compiler bugs.
16401639
o['variables']['v8_optimized_debug'] = 0 if options.v8_non_optimized_debug else 1
16411640
o['variables']['dcheck_always_on'] = 1 if options.v8_with_dchecks else 0
16421641
o['variables']['v8_enable_object_print'] = 0 if options.v8_disable_object_print else 1

doc/api/process.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,6 @@ An example of the possible output looks like:
11011101
node_shared_zlib: 'false',
11021102
node_use_openssl: 'true',
11031103
node_shared_openssl: 'false',
1104-
strict_aliasing: 'true',
11051104
target_arch: 'x64',
11061105
v8_use_snapshot: 1
11071106
}

tools/v8_gypfiles/toolchain.gypi

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@
6969
# Enable profiling support. Only required on Windows.
7070
'v8_enable_prof%': 0,
7171

72-
# Some versions of GCC 4.5 seem to need -fno-strict-aliasing.
73-
'v8_no_strict_aliasing%': 0,
74-
7572
# Chrome needs this definition unconditionally. For standalone V8 builds,
7673
# it's handled in gypfiles/standalone.gypi.
7774
'want_separate_host_toolset%': 1,
@@ -666,14 +663,6 @@
666663
'V8_ANDROID_LOG_STDOUT',
667664
],
668665
}],
669-
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
670-
or OS=="netbsd" or OS=="qnx" or OS=="aix" or OS=="os400"', {
671-
'conditions': [
672-
[ 'v8_no_strict_aliasing==1', {
673-
'cflags': [ '-fno-strict-aliasing' ],
674-
}],
675-
], # conditions
676-
}],
677666
['OS=="solaris"', {
678667
'defines': [ '__C99FEATURES__=1' ], # isinf() etc.
679668
}],
@@ -830,7 +819,6 @@
830819
['OS=="mac"', {
831820
'xcode_settings': {
832821
'GCC_OPTIMIZATION_LEVEL': '3', # -O3
833-
'GCC_STRICT_ALIASING': 'YES',
834822
},
835823
}],
836824
['v8_enable_slow_dchecks==1', {
@@ -889,12 +877,6 @@
889877
['OS=="mac"', {
890878
'xcode_settings': {
891879
'GCC_OPTIMIZATION_LEVEL': '3', # -O3
892-
893-
# -fstrict-aliasing. Mainline gcc
894-
# enables this at -O2 and above,
895-
# but Apple gcc does not unless it
896-
# is specified explicitly.
897-
'GCC_STRICT_ALIASING': 'YES',
898880
},
899881
}], # OS=="mac"
900882
['OS=="win"', {

0 commit comments

Comments
 (0)