diff options
Diffstat (limited to 'src/wrapped')
| -rw-r--r-- | src/wrapped/generated/functions_list.txt | 86 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedlibctypes.h | 66 | ||||
| -rw-r--r-- | src/wrapped/generated/wrappedlibmtypes.h | 6 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.c | 48 | ||||
| -rw-r--r-- | src/wrapped/generated/wrapper.h | 17 | ||||
| -rw-r--r-- | src/wrapped/wrappedldlinux.c | 11 | ||||
| -rw-r--r-- | src/wrapped/wrappedldlinux_private.h | 8 | ||||
| -rw-r--r-- | src/wrapped/wrappedlib_init.h | 91 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibbsd.c | 9 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibc.c | 13 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibc_private.h | 266 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibcmusl.c | 2 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibdl.c | 4 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibdl_private.h | 6 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibm.c | 10 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibm_private.h | 12 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibpthread.c | 42 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibpthread_private.h | 4 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibresolv.c | 28 | ||||
| -rw-r--r-- | src/wrapped/wrappedlibrt.c | 11 | ||||
| -rw-r--r-- | src/wrapped/wrappedutil.c | 8 |
21 files changed, 417 insertions, 331 deletions
diff --git a/src/wrapped/generated/functions_list.txt b/src/wrapped/generated/functions_list.txt index 4999044b..514b18eb 100644 --- a/src/wrapped/generated/functions_list.txt +++ b/src/wrapped/generated/functions_list.txt @@ -502,9 +502,7 @@ #() iFupL #() iFupp #() iFfff -#() iFlip #() iFLip -#() iFLLi #() iFLpp #() iFpwp #() iFpii @@ -936,7 +934,6 @@ #() iFEpLi #() iFEpLp #() iFEppi -#() iFEppu #() iFEppd #() iFEppL #() iFEppp @@ -965,7 +962,6 @@ #() iFipWp #() iFipui #() iFipuL -#() iFipup #() iFipLi #() iFipLu #() iFipLp @@ -984,7 +980,6 @@ #() iFuppi #() iFuppu #() iFuppp -#() iFLLiW #() iFLppp #() iFpwww #() iFpwpp @@ -1504,7 +1499,6 @@ #() iFiiipu #() iFiiipp #() iFiiupp -#() iFiipup #() iFiuuuu #() iFiuuup #() iFiuLip @@ -1989,7 +1983,6 @@ #() iFpipLpp #() iFpippip #() iFpippup -#() iFpipppL #() iFpipppp #() iFpCiipp #() iFpCpipu @@ -3040,9 +3033,16 @@ #!defined(HAVE_LD80BITS) lFKK #!defined(HAVE_LD80BITS) KFKKK #defined(NOALIGN) iFipiip +#!defined(NOALIGN) iFEppu #!defined(NOALIGN) iFEiiip #!defined(NOALIGN) iFEipii #!defined(NOALIGN) iFEipiip +#!defined(STATICBUILD) iFlip +#!defined(STATICBUILD) iFLLi +#!defined(STATICBUILD) iFipup +#!defined(STATICBUILD) iFLLiW +#!defined(STATICBUILD) iFiipup +#!defined(STATICBUILD) iFpipppL #() vFEv -> vFE #() iFEv -> iFE #() lFEv -> lFE @@ -4035,18 +4035,6 @@ wrappedlibc: - _setjmp - atexit - getcontext - - pthread_attr_destroy - - pthread_attr_init - - pthread_barrierattr_destroy - - pthread_barrierattr_init - - pthread_cond_broadcast - - pthread_cond_destroy - - pthread_condattr_destroy - - pthread_condattr_init - - pthread_getattr_default_np - - pthread_mutexattr_destroy - - pthread_mutexattr_init - - pthread_setattr_default_np - register_printf_type - setcontext - setjmp @@ -4085,30 +4073,12 @@ wrappedlibc: - fstat64 - iFup: - setrlimit -- iFLp: - - pthread_getattr_np - iFpi: - __sigsetjmp - backtrace - - pthread_attr_setdetachstate - - pthread_attr_setinheritsched - - pthread_attr_setschedpolicy - - pthread_attr_setscope - - pthread_barrierattr_setpshared - - pthread_condattr_setclock - - pthread_condattr_setpshared - - pthread_kill - - pthread_kill@GLIBC_2.2.5 - - pthread_mutexattr_setkind_np - - pthread_mutexattr_setprotocol - - pthread_mutexattr_setpshared - - pthread_mutexattr_setrobust - - pthread_mutexattr_settype - sigsetjmp - iFpL: - munmap - - pthread_attr_setguardsize - - pthread_attr_setstacksize - iFpp: - __vprintf_chk - dl_iterate_phdr @@ -4116,28 +4086,6 @@ wrappedlibc: - execvp - lstat - lstat64 - - pthread_attr_getdetachstate - - pthread_attr_getguardsize - - pthread_attr_getinheritsched - - pthread_attr_getschedparam - - pthread_attr_getschedpolicy - - pthread_attr_getscope - - pthread_attr_getstackaddr - - pthread_attr_getstacksize - - pthread_attr_setschedparam - - pthread_attr_setstackaddr - - pthread_barrierattr_getpshared - - pthread_cond_init - - pthread_cond_wait - - pthread_condattr_getclock - - pthread_condattr_getpshared - - pthread_key_create - - pthread_mutex_init - - pthread_mutexattr_getkind_np - - pthread_mutexattr_getprotocol - - pthread_mutexattr_getrobust - - pthread_mutexattr_gettype - - pthread_once - sigaltstack - stat - stat64 @@ -4200,26 +4148,15 @@ wrappedlibc: - vdprintf - iFpLi: - mprotect -- iFpLp: - - pthread_attr_setaffinity_np - - pthread_getaffinity_np - - pthread_setaffinity_np - iFppi: - ftw - ftw64 -- iFppu: - - pthread_barrier_init -- iFppL: - - pthread_attr_setstack - iFppp: - __cxa_atexit - __cxa_thread_atexit_impl - __vfprintf_chk - __vsscanf - execve - - pthread_atfork - - pthread_attr_getstack - - pthread_cond_timedwait - iFppV: - __asprintf - __isoc23_fscanf @@ -4309,14 +4246,11 @@ wrappedlibc: - vswprintf - iFppii: - nftw64 -- iFppip: - - pthread_cond_clockwait - iFppiV: - makecontext - iFpppp: - __register_atfork - __vsprintf_chk - - pthread_create - scandir - scandir64 - lFuipp: @@ -4539,6 +4473,7 @@ wrappedlibm: - __sinhf_finite - __sqrtf_finite - nearbyintf + - pow10f - rintf - dFd: - __acos_finite @@ -4553,7 +4488,12 @@ wrappedlibm: - __sinh_finite - __sqrt_finite - nearbyint + - pow10 - rint +- DFD: + - pow10l +- KFK: + - pow10l - fFff: - __atan2f_finite - __fmodf_finite diff --git a/src/wrapped/generated/wrappedlibctypes.h b/src/wrapped/generated/wrappedlibctypes.h index efe6d40d..6e38ef3d 100644 --- a/src/wrapped/generated/wrappedlibctypes.h +++ b/src/wrapped/generated/wrappedlibctypes.h @@ -28,7 +28,6 @@ typedef void (*vFpp_t)(void*, void*); typedef void (*vFpV_t)(void*, ...); typedef int32_t (*iFip_t)(int32_t, void*); typedef int32_t (*iFup_t)(uint32_t, void*); -typedef int32_t (*iFLp_t)(uintptr_t, void*); typedef int32_t (*iFpi_t)(void*, int32_t); typedef int32_t (*iFpL_t)(void*, uintptr_t); typedef int32_t (*iFpp_t)(void*, void*); @@ -48,10 +47,7 @@ typedef int32_t (*iFipp_t)(int32_t, void*, void*); typedef int32_t (*iFipV_t)(int32_t, void*, ...); typedef int32_t (*iFipA_t)(int32_t, void*, va_list); typedef int32_t (*iFpLi_t)(void*, uintptr_t, int32_t); -typedef int32_t (*iFpLp_t)(void*, uintptr_t, void*); typedef int32_t (*iFppi_t)(void*, void*, int32_t); -typedef int32_t (*iFppu_t)(void*, void*, uint32_t); -typedef int32_t (*iFppL_t)(void*, void*, uintptr_t); typedef int32_t (*iFppp_t)(void*, void*, void*); typedef int32_t (*iFppV_t)(void*, void*, ...); typedef int32_t (*iFppA_t)(void*, void*, va_list); @@ -79,7 +75,6 @@ typedef int32_t (*iFpipA_t)(void*, int32_t, void*, va_list); typedef int32_t (*iFpLpV_t)(void*, uintptr_t, void*, ...); typedef int32_t (*iFpLpA_t)(void*, uintptr_t, void*, va_list); typedef int32_t (*iFppii_t)(void*, void*, int32_t, int32_t); -typedef int32_t (*iFppip_t)(void*, void*, int32_t, void*); typedef int32_t (*iFppiV_t)(void*, void*, int32_t, ...); typedef int32_t (*iFpppp_t)(void*, void*, void*, void*); typedef intptr_t (*lFuipp_t)(uint32_t, int32_t, void*, void*); @@ -115,18 +110,6 @@ typedef int32_t (*iFppipppp_t)(void*, void*, int32_t, void*, void*, void*, void* GO(_setjmp, iFp_t) \ GO(atexit, iFp_t) \ GO(getcontext, iFp_t) \ - GO(pthread_attr_destroy, iFp_t) \ - GO(pthread_attr_init, iFp_t) \ - GO(pthread_barrierattr_destroy, iFp_t) \ - GO(pthread_barrierattr_init, iFp_t) \ - GO(pthread_cond_broadcast, iFp_t) \ - GO(pthread_cond_destroy, iFp_t) \ - GO(pthread_condattr_destroy, iFp_t) \ - GO(pthread_condattr_init, iFp_t) \ - GO(pthread_getattr_default_np, iFp_t) \ - GO(pthread_mutexattr_destroy, iFp_t) \ - GO(pthread_mutexattr_init, iFp_t) \ - GO(pthread_setattr_default_np, iFp_t) \ GO(register_printf_type, iFp_t) \ GO(setcontext, iFp_t) \ GO(setjmp, iFp_t) \ @@ -154,55 +137,16 @@ typedef int32_t (*iFppipppp_t)(void*, void*, int32_t, void*, void*, void*, void* GO(fstat, iFip_t) \ GO(fstat64, iFip_t) \ GO(setrlimit, iFup_t) \ - GO(pthread_getattr_np, iFLp_t) \ GO(__sigsetjmp, iFpi_t) \ GO(backtrace, iFpi_t) \ - GO(pthread_attr_setdetachstate, iFpi_t) \ - GO(pthread_attr_setinheritsched, iFpi_t) \ - GO(pthread_attr_setschedpolicy, iFpi_t) \ - GO(pthread_attr_setscope, iFpi_t) \ - GO(pthread_barrierattr_setpshared, iFpi_t) \ - GO(pthread_condattr_setclock, iFpi_t) \ - GO(pthread_condattr_setpshared, iFpi_t) \ - GO(pthread_kill, iFpi_t) \ - GO(pthread_kill@GLIBC_2.2.5, iFpi_t) \ - GO(pthread_mutexattr_setkind_np, iFpi_t) \ - GO(pthread_mutexattr_setprotocol, iFpi_t) \ - GO(pthread_mutexattr_setpshared, iFpi_t) \ - GO(pthread_mutexattr_setrobust, iFpi_t) \ - GO(pthread_mutexattr_settype, iFpi_t) \ GO(sigsetjmp, iFpi_t) \ GO(munmap, iFpL_t) \ - GO(pthread_attr_setguardsize, iFpL_t) \ - GO(pthread_attr_setstacksize, iFpL_t) \ GO(__vprintf_chk, iFpp_t) \ GO(dl_iterate_phdr, iFpp_t) \ GO(execv, iFpp_t) \ GO(execvp, iFpp_t) \ GO(lstat, iFpp_t) \ GO(lstat64, iFpp_t) \ - GO(pthread_attr_getdetachstate, iFpp_t) \ - GO(pthread_attr_getguardsize, iFpp_t) \ - GO(pthread_attr_getinheritsched, iFpp_t) \ - GO(pthread_attr_getschedparam, iFpp_t) \ - GO(pthread_attr_getschedpolicy, iFpp_t) \ - GO(pthread_attr_getscope, iFpp_t) \ - GO(pthread_attr_getstackaddr, iFpp_t) \ - GO(pthread_attr_getstacksize, iFpp_t) \ - GO(pthread_attr_setschedparam, iFpp_t) \ - GO(pthread_attr_setstackaddr, iFpp_t) \ - GO(pthread_barrierattr_getpshared, iFpp_t) \ - GO(pthread_cond_init, iFpp_t) \ - GO(pthread_cond_wait, iFpp_t) \ - GO(pthread_condattr_getclock, iFpp_t) \ - GO(pthread_condattr_getpshared, iFpp_t) \ - GO(pthread_key_create, iFpp_t) \ - GO(pthread_mutex_init, iFpp_t) \ - GO(pthread_mutexattr_getkind_np, iFpp_t) \ - GO(pthread_mutexattr_getprotocol, iFpp_t) \ - GO(pthread_mutexattr_getrobust, iFpp_t) \ - GO(pthread_mutexattr_gettype, iFpp_t) \ - GO(pthread_once, iFpp_t) \ GO(sigaltstack, iFpp_t) \ GO(stat, iFpp_t) \ GO(stat64, iFpp_t) \ @@ -249,21 +193,13 @@ typedef int32_t (*iFppipppp_t)(void*, void*, int32_t, void*, void*, void*, void* GO(dprintf, iFipV_t) \ GO(vdprintf, iFipA_t) \ GO(mprotect, iFpLi_t) \ - GO(pthread_attr_setaffinity_np, iFpLp_t) \ - GO(pthread_getaffinity_np, iFpLp_t) \ - GO(pthread_setaffinity_np, iFpLp_t) \ GO(ftw, iFppi_t) \ GO(ftw64, iFppi_t) \ - GO(pthread_barrier_init, iFppu_t) \ - GO(pthread_attr_setstack, iFppL_t) \ GO(__cxa_atexit, iFppp_t) \ GO(__cxa_thread_atexit_impl, iFppp_t) \ GO(__vfprintf_chk, iFppp_t) \ GO(__vsscanf, iFppp_t) \ GO(execve, iFppp_t) \ - GO(pthread_atfork, iFppp_t) \ - GO(pthread_attr_getstack, iFppp_t) \ - GO(pthread_cond_timedwait, iFppp_t) \ GO(__asprintf, iFppV_t) \ GO(__isoc23_fscanf, iFppV_t) \ GO(__isoc23_sscanf, iFppV_t) \ @@ -327,11 +263,9 @@ typedef int32_t (*iFppipppp_t)(void*, void*, int32_t, void*, void*, void*, void* GO(vsnprintf, iFpLpA_t) \ GO(vswprintf, iFpLpA_t) \ GO(nftw64, iFppii_t) \ - GO(pthread_cond_clockwait, iFppip_t) \ GO(makecontext, iFppiV_t) \ GO(__register_atfork, iFpppp_t) \ GO(__vsprintf_chk, iFpppp_t) \ - GO(pthread_create, iFpppp_t) \ GO(scandir, iFpppp_t) \ GO(scandir64, iFpppp_t) \ GO(ptrace, lFuipp_t) \ diff --git a/src/wrapped/generated/wrappedlibmtypes.h b/src/wrapped/generated/wrappedlibmtypes.h index f5ab45f4..b31e0cbc 100644 --- a/src/wrapped/generated/wrappedlibmtypes.h +++ b/src/wrapped/generated/wrappedlibmtypes.h @@ -21,6 +21,8 @@ typedef int64_t (*IFD_t)(long double); typedef int64_t (*IFK_t)(double); typedef float (*fFf_t)(float); typedef double (*dFd_t)(double); +typedef long double (*DFD_t)(long double); +typedef double (*KFK_t)(double); typedef float (*fFff_t)(float, float); typedef double (*dFdd_t)(double, double); @@ -45,6 +47,7 @@ typedef double (*dFdd_t)(double, double); GO(__sinhf_finite, fFf_t) \ GO(__sqrtf_finite, fFf_t) \ GO(nearbyintf, fFf_t) \ + GO(pow10f, fFf_t) \ GO(rintf, fFf_t) \ GO(__acos_finite, dFd_t) \ GO(__acosh_finite, dFd_t) \ @@ -58,7 +61,10 @@ typedef double (*dFdd_t)(double, double); GO(__sinh_finite, dFd_t) \ GO(__sqrt_finite, dFd_t) \ GO(nearbyint, dFd_t) \ + GO(pow10, dFd_t) \ GO(rint, dFd_t) \ + GO(pow10l, DFD_t) \ + GO(pow10l, KFK_t) \ GO(__atan2f_finite, fFff_t) \ GO(__fmodf_finite, fFff_t) \ GO(__hypotf_finite, fFff_t) \ diff --git a/src/wrapped/generated/wrapper.c b/src/wrapped/generated/wrapper.c index 6da52f0f..78ec76b8 100644 --- a/src/wrapped/generated/wrapper.c +++ b/src/wrapped/generated/wrapper.c @@ -540,9 +540,7 @@ typedef int32_t (*iFupu_t)(uint32_t, void*, uint32_t); typedef int32_t (*iFupL_t)(uint32_t, void*, uintptr_t); typedef int32_t (*iFupp_t)(uint32_t, void*, void*); typedef int32_t (*iFfff_t)(float, float, float); -typedef int32_t (*iFlip_t)(intptr_t, int32_t, void*); typedef int32_t (*iFLip_t)(uintptr_t, int32_t, void*); -typedef int32_t (*iFLLi_t)(uintptr_t, uintptr_t, int32_t); typedef int32_t (*iFLpp_t)(uintptr_t, void*, void*); typedef int32_t (*iFpwp_t)(void*, int16_t, void*); typedef int32_t (*iFpii_t)(void*, int32_t, int32_t); @@ -974,7 +972,6 @@ typedef int32_t (*iFEpUp_t)(x64emu_t*, void*, uint64_t, void*); typedef int32_t (*iFEpLi_t)(x64emu_t*, void*, uintptr_t, int32_t); typedef int32_t (*iFEpLp_t)(x64emu_t*, void*, uintptr_t, void*); typedef int32_t (*iFEppi_t)(x64emu_t*, void*, void*, int32_t); -typedef int32_t (*iFEppu_t)(x64emu_t*, void*, void*, uint32_t); typedef int32_t (*iFEppd_t)(x64emu_t*, void*, void*, double); typedef int32_t (*iFEppL_t)(x64emu_t*, void*, void*, uintptr_t); typedef int32_t (*iFEppp_t)(x64emu_t*, void*, void*, void*); @@ -1003,7 +1000,6 @@ typedef int32_t (*iFipip_t)(int32_t, void*, int32_t, void*); typedef int32_t (*iFipWp_t)(int32_t, void*, uint16_t, void*); typedef int32_t (*iFipui_t)(int32_t, void*, uint32_t, int32_t); typedef int32_t (*iFipuL_t)(int32_t, void*, uint32_t, uintptr_t); -typedef int32_t (*iFipup_t)(int32_t, void*, uint32_t, void*); typedef int32_t (*iFipLi_t)(int32_t, void*, uintptr_t, int32_t); typedef int32_t (*iFipLu_t)(int32_t, void*, uintptr_t, uint32_t); typedef int32_t (*iFipLp_t)(int32_t, void*, uintptr_t, void*); @@ -1022,7 +1018,6 @@ typedef int32_t (*iFupLp_t)(uint32_t, void*, uintptr_t, void*); typedef int32_t (*iFuppi_t)(uint32_t, void*, void*, int32_t); typedef int32_t (*iFuppu_t)(uint32_t, void*, void*, uint32_t); typedef int32_t (*iFuppp_t)(uint32_t, void*, void*, void*); -typedef int32_t (*iFLLiW_t)(uintptr_t, uintptr_t, int32_t, uint16_t); typedef int32_t (*iFLppp_t)(uintptr_t, void*, void*, void*); typedef int32_t (*iFpwww_t)(void*, int16_t, int16_t, int16_t); typedef int32_t (*iFpwpp_t)(void*, int16_t, void*, void*); @@ -1542,7 +1537,6 @@ typedef int32_t (*iFEpppA_t)(x64emu_t*, void*, void*, void*, void*); typedef int32_t (*iFiiipu_t)(int32_t, int32_t, int32_t, void*, uint32_t); typedef int32_t (*iFiiipp_t)(int32_t, int32_t, int32_t, void*, void*); typedef int32_t (*iFiiupp_t)(int32_t, int32_t, uint32_t, void*, void*); -typedef int32_t (*iFiipup_t)(int32_t, int32_t, void*, uint32_t, void*); typedef int32_t (*iFiuuuu_t)(int32_t, uint32_t, uint32_t, uint32_t, uint32_t); typedef int32_t (*iFiuuup_t)(int32_t, uint32_t, uint32_t, uint32_t, void*); typedef int32_t (*iFiuLip_t)(int32_t, uint32_t, uintptr_t, int32_t, void*); @@ -2027,7 +2021,6 @@ typedef int32_t (*iFpipupp_t)(void*, int32_t, void*, uint32_t, void*, void*); typedef int32_t (*iFpipLpp_t)(void*, int32_t, void*, uintptr_t, void*, void*); typedef int32_t (*iFpippip_t)(void*, int32_t, void*, void*, int32_t, void*); typedef int32_t (*iFpippup_t)(void*, int32_t, void*, void*, uint32_t, void*); -typedef int32_t (*iFpipppL_t)(void*, int32_t, void*, void*, void*, uintptr_t); typedef int32_t (*iFpipppp_t)(void*, int32_t, void*, void*, void*, void*); typedef int32_t (*iFpCiipp_t)(void*, uint8_t, int32_t, int32_t, void*, void*); typedef int32_t (*iFpCpipu_t)(void*, uint8_t, void*, int32_t, void*, uint32_t); @@ -3089,11 +3082,21 @@ typedef int32_t (*iFipiip_t)(int32_t, void*, int32_t, int32_t, void*); #endif #if !defined(NOALIGN) +typedef int32_t (*iFEppu_t)(x64emu_t*, void*, void*, uint32_t); typedef int32_t (*iFEiiip_t)(x64emu_t*, int32_t, int32_t, int32_t, void*); typedef int32_t (*iFEipii_t)(x64emu_t*, int32_t, void*, int32_t, int32_t); typedef int32_t (*iFEipiip_t)(x64emu_t*, int32_t, void*, int32_t, int32_t, void*); #endif +#if !defined(STATICBUILD) +typedef int32_t (*iFlip_t)(intptr_t, int32_t, void*); +typedef int32_t (*iFLLi_t)(uintptr_t, uintptr_t, int32_t); +typedef int32_t (*iFipup_t)(int32_t, void*, uint32_t, void*); +typedef int32_t (*iFLLiW_t)(uintptr_t, uintptr_t, int32_t, uint16_t); +typedef int32_t (*iFiipup_t)(int32_t, int32_t, void*, uint32_t, void*); +typedef int32_t (*iFpipppL_t)(void*, int32_t, void*, void*, void*, uintptr_t); +#endif + void vFE(x64emu_t *emu, uintptr_t fcn) { vFE_t fn = (vFE_t)fcn; fn(emu); } void vFv(x64emu_t *emu, uintptr_t fcn) { vFv_t fn = (vFv_t)fcn; fn(); (void)emu; } void vFc(x64emu_t *emu, uintptr_t fcn) { vFc_t fn = (vFc_t)fcn; fn((int8_t)R_RDI); } @@ -3598,9 +3601,7 @@ void iFupu(x64emu_t *emu, uintptr_t fcn) { iFupu_t fn = (iFupu_t)fcn; R_RAX=(int void iFupL(x64emu_t *emu, uintptr_t fcn) { iFupL_t fn = (iFupL_t)fcn; R_RAX=(int32_t)fn((uint32_t)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX); } void iFupp(x64emu_t *emu, uintptr_t fcn) { iFupp_t fn = (iFupp_t)fcn; R_RAX=(int32_t)fn((uint32_t)R_RDI, (void*)R_RSI, (void*)R_RDX); } void iFfff(x64emu_t *emu, uintptr_t fcn) { iFfff_t fn = (iFfff_t)fcn; R_RAX=(int32_t)fn(emu->xmm[0].f[0], emu->xmm[1].f[0], emu->xmm[2].f[0]); } -void iFlip(x64emu_t *emu, uintptr_t fcn) { iFlip_t fn = (iFlip_t)fcn; R_RAX=(int32_t)fn((intptr_t)R_RDI, (int32_t)R_RSI, (void*)R_RDX); } void iFLip(x64emu_t *emu, uintptr_t fcn) { iFLip_t fn = (iFLip_t)fcn; R_RAX=(int32_t)fn((uintptr_t)R_RDI, (int32_t)R_RSI, (void*)R_RDX); } -void iFLLi(x64emu_t *emu, uintptr_t fcn) { iFLLi_t fn = (iFLLi_t)fcn; R_RAX=(int32_t)fn((uintptr_t)R_RDI, (uintptr_t)R_RSI, (int32_t)R_RDX); } void iFLpp(x64emu_t *emu, uintptr_t fcn) { iFLpp_t fn = (iFLpp_t)fcn; R_RAX=(int32_t)fn((uintptr_t)R_RDI, (void*)R_RSI, (void*)R_RDX); } void iFpwp(x64emu_t *emu, uintptr_t fcn) { iFpwp_t fn = (iFpwp_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (int16_t)R_RSI, (void*)R_RDX); } void iFpii(x64emu_t *emu, uintptr_t fcn) { iFpii_t fn = (iFpii_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX); } @@ -4032,7 +4033,6 @@ void iFEpUp(x64emu_t *emu, uintptr_t fcn) { iFEpUp_t fn = (iFEpUp_t)fcn; R_RAX=( void iFEpLi(x64emu_t *emu, uintptr_t fcn) { iFEpLi_t fn = (iFEpLi_t)fcn; R_RAX=(int32_t)fn(emu, (void*)R_RDI, (uintptr_t)R_RSI, (int32_t)R_RDX); } void iFEpLp(x64emu_t *emu, uintptr_t fcn) { iFEpLp_t fn = (iFEpLp_t)fcn; R_RAX=(int32_t)fn(emu, (void*)R_RDI, (uintptr_t)R_RSI, (void*)R_RDX); } void iFEppi(x64emu_t *emu, uintptr_t fcn) { iFEppi_t fn = (iFEppi_t)fcn; R_RAX=(int32_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (int32_t)R_RDX); } -void iFEppu(x64emu_t *emu, uintptr_t fcn) { iFEppu_t fn = (iFEppu_t)fcn; R_RAX=(int32_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (uint32_t)R_RDX); } void iFEppd(x64emu_t *emu, uintptr_t fcn) { iFEppd_t fn = (iFEppd_t)fcn; R_RAX=(int32_t)fn(emu, (void*)R_RDI, (void*)R_RSI, emu->xmm[0].d[0]); } void iFEppL(x64emu_t *emu, uintptr_t fcn) { iFEppL_t fn = (iFEppL_t)fcn; R_RAX=(int32_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX); } void iFEppp(x64emu_t *emu, uintptr_t fcn) { iFEppp_t fn = (iFEppp_t)fcn; R_RAX=(int32_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (void*)R_RDX); } @@ -4061,7 +4061,6 @@ void iFipip(x64emu_t *emu, uintptr_t fcn) { iFipip_t fn = (iFipip_t)fcn; R_RAX=( void iFipWp(x64emu_t *emu, uintptr_t fcn) { iFipWp_t fn = (iFipWp_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (void*)R_RSI, (uint16_t)R_RDX, (void*)R_RCX); } void iFipui(x64emu_t *emu, uintptr_t fcn) { iFipui_t fn = (iFipui_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (void*)R_RSI, (uint32_t)R_RDX, (int32_t)R_RCX); } void iFipuL(x64emu_t *emu, uintptr_t fcn) { iFipuL_t fn = (iFipuL_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (void*)R_RSI, (uint32_t)R_RDX, (uintptr_t)R_RCX); } -void iFipup(x64emu_t *emu, uintptr_t fcn) { iFipup_t fn = (iFipup_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (void*)R_RSI, (uint32_t)R_RDX, (void*)R_RCX); } void iFipLi(x64emu_t *emu, uintptr_t fcn) { iFipLi_t fn = (iFipLi_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (int32_t)R_RCX); } void iFipLu(x64emu_t *emu, uintptr_t fcn) { iFipLu_t fn = (iFipLu_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (uint32_t)R_RCX); } void iFipLp(x64emu_t *emu, uintptr_t fcn) { iFipLp_t fn = (iFipLp_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (void*)R_RSI, (uintptr_t)R_RDX, (void*)R_RCX); } @@ -4080,7 +4079,6 @@ void iFupLp(x64emu_t *emu, uintptr_t fcn) { iFupLp_t fn = (iFupLp_t)fcn; R_RAX=( void iFuppi(x64emu_t *emu, uintptr_t fcn) { iFuppi_t fn = (iFuppi_t)fcn; R_RAX=(int32_t)fn((uint32_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (int32_t)R_RCX); } void iFuppu(x64emu_t *emu, uintptr_t fcn) { iFuppu_t fn = (iFuppu_t)fcn; R_RAX=(int32_t)fn((uint32_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (uint32_t)R_RCX); } void iFuppp(x64emu_t *emu, uintptr_t fcn) { iFuppp_t fn = (iFuppp_t)fcn; R_RAX=(int32_t)fn((uint32_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX); } -void iFLLiW(x64emu_t *emu, uintptr_t fcn) { iFLLiW_t fn = (iFLLiW_t)fcn; R_RAX=(int32_t)fn((uintptr_t)R_RDI, (uintptr_t)R_RSI, (int32_t)R_RDX, (uint16_t)R_RCX); } void iFLppp(x64emu_t *emu, uintptr_t fcn) { iFLppp_t fn = (iFLppp_t)fcn; R_RAX=(int32_t)fn((uintptr_t)R_RDI, (void*)R_RSI, (void*)R_RDX, (void*)R_RCX); } void iFpwww(x64emu_t *emu, uintptr_t fcn) { iFpwww_t fn = (iFpwww_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (int16_t)R_RSI, (int16_t)R_RDX, (int16_t)R_RCX); } void iFpwpp(x64emu_t *emu, uintptr_t fcn) { iFpwpp_t fn = (iFpwpp_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (int16_t)R_RSI, (void*)R_RDX, (void*)R_RCX); } @@ -4600,7 +4598,6 @@ void iFEpppA(x64emu_t *emu, uintptr_t fcn) { iFEpppA_t fn = (iFEpppA_t)fcn; R_RA void iFiiipu(x64emu_t *emu, uintptr_t fcn) { iFiiipu_t fn = (iFiiipu_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (void*)R_RCX, (uint32_t)R_R8); } void iFiiipp(x64emu_t *emu, uintptr_t fcn) { iFiiipp_t fn = (iFiiipp_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (void*)R_RCX, (void*)R_R8); } void iFiiupp(x64emu_t *emu, uintptr_t fcn) { iFiiupp_t fn = (iFiiupp_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (int32_t)R_RSI, (uint32_t)R_RDX, (void*)R_RCX, (void*)R_R8); } -void iFiipup(x64emu_t *emu, uintptr_t fcn) { iFiipup_t fn = (iFiipup_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (uint32_t)R_RCX, (void*)R_R8); } void iFiuuuu(x64emu_t *emu, uintptr_t fcn) { iFiuuuu_t fn = (iFiuuuu_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (uint32_t)R_RSI, (uint32_t)R_RDX, (uint32_t)R_RCX, (uint32_t)R_R8); } void iFiuuup(x64emu_t *emu, uintptr_t fcn) { iFiuuup_t fn = (iFiuuup_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (uint32_t)R_RSI, (uint32_t)R_RDX, (uint32_t)R_RCX, (void*)R_R8); } void iFiuLip(x64emu_t *emu, uintptr_t fcn) { iFiuLip_t fn = (iFiuLip_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (uint32_t)R_RSI, (uintptr_t)R_RDX, (int32_t)R_RCX, (void*)R_R8); } @@ -5085,7 +5082,6 @@ void iFpipupp(x64emu_t *emu, uintptr_t fcn) { iFpipupp_t fn = (iFpipupp_t)fcn; R void iFpipLpp(x64emu_t *emu, uintptr_t fcn) { iFpipLpp_t fn = (iFpipLpp_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (uintptr_t)R_RCX, (void*)R_R8, (void*)R_R9); } void iFpippip(x64emu_t *emu, uintptr_t fcn) { iFpippip_t fn = (iFpippip_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (int32_t)R_R8, (void*)R_R9); } void iFpippup(x64emu_t *emu, uintptr_t fcn) { iFpippup_t fn = (iFpippup_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (uint32_t)R_R8, (void*)R_R9); } -void iFpipppL(x64emu_t *emu, uintptr_t fcn) { iFpipppL_t fn = (iFpipppL_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (uintptr_t)R_R9); } void iFpipppp(x64emu_t *emu, uintptr_t fcn) { iFpipppp_t fn = (iFpipppp_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (void*)R_R9); } void iFpCiipp(x64emu_t *emu, uintptr_t fcn) { iFpCiipp_t fn = (iFpCiipp_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (uint8_t)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (void*)R_R8, (void*)R_R9); } void iFpCpipu(x64emu_t *emu, uintptr_t fcn) { iFpCpipu_t fn = (iFpCpipu_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (uint8_t)R_RSI, (void*)R_RDX, (int32_t)R_RCX, (void*)R_R8, (uint32_t)R_R9); } @@ -6147,11 +6143,21 @@ void iFipiip(x64emu_t *emu, uintptr_t fcn) { iFipiip_t fn = (iFipiip_t)fcn; R_RA #endif #if !defined(NOALIGN) +void iFEppu(x64emu_t *emu, uintptr_t fcn) { iFEppu_t fn = (iFEppu_t)fcn; R_RAX=(int32_t)fn(emu, (void*)R_RDI, (void*)R_RSI, (uint32_t)R_RDX); } void iFEiiip(x64emu_t *emu, uintptr_t fcn) { iFEiiip_t fn = (iFEiiip_t)fcn; R_RAX=(int32_t)fn(emu, (int32_t)R_RDI, (int32_t)R_RSI, (int32_t)R_RDX, (void*)R_RCX); } void iFEipii(x64emu_t *emu, uintptr_t fcn) { iFEipii_t fn = (iFEipii_t)fcn; R_RAX=(int32_t)fn(emu, (int32_t)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX); } void iFEipiip(x64emu_t *emu, uintptr_t fcn) { iFEipiip_t fn = (iFEipiip_t)fcn; R_RAX=(int32_t)fn(emu, (int32_t)R_RDI, (void*)R_RSI, (int32_t)R_RDX, (int32_t)R_RCX, (void*)R_R8); } #endif +#if !defined(STATICBUILD) +void iFlip(x64emu_t *emu, uintptr_t fcn) { iFlip_t fn = (iFlip_t)fcn; R_RAX=(int32_t)fn((intptr_t)R_RDI, (int32_t)R_RSI, (void*)R_RDX); } +void iFLLi(x64emu_t *emu, uintptr_t fcn) { iFLLi_t fn = (iFLLi_t)fcn; R_RAX=(int32_t)fn((uintptr_t)R_RDI, (uintptr_t)R_RSI, (int32_t)R_RDX); } +void iFipup(x64emu_t *emu, uintptr_t fcn) { iFipup_t fn = (iFipup_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (void*)R_RSI, (uint32_t)R_RDX, (void*)R_RCX); } +void iFLLiW(x64emu_t *emu, uintptr_t fcn) { iFLLiW_t fn = (iFLLiW_t)fcn; R_RAX=(int32_t)fn((uintptr_t)R_RDI, (uintptr_t)R_RSI, (int32_t)R_RDX, (uint16_t)R_RCX); } +void iFiipup(x64emu_t *emu, uintptr_t fcn) { iFiipup_t fn = (iFiipup_t)fcn; R_RAX=(int32_t)fn((int32_t)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (uint32_t)R_RCX, (void*)R_R8); } +void iFpipppL(x64emu_t *emu, uintptr_t fcn) { iFpipppL_t fn = (iFpipppL_t)fcn; R_RAX=(int32_t)fn((void*)R_RDI, (int32_t)R_RSI, (void*)R_RDX, (void*)R_RCX, (void*)R_R8, (uintptr_t)R_R9); } +#endif + void vFEv(x64emu_t *emu, uintptr_t fcn) { vFE_t fn = (vFE_t)fcn; fn(emu); } void iFEv(x64emu_t *emu, uintptr_t fcn) { iFE_t fn = (iFE_t)fcn; R_RAX=(int32_t)fn(emu); } void lFEv(x64emu_t *emu, uintptr_t fcn) { lFE_t fn = (lFE_t)fcn; R_RAX=(intptr_t)fn(emu); } @@ -6568,9 +6574,7 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFupL) return 1; if (fun == &iFupp) return 1; if (fun == &iFfff) return 4; - if (fun == &iFlip) return 1; if (fun == &iFLip) return 1; - if (fun == &iFLLi) return 1; if (fun == &iFLpp) return 1; if (fun == &iFpwp) return 1; if (fun == &iFpii) return 1; @@ -6937,7 +6941,6 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFipWp) return 1; if (fun == &iFipui) return 1; if (fun == &iFipuL) return 1; - if (fun == &iFipup) return 1; if (fun == &iFipLi) return 1; if (fun == &iFipLu) return 1; if (fun == &iFipLp) return 1; @@ -6955,7 +6958,6 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFuppi) return 1; if (fun == &iFuppu) return 1; if (fun == &iFuppp) return 1; - if (fun == &iFLLiW) return 1; if (fun == &iFLppp) return 1; if (fun == &iFpwww) return 1; if (fun == &iFpwpp) return 1; @@ -7369,7 +7371,6 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFiiipu) return 1; if (fun == &iFiiipp) return 1; if (fun == &iFiiupp) return 1; - if (fun == &iFiipup) return 1; if (fun == &iFiuuuu) return 1; if (fun == &iFiuuup) return 1; if (fun == &iFiuLip) return 1; @@ -7779,7 +7780,6 @@ int isSimpleWrapper(wrapper_t fun) { if (fun == &iFpipLpp) return 1; if (fun == &iFpippip) return 1; if (fun == &iFpippup) return 1; - if (fun == &iFpipppL) return 1; if (fun == &iFpipppp) return 1; if (fun == &iFpCiipp) return 1; if (fun == &iFpCpipu) return 1; @@ -7983,6 +7983,14 @@ int isSimpleWrapper(wrapper_t fun) { #if defined(NOALIGN) if (fun == &iFipiip) return 1; #endif +#if !defined(STATICBUILD) + if (fun == &iFlip) return 1; + if (fun == &iFLLi) return 1; + if (fun == &iFipup) return 1; + if (fun == &iFLLiW) return 1; + if (fun == &iFiipup) return 1; + if (fun == &iFpipppL) return 1; +#endif return 0; } #elif defined(RV64) diff --git a/src/wrapped/generated/wrapper.h b/src/wrapped/generated/wrapper.h index e6cc6738..a6464e60 100644 --- a/src/wrapped/generated/wrapper.h +++ b/src/wrapped/generated/wrapper.h @@ -540,9 +540,7 @@ void iFupu(x64emu_t *emu, uintptr_t fnc); void iFupL(x64emu_t *emu, uintptr_t fnc); void iFupp(x64emu_t *emu, uintptr_t fnc); void iFfff(x64emu_t *emu, uintptr_t fnc); -void iFlip(x64emu_t *emu, uintptr_t fnc); void iFLip(x64emu_t *emu, uintptr_t fnc); -void iFLLi(x64emu_t *emu, uintptr_t fnc); void iFLpp(x64emu_t *emu, uintptr_t fnc); void iFpwp(x64emu_t *emu, uintptr_t fnc); void iFpii(x64emu_t *emu, uintptr_t fnc); @@ -974,7 +972,6 @@ void iFEpUp(x64emu_t *emu, uintptr_t fnc); void iFEpLi(x64emu_t *emu, uintptr_t fnc); void iFEpLp(x64emu_t *emu, uintptr_t fnc); void iFEppi(x64emu_t *emu, uintptr_t fnc); -void iFEppu(x64emu_t *emu, uintptr_t fnc); void iFEppd(x64emu_t *emu, uintptr_t fnc); void iFEppL(x64emu_t *emu, uintptr_t fnc); void iFEppp(x64emu_t *emu, uintptr_t fnc); @@ -1003,7 +1000,6 @@ void iFipip(x64emu_t *emu, uintptr_t fnc); void iFipWp(x64emu_t *emu, uintptr_t fnc); void iFipui(x64emu_t *emu, uintptr_t fnc); void iFipuL(x64emu_t *emu, uintptr_t fnc); -void iFipup(x64emu_t *emu, uintptr_t fnc); void iFipLi(x64emu_t *emu, uintptr_t fnc); void iFipLu(x64emu_t *emu, uintptr_t fnc); void iFipLp(x64emu_t *emu, uintptr_t fnc); @@ -1022,7 +1018,6 @@ void iFupLp(x64emu_t *emu, uintptr_t fnc); void iFuppi(x64emu_t *emu, uintptr_t fnc); void iFuppu(x64emu_t *emu, uintptr_t fnc); void iFuppp(x64emu_t *emu, uintptr_t fnc); -void iFLLiW(x64emu_t *emu, uintptr_t fnc); void iFLppp(x64emu_t *emu, uintptr_t fnc); void iFpwww(x64emu_t *emu, uintptr_t fnc); void iFpwpp(x64emu_t *emu, uintptr_t fnc); @@ -1542,7 +1537,6 @@ void iFEpppA(x64emu_t *emu, uintptr_t fnc); void iFiiipu(x64emu_t *emu, uintptr_t fnc); void iFiiipp(x64emu_t *emu, uintptr_t fnc); void iFiiupp(x64emu_t *emu, uintptr_t fnc); -void iFiipup(x64emu_t *emu, uintptr_t fnc); void iFiuuuu(x64emu_t *emu, uintptr_t fnc); void iFiuuup(x64emu_t *emu, uintptr_t fnc); void iFiuLip(x64emu_t *emu, uintptr_t fnc); @@ -2027,7 +2021,6 @@ void iFpipupp(x64emu_t *emu, uintptr_t fnc); void iFpipLpp(x64emu_t *emu, uintptr_t fnc); void iFpippip(x64emu_t *emu, uintptr_t fnc); void iFpippup(x64emu_t *emu, uintptr_t fnc); -void iFpipppL(x64emu_t *emu, uintptr_t fnc); void iFpipppp(x64emu_t *emu, uintptr_t fnc); void iFpCiipp(x64emu_t *emu, uintptr_t fnc); void iFpCpipu(x64emu_t *emu, uintptr_t fnc); @@ -3089,11 +3082,21 @@ void iFipiip(x64emu_t *emu, uintptr_t fnc); #endif #if !defined(NOALIGN) +void iFEppu(x64emu_t *emu, uintptr_t fnc); void iFEiiip(x64emu_t *emu, uintptr_t fnc); void iFEipii(x64emu_t *emu, uintptr_t fnc); void iFEipiip(x64emu_t *emu, uintptr_t fnc); #endif +#if !defined(STATICBUILD) +void iFlip(x64emu_t *emu, uintptr_t fnc); +void iFLLi(x64emu_t *emu, uintptr_t fnc); +void iFipup(x64emu_t *emu, uintptr_t fnc); +void iFLLiW(x64emu_t *emu, uintptr_t fnc); +void iFiipup(x64emu_t *emu, uintptr_t fnc); +void iFpipppL(x64emu_t *emu, uintptr_t fnc); +#endif + void vFEv(x64emu_t *emu, uintptr_t fnc); void iFEv(x64emu_t *emu, uintptr_t fnc); void lFEv(x64emu_t *emu, uintptr_t fnc); diff --git a/src/wrapped/wrappedldlinux.c b/src/wrapped/wrappedldlinux.c index 83245e93..90ec1b23 100644 --- a/src/wrapped/wrappedldlinux.c +++ b/src/wrapped/wrappedldlinux.c @@ -34,14 +34,25 @@ void stSetup(box64context_t* context) my___libc_stack_end = context->stack; // is this the end, or should I add stasz? } +#ifdef STATICBUILD +#include <link.h> +extern void* __libc_enable_secure; +extern void* __stack_chk_guard; +//extern void* __pointer_chk_guard; +//extern void* _rtld_global; +//extern void* _rtld_global_ro; +#endif + // don't try to load the actual ld-linux (because name is variable), just use box64 itself, as it's linked to ld-linux const char* ldlinuxName = "ld-linux.so.2"; #define LIBNAME ldlinux +#ifndef STATICBUILD #define PRE_INIT\ if(1) \ lib->w.lib = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL); \ else +#endif #define CUSTOM_INIT \ stSetup(box64); \ diff --git a/src/wrapped/wrappedldlinux_private.h b/src/wrapped/wrappedldlinux_private.h index 9bdcccb1..4bde24e1 100644 --- a/src/wrapped/wrappedldlinux_private.h +++ b/src/wrapped/wrappedldlinux_private.h @@ -15,9 +15,15 @@ // _dl_tls_setup DATA(__libc_enable_secure, sizeof(void*)) DATAM(__libc_stack_end, sizeof(void*)) -DATA(__pointer_chk_guard, sizeof(void*)) DATAB(_r_debug, 40) +#ifdef STATICBUILD +//DATA(__pointer_chk_guard, sizeof(void*)) +//DATA(_rtld_global, sizeof(void*)) +//DATA(_rtld_global_ro, sizeof(void*)) +#else +DATA(__pointer_chk_guard, sizeof(void*)) DATA(_rtld_global, sizeof(void*)) DATA(_rtld_global_ro, sizeof(void*)) +#endif DATA(__stack_chk_guard, sizeof(void*)) GOM(__tls_get_addr, pFp) //%NoE diff --git a/src/wrapped/wrappedlib_init.h b/src/wrapped/wrappedlib_init.h index 44af7c90..3505efd3 100644 --- a/src/wrapped/wrappedlib_init.h +++ b/src/wrapped/wrappedlib_init.h @@ -43,36 +43,54 @@ // #define the 4 maps first #undef GO -#define GO(N, W) {#N, W, 0}, #undef GOW +#ifdef STATICBUILD +#define GO(N, W) {#N, W, 0, &N}, +#define GOW(N, W) {#N, W, 1, &N}, +#else +#define GO(N, W) {#N, W, 0}, #define GOW(N, W) {#N, W, 1}, +#endif static const map_onesymbol_t MAPNAME(symbolmap)[] = { #include PRIVATE(LIBNAME) }; #undef GO -#define GO(N, W) #undef GOW -#define GOW(N, W) #undef GOM -#define GOM(N, W) {#N, W, 0}, #undef GOWM +#define GO(N, W) +#define GOW(N, W) +#ifdef STATICBUILD +#define GOM(N, W) {#N, W, 0, &my_##N}, +#define GOWM(N, W) {#N, W, 1, &my_##N}, +#else +#define GOM(N, W) {#N, W, 0}, #define GOWM(N, W) {#N, W, 1}, +#endif static const map_onesymbol_t MAPNAME(mysymbolmap)[] = { #include PRIVATE(LIBNAME) }; #undef GOM -#define GOM(N, W) #undef GOWM -#define GOWM(N, W) #undef GOS +#define GOM(N, W) +#define GOWM(N, W) +#ifdef STATICBUILD +#define GOS(N, W) {#N, W, 0, &my_##N}, +#else #define GOS(N, W) {#N, W, 0}, +#endif static const map_onesymbol_t MAPNAME(stsymbolmap)[] = { #include PRIVATE(LIBNAME) }; #undef GOS -#define GOS(N, W) #undef GO2 +#define GOS(N, W) +#ifdef STATICBUILD +#define GO2(N, W, O) {#N, W, 0, #O, &O}, +#else #define GO2(N, W, O) {#N, W, 0, #O}, +#endif static const map_onesymbol2_t MAPNAME(symbol2map)[] = { #include PRIVATE(LIBNAME) }; @@ -81,9 +99,15 @@ static const map_onesymbol2_t MAPNAME(symbol2map)[] = { #undef DATA #undef DATAV #undef DATAB +#ifdef STATICBUILD +#define DATA(N, S) {#N, S, 0, (void*)&N}, +#define DATAV(N, S) {#N, S, 1, (void*)&N}, +#define DATAB(N, S) {#N, S, 0, (void*)&N}, +#else #define DATA(N, S) {#N, S, 0}, #define DATAV(N, S) {#N, S, 1}, #define DATAB(N, S) {#N, S, 0}, +#endif static const map_onedata_t MAPNAME(datamap)[] = { #include PRIVATE(LIBNAME) }; @@ -94,7 +118,11 @@ static const map_onedata_t MAPNAME(datamap)[] = { #define DATAV(N, S) #define DATAB(N, S) #undef DATAM +#ifdef STATICBUILD +#define DATAM(N, S) {#N, S, 0, &my_##N}, +#else #define DATAM(N, S) {#N, S, 0}, +#endif static const map_onedata_t MAPNAME(mydatamap)[] = { #include PRIVATE(LIBNAME) }; @@ -136,6 +164,7 @@ int FUNC(_init)(library_t* lib, box64context_t* box64) PRE_INIT #endif { +#ifndef STATICBUILD lib->w.lib = dlopen(MAPNAME(Name), RTLD_LAZY | RTLD_GLOBAL); if(!lib->w.lib) { #ifdef ALTNAME @@ -154,6 +183,9 @@ int FUNC(_init)(library_t* lib, box64context_t* box64) } else lib->path = box_strdup(ALTNAME); #endif } else lib->path = box_strdup(MAPNAME(Name)); +#else + lib->path = box_strdup(MAPNAME(Name)); +#endif } WrappedLib_CommonInit(lib); @@ -162,6 +194,25 @@ int FUNC(_init)(library_t* lib, box64context_t* box64) int cnt; // populates maps... +#ifdef STATICBUILD +#define DOIT(mapname) \ + cnt = sizeof(MAPNAME(mapname))/sizeof(map_onesymbol_t); \ + for (int i = 0; i < cnt; ++i) { \ + if (MAPNAME(mapname)[i].weak) { \ + k = kh_put(symbolmap, lib->w.w##mapname, MAPNAME(mapname)[i].name, &ret); \ + kh_value(lib->w.w##mapname, k).w = MAPNAME(mapname)[i].w; \ + kh_value(lib->w.w##mapname, k).resolved = 0; \ + kh_value(lib->w.w##mapname, k).addr = (uintptr_t)MAPNAME(mapname)[i].addr; \ + } else { \ + k = kh_put(symbolmap, lib->w.mapname, MAPNAME(mapname)[i].name, &ret); \ + kh_value(lib->w.mapname, k).w = MAPNAME(mapname)[i].w; \ + kh_value(lib->w.mapname, k).resolved = 0; \ + kh_value(lib->w.mapname, k).addr = (uintptr_t)MAPNAME(mapname)[i].addr; \ + } \ + if (strchr(MAPNAME(mapname)[i].name, '@')) \ + AddDictionnary(box64->versym, MAPNAME(mapname)[i].name); \ + } +#else #define DOIT(mapname) \ cnt = sizeof(MAPNAME(mapname))/sizeof(map_onesymbol_t); \ for (int i = 0; i < cnt; ++i) { \ @@ -177,6 +228,7 @@ int FUNC(_init)(library_t* lib, box64context_t* box64) if (strchr(MAPNAME(mapname)[i].name, '@')) \ AddDictionnary(box64->versym, MAPNAME(mapname)[i].name); \ } +#endif DOIT(symbolmap) DOIT(mysymbolmap) #undef DOIT @@ -184,7 +236,12 @@ int FUNC(_init)(library_t* lib, box64context_t* box64) for (int i=0; i<cnt; ++i) { k = kh_put(symbolmap, lib->w.stsymbolmap, MAPNAME(stsymbolmap)[i].name, &ret); kh_value(lib->w.stsymbolmap, k).w = MAPNAME(stsymbolmap)[i].w; + #ifdef STATICBUILD + kh_value(lib->w.stsymbolmap, k).resolved = 1; + kh_value(lib->w.stsymbolmap, k).addr = (uintptr_t)MAPNAME(stsymbolmap)[i].addr; + #else kh_value(lib->w.stsymbolmap, k).resolved = 0; + #endif if(strchr(MAPNAME(stsymbolmap)[i].name, '@')) AddDictionnary(box64->versym, MAPNAME(stsymbolmap)[i].name); } @@ -194,7 +251,12 @@ int FUNC(_init)(library_t* lib, box64context_t* box64) kh_value(lib->w.symbol2map, k).name = MAPNAME(symbol2map)[i].name2; kh_value(lib->w.symbol2map, k).w = MAPNAME(symbol2map)[i].w; kh_value(lib->w.symbol2map, k).weak = MAPNAME(symbol2map)[i].weak; + #ifdef STATICBUILD + kh_value(lib->w.symbol2map, k).resolved = 1; + kh_value(lib->w.symbol2map, k).addr = (uintptr_t)MAPNAME(symbol2map)[i].addr; + #else kh_value(lib->w.symbol2map, k).resolved = 0; + #endif if(strchr(MAPNAME(symbol2map)[i].name, '@')) AddDictionnary(box64->versym, MAPNAME(symbol2map)[i].name); } @@ -202,16 +264,31 @@ int FUNC(_init)(library_t* lib, box64context_t* box64) for (int i=0; i<cnt; ++i) { if(MAPNAME(datamap)[i].weak) { k = kh_put(datamap, lib->w.wdatamap, MAPNAME(datamap)[i].name, &ret); + #ifdef STATICBUILD + kh_value(lib->w.wdatamap, k).size = MAPNAME(datamap)[i].sz; + kh_value(lib->w.wdatamap, k).addr = (uintptr_t)MAPNAME(datamap)[i].addr; + #else kh_value(lib->w.wdatamap, k) = MAPNAME(datamap)[i].sz; + #endif } else { k = kh_put(datamap, lib->w.datamap, MAPNAME(datamap)[i].name, &ret); + #ifdef STATICBUILD + kh_value(lib->w.datamap, k).size = MAPNAME(datamap)[i].sz; + kh_value(lib->w.datamap, k).addr = (uintptr_t)MAPNAME(datamap)[i].addr; + #else kh_value(lib->w.datamap, k) = MAPNAME(datamap)[i].sz; + #endif } } cnt = sizeof(MAPNAME(mydatamap))/sizeof(map_onedata_t); for (int i=0; i<cnt; ++i) { k = kh_put(datamap, lib->w.mydatamap, MAPNAME(mydatamap)[i].name, &ret); + #ifdef STATICBUILD + kh_value(lib->w.mydatamap, k).size = MAPNAME(mydatamap)[i].sz; + kh_value(lib->w.mydatamap, k).addr = (uintptr_t)MAPNAME(mydatamap)[i].addr; + #else kh_value(lib->w.mydatamap, k) = MAPNAME(mydatamap)[i].sz; + #endif } #ifdef ALTMY SETALT(ALTMY); diff --git a/src/wrapped/wrappedlibbsd.c b/src/wrapped/wrappedlibbsd.c index 8937ed9d..231e74ce 100644 --- a/src/wrapped/wrappedlibbsd.c +++ b/src/wrapped/wrappedlibbsd.c @@ -24,10 +24,19 @@ const char* libbsdName = "libbsd.so.0"; #endif #define LIBNAME libbsd +#ifdef STATICBUILD +void arc4random_addrandom(unsigned char *dat, int datlen); +void arc4random_stir(void); +const char *getprogname(void); +void setprogname(const char *); +#endif + +#ifndef STATICBUILD #define PRE_INIT\ if(1) \ lib->w.lib = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL); \ else +#endif // define all standard library functions #include "wrappedlib_init.h" diff --git a/src/wrapped/wrappedlibc.c b/src/wrapped/wrappedlibc.c index 6629585f..889ae59b 100644 --- a/src/wrapped/wrappedlibc.c +++ b/src/wrapped/wrappedlibc.c @@ -911,7 +911,7 @@ EXPORT int my_vsscanf(x64emu_t* emu, void* stream, void* fmt, x64_va_list_t b) return vsscanf(stream, fmt, VARARGS); } -EXPORT int my__vsscanf(x64emu_t* emu, void* stream, void* fmt, void* b) __attribute__((alias("my_vsscanf"))); +EXPORT int my___vsscanf(x64emu_t* emu, void* stream, void* fmt, void* b) __attribute__((alias("my_vsscanf"))); EXPORT int my_vswscanf(x64emu_t* emu, void* stream, void* fmt, x64_va_list_t b) { @@ -2818,6 +2818,11 @@ EXPORT void* my_mallinfo(x64emu_t* emu, void* p) return p; } +#ifdef STATICBUILD +void my_updateGlobalOpt() {} +void my_checkGlobalOpt() {} +#endif + EXPORT int my_getopt(int argc, char* const argv[], const char *optstring) { my_updateGlobalOpt(); @@ -3475,10 +3480,16 @@ EXPORT char* my_program_invocation_short_name = NULL; // ignoring this for now EXPORT char my___libc_single_threaded = 0; +#ifdef STATICBUILD +#include "libtools/static_libc.h" +#endif + +#ifndef STATICBUILD #define PRE_INIT\ if(1) \ lib->w.lib = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL); \ else +#endif #ifdef ANDROID #define NEEDED_LIBS_DEF 1,\ diff --git a/src/wrapped/wrappedlibc_private.h b/src/wrapped/wrappedlibc_private.h index c0ebefd1..c38718cc 100644 --- a/src/wrapped/wrappedlibc_private.h +++ b/src/wrapped/wrappedlibc_private.h @@ -124,6 +124,21 @@ GO(chroot, iFp) GOW(clearenv, iFv) GO(clearerr, vFp) GO(clearerr_unlocked, vFp) +#ifdef STATICBUILD +//GO(clnt_broadcast, +//GO(clnt_create, !FpLLp) +//GO(clnt_pcreateerror, vFp) +//GO(clnt_perrno, vFu) +//GO(clnt_perror, vF!p) +//GO(clntraw_create, !FLL) +//GO(clnt_spcreateerror, pFp) +//GO(clnt_sperrno, pFu) +//GO(clnt_sperror, pF!p) +//GO(clnttcp_create, !F!LLpuu) +//GO(clntudp_bufcreate, !F!LL?puu) +//GO(clntudp_create, !F!LL?p) +//GO(clntunix_create, !F!LLpuu) +#else //GO(clnt_broadcast, //GO(clnt_create, !FpLLp) GO(clnt_pcreateerror, vFp) @@ -137,6 +152,7 @@ GO(clnt_sperrno, pFu) //GO(clntudp_bufcreate, !F!LL?puu) //GO(clntudp_create, !F!LL?p) //GO(clntunix_create, !F!LLpuu) +#endif GO(clock, lFv) GO(clock_adjtime, iFip) //GO(__clock_getcpuclockid, @@ -176,7 +192,11 @@ GO(ctime_r, pFpp) //DATA(__ctype32_b, //DATA(__ctype32_tolower, //DATA(__ctype32_toupper, +#ifdef STATICBUILD +//DATA(__ctype_b, sizeof(void*)) +#else DATA(__ctype_b, sizeof(void*)) +#endif GO(__ctype_b_loc, pFv) GO(__ctype_get_mb_cur_max, LFv) //GO(__ctype_init, @@ -565,7 +585,11 @@ GO(getnameinfo, iFpupupui) //GO(getnetent_r, iF!pL!p) GO(getnetgrent, iFppp) GOW(getnetgrent_r, iFppppL) +#ifdef STATICBUILD +//GO(getnetname, iFp) +#else GO(getnetname, iFp) +#endif GOW(get_nprocs, iFv) GOW(get_nprocs_conf, iFv) GOM(getopt, iFipp) @@ -579,7 +603,7 @@ GO(__getpgid, iFi) GOW(getpgid, iFi) GO(getpgrp, iFv) GOW(get_phys_pages, lFv) -GO(__getpid, uFv) +GO(__getpid, iFv) GO(getpid, iFv) //GO(getpmsg, // Deprecated GOW(getppid, iFv) @@ -591,7 +615,11 @@ GO(getprotobynumber_r, iFippLp) GO(getprotoent, pFv) GO(getprotoent_r, iFppLp) GOW(getpt, iFv) +#ifdef STATICBUILD +//GO(getpublickey, iFpp) +#else GO(getpublickey, iFpp) +#endif GOW(getpw, iFup) GO(getpwent, pFv) GO(getpwent_r, iFppLp) @@ -611,11 +639,19 @@ GO(getrpcbynumber, pFi) GO(getrpcbynumber_r, iFippLp) GO(getrpcent, pFv) GO(getrpcent_r, iFppLp) +#ifdef STATICBUILD +//GO(getrpcport, +#else GO(getrpcport, iFpLLu) +#endif GOW(getrusage, iFip) //GOW(gets, // Deprecated //GO(__gets_chk, +#ifdef STATICBUILD +//GO(getsecretkey, +#else GO(getsecretkey, iFppp) +#endif GO(getservbyname, pFpp) GO(getservbyname_r, iFppppLp) GO(getservbyport, pFip) @@ -688,7 +724,11 @@ GOW(hdestroy, vFv) //DATAB(__h_errno, GO(__h_errno_location, pFv) GO(herror, vFp) +#ifdef STATICBUILD +//GO(host2netname, +#else GO(host2netname, iFppp) +#endif //GO(hsearch, pF?u) //GOW(hsearch_r, iF?up!) GO(hstrerror, pFi) @@ -832,7 +872,11 @@ DATA(_IO_list_all, sizeof(void*)) //GO(_IO_marker_difference, //GO(_IO_padn, //GO(_IO_peekc_locked, +#ifdef STATICBUILD +//GO(ioperm, +#else GO(ioperm, iFLLi) +#endif GOM(iopl, iFEi) //Not always present //GO(_IO_popen, //GO(_IO_printf, @@ -1013,9 +1057,15 @@ GOW(jrand48_r, iFppp) //GO(key_gendes, iF!) //DATAB(__key_gendes_LOCAL, //GO(key_get_conv, iFp!) +#ifdef STATICBUILD +//GO(key_secretkey_is_set, +//GO(key_setnet, +//GO(key_setsecret, +#else GO(key_secretkey_is_set, iFv) //GO(key_setnet, GO(key_setsecret, iFp) +#endif GOW(kill, iFii) GO(killpg, iFii) GO(klogctl, iFipi) @@ -1233,8 +1283,13 @@ GO(__nanosleep, iFpp) GOW(nanosleep, iFpp) //GO(__nanosleep_nocancel, //GO(__netlink_assert_response, +#ifdef STATICBUILD +//GO(netname2host, iFppi) +//GO(netname2user, iFppppp) +#else GO(netname2host, iFppi) GO(netname2user, iFppppp) +#endif GO(__newlocale, pFipp) GOW(newlocale, pFipp) //GO(nfsservctl, // Deprecated @@ -1333,8 +1388,13 @@ GO(pkey_set, iFiu) //GO(pmap_getmaps, pF!) //GO(pmap_getport, WF!LLu) //GO(pmap_rmtcall, uF!LLL@p@p?p) +#ifdef STATICBUILD +//GO(pmap_set, iFLLiW) +//GO(pmap_unset, iFLL) +#else GO(pmap_set, iFLLiW) GO(pmap_unset, iFLL) +#endif GO(__poll, iFpLi) GO(poll, iFpLi) GO(__poll_chk, iFpuiL) @@ -1398,131 +1458,13 @@ DATA(__progname_full, sizeof(void)) GOW(pselect, iFippppp) GO(psiginfo, vFpp) GO(psignal, vFip) +#ifdef STATICBUILD +//GO(__sF, vFip) +//GO(__assert2, vFip) +#else GO(__sF, vFip) GO(__assert2, vFip) - -GOM(pthread_atfork, iFEppp) -GOM(pthread_attr_destroy, iFEp) -GOM(pthread_attr_getdetachstate, iFEpp) -GOM(pthread_attr_getguardsize, iFEpp) -GOM(pthread_attr_getinheritsched, iFEpp) -GOM(pthread_attr_getschedparam, iFEpp) -GOM(pthread_attr_getschedpolicy, iFEpp) -GOM(pthread_attr_getscope, iFEpp) -GOM(pthread_attr_getstack, iFEppp) -GOM(pthread_attr_getstackaddr, iFEpp) -GOM(pthread_attr_getstacksize, iFEpp) -GOM(pthread_attr_init, iFEp) -GOM(pthread_attr_setaffinity_np, iFEpLp) -GOM(pthread_attr_setdetachstate, iFEpi) -GOM(pthread_attr_setguardsize, iFEpL) -GOM(pthread_attr_setinheritsched, iFEpi) -GOM(pthread_attr_setschedparam, iFEpp) -GOM(pthread_attr_setschedpolicy, iFEpi) -GOM(pthread_attr_setscope, iFEpi) -GOM(pthread_attr_setstackaddr, iFEpp) -GOM(pthread_attr_setstack, iFEppL) -GOM(pthread_attr_setstacksize, iFEpL) -GOM(pthread_barrierattr_destroy, iFEp) -GOM(pthread_barrierattr_getpshared, iFEpp) -GOM(pthread_barrierattr_init, iFEp) -GOM(pthread_barrierattr_setpshared, iFEpi) -GO(pthread_barrier_destroy, iFp) -GOM(pthread_barrier_init, iFEppu) -GO(pthread_barrier_wait, iFp) -GO(pthread_cancel, iFL) -GOM(pthread_condattr_destroy, iFEp) -GOM(pthread_condattr_getclock, iFEpp) -GOM(pthread_condattr_getpshared, iFEpp) -GOM(pthread_condattr_init, iFEp) -GOM(pthread_condattr_setclock, iFEpi) -GOM(pthread_condattr_setpshared, iFEpi) -GOM(pthread_cond_broadcast, iFEp) -GOM(pthread_cond_destroy, iFEp) -GOM(pthread_cond_init, iFEpp) -GO(pthread_cond_signal, iFp) -GOM(pthread_cond_timedwait, iFEppp) -GOM(pthread_cond_wait, iFEpp) -GOM(pthread_create, iFEpppp) -GOM(pthread_cond_clockwait, iFEppip) -GO(pthread_detach, iFL) -GO(pthread_equal, iFLL) -GO(pthread_exit, vFp) -GOM(pthread_getaffinity_np, iFEpLp) -GOM(pthread_getattr_np, iFELp) -GOM(pthread_getattr_default_np, iFEp) -GOM(pthread_setattr_default_np, iFEp) -GO(pthread_getcpuclockid, iFLp) -GO(pthread_getschedparam, iFLpp) -GO(pthread_getspecific, pFL) -GO(pthread_getname_np, iFppL) -GO(pthread_join, iFLp) -GOM(pthread_key_create, iFEpp) -GO(pthread_key_delete, iFL) -GO2(pthread_kill@GLIBC_2.2.5, iFEpi, my_pthread_kill_old) -GOM(pthread_kill, iFEpi) -GO(pthread_kill_other_threads_np, vFv) -GOM(pthread_mutexattr_destroy, iFEp) -GOM(pthread_mutexattr_getkind_np, iFEpp) -GOM(pthread_mutexattr_getprotocol, iFEpp) -GOM(pthread_mutexattr_getrobust, iFEpp) -GOM(pthread_mutexattr_gettype, iFEpp) -GOM(pthread_mutexattr_init, iFEp) -GOM(pthread_mutexattr_setkind_np, iFEpi) -GOM(pthread_mutexattr_setprotocol, iFEpi) -GOM(pthread_mutexattr_setpshared, iFEpi) -GOM(pthread_mutexattr_setrobust, iFEpi) -GOM(pthread_mutexattr_settype, iFEpi) -GO(pthread_mutex_consistent, iFp) -GO(pthread_mutex_destroy, iFp) -// phtread_mutex_t is 40 bytes on x86_64, but 48bytes on ARM64 -GOM(pthread_mutex_init, iFpp) -GO(pthread_mutex_lock, iFp) -GO(pthread_mutex_timedlock, iFpp) -GO(pthread_mutex_trylock, iFp) -GO(pthread_mutex_unlock, iFp) -GOM(pthread_once, iFEpp) -GO(pthread_rwlockattr_destroy, vFp) -GO(pthread_rwlockattr_getkind_np, iFpp) -GO(pthread_rwlockattr_init, iFp) -GO(pthread_rwlockattr_setkind_np, iFpi) -GO(pthread_rwlock_destroy, iFp) -GO(pthread_rwlock_init, iFpp) -GO(pthread_rwlock_rdlock, iFp) -GO(pthread_rwlock_tryrdlock, iFp) -GO(pthread_rwlock_trywrlock, iFp) -GO(pthread_rwlock_unlock, iFp) -GO(pthread_rwlock_wrlock, iFp) -GO(pthread_self, LFv) -GOM(pthread_setaffinity_np, iFEpLp) -GO(pthread_setcancelstate, iFip) -GO(pthread_setcanceltype, iFip) -GO(pthread_setconcurrency, iFi) -GO(pthread_setname_np, iFpp) -GO(pthread_setschedparam, iFLip) -GO(pthread_setschedprio, iFpi) -GO(pthread_setspecific, iFLp) -GO(pthread_sigmask, iFipp) -GO(pthread_spin_destroy, iFp) -GO(pthread_spin_init, iFpi) -GO(pthread_spin_lock, iFp) -GO(pthread_spin_trylock, iFp) -GO(pthread_spin_unlock, iFp) -GO(pthread_testcancel, vFv) -GO(pthread_timedjoin_np, iFppp) -GO(pthread_tryjoin_np, iFpp) -GO(pthread_yield, iFv) -GO(sem_close, iFp) -GO(sem_clockwait, iFppp) -GO(sem_destroy, iFp) -GO(sem_getvalue, iFpp) -GO(sem_init, iFpiu) -GO(sem_open, pFpOM) -GO(sem_post, iFp) -GO(sem_timedwait, iFpp) -GO(sem_trywait, iFp) -GO(sem_unlink, iFp) -GO(sem_wait, iFp) +#endif GOM(ptrace, lFEuipp) GO(ptsname, pFi) @@ -1651,12 +1593,21 @@ GO(rexec_af, iFpippppW) //DATAB(rexecoptions, GO(rindex, pFpi) GOW(rmdir, iFp) +#ifdef STATICBUILD +//DATAB(rpc_createerr, +//GO(_rpc_dtablesize, iFv) +//GO(__rpc_thread_createerr, !Fv) +//GO(__rpc_thread_svc_fdset, !Fv) +//GO(__rpc_thread_svc_max_pollfd, pFv) +//GO(__rpc_thread_svc_pollfd, pFv) +#else //DATAB(rpc_createerr, GO(_rpc_dtablesize, iFv) //GO(__rpc_thread_createerr, !Fv) //GO(__rpc_thread_svc_fdset, !Fv) GO(__rpc_thread_svc_max_pollfd, pFv) GO(__rpc_thread_svc_pollfd, pFv) +#endif GO(rpmatch, iFp) GO(rresvport, iFp) GO(rresvport_af, iFpW) @@ -1995,6 +1946,36 @@ GO(strxfrm, LFppL) GO(__strxfrm_l, LFppLL) GO(strxfrm_l, LFppLp) //GO(stty, // Deprecated +#ifdef STATICBUILD +//DATAB(svcauthdes_stats, +//GO(svcerr_auth, vF!u) +//GO(svcerr_decode, vF!) +//GO(svcerr_noproc, vF!) +//GO(svcerr_noprog, vF!) +//GO(svcerr_progvers, vF!LL) +//GO(svcerr_systemerr, vF!) +//GO(svcerr_weakauth, vF!) +//GO(svc_exit, vFv) +//GO(svcfd_create, !Fiuu) +//DATAB(svc_fdset, +//GO(svc_getreq, vFi) +//GO(svc_getreq_common, vFi) +//GO(svc_getreq_poll, vFpi) +//GO(svc_getreqset, vF!) +//DATAB(svc_max_pollfd, +//DATAB(svc_pollfd, +//GO(svcraw_create, !Fv) +//GO(svc_register, iF!LL@L) +//GO(svc_run, vFv) +//GO(svc_sendreply, iF!@p) +//GO(svctcp_create, !Fiuu) +//GO(svcudp_bufcreate, !Fiuu) +//GO(svcudp_create, !Fi) +//GO(svcudp_enablecache, +//GO(svcunix_create, !Fiuup) +//GO(svcunixfd_create, +//GO(svc_unregister, vFLL) +#else //DATAB(svcauthdes_stats, //GO(svcerr_auth, vF!u) //GO(svcerr_decode, vF!) @@ -2023,6 +2004,7 @@ GO(svc_run, vFv) //GO(svcunix_create, !Fiuup) //GO(svcunixfd_create, GO(svc_unregister, vFLL) +#endif GO(swab, vFppl) GOWM(swapcontext, iFEpp) //GOW(swapoff, @@ -2038,10 +2020,20 @@ GO(syncfs, iFi) GOM(syscall, lFEv) GOM(__sysconf, lFEi) GOM(sysconf, IFEi) +#ifdef STATICBUILD +//GO(__sysctl, +//GO(sysctl, +#else GO(__sysctl, iFpipppL) GOW(sysctl, iFpipppL) // Deprecated +#endif +#ifdef STATICBUILD +//DATA(_sys_errlist, sizeof(void*)) +//DATA(sys_errlist, sizeof(void*)) +#else DATA(_sys_errlist, sizeof(void*)) DATA(sys_errlist, sizeof(void*)) +#endif GOW(sysinfo, iFp) GOM(syslog, vFEipV) GOM(__syslog_chk, vFEiipV) @@ -2145,7 +2137,11 @@ GO(updwtmpx, vFpp) //GO(uselib, // Deprecated GO(__uselocale, pFp) GOW(uselocale, pFp) +#ifdef STATICBUILD +//GO(user2netname, +#else GO(user2netname, iFpup) +#endif GO(usleep, iFu) //GO(ustat, // Deprecated GO(utime, iFpp) @@ -2397,11 +2393,21 @@ GOW(writev, lFipi) //GO(xdr_u_quad_t, iF!p) //GO(xdr_u_short, iF!p) //GO(xdr_vector, iF!puu@) +#ifdef STATICBUILD +//GO(xdr_void, +//GO(xdr_wrapstring, iF!p) +#else GO(xdr_void, iFv) //GO(xdr_wrapstring, iF!p) +#endif //GO(xencrypt, +#ifdef STATICBUILD +//GO(__xmknod, iFipup) +//GO(__xmknodat, iFiipup) +#else GO(__xmknod, iFipup) GO(__xmknodat, iFiipup) +#endif GO(__xpg_basename, pFp) GOW(__xpg_sigpause, iFi) GO(__xpg_strerror_r, pFipL) @@ -2429,7 +2435,11 @@ DATAM(program_invocation_short_name, sizeof(void*)) DATAM(__libc_single_threaded, 1) +#ifdef STATICBUILD +//GO(iconvctl, +#else GO(iconvctl, iFlip) +#endif GO(dummy__ZnwmSt11align_val_tRKSt9nothrow_t, pFLLp) // for mallochook.c #ifdef ANDROID @@ -2440,3 +2450,11 @@ GO(__errno, pFv) //GOM(__libc_init, //GO(__errno, #endif +#ifdef STATICBUILD +GO(dummy_pFLp, pFLp) +GO(dummy_pFpLLp, pFpLLp) +#else +// not needed in no-static build +//GO(dummy_pFLp, pFLp) +//GO(dummy_pFpLLp, pFpLLp) +#endif diff --git a/src/wrapped/wrappedlibcmusl.c b/src/wrapped/wrappedlibcmusl.c index 213fecd1..8294b7ce 100644 --- a/src/wrapped/wrappedlibcmusl.c +++ b/src/wrapped/wrappedlibcmusl.c @@ -21,10 +21,12 @@ const char* libcmuslName = "libc.musl-x86_64.so.1"; #define LIBNAME libcmusl +#ifndef STATICBUILD #define PRE_INIT\ if(1) \ lib->w.lib = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL); \ else +#endif #define CUSTOM_INIT \ box64_musl = 1; diff --git a/src/wrapped/wrappedlibdl.c b/src/wrapped/wrappedlibdl.c index b781b9cb..98d81034 100644 --- a/src/wrapped/wrappedlibdl.c +++ b/src/wrapped/wrappedlibdl.c @@ -611,6 +611,10 @@ void closeAllDLOpenned() } } +#ifdef STATICBUILD +//extern void* _dlfcn_hook; +#endif + #define CUSTOM_FINI \ closeAllDLOpenned(); diff --git a/src/wrapped/wrappedlibdl_private.h b/src/wrapped/wrappedlibdl_private.h index f547ffb9..c2106250 100644 --- a/src/wrapped/wrappedlibdl_private.h +++ b/src/wrapped/wrappedlibdl_private.h @@ -4,7 +4,11 @@ GOM(dladdr, iFEpp) GOM(dladdr1, iFEpppi) GOM(dlclose, iFEp) GOM(dlerror, pFEv) -DATAB(_dlfcn_hook, 8) +#ifdef STATICBUILD +//DATAB(_dlfcn_hook, sizeof(void*)) +#else +DATAB(_dlfcn_hook, sizeof(void*)) +#endif GOM(dlinfo, iFEpip) GOM(dlmopen, pFEppi) GOM(dlopen, pFEpi) diff --git a/src/wrapped/wrappedlibm.c b/src/wrapped/wrappedlibm.c index 670ce370..797d8bd3 100644 --- a/src/wrapped/wrappedlibm.c +++ b/src/wrapped/wrappedlibm.c @@ -1,7 +1,7 @@ +#define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <string.h> -#define _GNU_SOURCE /* See feature_test_macros(7) */ #include <dlfcn.h> #include <complex.h> #include <math.h> @@ -193,6 +193,14 @@ EXPORT double my_llrintl(x64emu_t* emu, double val) } #endif +double my_pow10(double a) { return exp10(a);} +float my_pow10f(float a) { return exp10f(a);} +long double my_pow10l(long double a) { return exp10l(a);} + +#ifdef STATICBUILD +//extern void* _LIB_VERSION; +#endif + #undef FROUND #undef TO_NATIVE diff --git a/src/wrapped/wrappedlibm_private.h b/src/wrapped/wrappedlibm_private.h index 7e2a55df..64e9a7ec 100644 --- a/src/wrapped/wrappedlibm_private.h +++ b/src/wrapped/wrappedlibm_private.h @@ -350,7 +350,11 @@ GO2(lgammal_r, KFKp, lgamma_r) #endif GOW(lgamma_r, dFdp) // __lgamma_r_finite +#ifdef STATICBUILD +//DATAV(_LIB_VERSION, 8) +#else DATAV(_LIB_VERSION, 8) +#endif GOWM(llrint, IFEd) GOWM(llrintf, IFEf) #ifdef HAVE_LD80BITS @@ -417,12 +421,12 @@ GOW(nexttoward, dFdD) GOW(nexttowardf, fFfD) // nexttowardl // Weak GOW(pow, dFdd) -GOW(pow10, dFd) -GOW(pow10f, fFf) +GOWM(pow10, dFd) +GOWM(pow10f, fFf) #ifdef HAVE_LD80BITS -GOW(pow10l, DFD) +GOWM(pow10l, DFD) #else -GOW(pow10l, KFK) +GOWM(pow10l, KFK) #endif GOW(powf, fFff) GOM(__powf_finite, fFff) diff --git a/src/wrapped/wrappedlibpthread.c b/src/wrapped/wrappedlibpthread.c index d29218ed..9b0184c6 100644 --- a/src/wrapped/wrappedlibpthread.c +++ b/src/wrapped/wrappedlibpthread.c @@ -1,3 +1,4 @@ +#define __USE_UNIX98 #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> @@ -20,30 +21,6 @@ const char* libpthreadName = "libpthread.so.0"; #define LIBNAME libpthread - -//int my_pthread_create(x64emu_t *emu, void* t, void* attr, void* start_routine, void* arg); //implemented in thread.c -//int my_pthread_key_create(x64emu_t* emu, void* key, void* dtor); -//int my___pthread_key_create(x64emu_t* emu, void* key, void* dtor); -//int my_pthread_once(x64emu_t* emu, void* once, void* cb); -//int my___pthread_once(x64emu_t* emu, void* once, void* cb); -//int my_pthread_cond_broadcast(x64emu_t* emu, void* cond); -//int my_pthread_cond_destroy(x64emu_t* emu, void* cond); -//int my_pthread_cond_init(x64emu_t* emu, void* cond, void* attr); -//int my_pthread_cond_signal(x64emu_t* emu, void* cond); -//int my_pthread_cond_timedwait(x64emu_t* emu, void* cond, void* mutex, void* abstime); -//int my_pthread_cond_wait(x64emu_t* emu, void* cond, void* mutex); -//int my_pthread_mutexattr_setkind_np(x64emu_t* emu, void* t, int kind); -//int my_pthread_attr_setscope(x64emu_t* emu, void* attr, int scope); -//void my__pthread_cleanup_push_defer(x64emu_t* emu, void* buffer, void* routine, void* arg); -//void my__pthread_cleanup_push(x64emu_t* emu, void* buffer, void* routine, void* arg); -//void my__pthread_cleanup_pop(x64emu_t* emu, void* buffer, int exec); -//void my__pthread_cleanup_pop_restore(x64emu_t* emu, void* buffer, int exec); -//int my_pthread_kill(x64emu_t* emu, void* thread, int sig); -//int my_pthread_getaffinity_np(x64emu_t* emu, pthread_t thread, int cpusetsize, void* cpuset); -//int my_pthread_setaffinity_np(x64emu_t* emu, pthread_t thread, int cpusetsize, void* cpuset); -//int my_pthread_attr_setaffinity_np(x64emu_t* emu, void* attr, uint32_t cpusetsize, void* cpuset); - - //EXPORT int my_pthread_attr_setschedparam(x64emu_t* emu, void* attr, void* param) //{ // int policy; @@ -82,4 +59,21 @@ EXPORT void my___pthread_initialize() // nothing, the lib initialize itself now } +#ifdef STATICBUILD +#include <semaphore.h> +#include "libtools/static_threads.h" + +extern void* __pthread_getspecific(size_t); +extern int __pthread_mutex_destroy(void*); +extern int __pthread_mutex_lock(void*); +extern int __pthread_mutex_trylock(void*); +extern int __pthread_mutex_unlock(void*); +extern int __pthread_rwlock_init(void*, void*); +extern int __pthread_rwlock_rdlock(void*); +extern int __pthread_rwlock_unlock(void*); +extern int __pthread_rwlock_wrlock(void*); +extern int __pthread_setspecific(size_t, void*); +extern int pthread_sigmask(int, void*, void*); +#endif + #include "wrappedlib_init.h" diff --git a/src/wrapped/wrappedlibpthread_private.h b/src/wrapped/wrappedlibpthread_private.h index ca356e39..878d9f8f 100644 --- a/src/wrapped/wrappedlibpthread_private.h +++ b/src/wrapped/wrappedlibpthread_private.h @@ -138,7 +138,11 @@ GOM(pthread_key_create, iFEpp) GOM(pthread_key_delete, iFEL) GO2(pthread_kill@GLIBC_2.2.5, iFEpi, my_pthread_kill_old) GOM(pthread_kill, iFEpi) +#ifndef STATICBUILD GO(pthread_kill_other_threads_np, vFv) +#else +//GO(pthread_kill_other_threads_np, vFv) +#endif #ifdef NOALIGN GO(__pthread_mutexattr_destroy, iFp) GO(pthread_mutexattr_destroy, iFp) diff --git a/src/wrapped/wrappedlibresolv.c b/src/wrapped/wrappedlibresolv.c index 36af9fbc..f36326d2 100644 --- a/src/wrapped/wrappedlibresolv.c +++ b/src/wrapped/wrappedlibresolv.c @@ -20,4 +20,32 @@ const char* libresolvName = "libresolv.so.2"; #define LIBNAME libresolv +#ifdef STATICBUILD +#include <arpa/inet.h> +#include <resolv.h> + +#undef __dn_comp +#undef __dn_expand +#undef __dn_skipname + +int __dn_comp(void* a, void* b, int c, void* d, void* e ) {return dn_comp(a, b, c, d, e);} +int __dn_expand(void* a, void* b, void* c, void* d, int e) {return dn_expand(a, b, c, d, e);} +int __dn_skipname(void* a, void* b) {return dn_skipname(a, b);} +uint32_t __ns_get16(void* a); +size_t __ns_get32(void* a); +extern int __ns_name_ntop(void* a, void* b, size_t c) {return ns_name_ntop(a, b, c);} +extern int __ns_name_unpack(void* a, void* b, void* c, void* d, size_t e) {return ns_name_unpack(a, b, c, d, e);} +extern int __res_dnok(void* a) {return res_dnok(a);} +extern int __res_hnok(void* a) {return res_hnok(a);} +extern int __res_mailok(void* a) {return res_mailok(a);} +extern int __res_mkquery(int a, void* b, int c, int d, void* e, int f, void* g, void* h, int i) {return res_mkquery(a, b, c, d, e, f, g, h, i);} +extern int __res_nquery(int a, void* b, int c, int d, void* e, int f) {return res_nquery(a, b, c, d, e, f);} +extern int __res_nsearch(void* a, void* b, int c, int d, void* e, int f) {return res_nsearch(a, b, c, d, e, f);} +extern int __res_ownok(void* a) {return res_ownok(a);} +extern int __res_query(void* a, int b, int c, void* d, int e) {return res_query(a, b, c, d, e);} +extern int __res_querydomain(void* a, void* b, int c, int d, void* e, int f) {return res_querydomain(a, b, c, d, e, f);} +extern int __res_search(void* a, int b, int c, void* d, int e) {return res_search(a, b, c, d, e);} +extern int __res_send(void* a, int b, void* c, int d) {return res_send(a, b, c, d);} +#endif + #include "wrappedlib_init.h" diff --git a/src/wrapped/wrappedlibrt.c b/src/wrapped/wrappedlibrt.c index 3b90c84a..36ea8829 100644 --- a/src/wrapped/wrappedlibrt.c +++ b/src/wrapped/wrappedlibrt.c @@ -112,7 +112,7 @@ EXPORT int my_aio_write64(x64emu_t emu, struct aiocb* aiocbp) aiocbp->aio_sigevent.sigev_notify_function = findsigev_notifyFct(aiocbp->aio_sigevent.sigev_notify_function); return my->aio_write64(aiocbp); } -EXPORT int mylio_listio(x64emu_t* emu, int mode, struct aiocb* list[], int nent, struct sigevent* sig) +EXPORT int my_lio_listio(x64emu_t* emu, int mode, struct aiocb* list[], int nent, struct sigevent* sig) { struct sigevent sevent; if(sig) { @@ -148,11 +148,18 @@ EXPORT int my_aio_write64(x64emu_t emu, void* aiocbp) errno = ENOSYS; return -1; } -EXPORT int mylio_listio(x64emu_t* emu, int mode, void* list[], int nent, struct sigevent* sig) +EXPORT int my_lio_listio(x64emu_t* emu, int mode, void* list[], int nent, struct sigevent* sig) { errno = ENOSYS; return -1; } #endif +#ifdef STATICBUILD +#include <mqueue.h> +#include <sys/mman.h> + +extern int __mq_open_2(void*, int); +#endif + #include "wrappedlib_init.h" diff --git a/src/wrapped/wrappedutil.c b/src/wrapped/wrappedutil.c index 3d4911aa..91503f78 100644 --- a/src/wrapped/wrappedutil.c +++ b/src/wrapped/wrappedutil.c @@ -37,10 +37,18 @@ EXPORT pid_t my_forkpty(x64emu_t* emu, void* amaster, void* name, void* termp, v return 0; } +#ifdef STATICBUILD +#include <pty.h> +#include <utmp.h> +#endif + +#ifdef STATICBUILD +#else #define PRE_INIT\ if(1) \ lib->w.lib = dlopen(NULL, RTLD_LAZY | RTLD_GLOBAL); \ else +#endif #include "wrappedlib_init.h" |