Skip to content

Instantly share code, notes, and snippets.

@zhangyuchi
Forked from nicky-zs/memcpy.c
Created June 8, 2017 04:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhangyuchi/0caffb54157125ca35b4bf7ba4f0f60a to your computer and use it in GitHub Desktop.
Save zhangyuchi/0caffb54157125ca35b4bf7ba4f0f60a to your computer and use it in GitHub Desktop.
One way to solve the glibc compatibility problem. In my case, when building a program with libthrift.a on linux with glibc version 2.15, ld always links memcpy@GLIBC_2.14 which cannot be found on systems with glibc version < 2.14. So, use this file to define a symbol __wrap_memcpy and use -Wl,--wrap=memcpy to tell ld using this symbol when meeti…
#include <string.h>
void *__memcpy_glibc_2_2_5(void *, const void *, size_t);
asm(".symver __memcpy_glibc_2_2_5, memcpy@GLIBC_2.2.5");
void *__wrap_memcpy(void *dest, const void *src, size_t n)
{
return __memcpy_glibc_2_2_5(dest, src, n);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment