Browse Source

build: fix spurious mksnapshot crashes for good

A variety of gcc bugs made mksnapshot crash with either a segmentation fault
or a 'pure virtual method callled' run-time error.

After much wailing and gnashing of teeth I managed to deduce that the bugs
show up when:

  1. gcc 4.5.2 for i386-pc-solaris2.11 is used and -fstrict-aliasing is
     enabled, or

  2. gcc version 4.4.6 for x86_64-redhat-linux is used and
     -ffunction-sections -finline-functions at -O2 or higher is enabled

Therefore, disable -ffunction-sections and -fdata-sections unconditionally
and disable -fstrict-aliasing only on Solaris.

The -ffunction-sections and -fdata-sections switches were nonsense anyway
because we don't link with -Wl,--gc-sections.
v0.8.7-release
Ben Noordhuis 13 years ago
parent
commit
b40f813bab
  1. 11
      common.gypi
  2. 12
      configure

11
common.gypi

@ -1,6 +1,5 @@
{ {
'variables': { 'variables': {
'node_no_strict_aliasing%': 0, # turn off -fstrict-aliasing
'visibility%': 'hidden', # V8's visibility setting 'visibility%': 'hidden', # V8's visibility setting
'target_arch%': 'ia32', # set v8's target architecture 'target_arch%': 'ia32', # set v8's target architecture
'host_arch%': 'ia32', # set v8's host architecture 'host_arch%': 'ia32', # set v8's host architecture
@ -42,7 +41,12 @@
}, },
}, },
'Release': { 'Release': {
'cflags': [ '-O3', '-fdata-sections', '-ffunction-sections' ], # Do *NOT* enable -ffunction-sections or -fdata-sections again.
# We don't link with -Wl,--gc-sections so they're effectively no-ops.
# Worse, they trigger very nasty bugs in some versions of gcc, notably
# v4.4.6 on x86_64-redhat-linux (i.e. RHEL and CentOS).
'cflags!': [ '-ffunction-sections', '-fdata-sections' ],
'cflags': [ '-O3' ],
'conditions': [ 'conditions': [
['target_arch=="x64"', { ['target_arch=="x64"', {
'msvs_configuration_platform': 'x64', 'msvs_configuration_platform': 'x64',
@ -52,9 +56,6 @@
# pull in V8's postmortem metadata # pull in V8's postmortem metadata
'ldflags': [ '-Wl,-z,allextract' ] 'ldflags': [ '-Wl,-z,allextract' ]
}], }],
['node_no_strict_aliasing==1', {
'cflags': [ '-fno-strict-aliasing' ],
}],
], ],
'msvs_settings': { 'msvs_settings': {
'VCCLCompilerTool': { 'VCCLCompilerTool': {

12
configure

@ -288,13 +288,6 @@ def configure_node(o):
cc_version, is_clang = compiler_version() cc_version, is_clang = compiler_version()
# turn off strict aliasing if gcc < 4.6.0 unless it's llvm-gcc
# see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45883
# see http://code.google.com/p/v8/issues/detail?id=884
no_strict_aliasing = int(not(is_clang or cc_version >= (4,6,0)))
o['variables']['v8_no_strict_aliasing'] = no_strict_aliasing
o['variables']['node_no_strict_aliasing'] = no_strict_aliasing
# clang has always supported -fvisibility=hidden, right? # clang has always supported -fvisibility=hidden, right?
if not is_clang and cc_version < (4,0,0): if not is_clang and cc_version < (4,0,0):
o['variables']['visibility'] = '' o['variables']['visibility'] = ''
@ -303,9 +296,8 @@ def configure_node(o):
# systems, since it won't work. (The MacOS build process is different than # systems, since it won't work. (The MacOS build process is different than
# SunOS, and we haven't implemented it.) # SunOS, and we haven't implemented it.)
if sys.platform.startswith('sunos'): if sys.platform.startswith('sunos'):
o['variables']['node_use_dtrace'] = b(not options.without_dtrace); o['variables']['node_use_dtrace'] = b(not options.without_dtrace)
# Strict aliasing causes problems with the V8 snapshots on SunOS o['variables']['v8_no_strict_aliasing'] = 1 # work around compiler bug
o['variables']['strict_aliasing'] = b(False);
elif b(options.with_dtrace) == 'true': elif b(options.with_dtrace) == 'true':
raise Exception('DTrace is currently only supported on SunOS systems.') raise Exception('DTrace is currently only supported on SunOS systems.')
else: else:

Loading…
Cancel
Save