From b8bea7545cc3f3b9b5f6f4d848ac9f25d2ad1f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Buchm=C3=BCller?= Date: Wed, 6 Dec 2017 21:18:22 +0100 Subject: [PATCH] uftrace: fix musl --- .../uftrace/patches/musl-rtld_default.patch | 13 +++++++++++ srcpkgs/uftrace/patches/strerror.patch | 22 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 srcpkgs/uftrace/patches/musl-rtld_default.patch diff --git a/srcpkgs/uftrace/patches/musl-rtld_default.patch b/srcpkgs/uftrace/patches/musl-rtld_default.patch new file mode 100644 index 00000000000..228f2ae2e64 --- /dev/null +++ b/srcpkgs/uftrace/patches/musl-rtld_default.patch @@ -0,0 +1,13 @@ +--- libmcount/plthook.c 2017-12-05 06:11:38.000000000 +0100 ++++ libmcount/plthook.c 2017-12-06 21:17:22.716483918 +0100 +@@ -32,6 +32,10 @@ + #define PAGE_SIZE 4096 + #define PAGE_ADDR(addr) ((void *)((addr) & ~(PAGE_SIZE - 1))) + ++#if !defined(RTLD_DEFAULT) ++#define RTLD_DEFAULT ((void *) 0) ++#endif ++ + static void segv_handler(int sig, siginfo_t *si, void *ctx) + { + if (segv_handled) diff --git a/srcpkgs/uftrace/patches/strerror.patch b/srcpkgs/uftrace/patches/strerror.patch index 2fae067ebac..984a731ae01 100644 --- a/srcpkgs/uftrace/patches/strerror.patch +++ b/srcpkgs/uftrace/patches/strerror.patch @@ -9,3 +9,25 @@ color(TERM_COLOR_RESET, logfp); +--- libtraceevent/event-parse.c 2017-12-05 06:11:38.000000000 +0100 ++++ libtraceevent/event-parse.c 2017-12-06 21:02:42.135421115 +0100 +@@ -5353,12 +5353,19 @@ + const char *msg; + + if (errnum >= 0) { ++#if defined(__GLIBC__) + msg = strerror_r(errnum, buf, buflen); + if (msg != buf) { + size_t len = strlen(msg); + memcpy(buf, msg, min(buflen - 1, len)); + *(buf + min(buflen - 1, len)) = '\0'; + } ++#else ++ int rc = strerror_r(errnum, buf, buflen); ++ if (rc < 0) { ++ snprintf(buf, buflen, "Error %d", errnum); ++ } ++#endif + return 0; + } +