# Export CFLAGS + CXXFLAGS
-GLOBAL_CFLAGS = -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
-GLOBAL_CFLAGS += -fPIC -fstack-protector-strong --param=ssp-buffer-size=4
-GLOBAL_CFLAGS += -grecord-gcc-switches -fdebug-prefix-map=%{DIR_SRC}=%{debugsourcedir}
+GLOBAL_CFLAGS = -O2 -g
+
+# Enable all compiler warnings
+GLOBAL_CFLAGS += -Wall
+
+# Fortify Source
+GLOBAL_CFLAGS += -Wp,-U_FORTIFY_SOURCE-Wp,-D_FORTIFY_SOURCE=3
+
+# Build Position Independent Code
+GLOBAL_CFLAGS += -fPIC
+
+# Enable Stack Smashing Protection
+GLOBAL_CFLAGS += -fstack-protector-strong
+
+# Enable unwind tables
+GLOBAL_CFLAGS += -funwind-tables -fasynchronous-unwind-tables
+
+# Enable Stack Clash Protection
+GLOBAL_CFLAGS += -fstack-clash-protection
+
+# Tell the compiler where the source will be put
+GLOBAL_CFLAGS += -fdebug-prefix-map=%{DIR_SRC}=%{debugsourcedir}
+
+# Arch: x86_64
+CFLAGS_x86_64 = -m64 -march=x86-64-v2 -mtune=generic
+
+# Arch: aarch64
+CFLAGS_aarch64 = -mbranch-protection=standard
-CFLAGS_x86_64 = -m64 -mtune=generic
-# Disabled for now because the version of GCC we have does not support this switch
-#CFLAGS_aarch64 = -fstack-clash-protection
export CFLAGS = %{GLOBAL_CFLAGS} %{CFLAGS_%{DISTRO_ARCH}}
export CXXFLAGS = %{CFLAGS}