From 0c097001d1a56df4e00e8ebdfd15149704dfc07e Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 29 Aug 2023 10:58:30 +0200 Subject: [PATCH] Add support for x86_64_v2, x86_64_v3, x86_64_v4 (#2233093) --- buildflags.md | 6 +++++- macros | 1 + redhat-rpm-config.spec | 5 ++++- rpmrc | 5 ++++- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/buildflags.md b/buildflags.md index c569531..70e7b5e 100644 --- a/buildflags.md +++ b/buildflags.md @@ -593,7 +593,11 @@ tuning in the `gcc` package. These settings are: CPU level of zEC12, while optimizing for a subsequent CPU generation (z13). * **x86_64**: `-mtune=generic` selects tuning which is expected to - beneficial for a broad range of current CPUs. + beneficial for a broad range of current CPUs. Distribution-specific + defaults for `-march=x86-64-v2` or `-march=x86-64-v3` may be + applied. The default can be overriden (for any distribution) + by specifying `--target x86_64_v2`, `--target x86_64_v3`, + `--target x86_64_v4` in the `rpmbuild` invocation. * **aarch64** does not have any architecture-specific tuning. ### Vala-specific compiler flags diff --git a/macros b/macros index d7dc4a6..866d76c 100644 --- a/macros +++ b/macros @@ -147,6 +147,7 @@ for k,_ in pairs(stripped_flags) do print(k .. " ") end %__cflags_arch_x86_64_v2 %[0%{?rhel} == 9 ? "-march=x86-64-v2" : ""] %__cflags_arch_x86_64_v3 %[0%{?rhel} > 9 ? "-march=x86-64-v3" : ""] %__cflags_arch_x86_64 %{__cflags_arch_x86_64_v2} %{__cflags_arch_x86_64_v3} +%__cflags_arch_x86_64_common -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection %{_frame_pointers_cflags} %{_frame_pointers_cflags_x86_64} # Also used for s390. %__cflags_arch_s390x %[0%{?rhel} >= 9 ? "-march=z14 -mtune=z15" : "-march=z13 -mtune=z14"] diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index f5876bf..f35fdb2 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -4,7 +4,7 @@ # 2) When making changes, increment the version (in baserelease) by 1. # rpmdev-bumpspec and other tools update the macro below, which is used # in Version: to get the desired effect. -%global baserelease 264 +%global baserelease 265 Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config @@ -257,6 +257,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua %doc buildflags.md %changelog +* Tue Aug 29 2023 Florian Weimer - 265-1 +- Add support for x86_64_v2, x86_64_v3, x86_64_v4 (#2233093) + * Tue Aug 22 2023 Yaakov Selkowitz - 264-1 - Add macros.rpmautospec diff --git a/rpmrc b/rpmrc index a12e122..6d74f22 100644 --- a/rpmrc +++ b/rpmrc @@ -5,7 +5,10 @@ optflags: i486 %{__global_compiler_flags} -m32 -march=i486 -fasynchronous-unwind optflags: i586 %{__global_compiler_flags} -m32 -march=i586 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection optflags: i686 %{__global_compiler_flags} -m32 -march=i686 -mtune=generic -msse2 -mfpmath=sse -mstackrealign -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection optflags: athlon %{__global_compiler_flags} -m32 -march=athlon -fasynchronous-unwind-tables -fstack-clash-protection -optflags: x86_64 %{__global_compiler_flags} -m64 %{__cflags_arch_x86_64} -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection %{_frame_pointers_cflags} %{_frame_pointers_cflags_x86_64} +optflags: x86_64 %{__global_compiler_flags} -m64 %{__cflags_arch_x86_64} %__cflags_arch_x86_64_common +optflags: x86_64_v2 %{__global_compiler_flags} -m64 -march=x86-64-v2 %__cflags_arch_x86_64_common +optflags: x86_64_v3 %{__global_compiler_flags} -m64 -march=x86-64-v3 %__cflags_arch_x86_64_common +optflags: x86_64_v4 %{__global_compiler_flags} -m64 -march=x86-64-v4 %__cflags_arch_x86_64_common optflags: ppc64le %{__global_compiler_flags} -m64 %{__cflags_arch_ppc64le} -fasynchronous-unwind-tables -fstack-clash-protection