From 73fdf3fb48dd390f4c517c11eac0fc68d3f07388 Mon Sep 17 00:00:00 2001 From: Benjamin Barenblat Date: Tue, 12 Jul 2022 22:23:45 -0400 Subject: Explicitly specify support status for SSE and NEON MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Turn SSE off on i386 since Debian still supports the Pentium II. Similarly, turn NEON off on armel and armhf since it’s not universally supported. Split CPU feature support configuration into its own patch for clarity. --- debian/patches/configure.diff | 27 -------------------- debian/patches/cpu-features.diff | 54 ++++++++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 55 insertions(+), 27 deletions(-) create mode 100644 debian/patches/cpu-features.diff (limited to 'debian') diff --git a/debian/patches/configure.diff b/debian/patches/configure.diff index 15a20382..ff0c64e9 100644 --- a/debian/patches/configure.diff +++ b/debian/patches/configure.diff @@ -13,13 +13,6 @@ Configure Abseil for Debian. - Enable upstream's hardened build mode. - - Disable Intel SSE2 on i386, since Debian supports some i386 processors - without that extension. Keep it enabled on amd64, since all amd64 processors - have it. - - - Disable Intel SSSE3 entirely, since no i386 processor supports it and Debian - supports amd64 processors without it. - --- a/CMake/AbseilHelpers.cmake +++ b/CMake/AbseilHelpers.cmake @@ -281,7 +281,8 @@ @@ -87,23 +80,3 @@ Configure Abseil for Debian. +#define ABSL_OPTION_HARDENED 1 #endif // ABSL_BASE_OPTIONS_H_ ---- a/absl/base/config.h -+++ b/absl/base/config.h -@@ -877,7 +877,7 @@ - // which architectures support the various x86 instruction sets. - #ifdef ABSL_INTERNAL_HAVE_SSE2 - #error ABSL_INTERNAL_HAVE_SSE2 cannot be directly set --#elif defined(__SSE2__) -+#elif defined(__x86_64__) - #define ABSL_INTERNAL_HAVE_SSE2 1 - #elif defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2) - // MSVC only defines _M_IX86_FP for x86 32-bit code, and _M_IX86_FP >= 2 -@@ -898,8 +898,6 @@ - // by the CPU. - #ifdef ABSL_INTERNAL_HAVE_SSSE3 - #error ABSL_INTERNAL_HAVE_SSSE3 cannot be directly set --#elif defined(__SSSE3__) --#define ABSL_INTERNAL_HAVE_SSSE3 1 - #endif - - // ABSL_INTERNAL_HAVE_ARM_NEON is used for compile-time detection of NEON (ARM diff --git a/debian/patches/cpu-features.diff b/debian/patches/cpu-features.diff new file mode 100644 index 00000000..7610e6b1 --- /dev/null +++ b/debian/patches/cpu-features.diff @@ -0,0 +1,54 @@ +From: Benjamin Barenblat +Subject: Canonicalize supported CPU feature set +Forwarded: not-needed + +Explicitly set supported CPU features. + + - Disable Intel SSE and SSE2 on i386, since Debian supports some i386 + processors without those extensions. Keep them enabled on amd64, since all + amd64 processors have them. + + - Disable Intel SSSE3 entirely, since no i386 processor supports it and Debian + supports amd64 processors without it. + + - Disable NEON on armel and armhf, since no armel processor supports NEON and + Debian supports some armhf processors without it. Keep it enabled on arm64, + since all arm64 processors have it. + +--- a/absl/base/config.h ++++ b/absl/base/config.h +@@ -862,7 +862,7 @@ + // which architectures support the various x86 instruction sets. + #ifdef ABSL_INTERNAL_HAVE_SSE + #error ABSL_INTERNAL_HAVE_SSE cannot be directly set +-#elif defined(__SSE__) ++#elif defined(__x86_64__) + #define ABSL_INTERNAL_HAVE_SSE 1 + #elif defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 1) + // MSVC only defines _M_IX86_FP for x86 32-bit code, and _M_IX86_FP >= 1 +@@ -877,7 +877,7 @@ + // which architectures support the various x86 instruction sets. + #ifdef ABSL_INTERNAL_HAVE_SSE2 + #error ABSL_INTERNAL_HAVE_SSE2 cannot be directly set +-#elif defined(__SSE2__) ++#elif defined(__x86_64__) + #define ABSL_INTERNAL_HAVE_SSE2 1 + #elif defined(_M_X64) || (defined(_M_IX86_FP) && _M_IX86_FP >= 2) + // MSVC only defines _M_IX86_FP for x86 32-bit code, and _M_IX86_FP >= 2 +@@ -898,15 +898,13 @@ + // by the CPU. + #ifdef ABSL_INTERNAL_HAVE_SSSE3 + #error ABSL_INTERNAL_HAVE_SSSE3 cannot be directly set +-#elif defined(__SSSE3__) +-#define ABSL_INTERNAL_HAVE_SSSE3 1 + #endif + + // ABSL_INTERNAL_HAVE_ARM_NEON is used for compile-time detection of NEON (ARM + // SIMD). + #ifdef ABSL_INTERNAL_HAVE_ARM_NEON + #error ABSL_INTERNAL_HAVE_ARM_NEON cannot be directly set +-#elif defined(__ARM_NEON) ++#elif defined(__aarch64__) + #define ABSL_INTERNAL_HAVE_ARM_NEON 1 + #endif + diff --git a/debian/patches/series b/debian/patches/series index 7134596e..b64772ac 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ configure.diff +cpu-features.diff latomic.diff empty-flags-library.diff -- cgit v1.2.3