bpo-36618: Don't add -fmax-type-align flag to old clang (GH-12811) · python/cpython@a304b13 (original) (raw)
3 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -4,5 +4,5 @@ alignment on 16 bytes by default and so uses MOVAPS instruction which can | ||
4 | 4 | lead to segmentation fault. Instruct clang that Python is limited to |
5 | 5 | alignemnt on 8 bytes to use MOVUPS instruction instead: slower but don't |
6 | 6 | 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. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -6889,9 +6889,14 @@ then | ||
6889 | 6889 | # instead: slower but don't trigger a SIGSEGV if the memory is not aligned |
6890 | 6890 | # on 16 bytes. |
6891 | 6891 | # |
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, | |
6893 | 6893 | # 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 | |
6895 | 6900 | fi |
6896 | 6901 | |
6897 | 6902 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1540,9 +1540,14 @@ then | ||
1540 | 1540 | # instead: slower but don't trigger a SIGSEGV if the memory is not aligned |
1541 | 1541 | # on 16 bytes. |
1542 | 1542 | # |
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, | |
1544 | 1544 | # 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 | |
1546 | 1551 | fi |
1547 | 1552 | |
1548 | 1553 | AC_SUBST(BASECFLAGS) |