|
0 |
Add Hardening flags, based on what blhc (and the Debian wiki) recommends.
|
|
1 |
Index: firmware-tomu/booster/Makefile
|
|
2 |
===================================================================
|
|
3 |
--- firmware-tomu.orig/booster/Makefile
|
|
4 |
+++ firmware-tomu/booster/Makefile
|
|
5 |
@@ -1,6 +1,7 @@
|
|
6 |
PACKAGE = booster
|
|
7 |
-ADD_CFLAGS =
|
|
8 |
-ADD_LFLAGS =
|
|
9 |
+ADD_CFLAGS = -O2 -Wformat -Werror=format-security
|
|
10 |
+ADD_CPPFLAGS = -D_FORTIFY_SOURCE=2
|
|
11 |
+ADD_LFLAGS = -Wl,-z,relro -Wl,-z,now
|
|
12 |
|
|
13 |
TRGT ?= arm-none-eabi-
|
|
14 |
CC = $(TRGT)gcc
|
|
15 |
@@ -10,7 +11,7 @@ OBJCOPY = $(TRGT)objcopy
|
|
16 |
LDSCRIPT = tomu.ld
|
|
17 |
DBG_CFLAGS = -ggdb -g -DDEBUG -Wall
|
|
18 |
DBG_LFLAGS = -ggdb -g -Wall
|
|
19 |
-CFLAGS = $(ADD_CFLAGS) \
|
|
20 |
+CFLAGS = $(ADD_CFLAGS) $(ADD_CPPFLAGS) \
|
|
21 |
-Wall -Wextra \
|
|
22 |
-mcpu=cortex-m0plus -mfloat-abi=soft -mthumb \
|
|
23 |
-ffunction-sections -fdata-sections -fno-common \
|
|
24 |
@@ -60,7 +61,7 @@ $(OBJ_DIR):
|
|
25 |
$(QUIET) mkdir $(OBJ_DIR)
|
|
26 |
|
|
27 |
$(COBJS) : $(OBJ_DIR)/%.o : %.c Makefile
|
|
28 |
- $(QUIET) echo " CC $< $(notdir $@)"
|
|
29 |
+# $(QUIET) echo " CC $< $(notdir $@)"
|
|
30 |
$(QUIET) $(CC) -c $< $(CFLAGS) -o $@ -MMD
|
|
31 |
|
|
32 |
$(OBJ_DIR)/%.o: %.cpp
|
|
33 |
Index: firmware-tomu/toboot/Makefile
|
|
34 |
===================================================================
|
|
35 |
--- firmware-tomu.orig/toboot/Makefile
|
|
36 |
+++ firmware-tomu/toboot/Makefile
|
|
37 |
@@ -1,6 +1,7 @@
|
|
38 |
PACKAGE = toboot
|
|
39 |
-ADD_CFLAGS =
|
|
40 |
-ADD_LFLAGS =
|
|
41 |
+ADD_CFLAGS = -O2 -Wformat -Werror=format-security
|
|
42 |
+ADD_CPPFLAGS = -D_FORTIFY_SOURCE=2
|
|
43 |
+ADD_LFLAGS = -Wl,-z,relro -Wl,-z,now
|
|
44 |
|
|
45 |
GIT_VERSION := $(shell dpkg-parsechangelog -l ../debian/changelog -S Version)
|
|
46 |
TRGT ?= arm-none-eabi-
|
|
47 |
@@ -21,7 +22,7 @@ endif
|
|
48 |
LDSCRIPT = toboot-bl.ld
|
|
49 |
DBG_CFLAGS = -ggdb -g -DDEBUG -Wall
|
|
50 |
DBG_LFLAGS = -ggdb -g -Wall
|
|
51 |
-CFLAGS = $(ADD_CFLAGS) \
|
|
52 |
+CFLAGS = $(ADD_CFLAGS) $(ADD_CPPFLAGS) \
|
|
53 |
-DTOBOOT_APP_FLAGS=0x00006fb0 \
|
|
54 |
-Wall -Wextra \
|
|
55 |
-mcpu=cortex-m0plus -mfloat-abi=soft -mthumb \
|
|
56 |
@@ -82,7 +83,7 @@ $(OBJ_DIR):
|
|
57 |
$(QUIET) mkdir $(OBJ_DIR)
|
|
58 |
|
|
59 |
$(COBJS) : $(OBJ_DIR)/%.o : %.c Makefile
|
|
60 |
- $(QUIET) echo " CC $< $(notdir $@)"
|
|
61 |
+# $(QUIET) echo " CC $< $(notdir $@)"
|
|
62 |
$(QUIET) $(CC) -c $< $(CFLAGS) -o $@ -MMD
|
|
63 |
|
|
64 |
$(OBJ_DIR)/%.o: %.cpp
|