bpo-36618: Don't add -fmax-type-align flag to old clang (GH-12811) · python/cpython@a304b13

3 files changed

lines changed

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.

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
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)