diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-04-12 21:27:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-12 21:27:37 +0200 |
commit | 23a683adf803eef405d248cc9c2a7eb08a7300e2 (patch) | |
tree | 6e2c3cfbe541c098b51418c092bc8e61a20937ab /Misc/NEWS.d/next/Build | |
parent | 606c66a17faf34a4e74d4829e8fe5ad0d2879434 (diff) | |
download | cpython-git-23a683adf803eef405d248cc9c2a7eb08a7300e2.tar.gz |
bpo-36618: Add -fmax-type-align=8 flag for clang (GH-12809)
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 expected to CFLAGS and not just
CFLAGS_NODIST, since third party C extensions can have the same
issue.
Diffstat (limited to 'Misc/NEWS.d/next/Build')
-rw-r--r-- | Misc/NEWS.d/next/Build/2019-04-12-19-49-10.bpo-36618.gcI9iq.rst | 8 |
1 files changed, 8 insertions, 0 deletions
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 new file mode 100644 index 0000000000..597dd67b46 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2019-04-12-19-49-10.bpo-36618.gcI9iq.rst @@ -0,0 +1,8 @@ +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 expected to ``CFLAGS`` and not just ``CFLAGS_NODIST``, since third +party C extensions can have the same issue. |