Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Fix #2830 for the old gcc bug on SmartOS
Browse files Browse the repository at this point in the history
  • Loading branch information
Shigeki Ohtsu authored and isaacs committed Feb 27, 2012
1 parent 0e7dad3 commit 82ad1f8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
12 changes: 7 additions & 5 deletions common.gypi
Expand Up @@ -36,12 +36,14 @@
'Release': {
'conditions': [
[ 'OS!="solaris"', {
'cflags': [ '-fomit-frame-pointer' ]
'cflags': [ '-O3','-fomit-frame-pointer', '-fdata-sections', '-ffunction-sections' ],
}],
[ 'OS=="solaris" and gcc_optimize_level =="-O3"', {
'cflags': [ '-O3', '-fdata-sections', '-ffunction-sections' ],
}],
[ 'OS=="solaris" and gcc_optimize_level =="-O"', {
'cflags': [ '-O', '-fdata-sections', '-ffunction-sections' ], # For bug fix of #2830
}],
],
# 'defines': [ 'NDEBUG' ],
'cflags': [ '-O3', '-fdata-sections', '-ffunction-sections' ],
'conditions': [
['target_arch=="x64"', {
'msvs_configuration_platform': 'x64',
}],
Expand Down
15 changes: 13 additions & 2 deletions configure
@@ -1,10 +1,10 @@
#!/usr/bin/env python

import optparse
import os
import pprint
import subprocess
import sys
from distutils.version import StrictVersion

root_dir = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(root_dir, 'deps', 'v8', 'tools'))
Expand Down Expand Up @@ -200,6 +200,17 @@ def host_arch():
def target_arch():
return host_arch()

def gcc_optimize_level():
cc = ['gcc']
cmd = cc + [ '-dumpversion' ]
p = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p.stdin.write('\n')
out = p.communicate()[0]
gcc_version = (str(out).split('\n'))[0]
if StrictVersion(gcc_version) >= '4.6.1':
return '-O3'
else:
return '-O'

def configure_node(o):
# TODO add gdb
Expand All @@ -214,7 +225,7 @@ def configure_node(o):
# TODO move to node.gyp
if sys.platform == 'sunos5':
o['variables']['visibility'] = '' # FIXME -fvisibility=hidden, should be a gcc check

o['variables']['gcc_optimize_level'] = gcc_optimize_level() # For bug fix of #2830

def configure_libz(o):
o['variables']['node_shared_zlib'] = b(options.shared_zlib)
Expand Down

3 comments on commit 82ad1f8

@isaacs
Copy link

@isaacs isaacs commented on 82ad1f8 Feb 27, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shigeki Thanks for this. Landed in master.

@shigeki
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isaacs Thanks for merge.
I found that node crashed into core dump in test/simple/test-script-new.js on SmartOS which may be caused by the another issue but it has just been solved in 44daa98

@isaacs
Copy link

@isaacs isaacs commented on 82ad1f8 Feb 28, 2012

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the test-script-new test should be passing on the latest master now.

Please sign in to comment.