From 106dd2fed89f76608e5ae3f68924c9596220a0c2 Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Tue, 5 Oct 2021 03:35:04 -0700 Subject: [PATCH] Drop -msse4 compiler flag (#27121) * Drop ABSL_RANDOM_HWAES_FLAGS compiler flags Older CPUs that do not have SSE4.1 would crash with the Ruby native gem due to an illegal instruction exception. The Abseil random library isn't being used at the moment (https://github.com/grpc/grpc/pull/26476), and there's no reason gRPC needs to force SSE4.1 instructions on all platforms at the moment. There are other hardware-specific issues that need to be ironed out for this to work: https://github.com/grpc/grpc/pull/26479 When the `-msse4` compiler flag was enabled, the Abseil code started using the `pinsrb` instruction: ``` $ elfx86exts abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.o MODE64 (ret) CMOV (cmovne) SSE2 (movdqa) SSE41 (pinsrb) SSE1 (movaps) CPU Generation: Penryn ``` Closes https://github.com/grpc/grpc/issues/27095 * Revert "Drop ABSL_RANDOM_HWAES_FLAGS compiler flags" This reverts commit 3b7cc74d39ec6263be4a45a479bc0d1ce9fab0ce. * Drop -msse4 compiler flag Older CPUs that do not have SSE4.1 would crash with the Ruby native gem due to an illegal instruction exception. The Abseil random library isn't being used at the moment (https://github.com/grpc/grpc/pull/26476), and there's no reason gRPC needs to force SSE4.1 instructions on all platforms at the moment. There are other hardware-specific issues that need to be ironed out for this to work: https://github.com/grpc/grpc/pull/26479 When the `-msse4` compiler flag was enabled, the Abseil code started using the `pinsrb` instruction: ``` $ elfx86exts abseil-cpp/absl/time/internal/cctz/src/time_zone_libc.o MODE64 (ret) CMOV (cmovne) SSE2 (movdqa) SSE41 (pinsrb) SSE1 (movaps) CPU Generation: Penryn ``` This was previously needed because gcc 4.8 wouldn't compile without the `-msse4` and `-maes` flags. However, per https://github.com/gcc-mirror/gcc/commit/97db2bf7fb10e7eb2e8224e0471b56976f133843 gcc 5.0+ automatically detects whether these options are enabled. clang still needs `-maes` since including `wmmintrin.h` expects the AES option to be enabled. Closes https://github.com/grpc/grpc/issues/27095 --- Makefile | 2 +- templates/Makefile.template | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2ec11df6e6c..c6214ba7d88 100644 --- a/Makefile +++ b/Makefile @@ -579,7 +579,7 @@ CPPFLAGS := -Ithird_party/address_sorting/include $(CPPFLAGS) GRPC_ABSEIL_DEP = $(LIBDIR)/$(CONFIG)/libgrpc_abseil.a GRPC_ABSEIL_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libgrpc_abseil.a ifeq ($(HOST_IS_X86_64),true) -ABSL_RANDOM_HWAES_FLAGS = -maes -msse4 +ABSL_RANDOM_HWAES_FLAGS = -maes else ABSL_RANDOM_HWAES_FLAGS = endif diff --git a/templates/Makefile.template b/templates/Makefile.template index 5afb36ce6a4..7e47866b37e 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -442,7 +442,7 @@ GRPC_ABSEIL_DEP = $(LIBDIR)/$(CONFIG)/libgrpc_abseil.a GRPC_ABSEIL_MERGE_LIBS = $(LIBDIR)/$(CONFIG)/libgrpc_abseil.a ifeq ($(HOST_IS_X86_64),true) - ABSL_RANDOM_HWAES_FLAGS = -maes -msse4 + ABSL_RANDOM_HWAES_FLAGS = -maes else ABSL_RANDOM_HWAES_FLAGS = endif