fix: segfault in panic when statically compiled

Co-authored-by: RoadToLP <ilya.titoff2013@yandex.ru>
This commit is contained in:
PavelBlinnikov
2024-10-12 21:02:07 +03:00
committed by Christoffer Lerno
parent e6c9cfed42
commit 6a2957faf7
2 changed files with 2 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ const int RTLD_LAZY = 0x1;
const int RTLD_NOW = 0x2;
const int RTLD_LOCAL = 0x4;
const int RTLD_GLOBAL = 0x8;
const int RTLD_NODELETE = 0x1000;
def Pid_t = int;
def Uid_t = uint;

View File

@@ -61,7 +61,7 @@ def BacktraceFn = fn CInt(void** buffer, CInt size);
fn CInt backtrace(void** buffer, CInt size)
{
if (size < 1) return 0;
void* handle = libc::dlopen("libc.so.6", libc::RTLD_LAZY);
void* handle = libc::dlopen("libc.so.6", libc::RTLD_LAZY|libc::RTLD_NODELETE);
if (handle)
{
BacktraceFn backtrace_fn = libc::dlsym(handle, "backtrace");