diff --git a/patches/mlibc/jinx-working-patch.patch b/patches/mlibc/jinx-working-patch.patch index b9c654b0..89d4ed29 100644 --- a/patches/mlibc/jinx-working-patch.patch +++ b/patches/mlibc/jinx-working-patch.patch @@ -1,5 +1,5 @@ diff --git mlibc-clean/options/ansi/generic/stdio.cpp mlibc-workdir/options/ansi/generic/stdio.cpp -index a5e177a..91a9db7 100644 +index 070168f..827732a 100644 --- mlibc-clean/options/ansi/generic/stdio.cpp +++ mlibc-workdir/options/ansi/generic/stdio.cpp @@ -8,6 +8,7 @@ @@ -10,7 +10,7 @@ index a5e177a..91a9db7 100644 #include -@@ -348,6 +349,20 @@ static void store_int(void *dest, unsigned int size, unsigned long long i) { +@@ -379,6 +380,20 @@ static void store_int(void *dest, unsigned int size, unsigned long long i) { } } @@ -31,7 +31,7 @@ index a5e177a..91a9db7 100644 template static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) { #define NOMATCH_CHECK(cond) ({ if(cond) return match_count; }) // if cond is true, matching error -@@ -476,6 +491,141 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) { +@@ -521,6 +536,141 @@ static int do_scanf(H &handler, const char *fmt, __builtin_va_list args) { } switch (*fmt) { @@ -174,18 +174,46 @@ index a5e177a..91a9db7 100644 case 'u': base = 10; diff --git mlibc-clean/options/glibc/generic/execinfo.cpp mlibc-workdir/options/glibc/generic/execinfo.cpp -index 6b6a9c0..e1a37e2 100644 +index 119574e..f9f1cde 100644 --- mlibc-clean/options/glibc/generic/execinfo.cpp +++ mlibc-workdir/options/glibc/generic/execinfo.cpp -@@ -2,6 +2,7 @@ +@@ -7,6 +7,7 @@ #include #include +#include - int backtrace(void **, int) { - mlibc::infoLogger() << "mlibc: backtrace() is a stub!" << frg::endlog; -@@ -9,8 +10,9 @@ int backtrace(void **, int) { + namespace { + +@@ -52,33 +53,15 @@ _Unwind_Reason_Code trace(_Unwind_Context *context, void *arg) { + } // namespace + + int backtrace(void **buffer, int size) { +- if (size <= 0) +- return 0; +- +- if (!libgccHandle) { +- libgccHandle = dlopen("libgcc_s.so.1", RTLD_LAZY | RTLD_LOCAL); +- if (!libgccHandle || libgccHandle.value() == nullptr) { +- mlibc::infoLogger() << "Failed to load libgcc_s.so.1: " << (dlerror() ? dlerror() : "") << frg::endlog; +- return 0; +- } +- +- unwindBacktrace = reinterpret_cast(dlsym(libgccHandle.value(), "_Unwind_Backtrace")); +- unwindGetIP = reinterpret_cast(dlsym(libgccHandle.value(), "_Unwind_GetIP")); +- +- if (!unwindBacktrace || !unwindGetIP) { +- mlibc::infoLogger() << "Failed to find unwind functions in libgcc_s.so.1: " << dlerror() << frg::endlog; +- return 0; +- } +- } +- +- UnwindState state{buffer, size}; +- unwindBacktrace(trace, &state); +- return state.current_frame; ++ mlibc::infoLogger() << "mlibc: backtrace() is a stub!" << frg::endlog; ++ errno = ENOSYS; ++ return -1; } char **backtrace_symbols(void *const *, int) { @@ -196,4 +224,4 @@ index 6b6a9c0..e1a37e2 100644 + return NULL; } - void backtrace_symbols_fd(void *const *, int, int) { + void backtrace_symbols_fd(void *const *buffer, int size, int fd) {