Skip to content

Commit

Permalink
build: always disable strict aliasing
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
targos authored and RafaelGSS committed Aug 21, 2024
1 parent df428ad commit c640a2f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 24 deletions.
11 changes: 7 additions & 4 deletions common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,12 @@
}],
[ 'OS in "linux freebsd openbsd solaris android aix os400 cloudabi"', {
'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++17' ],
'cflags_cc': [
'-fno-rtti',
'-fno-exceptions',
'-fno-strict-aliasing',
'-std=gnu++17',
],
'defines': [ '__STDC_FORMAT_MACROS' ],
'ldflags': [ '-rdynamic' ],
'target_conditions': [
Expand Down Expand Up @@ -620,12 +625,10 @@
'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
'GCC_STRICT_ALIASING': 'NO', # -fno-strict-aliasing
'PREBINDING': 'NO', # No -Wl,-prebind
'MACOSX_DEPLOYMENT_TARGET': '11.0', # -mmacosx-version-min=11.0
'USE_HEADERMAP': 'NO',
'OTHER_CFLAGS': [
'-fno-strict-aliasing',
],
'WARNING_CFLAGS': [
'-Wall',
'-Wendif-labels',
Expand Down
1 change: 0 additions & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -1637,7 +1637,6 @@ def configure_v8(o, configs):
o['variables']['v8_enable_javascript_promise_hooks'] = 1
o['variables']['v8_enable_lite_mode'] = 1 if options.v8_lite_mode else 0
o['variables']['v8_enable_gdbjit'] = 1 if options.gdb else 0
o['variables']['v8_no_strict_aliasing'] = 1 # Work around compiler bugs.
o['variables']['v8_optimized_debug'] = 0 if options.v8_non_optimized_debug else 1
o['variables']['dcheck_always_on'] = 1 if options.v8_with_dchecks else 0
o['variables']['v8_enable_object_print'] = 0 if options.v8_disable_object_print else 1
Expand Down
1 change: 0 additions & 1 deletion doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,6 @@ An example of the possible output looks like:
node_shared_zlib: 'false',
node_use_openssl: 'true',
node_shared_openssl: 'false',
strict_aliasing: 'true',
target_arch: 'x64',
v8_use_snapshot: 1
}
Expand Down
18 changes: 0 additions & 18 deletions tools/v8_gypfiles/toolchain.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@
# Enable profiling support. Only required on Windows.
'v8_enable_prof%': 0,

# Some versions of GCC 4.5 seem to need -fno-strict-aliasing.
'v8_no_strict_aliasing%': 0,

# Chrome needs this definition unconditionally. For standalone V8 builds,
# it's handled in gypfiles/standalone.gypi.
'want_separate_host_toolset%': 1,
Expand Down Expand Up @@ -674,14 +671,6 @@
'V8_ANDROID_LOG_STDOUT',
],
}],
['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
or OS=="netbsd" or OS=="qnx" or OS=="aix" or OS=="os400"', {
'conditions': [
[ 'v8_no_strict_aliasing==1', {
'cflags': [ '-fno-strict-aliasing' ],
}],
], # conditions
}],
['OS=="solaris"', {
'defines': [ '__C99FEATURES__=1' ], # isinf() etc.
}],
Expand Down Expand Up @@ -838,7 +827,6 @@
['OS=="mac"', {
'xcode_settings': {
'GCC_OPTIMIZATION_LEVEL': '3', # -O3
'GCC_STRICT_ALIASING': 'YES',
},
}],
['v8_enable_slow_dchecks==1', {
Expand Down Expand Up @@ -897,12 +885,6 @@
['OS=="mac"', {
'xcode_settings': {
'GCC_OPTIMIZATION_LEVEL': '3', # -O3

# -fstrict-aliasing. Mainline gcc
# enables this at -O2 and above,
# but Apple gcc does not unless it
# is specified explicitly.
'GCC_STRICT_ALIASING': 'YES',
},
}], # OS=="mac"
['OS=="win"', {
Expand Down

0 comments on commit c640a2f

Please sign in to comment.