Permalink
Browse files

build: enable strict aliasing if gcc < 4.5.0

We already enable -fstrict-aliasing when gcc >= 4.6.0 but let's enable it for
gcc < 4.5.0 as well. The aliasing bugs that we ran into in the past are all
particular to the 4.5.x releases.
  • Loading branch information...
1 parent 4f27a08 commit 57276ae70ade5faeb0be0d26a6d6ff08d8d579ac @bnoordhuis bnoordhuis committed Jun 26, 2012
Showing with 6 additions and 9 deletions.
  1. +2 −2 common.gypi
  2. +4 −7 configure
View
@@ -1,6 +1,6 @@
{
'variables': {
- 'strict_aliasing%': 'false', # turn on/off -fstrict-aliasing
+ '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
@@ -52,7 +52,7 @@
# pull in V8's postmortem metadata
'ldflags': [ '-Wl,-z,allextract' ]
}],
- ['strict_aliasing!="true"', {
+ ['node_no_strict_aliasing==1', {
'cflags': [ '-fno-strict-aliasing' ],
}],
],
View
@@ -267,15 +267,12 @@ def configure_node(o):
is_llvm, is_clang, cc_version = compiler_version()
- # turn off strict aliasing if gcc < 4.6.0 unless it's llvm-gcc
+ # turn off strict aliasing if gcc >= 4.5.0 && < 4.6.0 unless it's clang
# see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45883
# see http://code.google.com/p/v8/issues/detail?id=884
- o['variables']['strict_aliasing'] = b(is_clang or cc_version >= (4,6,0))
-
- # disable strict aliasing in V8 if we're compiling with gcc 4.5.x,
- # it makes V8 crash in various ways
- o['variables']['v8_no_strict_aliasing'] = b(
- not is_clang and (4,5,0) <= cc_version < (4,6,0))
+ no_strict_aliasing = (4,5,0) <= cc_version < (4,6,0) and not is_clang
+ o['variables']['node_no_strict_aliasing'] = int(no_strict_aliasing)
+ o['variables']['v8_no_strict_aliasing'] = int(no_strict_aliasing)
# clang has always supported -fvisibility=hidden, right?
if not is_clang and cc_version < (4,0,0):

0 comments on commit 57276ae

Please sign in to comment.