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

Commit

Permalink
build: enable strict aliasing if gcc < 4.5.0
Browse files Browse the repository at this point in the history
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
bnoordhuis committed Jun 26, 2012
1 parent 4f27a08 commit 57276ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions common.gypi
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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' ],
}],
],
Expand Down
11 changes: 4 additions & 7 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 57276ae

Please sign in to comment.