From d393f1923f1efa8ddef2079bab6e8c95def64d64 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Sat, 3 Apr 2021 22:18:15 +0200 Subject: [PATCH 1/3] Fix spillover of host-specific build flags into the shared part of DYNAMIC_ARCH builds with gmake for #3139 --- Makefile.x86_64 | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/Makefile.x86_64 b/Makefile.x86_64 index 5406494c9..7f5f8d0be 100644 --- a/Makefile.x86_64 +++ b/Makefile.x86_64 @@ -8,6 +8,20 @@ endif endif endif + +ifndef DYNAMIC_ARCH +define ADD_CPUFLAGS +1 +endef +else +ifdef TARGET_CORE +define ADD_CPUFLAGS +1 +endef +endif +endif + +ifdef ADD_CPUFLAGS ifdef HAVE_SSE3 CCOMMON_OPT += -msse3 ifneq ($(F_COMPILER), NAG) @@ -44,7 +58,6 @@ endif endif ifeq ($(CORE), SKYLAKEX) -ifndef DYNAMIC_ARCH ifndef NO_AVX512 CCOMMON_OPT += -march=skylake-avx512 ifneq ($(F_COMPILER), NAG) @@ -62,10 +75,8 @@ endif endif endif endif -endif ifeq ($(CORE), COOPERLAKE) -ifndef DYNAMIC_ARCH ifndef NO_AVX512 ifeq ($(C_COMPILER), GCC) # cooperlake support was added in 10.1 @@ -88,7 +99,6 @@ endif endif endif endif -endif ifdef HAVE_AVX2 ifndef NO_AVX2 @@ -120,6 +130,7 @@ endif endif endif +endif ifeq ($(OSNAME), Interix) From 1ae607beca84ff850e3c5e435a57002486a797d5 Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Sun, 4 Apr 2021 12:31:22 +0200 Subject: [PATCH 2/3] Update Makefile.x86_64 --- Makefile.x86_64 | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Makefile.x86_64 b/Makefile.x86_64 index 7f5f8d0be..f62ab9e5e 100644 --- a/Makefile.x86_64 +++ b/Makefile.x86_64 @@ -10,14 +10,10 @@ endif ifndef DYNAMIC_ARCH -define ADD_CPUFLAGS -1 -endef +ADD_CPUFLAGS = 1 else ifdef TARGET_CORE -define ADD_CPUFLAGS -1 -endef +ADD_CPUFLAGS = 1 endif endif From 5332cbae18174720aa9ea511f774d11975e7b4bb Mon Sep 17 00:00:00 2001 From: Martin Kroeker Date: Sun, 4 Apr 2021 23:12:17 +0200 Subject: [PATCH 3/3] Avoid adding host-specific cpuflags to the common part of DYNAMIC_ARCH builds --- Makefile.x86 | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile.x86 b/Makefile.x86 index 0e27264d8..893379c33 100644 --- a/Makefile.x86 +++ b/Makefile.x86 @@ -1,10 +1,21 @@ # COMPILER_PREFIX = mingw32- -ifdef HAVE_SSE -CCOMMON_OPT += -msse -FCOMMON_OPT += -msse +ifndef DYNAMIC_ARCH +ADD_CPUFLAGS = 1 +else +ifdef TARGET_CORE +ADD_CPUFLAGS = 1 +endif endif +ifdef ADD_CPUFLAGS +ifdef HAVE_SSE +CCOMMON_OPT += -msse +ifneq ($(F_COMPILER), NAG) +FCOMMON_OPT += -msse +endif +endif +endif ifeq ($(OSNAME), Interix) ARFLAGS = -m x86