@@ -239,7 +239,7 @@ def host_arch():
239239def target_arch ():
240240 return host_arch ()
241241
242- def cc_version ():
242+ def compiler_version ():
243243 try :
244244 proc = subprocess .Popen ([CC , '-v' ], stderr = subprocess .PIPE )
245245 except OSError :
@@ -254,7 +254,7 @@ def cc_version():
254254 version = version_line .split ("version" )[1 ].strip ().split ()[0 ].split ("." )
255255 if not version :
256256 return None
257- return [ 'LLVM' in version_line ] + version
257+ return ( 'LLVM' in version_line , 'clang' in CC , tuple ( version ))
258258
259259def configure_node (o ):
260260 # TODO add gdb
@@ -265,14 +265,20 @@ def configure_node(o):
265265 o ['variables' ]['target_arch' ] = options .dest_cpu or target_arch ()
266266 o ['default_configuration' ] = 'Debug' if options .debug else 'Release'
267267
268+ is_llvm , is_clang , cc_version = compiler_version ()
269+
268270 # turn off strict aliasing if gcc < 4.6.0 unless it's llvm-gcc
269271 # see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45883
270272 # see http://code.google.com/p/v8/issues/detail?id=884
271- o ['variables' ]['strict_aliasing' ] = b (
272- 'clang' in CC or cc_version () >= [False , 4 , 6 , 0 ])
273+ o ['variables' ]['strict_aliasing' ] = b (is_clang or cc_version >= (4 ,6 ,0 ))
274+
275+ # disable strict aliasing in V8 if we're compiling with gcc 4.5.x,
276+ # it makes V8 crash in various ways
277+ o ['variables' ]['v8_no_strict_aliasing' ] = b (
278+ not is_clang and (4 ,5 ,0 ) <= cc_version < (4 ,6 ,0 ))
273279
274280 # clang has always supported -fvisibility=hidden, right?
275- if 'clang' not in CC and cc_version () < [ False , 4 , 0 , 0 ] :
281+ if not is_clang and cc_version < ( 4 , 0 , 0 ) :
276282 o ['variables' ]['visibility' ] = ''
277283
278284 # By default, enable DTrace on SunOS systems. Don't allow it on other
0 commit comments