Skip to content

Commit a304b13

Browse files
authored
bpo-36618: Don't add -fmax-type-align flag to old clang (GH-12811)
1 parent 1e82954 commit a304b13

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

Misc/NEWS.d/next/Build/2019-04-12-19-49-10.bpo-36618.gcI9iq.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ alignment on 16 bytes by default and so uses MOVAPS instruction which can
44
lead to segmentation fault. Instruct clang that Python is limited to
55
alignemnt on 8 bytes to use MOVUPS instruction instead: slower but don't
66
trigger a SIGSEGV if the memory is not aligned on 16 bytes. Sadly, the flag
7-
must be expected to ``CFLAGS`` and not just ``CFLAGS_NODIST``, since third
8-
party C extensions can have the same issue.
7+
must be added to ``CFLAGS`` and not just ``CFLAGS_NODIST``, since third party C
8+
extensions can have the same issue.

configure

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6889,9 +6889,14 @@ then
68896889
# instead: slower but don't trigger a SIGSEGV if the memory is not aligned
68906890
# on 16 bytes.
68916891
#
6892-
# Sadly, the flag must be expected to CFLAGS and not just CFLAGS_NODIST,
6892+
# Sadly, the flag must be added to CFLAGS and not just CFLAGS_NODIST,
68936893
# since third party C extensions can have the same issue.
6894-
CFLAGS="$CFLAGS -fmax-type-align=8"
6894+
#
6895+
# Check if -fmax-type-align flag is supported (it's not supported by old
6896+
# clang versions):
6897+
if "$CC" -v --help 2>/dev/null |grep -- -fmax-type-align > /dev/null; then
6898+
CFLAGS="$CFLAGS -fmax-type-align=8"
6899+
fi
68956900
fi
68966901

68976902

configure.ac

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1540,9 +1540,14 @@ then
15401540
# instead: slower but don't trigger a SIGSEGV if the memory is not aligned
15411541
# on 16 bytes.
15421542
#
1543-
# Sadly, the flag must be expected to CFLAGS and not just CFLAGS_NODIST,
1543+
# Sadly, the flag must be added to CFLAGS and not just CFLAGS_NODIST,
15441544
# since third party C extensions can have the same issue.
1545-
CFLAGS="$CFLAGS -fmax-type-align=8"
1545+
#
1546+
# Check if -fmax-type-align flag is supported (it's not supported by old
1547+
# clang versions):
1548+
if "$CC" -v --help 2>/dev/null |grep -- -fmax-type-align > /dev/null; then
1549+
CFLAGS="$CFLAGS -fmax-type-align=8"
1550+
fi
15461551
fi
15471552

15481553
AC_SUBST(BASECFLAGS)

0 commit comments

Comments
 (0)