From b40f813bab51b676efe37cc7f459c42ce806a18a Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 11 Jul 2012 03:19:12 +0200 Subject: 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. --- common.gypi | 11 ++++++----- configure | 12 ++---------- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/common.gypi b/common.gypi index 8d6041418..e12469ff4 100644 --- a/common.gypi +++ b/common.gypi @@ -1,6 +1,5 @@ { 'variables': { - 'node_no_strict_aliasing%': 0, # turn off -fstrict-aliasing 'visibility%': 'hidden', # V8's visibility setting 'target_arch%': 'ia32', # set v8's target architecture 'host_arch%': 'ia32', # set v8's host architecture @@ -42,7 +41,12 @@ }, }, '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': [ ['target_arch=="x64"', { 'msvs_configuration_platform': 'x64', @@ -52,9 +56,6 @@ # pull in V8's postmortem metadata 'ldflags': [ '-Wl,-z,allextract' ] }], - ['node_no_strict_aliasing==1', { - 'cflags': [ '-fno-strict-aliasing' ], - }], ], 'msvs_settings': { 'VCCLCompilerTool': { diff --git a/configure b/configure index 5e60c55f4..b7d8498ab 100755 --- a/configure +++ b/configure @@ -288,13 +288,6 @@ def configure_node(o): 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? if not is_clang and cc_version < (4,0,0): o['variables']['visibility'] = '' @@ -303,9 +296,8 @@ def configure_node(o): # systems, since it won't work. (The MacOS build process is different than # SunOS, and we haven't implemented it.) if sys.platform.startswith('sunos'): - o['variables']['node_use_dtrace'] = b(not options.without_dtrace); - # Strict aliasing causes problems with the V8 snapshots on SunOS - o['variables']['strict_aliasing'] = b(False); + o['variables']['node_use_dtrace'] = b(not options.without_dtrace) + o['variables']['v8_no_strict_aliasing'] = 1 # work around compiler bug elif b(options.with_dtrace) == 'true': raise Exception('DTrace is currently only supported on SunOS systems.') else: -- cgit v1.2.3