From 34be0d84a99a6b313cef48b4c80e14a0d115d864 Mon Sep 17 00:00:00 2001 From: Esun Kim Date: Thu, 15 Feb 2024 16:51:37 -0800 Subject: [PATCH] [Core] Remove wrap_memcpy (#35826) gRPC has been having the `wrap_memcpy` workaround to handle the breaking change of `memcpy` on glibc 2.14 ([ref1](https://www.win.tue.nl/~aeb/linux/misc/gcc-semibug.html), [ref2](https://stackoverflow.com/questions/35656696/explanation-of-memcpy-memmove-glibc-2-14-2-2-5)). This was necessary to build more portable artifacts which are expected to run on most linux distributions and we manged to have https://github.com/grpc/grpc/pull/5007 years ago for this. Since we started to use manylinux2010-based docker images for artifacts, however, this became unnecessary since CentOS 6 has glibc 2.12 which is older than 2.14 so it doesn't have memcpy issue, which is another benefit of using manylinux2010. Superseding https://github.com/grpc/grpc/pull/23385 Changes after the original PR was made; Ruby is using manylinux images (manylinux2014) enabling this change, no more old docker images in our test env. Closes #35826 COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/35826 from veblush:del-wrap-memcpy-2 71e6718356b2b6684bb7e977fe66ef39561c05a7 PiperOrigin-RevId: 607499060 --- BUILD | 1 - CMakeLists.txt | 1 - Makefile | 1 - Package.swift | 1 - build_autogenerated.yaml | 1 - config.m4 | 1 - config.w32 | 1 - gRPC-Core.podspec | 1 - grpc.gemspec | 1 - grpc.gyp | 1 - package.xml | 1 - src/core/lib/gpr/wrap_memcpy.cc | 43 ------------------- src/python/grpcio/grpc_core_dependencies.py | 1 - .../observability_lib_deps.py | 1 - src/ruby/ext/grpc/extconf.rb | 1 - tools/doxygen/Doxyfile.c++.internal | 1 - tools/doxygen/Doxyfile.core.internal | 1 - 17 files changed, 59 deletions(-) delete mode 100644 src/core/lib/gpr/wrap_memcpy.cc diff --git a/BUILD b/BUILD index 236a89ec982..e2100794407 100644 --- a/BUILD +++ b/BUILD @@ -706,7 +706,6 @@ grpc_cc_library( "//src/core:lib/gpr/windows/sync.cc", "//src/core:lib/gpr/windows/time.cc", "//src/core:lib/gpr/windows/tmpfile.cc", - "//src/core:lib/gpr/wrap_memcpy.cc", "//src/core:lib/gprpp/crash.cc", "//src/core:lib/gprpp/fork.cc", "//src/core:lib/gprpp/host_port.cc", diff --git a/CMakeLists.txt b/CMakeLists.txt index 88429d02709..6b528b52ec9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1641,7 +1641,6 @@ add_library(gpr src/core/lib/gpr/windows/sync.cc src/core/lib/gpr/windows/time.cc src/core/lib/gpr/windows/tmpfile.cc - src/core/lib/gpr/wrap_memcpy.cc src/core/lib/gprpp/crash.cc src/core/lib/gprpp/examine_stack.cc src/core/lib/gprpp/fork.cc diff --git a/Makefile b/Makefile index 9fe4e2b80b1..f5c020f2582 100644 --- a/Makefile +++ b/Makefile @@ -864,7 +864,6 @@ LIBGPR_SRC = \ src/core/lib/gpr/windows/sync.cc \ src/core/lib/gpr/windows/time.cc \ src/core/lib/gpr/windows/tmpfile.cc \ - src/core/lib/gpr/wrap_memcpy.cc \ src/core/lib/gprpp/crash.cc \ src/core/lib/gprpp/examine_stack.cc \ src/core/lib/gprpp/fork.cc \ diff --git a/Package.swift b/Package.swift index 60ef86d31a9..03b9b6f26b8 100644 --- a/Package.swift +++ b/Package.swift @@ -1333,7 +1333,6 @@ let package = Package( "src/core/lib/gpr/windows/sync.cc", "src/core/lib/gpr/windows/time.cc", "src/core/lib/gpr/windows/tmpfile.cc", - "src/core/lib/gpr/wrap_memcpy.cc", "src/core/lib/gprpp/atomic_utils.h", "src/core/lib/gprpp/bitset.h", "src/core/lib/gprpp/chunked_vector.h", diff --git a/build_autogenerated.yaml b/build_autogenerated.yaml index 452e24b9d99..65c275a8246 100644 --- a/build_autogenerated.yaml +++ b/build_autogenerated.yaml @@ -107,7 +107,6 @@ libs: - src/core/lib/gpr/windows/sync.cc - src/core/lib/gpr/windows/time.cc - src/core/lib/gpr/windows/tmpfile.cc - - src/core/lib/gpr/wrap_memcpy.cc - src/core/lib/gprpp/crash.cc - src/core/lib/gprpp/examine_stack.cc - src/core/lib/gprpp/fork.cc diff --git a/config.m4 b/config.m4 index 97c6f517823..35a684dacec 100644 --- a/config.m4 +++ b/config.m4 @@ -567,7 +567,6 @@ if test "$PHP_GRPC" != "no"; then src/core/lib/gpr/windows/sync.cc \ src/core/lib/gpr/windows/time.cc \ src/core/lib/gpr/windows/tmpfile.cc \ - src/core/lib/gpr/wrap_memcpy.cc \ src/core/lib/gprpp/crash.cc \ src/core/lib/gprpp/examine_stack.cc \ src/core/lib/gprpp/fork.cc \ diff --git a/config.w32 b/config.w32 index a07a13e2a2a..c87b296783c 100644 --- a/config.w32 +++ b/config.w32 @@ -532,7 +532,6 @@ if (PHP_GRPC != "no") { "src\\core\\lib\\gpr\\windows\\sync.cc " + "src\\core\\lib\\gpr\\windows\\time.cc " + "src\\core\\lib\\gpr\\windows\\tmpfile.cc " + - "src\\core\\lib\\gpr\\wrap_memcpy.cc " + "src\\core\\lib\\gprpp\\crash.cc " + "src\\core\\lib\\gprpp\\examine_stack.cc " + "src\\core\\lib\\gprpp\\fork.cc " + diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec index 3e6029dc38e..f67f53c44b1 100644 --- a/gRPC-Core.podspec +++ b/gRPC-Core.podspec @@ -1446,7 +1446,6 @@ Pod::Spec.new do |s| 'src/core/lib/gpr/windows/sync.cc', 'src/core/lib/gpr/windows/time.cc', 'src/core/lib/gpr/windows/tmpfile.cc', - 'src/core/lib/gpr/wrap_memcpy.cc', 'src/core/lib/gprpp/atomic_utils.h', 'src/core/lib/gprpp/bitset.h', 'src/core/lib/gprpp/chunked_vector.h', diff --git a/grpc.gemspec b/grpc.gemspec index cf9045b5bc2..a991d744105 100644 --- a/grpc.gemspec +++ b/grpc.gemspec @@ -1339,7 +1339,6 @@ Gem::Specification.new do |s| s.files += %w( src/core/lib/gpr/windows/sync.cc ) s.files += %w( src/core/lib/gpr/windows/time.cc ) s.files += %w( src/core/lib/gpr/windows/tmpfile.cc ) - s.files += %w( src/core/lib/gpr/wrap_memcpy.cc ) s.files += %w( src/core/lib/gprpp/atomic_utils.h ) s.files += %w( src/core/lib/gprpp/bitset.h ) s.files += %w( src/core/lib/gprpp/chunked_vector.h ) diff --git a/grpc.gyp b/grpc.gyp index e3171fcf7a1..20b89da75f1 100644 --- a/grpc.gyp +++ b/grpc.gyp @@ -227,7 +227,6 @@ 'src/core/lib/gpr/windows/sync.cc', 'src/core/lib/gpr/windows/time.cc', 'src/core/lib/gpr/windows/tmpfile.cc', - 'src/core/lib/gpr/wrap_memcpy.cc', 'src/core/lib/gprpp/crash.cc', 'src/core/lib/gprpp/examine_stack.cc', 'src/core/lib/gprpp/fork.cc', diff --git a/package.xml b/package.xml index a0dde5572de..7c2c650fb5d 100644 --- a/package.xml +++ b/package.xml @@ -1321,7 +1321,6 @@ - diff --git a/src/core/lib/gpr/wrap_memcpy.cc b/src/core/lib/gpr/wrap_memcpy.cc deleted file mode 100644 index 0bbf703e613..00000000000 --- a/src/core/lib/gpr/wrap_memcpy.cc +++ /dev/null @@ -1,43 +0,0 @@ -// -// -// Copyright 2016 gRPC authors. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// - -#include - -#include - -// Provide a wrapped memcpy for targets that need to be backwards -// compatible with older libc's. -// -// Enable by setting LDFLAGS=-Wl,-wrap,memcpy when linking. -// - -extern "C" { -#ifdef __linux__ -#if defined(__x86_64__) && !defined(GPR_MUSL_LIBC_COMPAT) && \ - !defined(__ANDROID__) -__asm__(".symver memcpy,memcpy@GLIBC_2.2.5"); -void* __wrap_memcpy(void* destination, const void* source, size_t num) { - return memcpy(destination, source, num); -} -#else // !__x86_64__ -void* __wrap_memcpy(void* destination, const void* source, size_t num) { - return memmove(destination, source, num); -} -#endif -#endif -} diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 28823ac0bf2..ef280852032 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -541,7 +541,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/gpr/windows/sync.cc', 'src/core/lib/gpr/windows/time.cc', 'src/core/lib/gpr/windows/tmpfile.cc', - 'src/core/lib/gpr/wrap_memcpy.cc', 'src/core/lib/gprpp/crash.cc', 'src/core/lib/gprpp/examine_stack.cc', 'src/core/lib/gprpp/fork.cc', diff --git a/src/python/grpcio_observability/observability_lib_deps.py b/src/python/grpcio_observability/observability_lib_deps.py index 14fd1c9034b..eb117797788 100644 --- a/src/python/grpcio_observability/observability_lib_deps.py +++ b/src/python/grpcio_observability/observability_lib_deps.py @@ -46,7 +46,6 @@ CC_FILES=[ 'grpc_root/src/core/lib/gpr/windows/sync.cc', 'grpc_root/src/core/lib/gpr/windows/time.cc', 'grpc_root/src/core/lib/gpr/windows/tmpfile.cc', - 'grpc_root/src/core/lib/gpr/wrap_memcpy.cc', 'grpc_root/src/core/lib/gprpp/crash.cc', 'grpc_root/src/core/lib/gprpp/examine_stack.cc', 'grpc_root/src/core/lib/gprpp/fork.cc', diff --git a/src/ruby/ext/grpc/extconf.rb b/src/ruby/ext/grpc/extconf.rb index 502793d9198..18e8a919c53 100644 --- a/src/ruby/ext/grpc/extconf.rb +++ b/src/ruby/ext/grpc/extconf.rb @@ -192,7 +192,6 @@ if grpc_config == 'dbg' $CFLAGS << ' -O0' end -$LDFLAGS << ' -Wl,-wrap,memcpy' if linux # Do not statically link standard libraries on TruffleRuby as this does not work when compiling to bitcode if linux && RUBY_ENGINE != 'truffleruby' $LDFLAGS << ' -static-libgcc -static-libstdc++' diff --git a/tools/doxygen/Doxyfile.c++.internal b/tools/doxygen/Doxyfile.c++.internal index 27f47e275a9..c19780fd743 100644 --- a/tools/doxygen/Doxyfile.c++.internal +++ b/tools/doxygen/Doxyfile.c++.internal @@ -2338,7 +2338,6 @@ src/core/lib/gpr/windows/string_util.cc \ src/core/lib/gpr/windows/sync.cc \ src/core/lib/gpr/windows/time.cc \ src/core/lib/gpr/windows/tmpfile.cc \ -src/core/lib/gpr/wrap_memcpy.cc \ src/core/lib/gprpp/atomic_utils.h \ src/core/lib/gprpp/bitset.h \ src/core/lib/gprpp/chunked_vector.h \ diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal index 9ee3aeff6a1..35a1d5fb44f 100644 --- a/tools/doxygen/Doxyfile.core.internal +++ b/tools/doxygen/Doxyfile.core.internal @@ -2111,7 +2111,6 @@ src/core/lib/gpr/windows/string_util.cc \ src/core/lib/gpr/windows/sync.cc \ src/core/lib/gpr/windows/time.cc \ src/core/lib/gpr/windows/tmpfile.cc \ -src/core/lib/gpr/wrap_memcpy.cc \ src/core/lib/gprpp/README.md \ src/core/lib/gprpp/atomic_utils.h \ src/core/lib/gprpp/bitset.h \