Browse Source

platform/android: enable dynamic dladdr, fix build

pull/2/head
mittorn 5 years ago
parent
commit
bef873e1f8
  1. 1
      common/defaults.h
  2. 18
      engine/common/crashhandler.c
  3. 5
      engine/platform/posix/lib_posix.c

1
common/defaults.h

@ -69,6 +69,7 @@ SETUP BACKENDS DEFINITIONS
#endif // XASH_MESSAGEBOX #endif // XASH_MESSAGEBOX
#define XASH_USE_EVDEV #define XASH_USE_EVDEV
#define XASH_DYNAMIC_DLADDR
#elif XASH_LINUX #elif XASH_LINUX
// we are building for Linux without SDL2, can draw only to framebuffer yet // we are building for Linux without SDL2, can draw only to framebuffer yet
#ifndef XASH_VIDEO #ifndef XASH_VIDEO

18
engine/common/crashhandler.c

@ -243,6 +243,24 @@ void Sys_RestoreCrashHandler( void )
#include <signal.h> #include <signal.h>
#include <sys/mman.h> #include <sys/mman.h>
#ifdef XASH_DYNAMIC_DLADDR
static int d_dladdr( void *sym, Dl_info *info )
{
static int (*dladdr_real) ( void *sym, Dl_info *info );
if( !dladdr_real )
dladdr_real = dlsym( (void*)(size_t)(-1), "dladdr" );
memset( info, 0, sizeof( *info ) );
if( !dladdr_real )
return -1;
return dladdr_real( sym, info );
}
#define dladdr d_dladdr
#endif
int printframe( char *buf, int len, int i, void *addr ) int printframe( char *buf, int len, int i, void *addr )
{ {
Dl_info dlinfo; Dl_info dlinfo;

5
engine/platform/posix/lib_posix.c

@ -198,20 +198,21 @@ void *COM_FunctionFromName( void *hInstance, const char *pName )
} }
#ifdef XASH_DYNAMIC_DLADDR #ifdef XASH_DYNAMIC_DLADDR
int d_dladdr( void *sym, Dl_info *info ) static int d_dladdr( void *sym, Dl_info *info )
{ {
static int (*dladdr_real) ( void *sym, Dl_info *info ); static int (*dladdr_real) ( void *sym, Dl_info *info );
if( !dladdr_real ) if( !dladdr_real )
dladdr_real = dlsym( (void*)(size_t)(-1), "dladdr" ); dladdr_real = dlsym( (void*)(size_t)(-1), "dladdr" );
Q_memset( info, 0, sizeof( *info ) ); memset( info, 0, sizeof( *info ) );
if( !dladdr_real ) if( !dladdr_real )
return -1; return -1;
return dladdr_real( sym, info ); return dladdr_real( sym, info );
} }
#define dladdr d_dladdr
#endif #endif
const char *COM_NameForFunction( void *hInstance, void *function ) const char *COM_NameForFunction( void *hInstance, void *function )

Loading…
Cancel
Save