From 8c716c528bc7a91dc1b065269c23707f8c3cb82f Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 14 Aug 2013 08:56:47 +0200 Subject: fix strace with musl libc --- package/strace/Makefile | 3 +++ package/strace/patches/patch-defs_h | 23 +++++++++++++++++++++++ package/strace/patches/patch-defs_h.orig | 14 ++++++++++++++ package/strace/patches/patch-desc_c | 11 +++++++++++ package/strace/patches/patch-net_c | 19 +++++++++++++++++++ package/strace/patches/patch-process_c | 29 +++++++++++++++++++++++++++++ package/strace/patches/patch-signal_c | 11 +++++++++++ package/strace/patches/patch-time_c | 14 ++++++++++++++ 8 files changed, 124 insertions(+) create mode 100644 package/strace/patches/patch-defs_h create mode 100644 package/strace/patches/patch-defs_h.orig create mode 100644 package/strace/patches/patch-desc_c create mode 100644 package/strace/patches/patch-net_c create mode 100644 package/strace/patches/patch-process_c create mode 100644 package/strace/patches/patch-signal_c create mode 100644 package/strace/patches/patch-time_c diff --git a/package/strace/Makefile b/package/strace/Makefile index 30c6a64c4..98647b555 100644 --- a/package/strace/Makefile +++ b/package/strace/Makefile @@ -20,6 +20,9 @@ $(eval $(call PKG_template,STRACE,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PK ifeq ($(ADK_STATIC),y) TARGET_CFLAGS+= -static endif +ifeq ($(ADK_TARGET_LIB_MUSL),y) +TARGET_CPPFLAGS+= -DMSG_EXCEPT=020000 -D_LARGEFILE64_SOURCE=1 +endif INSTALL_STYLE:= manual diff --git a/package/strace/patches/patch-defs_h b/package/strace/patches/patch-defs_h new file mode 100644 index 000000000..50d061348 --- /dev/null +++ b/package/strace/patches/patch-defs_h @@ -0,0 +1,23 @@ +--- strace-4.8.orig/defs.h 2013-05-14 16:10:42.000000000 +0200 ++++ strace-4.8/defs.h 2013-08-14 08:51:03.000000000 +0200 +@@ -162,7 +162,7 @@ extern char *stpcpy(char *dst, const cha + # define ptrace xptrace + # include + # undef ptrace +-# ifdef POWERPC ++# if defined(POWERPC) || defined(ARM) + # define __KERNEL__ + # include + # undef __KERNEL__ +@@ -222,11 +222,6 @@ extern long ptrace(int, int, char *, lon + # define PTRACE_EVENT_EXIT 6 + #endif + +-#if !defined(__GLIBC__) +-# define PTRACE_PEEKUSER PTRACE_PEEKUSR +-# define PTRACE_POKEUSER PTRACE_POKEUSR +-#endif +- + #if USE_SEIZE + # undef PTRACE_SEIZE + # define PTRACE_SEIZE 0x4206 diff --git a/package/strace/patches/patch-defs_h.orig b/package/strace/patches/patch-defs_h.orig new file mode 100644 index 000000000..60ca6e97a --- /dev/null +++ b/package/strace/patches/patch-defs_h.orig @@ -0,0 +1,14 @@ +--- strace-4.8.orig/defs.h 2013-05-14 16:10:42.000000000 +0200 ++++ strace-4.8/defs.h 2013-08-14 08:01:46.000000000 +0200 +@@ -222,11 +222,6 @@ extern long ptrace(int, int, char *, lon + # define PTRACE_EVENT_EXIT 6 + #endif + +-#if !defined(__GLIBC__) +-# define PTRACE_PEEKUSER PTRACE_PEEKUSR +-# define PTRACE_POKEUSER PTRACE_POKEUSR +-#endif +- + #if USE_SEIZE + # undef PTRACE_SEIZE + # define PTRACE_SEIZE 0x4206 diff --git a/package/strace/patches/patch-desc_c b/package/strace/patches/patch-desc_c new file mode 100644 index 000000000..2702c7f5f --- /dev/null +++ b/package/strace/patches/patch-desc_c @@ -0,0 +1,11 @@ +--- strace-4.8.orig/desc.c 2013-05-02 00:39:10.000000000 +0200 ++++ strace-4.8/desc.c 2013-08-14 08:55:36.000000000 +0200 +@@ -223,7 +223,7 @@ static const struct xlat perf_event_open + { 0, NULL }, + }; + +-#if _LFS64_LARGEFILE ++#if defined(_LFS64_LARGEFILE) && defined(__GLIBC__) || defined(__UCLIBC__) + /* fcntl/lockf */ + static void + printflock64(struct tcb *tcp, long addr, int getlk) diff --git a/package/strace/patches/patch-net_c b/package/strace/patches/patch-net_c new file mode 100644 index 000000000..a3c31d2ae --- /dev/null +++ b/package/strace/patches/patch-net_c @@ -0,0 +1,19 @@ +--- strace-4.8.orig/net.c 2013-05-18 00:20:02.000000000 +0200 ++++ strace-4.8/net.c 2013-08-14 08:46:21.000000000 +0200 +@@ -94,13 +94,15 @@ + # define PF_UNSPEC AF_UNSPEC + #endif + +-/* Under Linux these are enums so we can't test for them with ifdef. */ ++/* Under Linux (glibc/uclibc) these are enums so we can't test for them with ifdef. */ ++#if defined(__GLIBC__) || defined(__UCLIBC__) + #define IPPROTO_EGP IPPROTO_EGP + #define IPPROTO_PUP IPPROTO_PUP + #define IPPROTO_IDP IPPROTO_IDP + #define IPPROTO_IGMP IPPROTO_IGMP + #define IPPROTO_RAW IPPROTO_RAW + #define IPPROTO_MAX IPPROTO_MAX ++#endif + + static const struct xlat domains[] = { + #ifdef PF_UNSPEC diff --git a/package/strace/patches/patch-process_c b/package/strace/patches/patch-process_c new file mode 100644 index 000000000..7fa9541f1 --- /dev/null +++ b/package/strace/patches/patch-process_c @@ -0,0 +1,29 @@ +--- strace-4.8.orig/process.c 2013-05-18 00:22:19.000000000 +0200 ++++ strace-4.8/process.c 2013-08-14 08:47:15.000000000 +0200 +@@ -2857,7 +2857,7 @@ sys_sched_setscheduler(struct tcb *tcp) + if (umove(tcp, tcp->u_arg[2], &p) < 0) + tprintf(", %#lx", tcp->u_arg[2]); + else +- tprintf(", { %d }", p.__sched_priority); ++ tprintf(", { %d }", p.sched_priority); + } + return 0; + } +@@ -2872,7 +2872,7 @@ sys_sched_getparam(struct tcb *tcp) + if (umove(tcp, tcp->u_arg[1], &p) < 0) + tprintf("%#lx", tcp->u_arg[1]); + else +- tprintf("{ %d }", p.__sched_priority); ++ tprintf("{ %d }", p.sched_priority); + } + return 0; + } +@@ -2885,7 +2885,7 @@ sys_sched_setparam(struct tcb *tcp) + if (umove(tcp, tcp->u_arg[1], &p) < 0) + tprintf("%d, %#lx", (int) tcp->u_arg[0], tcp->u_arg[1]); + else +- tprintf("%d, { %d }", (int) tcp->u_arg[0], p.__sched_priority); ++ tprintf("%d, { %d }", (int) tcp->u_arg[0], p.sched_priority); + } + return 0; + } diff --git a/package/strace/patches/patch-signal_c b/package/strace/patches/patch-signal_c new file mode 100644 index 000000000..041f7177b --- /dev/null +++ b/package/strace/patches/patch-signal_c @@ -0,0 +1,11 @@ +--- strace-4.8.orig/signal.c 2013-05-23 15:41:23.000000000 +0200 ++++ strace-4.8/signal.c 2013-08-14 08:50:16.000000000 +0200 +@@ -815,7 +815,7 @@ sys_sigreturn(struct tcb *tcp) + { + #if defined(ARM) + if (entering(tcp)) { +- struct sigcontext_struct sc; ++ struct sigcontext sc; + sigset_t sigm; + if (umove(tcp, arm_regs.ARM_sp, &sc) < 0) + return 0; diff --git a/package/strace/patches/patch-time_c b/package/strace/patches/patch-time_c new file mode 100644 index 000000000..746e00644 --- /dev/null +++ b/package/strace/patches/patch-time_c @@ -0,0 +1,14 @@ +--- strace-4.8.orig/time.c 2012-05-01 23:17:51.000000000 +0200 ++++ strace-4.8/time.c 2013-08-14 08:52:00.000000000 +0200 +@@ -774,7 +774,11 @@ printsigevent(struct tcb *tcp, long arg) + /* _pad[0] is the _tid field which might not be + present in the userlevel definition of the + struct. */ ++#if defined(__GLIBC__) || defined(__UCLIBC__) + tprintf("{%d}", sev._sigev_un._pad[0]); ++#else ++ ; ++#endif + else if (sev.sigev_notify == SIGEV_THREAD) + tprintf("{%p, %p}", sev.sigev_notify_function, + sev.sigev_notify_attributes); -- cgit v1.2.3