Skip to content

Instantly share code, notes, and snippets.

@greyfade
Created January 8, 2015 18:06
Show Gist options
  • Save greyfade/65ea6cd616fa9d656b23 to your computer and use it in GitHub Desktop.
Save greyfade/65ea6cd616fa9d656b23 to your computer and use it in GitHub Desktop.
#include <string.h>
/* force memcpy from old glibc for compatibility */
#ifdef __amd64__
__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
#else
__asm__(".symver memcpy,memcpy@GLIBC_2.0");
#endif /*__amd64__*/
void *__wrap_memcpy(void *dest, const void *src, size_t n)
{
return memcpy(dest, src, n);
}
@greyfade
Copy link
Author

greyfade commented Jan 8, 2015

Add "-Wl,--wrap=memcpy" to your linker flags to enable this hack. Repeat for all affected functions.

Use objdump -T <executable> | grep GLIBC_ to find affected symbols.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment