use optimization option

This commit is contained in:
Yiyang Kang 2021-02-24 14:05:05 +08:00
parent a057b43d34
commit 5a2433ad58
Signed by: kkyy
GPG Key ID: 80FD317ECAF06CC3
3 changed files with 45 additions and 6 deletions

View File

@ -1,7 +1,7 @@
pkgbase = python36 pkgbase = python36
pkgdesc = Major release 3.6 of the Python high-level programming language pkgdesc = Major release 3.6 of the Python high-level programming language
pkgver = 3.6.13 pkgver = 3.6.13
pkgrel = 1 pkgrel = 2
url = http://www.python.org/ url = http://www.python.org/
arch = i686 arch = i686
arch = x86_64 arch = x86_64
@ -22,7 +22,9 @@ pkgbase = python36
optdepends = sqlite optdepends = sqlite
options = !makeflags options = !makeflags
source = http://www.python.org/ftp/python/3.6.13/Python-3.6.13.tar.xz source = http://www.python.org/ftp/python/3.6.13/Python-3.6.13.tar.xz
source = fix-faulthandler._stack_overflow-on-GCC-10.patch
sha256sums = a47a43a53abb42286a2c11965343ff56711b9e64e8d11bf2c6701a4fb8ce1a0f sha256sums = a47a43a53abb42286a2c11965343ff56711b9e64e8d11bf2c6701a4fb8ce1a0f
sha256sums = 4146f0bff3b79cd05940e2274c6800897a60ae0264d2f05a150137da7c620fda
pkgname = python36 pkgname = python36

View File

@ -3,7 +3,7 @@
pkgname=python36 pkgname=python36
pkgver=3.6.13 pkgver=3.6.13
pkgrel=1 pkgrel=2
_pybasever=3.6 _pybasever=3.6
_pymajver=3 _pymajver=3
pkgdesc="Major release 3.6 of the Python high-level programming language" pkgdesc="Major release 3.6 of the Python high-level programming language"
@ -14,12 +14,21 @@ depends=('expat' 'bzip2' 'gdbm' 'openssl' 'libffi' 'zlib')
makedepends=('tk' 'sqlite' 'bluez-libs' 'mpdecimal') makedepends=('tk' 'sqlite' 'bluez-libs' 'mpdecimal')
optdepends=('tk: for tkinter' 'sqlite') optdepends=('tk: for tkinter' 'sqlite')
options=('!makeflags') options=('!makeflags')
source=(http://www.python.org/ftp/python/${pkgver}/Python-${pkgver}.tar.xz) source=(
sha256sums=('a47a43a53abb42286a2c11965343ff56711b9e64e8d11bf2c6701a4fb8ce1a0f') http://www.python.org/ftp/python/${pkgver}/Python-${pkgver}.tar.xz
fix-faulthandler._stack_overflow-on-GCC-10.patch
)
sha256sums=(
'a47a43a53abb42286a2c11965343ff56711b9e64e8d11bf2c6701a4fb8ce1a0f'
'4146f0bff3b79cd05940e2274c6800897a60ae0264d2f05a150137da7c620fda'
)
prepare() { prepare() {
cd "${srcdir}/Python-${pkgver}" cd "${srcdir}/Python-${pkgver}"
# fix build with gcc10 #bpo-38965
patch --forward --strip=0 --input="${srcdir}/fix-faulthandler._stack_overflow-on-GCC-10.patch"
# FS#23997 # FS#23997
sed -i -e "s|^#.* /usr/local/bin/python|#!/usr/bin/python|" Lib/cgi.py sed -i -e "s|^#.* /usr/local/bin/python|#!/usr/bin/python|" Lib/cgi.py
@ -44,9 +53,10 @@ build() {
--with-system-libmpdec \ --with-system-libmpdec \
--with-system-ffi \ --with-system-ffi \
--enable-loadable-sqlite-extensions \ --enable-loadable-sqlite-extensions \
--without-ensurepip --without-ensurepip \
--enable-optimizations
make make -j$(nproc)
} }
package() { package() {

View File

@ -0,0 +1,27 @@
--- Modules/faulthandler.c
+++ Modules/faulthandler.c
@@ -1161,18 +1161,14 @@ faulthandler_fatal_error_py(PyObject *self, PyObject *args)
#if defined(FAULTHANDLER_USE_ALT_STACK)
#define FAULTHANDLER_STACK_OVERFLOW
-#ifdef __INTEL_COMPILER
- /* Issue #23654: Turn off ICC's tail call optimization for the
- * stack_overflow generator. ICC turns the recursive tail call into
- * a loop. */
-# pragma intel optimization_level 0
-#endif
-static
-uintptr_t
+static uintptr_t
stack_overflow(uintptr_t min_sp, uintptr_t max_sp, size_t *depth)
{
- /* allocate 4096 bytes on the stack at each call */
- unsigned char buffer[4096];
+ /* Allocate (at least) 4096 bytes on the stack at each call.
+
+ bpo-23654, bpo-38965: use volatile keyword to prevent tail call
+ optimization. */
+ volatile unsigned char buffer[4096];
uintptr_t sp = (uintptr_t)&buffer;
*depth += 1;
if (sp < min_sp || max_sp < sp)