Skip to content

Commit

Permalink
bpo-36618: Don't add -fmax-type-align flag to old clang (GH-12811)
Browse files Browse the repository at this point in the history
  • Loading branch information
vstinner committed Apr 12, 2019
1 parent 1e82954 commit a304b13
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
Expand Up @@ -4,5 +4,5 @@ alignment on 16 bytes by default and so uses MOVAPS instruction which can
lead to segmentation fault. Instruct clang that Python is limited to
alignemnt on 8 bytes to use MOVUPS instruction instead: slower but don't
trigger a SIGSEGV if the memory is not aligned on 16 bytes. Sadly, the flag
must be expected to ``CFLAGS`` and not just ``CFLAGS_NODIST``, since third
party C extensions can have the same issue.
must be added to ``CFLAGS`` and not just ``CFLAGS_NODIST``, since third party C
extensions can have the same issue.
9 changes: 7 additions & 2 deletions configure
Expand Up @@ -6889,9 +6889,14 @@ then
# instead: slower but don't trigger a SIGSEGV if the memory is not aligned
# on 16 bytes.
#
# Sadly, the flag must be expected to CFLAGS and not just CFLAGS_NODIST,
# Sadly, the flag must be added to CFLAGS and not just CFLAGS_NODIST,
# since third party C extensions can have the same issue.
CFLAGS="$CFLAGS -fmax-type-align=8"
#
# Check if -fmax-type-align flag is supported (it's not supported by old
# clang versions):
if "$CC" -v --help 2>/dev/null |grep -- -fmax-type-align > /dev/null; then
CFLAGS="$CFLAGS -fmax-type-align=8"
fi
fi


Expand Down
9 changes: 7 additions & 2 deletions configure.ac
Expand Up @@ -1540,9 +1540,14 @@ then
# instead: slower but don't trigger a SIGSEGV if the memory is not aligned
# on 16 bytes.
#
# Sadly, the flag must be expected to CFLAGS and not just CFLAGS_NODIST,
# Sadly, the flag must be added to CFLAGS and not just CFLAGS_NODIST,
# since third party C extensions can have the same issue.
CFLAGS="$CFLAGS -fmax-type-align=8"
#
# Check if -fmax-type-align flag is supported (it's not supported by old
# clang versions):
if "$CC" -v --help 2>/dev/null |grep -- -fmax-type-align > /dev/null; then
CFLAGS="$CFLAGS -fmax-type-align=8"
fi
fi

AC_SUBST(BASECFLAGS)
Expand Down

0 comments on commit a304b13

Please sign in to comment.