From 587a2f5fe23e24814cf42deac960d900b3f85f8b Mon Sep 17 00:00:00 2001 From: Matthias Klose Date: Thu, 16 Dec 2021 23:13:29 +0000 Subject: [PATCH] mangle-fstack-protector # DP: When using GCC versions older than 4.9, automagically mangle # DP: -fstack-protector-strong to -fstack-protector # DP: When using GCC versions older than 4.9, automagically mangle # DP: -fstack-protector-strong to -fstack-protector Gbp-Pq: Name mangle-fstack-protector.diff --- Lib/distutils/sysconfig.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py index 551fbe9..bbb2ae4 100644 --- a/Lib/distutils/sysconfig.py +++ b/Lib/distutils/sysconfig.py @@ -13,6 +13,7 @@ import _imp import os import re import sys +import fnmatch from .errors import DistutilsPlatformError @@ -220,6 +221,10 @@ def customize_compiler(compiler): cc = newcc if 'CXX' in os.environ: cxx = os.environ['CXX'] + if fnmatch.filter([cc, cxx], '*-4.[0-8]'): + configure_cflags = configure_cflags.replace('-fstack-protector-strong', '-fstack-protector') + ldshared = ldshared.replace('-fstack-protector-strong', '-fstack-protector') + cflags = cflags.replace('-fstack-protector-strong', '-fstack-protector') if 'LDSHARED' in os.environ: ldshared = os.environ['LDSHARED'] if 'CPP' in os.environ: -- 2.30.2