File: mangle-fstack-protector.diff

package info (click to toggle)
python3-stdlib-extensions 3.11.2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 28,020 kB
  • sloc: python: 134,527; ansic: 24,386; sh: 213; makefile: 190
file content (24 lines) | stat: -rw-r--r-- 972 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# DP: When using GCC versions older than 4.9, automagically mangle
# DP: -fstack-protector-strong to -fstack-protector

--- a/3.8/Lib/distutils/sysconfig.py
+++ b/3.8/Lib/distutils/sysconfig.py
@@ -13,6 +13,7 @@ import _imp
 import os
 import re
 import sys
+import fnmatch
 
 from .errors import DistutilsPlatformError
 from .util import get_platform, get_host_platform
@@ -214,6 +215,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: