[Python-checkins] bpo-36618: Don't add -fmax-type-align=8 flag for clang (GH-13320)

Victor Stinner webhook-mailer at python.org
Tue May 14 13:29:56 EDT 2019


https://github.com/python/cpython/commit/d97adfb409290a1e4ad549e4af58cacea86d3358
commit: d97adfb409290a1e4ad549e4af58cacea86d3358
branch: master
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2019-05-14T19:29:53+02:00
summary:

bpo-36618: Don't add -fmax-type-align=8 flag for clang (GH-13320)

Python 3.8 now respects the x86-64 ABI: memory allocations are
aligned on 16 bytes. The clang flag was only used as a temporary
workaround.

files:
M configure
M configure.ac

diff --git a/configure b/configure
index e6e400735159..6da65ddbba50 100755
--- a/configure
+++ b/configure
@@ -6905,26 +6905,6 @@ then
     esac
 fi
 
-if test -n "${cc_is_clang}"
-then
-    # bpo-36618: Add -fmax-type-align=8 to CFLAGS when clang compiler is
-    # detected. The pymalloc memory allocator aligns memory on 8 bytes. On
-    # x86-64, clang expects 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 added to CFLAGS and not just CFLAGS_NODIST,
-    # since third party C extensions can have the same issue.
-    #
-    # 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 a02597da2db5..e673e136be8a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1543,26 +1543,6 @@ then
     esac
 fi
 
-if test -n "${cc_is_clang}"
-then
-    # bpo-36618: Add -fmax-type-align=8 to CFLAGS when clang compiler is
-    # detected. The pymalloc memory allocator aligns memory on 8 bytes. On
-    # x86-64, clang expects 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 added to CFLAGS and not just CFLAGS_NODIST,
-    # since third party C extensions can have the same issue.
-    #
-    # 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)
 AC_SUBST(CFLAGS_NODIST)
 AC_SUBST(LDFLAGS_NODIST)



More information about the Python-checkins mailing list