aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Adam Cozzette <acozzette@gmail.com>2017-03-20 08:26:06 -0700
committerGravatar GitHub <noreply@github.com>2017-03-20 08:26:06 -0700
commit4d273f28dc6fe9b4f1db78e76f19b1cf42210509 (patch)
tree8d445f307c836623bef06a8065f2e8fecf3a2191
parent15b60bccf8992f7ff0897705e43aa8ab8889cd02 (diff)
parentea5ef14aa01701f686c52de4e724f66101c8e163 (diff)
Merge pull request #2870 from acozzette/memcpy-memmove
Ruby: only link against specific version of memcpy if we're using glibc
-rw-r--r--ruby/ext/google/protobuf_c/wrap_memcpy.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ruby/ext/google/protobuf_c/wrap_memcpy.c b/ruby/ext/google/protobuf_c/wrap_memcpy.c
index 158952a8..394a52f9 100644
--- a/ruby/ext/google/protobuf_c/wrap_memcpy.c
+++ b/ruby/ext/google/protobuf_c/wrap_memcpy.c
@@ -30,15 +30,15 @@
#include <string.h>
-// On x86-64 Linux, we link against the 2.2.5 version of memcpy so that we
-// avoid depending on the 2.14 version of the symbol. This way, distributions
-// that are using pre-2.14 versions of glibc can successfully use the gem we
-// distribute (https://github.com/google/protobuf/issues/2783).
+// On x86-64 Linux with glibc, we link against the 2.2.5 version of memcpy so
+// that we avoid depending on the 2.14 version of the symbol. This way,
+// distributions that are using pre-2.14 versions of glibc can successfully use
+// the gem we distribute (https://github.com/google/protobuf/issues/2783).
//
// This wrapper is enabled by passing the linker flags -Wl,-wrap,memcpy in
// extconf.rb.
#ifdef __linux__
-#ifdef __x86_64__
+#if defined(__x86_64__) && defined(__GNU_LIBRARY__)
__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
void *__wrap_memcpy(void *dest, const void *src, size_t n) {
return memcpy(dest, src, n);