File: 0006-Add-hardening-flags-in-the-build.patch

package info (click to toggle)
scalene 1.5.16-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,904 kB
  • sloc: cpp: 22,801; javascript: 10,556; python: 9,187; ansic: 811; makefile: 197; sh: 45
file content (52 lines) | stat: -rw-r--r-- 2,350 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From: Emmanuel Arias <eamanu@yaerobi.com>
Date: Thu, 23 Jun 2022 10:26:16 -0300
Subject: Add CXXFLAGS, CPPFLAGS and LDFLAGS in the build

Add the CXXFLAGS, CPPFLAGS and LDFLAGS flags in build to solve
hardening issues.

Rename the upstream CXXFLAGS to SCALENECXXFLAGS to used th
Debian CXXFLAGS and the upstream flags.
---
 GNUmakefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: scalene-0.7.5/GNUmakefile
===================================================================
--- scalene-0.7.5.orig/GNUmakefile	2022-06-23 15:13:17.226949413 -0300
+++ scalene-0.7.5/GNUmakefile	2022-06-23 15:14:14.383183288 -0300
@@ -7,7 +7,7 @@
 .PHONY: black clang-format prettier format upload vendor-deps
 
 # CXXFLAGS = -std=c++17 -g -O0 # FIXME
-CXXFLAGS = -std=c++17 -Wall -g -O3 -DNDEBUG -D_REENTRANT=1 -DHL_USE_XXREALLOC=1 -pipe -fno-builtin-malloc -fvisibility=hidden
+SCALENECXXFLAGS = -std=c++17 -Wall -g -O3 -DNDEBUG -D_REENTRANT=1 -DHL_USE_XXREALLOC=1 -pipe -fno-builtin-malloc -fvisibility=hidden
 # CXX = g++
 
 INCLUDES  = -Isrc -Isrc/include
@@ -23,14 +23,14 @@
   else
     ARCH := -arch x86_64
   endif
-  CXXFLAGS := -std=c++17 -Wall -g -O3 -DNDEBUG -D_REENTRANT=1 -DHL_USE_XXREALLOC=1 -pipe -fno-builtin-malloc -fvisibility=hidden -flto -ftls-model=initial-exec -ftemplate-depth=1024 $(ARCH) -compatibility_version 1 -current_version 1 -dynamiclib
+  SCALENECXXFLAGS := -std=c++17 -Wall -g -O3 -DNDEBUG -D_REENTRANT=1 -DHL_USE_XXREALLOC=1 -pipe -fno-builtin-malloc -fvisibility=hidden -flto -ftls-model=initial-exec -ftemplate-depth=1024 $(ARCH) -compatibility_version 1 -current_version 1 -dynamiclib
   SED_INPLACE = -i ''
 
 else # non-Darwin
   LIBFILE := lib$(LIBNAME).so
   WRAPPER := vendor/Heap-Layers/wrappers/gnuwrapper.cpp
   INCLUDES := $(INCLUDES) -I/usr/include/nptl 
-  CXXFLAGS := $(CXXFLAGS) -fPIC -shared -Bsymbolic
+  SCALENECXXFLAGS := $(SCALENECXXFLAGS) -fPIC -shared -Bsymbolic
   RPATH_FLAGS :=
   SED_INPLACE = -i
 
@@ -43,7 +43,7 @@
 all: $(OUTDIR)/$(LIBFILE)
 
 $(OUTDIR)/$(LIBFILE): vendor/Heap-Layers $(SRC) $(C_SOURCES) GNUmakefile
-	$(CXX) $(CXXFLAGS) $(INCLUDES) $(SRC) -o $(OUTDIR)/$(LIBFILE) -ldl -lpthread
+	$(CXX) $(SCALENECXXFLAGS) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(INCLUDES) $(SRC) -o $(OUTDIR)/$(LIBFILE) -ldl -lpthread
 
 clean:
 	rm -f $(OUTDIR)/$(LIBFILE) scalene/*.so scalene/*.dylib