mangle-fstack-protector
authorMatthias Klose <doko@debian.org>
Sun, 16 Jan 2022 17:12:18 +0000 (17:12 +0000)
committerMatthias Klose <doko@debian.org>
Sun, 16 Jan 2022 17:12:18 +0000 (17:12 +0000)
# 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

index 551fbe969136839af36c2e6e3d04961070eb4c9c..bbb2ae47f1c8342b2fe82b15663d574229e80a10 100644 (file)
@@ -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: