Add support for stack-protector
Add support for stack protector for UBOOT, SPL, and TPL
as well as new pytest for stackprotector
Signed-off-by: Joel Peshkin <joel.peshkin@broadcom.com>
Adjust UEFI build flags.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index 4153f7e..e79f010 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -11,7 +11,8 @@
endif
endif
-CFLAGS_NON_EFI := -fno-pic -ffixed-r9 -ffunction-sections -fdata-sections
+CFLAGS_NON_EFI := -fno-pic -ffixed-r9 -ffunction-sections -fdata-sections \
+ -fstack-protector-strong
CFLAGS_EFI := -fpic -fshort-wchar
LDFLAGS_FINAL += --gc-sections
diff --git a/arch/riscv/lib/Makefile b/arch/riscv/lib/Makefile
index ff0677a..d08cbe9 100644
--- a/arch/riscv/lib/Makefile
+++ b/arch/riscv/lib/Makefile
@@ -27,6 +27,7 @@
obj-y += fdt_fixup.o
# For building EFI apps
+CFLAGS_NON_EFI := -fstack-protector-strong
CFLAGS_$(EFI_CRT0) := $(CFLAGS_EFI)
CFLAGS_REMOVE_$(EFI_CRT0) := $(CFLAGS_NON_EFI)
diff --git a/arch/x86/config.mk b/arch/x86/config.mk
index 3067702..7a82425 100644
--- a/arch/x86/config.mk
+++ b/arch/x86/config.mk
@@ -42,7 +42,7 @@
# Compiler flags to be added when building UEFI applications
CFLAGS_EFI := -fpic -fshort-wchar
# Compiler flags to be removed when building UEFI applications
-CFLAGS_NON_EFI := -mregparm=3
+CFLAGS_NON_EFI := -mregparm=3 -fstack-protector-strong
ifeq ($(CONFIG_EFI_STUB_64BIT),)
CFLAGS_EFI += $(call cc-option, -mno-red-zone)