From 3b7cc74d39ec6263be4a45a479bc0d1ce9fab0ce Mon Sep 17 00:00:00 2001 From: Stan Hu Date: Wed, 25 Aug 2021 00:33:43 -0700 Subject: [PATCH] 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 --- Makefile | 15 +-------------- build_handwritten.yaml | 2 +- templates/Makefile.template | 13 ------------- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index fd98ab5a60a..7f9030e170f 100644 --- a/Makefile +++ b/Makefile @@ -34,14 +34,6 @@ ifeq ($(SYSTEM),MINGW64) SYSTEM = MINGW32 endif -# Basic machine detection -HOST_MACHINE = $(shell uname -m) -ifeq ($(HOST_MACHINE),x86_64) -HOST_IS_X86_64 = true -else -HOST_IS_X86_64 = false -endif - MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) ifndef BUILDDIR BUILDDIR_ABSOLUTE = $(patsubst %/,%,$(dir $(MAKEFILE_PATH))) @@ -578,11 +570,6 @@ 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 -else -ABSL_RANDOM_HWAES_FLAGS = -endif # Setup re2 dependency @@ -2680,7 +2667,7 @@ LIBGRPC_ABSEIL_SRC = \ LIBGRPC_ABSEIL_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(LIBGRPC_ABSEIL_SRC)))) -$(LIBGRPC_ABSEIL_OBJS): CPPFLAGS += -g $(ABSL_RANDOM_HWAES_FLAGS) -Ithird_party/abseil-cpp +$(LIBGRPC_ABSEIL_OBJS): CPPFLAGS += -Ithird_party/abseil-cpp $(LIBDIR)/$(CONFIG)/libgrpc_abseil.a: $(LIBGRPC_ABSEIL_OBJS) $(E) "[AR] Creating $@" diff --git a/build_handwritten.yaml b/build_handwritten.yaml index 13b1b73df0f..d33482cda22 100644 --- a/build_handwritten.yaml +++ b/build_handwritten.yaml @@ -165,7 +165,7 @@ configs: UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1:suppressions=test/core/util/ubsan_suppressions.txt defaults: abseil: - CPPFLAGS: -g $(ABSL_RANDOM_HWAES_FLAGS) -Ithird_party/abseil-cpp + CPPFLAGS: -Ithird_party/abseil-cpp ares: CFLAGS: -g CPPFLAGS: -Ithird_party/cares -Ithird_party/cares/cares -fvisibility=hidden -D_GNU_SOURCE diff --git a/templates/Makefile.template b/templates/Makefile.template index 5afb36ce6a4..bdb172b7ae2 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -74,14 +74,6 @@ SYSTEM = MINGW32 endif - # Basic machine detection - HOST_MACHINE = $(shell uname -m) - ifeq ($(HOST_MACHINE),x86_64) - HOST_IS_X86_64 = true - else - HOST_IS_X86_64 = false - endif - MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) ifndef BUILDDIR BUILDDIR_ABSOLUTE = $(patsubst %/,%,$(dir $(MAKEFILE_PATH))) @@ -441,11 +433,6 @@ 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 - else - ABSL_RANDOM_HWAES_FLAGS = - endif # Setup re2 dependency