From 775394207477c7be7803b91d7e2ca733a03155fd Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 24 Nov 2022 21:52:23 +0000 Subject: [PATCH] macros: Update CFLAGS Signed-off-by: Michael Tremer --- macros/cflags.macro | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/macros/cflags.macro b/macros/cflags.macro index 7b2f7fa04..b9405cb00 100644 --- a/macros/cflags.macro +++ b/macros/cflags.macro @@ -1,12 +1,34 @@ # 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} -- 2.39.5