diff --git a/arch/x86_64/src/common/Toolchain.defs b/arch/x86_64/src/common/Toolchain.defs index 879e5818b2bf7..e8613edf04712 100644 --- a/arch/x86_64/src/common/Toolchain.defs +++ b/arch/x86_64/src/common/Toolchain.defs @@ -51,6 +51,14 @@ ifeq ($(CONFIG_FRAME_POINTER),y) ARCHOPTIMIZATION += -fno-omit-frame-pointer -fno-optimize-sibling-calls endif +ifeq ($(CONFIG_ARCH_INTEL64_DISABLE_CET),y) + ARCHOPTIMIZATION += -fcf-protection=none +endif + +ifeq ($(CONFIG_ARCH_INTEL64_DISABLE_VECTORIZE),y) + ARCHOPTIMIZATION += -fno-tree-vectorize +endif + ARCHCFLAGS += -fno-common -Wno-attributes ARCHCXXFLAGS += -fno-common -Wno-attributes -nostdinc++ @@ -58,10 +66,6 @@ ARCHCPUFLAGS = -fno-pic -mcmodel=large -fno-stack-protector -mno-red-zone -mrdrn ARCHPICFLAGS = -fPIC ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -Wundef -ifeq ($(CONFIG_ARCH_INTEL64_DISABLE_CET),y) - ARCHOPTIMIZATION += -fcf-protection=none -endif - # We have to use a cross-development toolchain under Cygwin because the native # Cygwin toolchains don't generate ELF binaries. diff --git a/arch/x86_64/src/intel64/Kconfig b/arch/x86_64/src/intel64/Kconfig index 53ce634be6c00..5c213f01178f8 100644 --- a/arch/x86_64/src/intel64/Kconfig +++ b/arch/x86_64/src/intel64/Kconfig @@ -203,5 +203,9 @@ config ARCH_INTEL64_DISABLE_CET It inserts the endbr64 instruction at the beginning of functions, which may impact CPU branch prediction performance. +config ARCH_INTEL64_DISABLE_VECTORIZE + bool "Disable vectorize completely" + ---help--- + Disable the compiler from vectorizing code optimization during compilation endif