From adc76d804bdc01562dffe768b725c1b6e8e1708e Mon Sep 17 00:00:00 2001 From: Christian Wiese Date: Sat, 22 Mar 2014 08:42:36 +0100 Subject: [PATCH] musl: fixed strace to compile --- .../strace/strace-linux-ptrace-header.patch | 46 +++++ base/musl/pkg/strace/strace-musl.patch | 183 ++++++++++++++++++ base/musl/pkg/strace/strace.conf | 17 ++ 3 files changed, 246 insertions(+) create mode 100644 base/musl/pkg/strace/strace-linux-ptrace-header.patch create mode 100644 base/musl/pkg/strace/strace-musl.patch create mode 100644 base/musl/pkg/strace/strace.conf diff --git a/base/musl/pkg/strace/strace-linux-ptrace-header.patch b/base/musl/pkg/strace/strace-linux-ptrace-header.patch new file mode 100644 index 000000000..be91fd75e --- /dev/null +++ b/base/musl/pkg/strace/strace-linux-ptrace-header.patch @@ -0,0 +1,46 @@ +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: package/.../musl/pkg/strace/strace-linux-ptrace-header.patch +# Copyright (C) 2014 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This patch file is dual-licensed. It is available under the license the +# patched project is licensed under, as long as it is an OpenSource license +# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms +# of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# --- SDE-COPYRIGHT-NOTE-END --- + +Original patch was taken from sabotage linux: + +https://github.com/sabotage-linux/sabotage/blob/master/KEEP/strace-kernelhdr_3.12.6.patch + +The second part which includes sys/sysinfo.h in the original patch needed +to be removed to be able to compile strace with OpenSDE's current kernel +headers of linux 3.10.29. + +--- strace-4.8.org/process.c ++++ strace-4.8/process.c +@@ -55,19 +55,6 @@ + # endif + #endif + +-#ifdef HAVE_LINUX_PTRACE_H +-# undef PTRACE_SYSCALL +-# ifdef HAVE_STRUCT_IA64_FPREG +-# define ia64_fpreg XXX_ia64_fpreg +-# endif +-# ifdef HAVE_STRUCT_PT_ALL_USER_REGS +-# define pt_all_user_regs XXX_pt_all_user_regs +-# endif +-# include +-# undef ia64_fpreg +-# undef pt_all_user_regs +-#endif +- + #if defined(SPARC64) + # define r_pc r_tpc + # undef PTRACE_GETREGS diff --git a/base/musl/pkg/strace/strace-musl.patch b/base/musl/pkg/strace/strace-musl.patch new file mode 100644 index 000000000..2fc3bf95d --- /dev/null +++ b/base/musl/pkg/strace/strace-musl.patch @@ -0,0 +1,183 @@ +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: package/.../musl/pkg/strace/strace-musl.patch +# Copyright (C) 2014 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This patch file is dual-licensed. It is available under the license the +# patched project is licensed under, as long as it is an OpenSource license +# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms +# of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# --- SDE-COPYRIGHT-NOTE-END --- + +diff -ru strace-4.8.orig/defs.h strace-4.8/defs.h +--- strace-4.8.orig/defs.h 2013-05-14 14:10:42.000000000 +0000 ++++ strace-4.8/defs.h 2013-09-20 14:30:38.785856744 +0000 +@@ -155,7 +155,7 @@ + || defined(METAG) \ + || defined(TILE) \ + || defined(XTENSA) \ +- ) && defined(__GLIBC__) ++ ) && defined(__linux__) + # include + #else + /* Work around awkward prototype in ptrace.h. */ +@@ -222,7 +222,7 @@ + # define PTRACE_EVENT_EXIT 6 + #endif + +-#if !defined(__GLIBC__) ++#if !defined(__GLIBC__) && !defined(PTRACE_PEEKUSER) + # define PTRACE_PEEKUSER PTRACE_PEEKUSR + # define PTRACE_POKEUSER PTRACE_POKEUSR + #endif +diff -ru strace-4.8.orig/desc.c strace-4.8/desc.c +--- strace-4.8.orig/desc.c 2013-05-01 22:39:10.000000000 +0000 ++++ strace-4.8/desc.c 2013-09-20 14:30:38.795856744 +0000 +@@ -299,7 +299,7 @@ + #ifdef X32 + tprintf(", start=%lld, len=%lld", fl.l_start, fl.l_len); + #else +- tprintf(", start=%ld, len=%ld", fl.l_start, fl.l_len); ++ tprintf(", start=%ld, len=%ld", (long) fl.l_start, (long) fl.l_len); + #endif + if (getlk) + tprintf(", pid=%lu}", (unsigned long) fl.l_pid); +diff -ru strace-4.8.orig/file.c strace-4.8/file.c +--- strace-4.8.orig/file.c 2013-05-06 18:23:01.000000000 +0000 ++++ strace-4.8/file.c 2013-09-20 14:30:38.795856744 +0000 +@@ -632,7 +632,7 @@ + return 0; + } + +-#if _LFS64_LARGEFILE ++#if defined _LFS64_LARGEFILE || defined HAVE_LONG_LONG_OFF_T + int + sys_truncate64(struct tcb *tcp) + { +@@ -654,7 +654,7 @@ + return 0; + } + +-#if _LFS64_LARGEFILE ++#if defined _LFS64_LARGEFILE || defined HAVE_LONG_LONG_OFF_T + int + sys_ftruncate64(struct tcb *tcp) + { +@@ -2322,7 +2322,7 @@ + return 0; + } + +-#if _LFS64_LARGEFILE ++#if defined _LFS64_LARGEFILE || defined HAVE_LONG_LONG_OFF_T + int + sys_getdents64(struct tcb *tcp) + { +diff -ru strace-4.8.orig/net.c strace-4.8/net.c +--- strace-4.8.orig/net.c 2013-05-17 22:20:02.000000000 +0000 ++++ strace-4.8/net.c 2013-09-20 14:30:38.805856744 +0000 +@@ -95,12 +95,14 @@ + #endif + + /* Under Linux these are enums so we can't test for them with ifdef. */ ++#if !defined(IPPROTO_MAX) + #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 -ru strace-4.8.orig/process.c strace-4.8/process.c +--- strace-4.8.orig/process.c 2013-05-17 22:22:19.000000000 +0000 ++++ strace-4.8/process.c 2013-09-20 14:30:38.805856744 +0000 +@@ -2857,7 +2857,7 @@ + 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 @@ + 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 @@ + 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 -ru strace-4.8.orig/signal.c strace-4.8/signal.c +--- strace-4.8.orig/signal.c 2013-05-23 13:41:23.000000000 +0000 ++++ strace-4.8/signal.c 2013-09-20 14:30:38.815856744 +0000 +@@ -59,6 +59,7 @@ + #ifdef IA64 + # include + #endif ++#include + + #if defined(SPARC) || defined(SPARC64) || defined(MIPS) + typedef struct { +diff -ru strace-4.8.orig/strace.c strace-4.8/strace.c +--- strace-4.8.orig/strace.c 2013-05-28 21:49:16.000000000 +0000 ++++ strace-4.8/strace.c 2013-09-20 14:30:38.815856744 +0000 +@@ -506,7 +506,7 @@ + perror_msg_and_die("dup2"); + close(fds[0]); + } +- execl(_PATH_BSHELL, "sh", "-c", command, NULL); ++ execl(_PATH_BSHELL, "sh", "-c", command, (void*) 0); + perror_msg_and_die("Can't execute '%s'", _PATH_BSHELL); + } + +diff -ru strace-4.8.orig/syscall.c strace-4.8/syscall.c +--- strace-4.8.orig/syscall.c 2013-05-14 14:10:42.000000000 +0000 ++++ strace-4.8/syscall.c 2013-09-20 14:30:38.825856744 +0000 +@@ -72,13 +72,7 @@ + # include + #endif + +-#if defined(AARCH64) +-# include +-#endif +- +-#if defined(XTENSA) +-# include +-#endif ++#include + + #ifndef ERESTARTSYS + # define ERESTARTSYS 512 +diff -ru strace-4.8.orig/time.c strace-4.8/time.c +--- strace-4.8.orig/time.c 2012-05-01 21:17:51.000000000 +0000 ++++ strace-4.8/time.c 2013-09-20 14:32:49.165856719 +0000 +@@ -774,7 +774,11 @@ + /* _pad[0] is the _tid field which might not be + present in the userlevel definition of the + struct. */ ++#if defined(__GLIBC__) + tprintf("{%d}", sev._sigev_un._pad[0]); ++#else ++ tprintf("{%d}", (int) sev.__pad[0]); ++#endif + else if (sev.sigev_notify == SIGEV_THREAD) + tprintf("{%p, %p}", sev.sigev_notify_function, + sev.sigev_notify_attributes); diff --git a/base/musl/pkg/strace/strace.conf b/base/musl/pkg/strace/strace.conf new file mode 100644 index 000000000..3e52b34c4 --- /dev/null +++ b/base/musl/pkg/strace/strace.conf @@ -0,0 +1,17 @@ +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: package/.../musl/pkg/strace/strace.conf +# Copyright (C) 2014 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. A copy of the +# GNU General Public License can be found in the file COPYING. +# --- SDE-COPYRIGHT-NOTE-END --- + +if atstage cross; then + var_append configcache ' ' "ac_cv_have_long_long_off_t=yes" +fi