bpo-36618: Don't add -fmax-type-align=8 flag for clang (GH-13320) · python/cpython@d97adfb

2 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -6905,26 +6905,6 @@ then

69056905

esac

69066906

fi

69076907
6908-

if test -n "${cc_is_clang}"

6909-

then

6910-

# bpo-36618: Add -fmax-type-align=8 to CFLAGS when clang compiler is

6911-

# detected. The pymalloc memory allocator aligns memory on 8 bytes. On

6912-

# x86-64, clang expects alignment on 16 bytes by default and so uses MOVAPS

6913-

# instruction which can lead to segmentation fault. Instruct clang that

6914-

# Python is limited to alignemnt on 8 bytes to use MOVUPS instruction

6915-

# instead: slower but don't trigger a SIGSEGV if the memory is not aligned

6916-

# on 16 bytes.

6917-

#

6918-

# Sadly, the flag must be added to CFLAGS and not just CFLAGS_NODIST,

6919-

# since third party C extensions can have the same issue.

6920-

#

6921-

# Check if -fmax-type-align flag is supported (it's not supported by old

6922-

# clang versions):

6923-

if "$CC" -v --help 2>/dev/null |grep -- -fmax-type-align > /dev/null; then

6924-

CFLAGS="$CFLAGS -fmax-type-align=8"

6925-

fi

6926-

fi

6927-
69286908
69296909
69306910
Original file line numberDiff line numberDiff line change

@@ -1543,26 +1543,6 @@ then

15431543

esac

15441544

fi

15451545
1546-

if test -n "${cc_is_clang}"

1547-

then

1548-

# bpo-36618: Add -fmax-type-align=8 to CFLAGS when clang compiler is

1549-

# detected. The pymalloc memory allocator aligns memory on 8 bytes. On

1550-

# x86-64, clang expects alignment on 16 bytes by default and so uses MOVAPS

1551-

# instruction which can lead to segmentation fault. Instruct clang that

1552-

# Python is limited to alignemnt on 8 bytes to use MOVUPS instruction

1553-

# instead: slower but don't trigger a SIGSEGV if the memory is not aligned

1554-

# on 16 bytes.

1555-

#

1556-

# Sadly, the flag must be added to CFLAGS and not just CFLAGS_NODIST,

1557-

# since third party C extensions can have the same issue.

1558-

#

1559-

# Check if -fmax-type-align flag is supported (it's not supported by old

1560-

# clang versions):

1561-

if "$CC" -v --help 2>/dev/null |grep -- -fmax-type-align > /dev/null; then

1562-

CFLAGS="$CFLAGS -fmax-type-align=8"

1563-

fi

1564-

fi

1565-
15661546

AC_SUBST(BASECFLAGS)

15671547

AC_SUBST(CFLAGS_NODIST)

15681548

AC_SUBST(LDFLAGS_NODIST)