-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use some linker magic to avoid issues with symbol versioning
- Loading branch information
Showing
3 changed files
with
71 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// hook __libc_start_main | ||
__asm__(".symver __libc_start_main_old,__libc_start_main@GLIBC_2.2.5"); | ||
int __libc_start_main_old(int (*main) (int, char **, char **), | ||
int argc, | ||
char **argv, | ||
__typeof (main) init, | ||
void (*fini) (void), | ||
void (*rtld_fini) (void), | ||
void *stack_end); | ||
|
||
int __wrap___libc_start_main(int (*main) (int, char **, char **), | ||
int argc, | ||
char **argv, | ||
__typeof (main) init, | ||
void (*fini) (void), | ||
void (*rtld_fini) (void), | ||
void *stack_end) | ||
{ | ||
return __libc_start_main_old(main, argc, argv, init, fini, rtld_fini, stack_end); | ||
} | ||
|
||
// hook dlsym | ||
__asm__(".symver dlsym_old,dlsym@GLIBC_2.2.5"); | ||
//__asm__(".symver dlsym_old,__libc_dlsym@GLIBC_PRIVATE"); | ||
void *dlsym_old(void *handle, const char *symbol); | ||
void *__wrap_dlsym(void *handle, const char *symbol) | ||
{ | ||
return dlsym_old(handle, symbol); | ||
} |