Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use hardening flags when compiling #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions booster/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
PACKAGE = booster
ADD_CFLAGS =
ADD_LFLAGS =
PACKAGE = booster
ADD_CFLAGS =
ADD_CPPFLAGS =
ADD_LFLAGS =

TRGT ?= arm-none-eabi-
CC = $(TRGT)gcc
Expand All @@ -10,15 +11,18 @@ OBJCOPY = $(TRGT)objcopy
LDSCRIPT = tomu.ld
DBG_CFLAGS = -ggdb -g -DDEBUG -Wall
DBG_LFLAGS = -ggdb -g -Wall
CFLAGS = $(ADD_CFLAGS) \
CPPFLAGS = -D_FORTIFY_SOURCE=2 $(ADD_CPPFLAGS)
CFLAGS = $(ADD_CFLAGS) $(CPPFLAGS) \
-Wall -Wextra \
-mcpu=cortex-m0plus -mfloat-abi=soft -mthumb \
-ffunction-sections -fdata-sections -fno-common \
-fomit-frame-pointer -Os
-fomit-frame-pointer -O2 \
-Wformat -Werror=format-security
CXXFLAGS = $(CFLAGS) -std=c++11 -fno-rtti -fno-exceptions
LFLAGS = $(ADD_LFLAGS) $(CFLAGS) \
-nostartfiles \
-Wl,--gc-sections \
-Wl,-z,relro -Wl,-z,now \
-Wl,--no-warn-mismatch,--script=$(LDSCRIPT),--build-id=none

OBJ_DIR = .obj
Expand Down
18 changes: 11 additions & 7 deletions toboot/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
PACKAGE = toboot
ADD_CFLAGS =
ADD_LFLAGS =
PACKAGE = toboot
ADD_CFLAGS =
ADD_CPPFLAGS =
ADD_LFLAGS =

GIT_VERSION= $(shell git describe --tags)
TRGT ?= arm-none-eabi-
Expand All @@ -24,17 +25,20 @@ endif
LDSCRIPT = toboot-bl.ld
DBG_CFLAGS = -ggdb -g -DDEBUG -Wall
DBG_LFLAGS = -ggdb -g -Wall
CFLAGS = $(ADD_CFLAGS) \
-DTOBOOT_APP_FLAGS=0x00006fb0 \
CPPFLAGS = -D_FORTIFY_SOURCE=2 $(ADD_CPPFLAGS)
CFLAGS = $(ADD_CFLAGS) $(CPPFLAGS) \
-DTOBOOT_APP_FLAGS=0x00006fb0 \
-Wall -Wextra \
-mcpu=cortex-m0plus -mfloat-abi=soft -mthumb \
-ffunction-sections -fdata-sections -fno-common \
-fomit-frame-pointer -Os \
-DTOBOOT_BOARD=TOBOOT_BOARD_$(BOARD) \
-fomit-frame-pointer -O2 \
-Wformat -Werror=format-security \
-DTOBOOT_BOARD=TOBOOT_BOARD_$(BOARD) \
-DGIT_VERSION=u\"$(GIT_VERSION)\" -std=gnu11
LFLAGS = $(ADD_LFLAGS) $(CFLAGS) \
-nostartfiles \
-Wl,--gc-sections \
-Wl,-z,relro -Wl,-z,now \
-Wl,--no-warn-mismatch,--script=$(LDSCRIPT),--build-id=none

OBJ_DIR = .obj
Expand Down