Skip to content

Instantly share code, notes, and snippets.

@wheybags
Created January 27, 2018 13:25
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 wheybags/b7e4152daf76c72503e9e1f52f3dca3d to your computer and use it in GitHub Desktop.
Save wheybags/b7e4152daf76c72503e9e1f52f3dca3d to your computer and use it in GitHub Desktop.
[monolith] ~/test_programs >
$ cat implicit_memcpy.c
struct a
{
int x[1024];
};
__asm__(".symver memcpy,memcpy@GLIBC_2.2.5");
void foo(struct a*restrict d, const struct a*restrict s, int len)
{
for(int i = 0; i < len; i++)
d[i] = s[i];
}
[monolith] ~/test_programs >
$ gcc -fPIC -shared implicit_memcpy.c -O3 && readelf -Ws a.out | grep memcpy
1: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memcpy@GLIBC_2.2.5 (2)
31: 0000000000000000 0 FILE LOCAL DEFAULT ABS implicit_memcpy.c
40: 0000000000000000 0 FUNC GLOBAL DEFAULT UND memcpy@GLIBC_2.2.5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment