-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#if defined(__LINUX_GLIBC_WRAP_H) | ||
|
||
/* ugly hack to get __libc_start_main versioned */ | ||
|
||
#if __GLIBC_PREREQ(2, 34) | ||
|
||
#define STR_(s) #s | ||
#define STR(s) STR_(s) | ||
#include <dlfcn.h> | ||
|
||
#ifdef __UCLIBC__ | ||
#define __libc_start_main __uClibc_main | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
int __libc_start_main( | ||
int (*main)(int,char**,char**), int ac, char **av, | ||
int (*init)(void), void (*fini)(void), | ||
void (*rtld_fini)(void), void *stack_end); | ||
int __libc_start_main( | ||
int (*main)(int,char**,char**), int ac, char **av, | ||
int (*init)(void), void (*fini)(void), | ||
void (*rtld_fini)(void), void *stack_end) | ||
{ | ||
typeof(__libc_start_main) *real_lsm; | ||
if ((*(void**)&real_lsm = dlsym(RTLD_NEXT, STR(__libc_start_main))) != 0) | ||
return real_lsm(main, ac, av, init, fini, rtld_fini, stack_end); | ||
fputs("BUG: dlsym error\n", stderr); | ||
return 1; | ||
} | ||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#undef STR | ||
#undef STR_ | ||
#endif | ||
#endif |