]> granicus.if.org Git - esp-idf/blobdiff - make/project.mk
esp32: Adds Stack Smashing Protection Feature
[esp-idf] / make / project.mk
index 19e4b425044f47a82562409db00b4db1676ebdf3..76a9555cb0718e08f0bbff255bb113ee8982e554 100644 (file)
@@ -264,6 +264,19 @@ COMMON_FLAGS = \
        -mlongcalls \
        -nostdlib
 
+ifndef IS_BOOTLOADER_BUILD
+# stack protection (only one option can be selected in menuconfig)
+ifdef CONFIG_STACK_CHECK_NORM
+COMMON_FLAGS += -fstack-protector
+endif
+ifdef CONFIG_STACK_CHECK_STRONG
+COMMON_FLAGS += -fstack-protector-strong
+endif
+ifdef CONFIG_STACK_CHECK_ALL
+COMMON_FLAGS += -fstack-protector-all
+endif
+endif
+
 # Optimization flags are set based on menuconfig choice
 ifdef CONFIG_OPTIMIZATION_LEVEL_RELEASE
 OPTIMIZATION_FLAGS = -Os