Skip to content

Commit 100e163

Browse files
committed
build: compile with -fno-tree-vrp when gcc >= 4.0
1 parent 9f26130 commit 100e163

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

common.gypi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
'library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds
88
'component%': 'static_library', # NB. these names match with what V8 expects
99
'msvs_multi_core_compile': '0', # we do enable multicore compiles, but not using the V8 way
10+
'gcc_version%': 'unknown',
11+
'clang%': 0,
1012

1113
# Turn on optimizations that may trigger compiler bugs.
1214
# Use at your own risk. Do *NOT* report bugs if this option is enabled.
@@ -53,7 +55,7 @@
5355
'cflags': [ '-O3', '-ffunction-sections', '-fdata-sections' ],
5456
'ldflags': [ '-Wl,--gc-sections' ],
5557
}, {
56-
'cflags': [ '-O2', '-fno-strict-aliasing', '-fno-tree-vrp' ],
58+
'cflags': [ '-O2', '-fno-strict-aliasing' ],
5759
'cflags!': [ '-O3', '-fstrict-aliasing' ],
5860
'conditions': [
5961
# Required by the dtrace post-processor. Unfortunately,
@@ -64,6 +66,9 @@
6466
}, {
6567
'cflags!': [ '-ffunction-sections', '-fdata-sections' ],
6668
}],
69+
['clang==1 or gcc_version >= 40', {
70+
'cflags': [ '-fno-tree-vrp' ],
71+
}],
6772
],
6873
}],
6974
['OS=="solaris"', {

configure

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,13 @@ def configure_node(o):
339339
o['variables']['v8_use_arm_eabi_hardfloat'] = b(hard_float)
340340
o['variables']['armv7'] = 1 if is_arch_armv7() else 0
341341

342-
# clang has always supported -fvisibility=hidden, right?
343342
cc_version, is_clang = compiler_version()
343+
o['variables']['clang'] = 1 if is_clang else 0
344+
345+
if not is_clang:
346+
o['variables']['gcc_version'] = 10 * cc_version[0] + cc_version[1]
347+
348+
# clang has always supported -fvisibility=hidden, right?
344349
if not is_clang and cc_version < (4,0,0):
345350
o['variables']['visibility'] = ''
346351

0 commit comments

Comments
 (0)