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

Commit

Permalink
build: disable strict aliasing in v8 with gcc 4.5.x
Browse files Browse the repository at this point in the history
The gcc 4.5.x have various bugs that make V8 crash in various and interesting
ways when -fstrict-aliasing is in effect.
  • Loading branch information
bnoordhuis committed Jun 26, 2012
1 parent f60def5 commit 07e5877
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def host_arch():
def target_arch():
return host_arch()

def cc_version():
def compiler_version():
try:
proc = subprocess.Popen([CC, '-v'], stderr=subprocess.PIPE)
except OSError:
Expand All @@ -254,7 +254,7 @@ def cc_version():
version = version_line.split("version")[1].strip().split()[0].split(".")
if not version:
return None
return ['LLVM' in version_line] + version
return ('LLVM' in version_line, 'clang' in CC, tuple(version))

def configure_node(o):
# TODO add gdb
Expand All @@ -265,14 +265,20 @@ def configure_node(o):
o['variables']['target_arch'] = options.dest_cpu or target_arch()
o['default_configuration'] = 'Debug' if options.debug else 'Release'

is_llvm, is_clang, cc_version = 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
o['variables']['strict_aliasing'] = b(
'clang' in CC or cc_version() >= [False, 4, 6, 0])
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))

# clang has always supported -fvisibility=hidden, right?
if 'clang' not in CC and cc_version() < [False, 4, 0, 0]:
if not is_clang and cc_version < (4,0,0):
o['variables']['visibility'] = ''

# By default, enable DTrace on SunOS systems. Don't allow it on other
Expand Down

0 comments on commit 07e5877

Please sign in to comment.