[Python-checkins] bpo-36618: Don't add -fmax-type-align flag to old clang (GH-12811)

Victor Stinner webhook-mailer at python.org
Fri Apr 12 18:51:10 EDT 2019


https://github.com/python/cpython/commit/a304b136adda3575898d8b5debedcd48d5072272
commit: a304b136adda3575898d8b5debedcd48d5072272
branch: master
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2019年04月13日T00:51:07+02:00
summary:
bpo-36618: Don't add -fmax-type-align flag to old clang (GH-12811)
files:
M Misc/NEWS.d/next/Build/2019-04-12-19-49-10.bpo-36618.gcI9iq.rst
M configure
M configure.ac
diff --git a/Misc/NEWS.d/next/Build/2019-04-12-19-49-10.bpo-36618.gcI9iq.rst b/Misc/NEWS.d/next/Build/2019-04-12-19-49-10.bpo-36618.gcI9iq.rst
index 597dd67b46e0..4408227b326c 100644
--- a/Misc/NEWS.d/next/Build/2019-04-12-19-49-10.bpo-36618.gcI9iq.rst
+++ b/Misc/NEWS.d/next/Build/2019-04-12-19-49-10.bpo-36618.gcI9iq.rst
@@ -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.
diff --git a/configure b/configure
index ac1e66a96bb6..9c7eded85359 100755
--- a/configure
+++ b/configure
@@ -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
 
 
diff --git a/configure.ac b/configure.ac
index 863b34245ad6..6450519444c8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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)


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /