patches/ltrace/0.5.3/160-fix-missing-ptrace-defines.patch
author Anthony Foiani <anthony.foiani@gmail.com>
Thu May 19 23:09:43 2011 +0200 (2011-05-19)
branch1.11
changeset 2465 5f98b7a90fbc
parent 1685 ecccce88fc71
permissions -rw-r--r--
complibs/ppl: fix 0.11-0.11.2 to compile with --disable-shared

PPL 0.11 (through 0.11.2) had a small bug where it still tried to build
and test its Java interface even when shared libraries are disabled.
Since that's exactly what ct-ng does, it explodes.

This is the patch from the PPL authors (see final link below).

More information can be found in these messages/threads:

Anthony's initial report and analysis with Yann:
http://www.cygwin.com/ml/crossgcc/2011-05/msg00046.html

Ron Flory hit the same problem:
http://www.cygwin.com/ml/crossgcc/2011-05/msg00054.html

Anthony's report to the ppl-devel list:
http://www.cs.unipr.it/pipermail/ppl-devel/2011-May/017450.html

Roberto's reply with a link to the fix in the PPL git repo:
http://www.cs.unipr.it/pipermail/ppl-devel/2011-May/017455.html

Signed-Off-By: Anthony Foiani <anthony.foiani@gmail.com>
(transplanted from 139b85d70b623e51f7585e7c64ecb8c6a6cf4567)
     1 This patch tries to fix the issue when PTRACE_EVENT_FORK is not found in the standard
     2 system headers.  The begininngs of this was already in place in trace.c, this patch
     3 only takes that idea and puts it in a shared include file for trace.c *and* events.c.
     4 The latter of which otherwise fails to build on Arm.
     5 
     6 	Joachim Nilsson <jocke@vmlinux.org>
     7 
     8 diff -ruN ltrace-0.5.3.orig/sysdeps/linux-gnu/events.c ltrace-0.5.3/sysdeps/linux-gnu/events.c
     9 --- ltrace-0.5.3.orig/sysdeps/linux-gnu/events.c	2009-07-25 17:13:02.000000000 +0200
    10 +++ ltrace-0.5.3/sysdeps/linux-gnu/events.c	2010-01-03 14:33:46.000000000 +0100
    11 @@ -7,9 +7,8 @@
    12  #include <errno.h>
    13  #include <signal.h>
    14  #include <string.h>
    15 -#include <sys/ptrace.h>
    16  
    17 -#include "common.h"
    18 +#include "trace.h"
    19  
    20  static Event event;
    21  
    22 diff -ruN ltrace-0.5.3.orig/sysdeps/linux-gnu/trace.c ltrace-0.5.3/sysdeps/linux-gnu/trace.c
    23 --- ltrace-0.5.3.orig/sysdeps/linux-gnu/trace.c	2009-07-25 17:13:02.000000000 +0200
    24 +++ ltrace-0.5.3/sysdeps/linux-gnu/trace.c	2010-01-03 14:33:38.000000000 +0100
    25 @@ -5,10 +5,9 @@
    26  #include <unistd.h>
    27  #include <sys/types.h>
    28  #include <sys/wait.h>
    29 -#include "ptrace.h"
    30  #include <asm/unistd.h>
    31  
    32 -#include "common.h"
    33 +#include "trace.h"
    34  
    35  /* If the system headers did not provide the constants, hard-code the normal
    36     values.  */
    37 diff -ruN ltrace-0.5.3.orig/sysdeps/linux-gnu/trace.h ltrace-0.5.3/sysdeps/linux-gnu/trace.h
    38 --- ltrace-0.5.3.orig/sysdeps/linux-gnu/trace.h	1970-01-01 01:00:00.000000000 +0100
    39 +++ ltrace-0.5.3/sysdeps/linux-gnu/trace.h	2010-01-03 14:33:26.000000000 +0100
    40 @@ -0,0 +1,32 @@
    41 +/* If the system headers did not provide the constants, hard-code the normal values. */
    42 +#ifndef __SYSDEPS_TRACE_H__
    43 +#define __SYSDEPS_TRACE_H__
    44 +
    45 +#include "ptrace.h"
    46 +#include "common.h"
    47 +
    48 +#ifndef PTRACE_EVENT_FORK
    49 +#warning  PTRACE_EVENT_FORK not found... redefining.
    50 +#define PTRACE_OLDSETOPTIONS    21
    51 +#define PTRACE_SETOPTIONS       0x4200
    52 +#define PTRACE_GETEVENTMSG      0x4201
    53 +
    54 +/* options set using PTRACE_SETOPTIONS */
    55 +#define PTRACE_O_TRACESYSGOOD   0x00000001
    56 +#define PTRACE_O_TRACEFORK      0x00000002
    57 +#define PTRACE_O_TRACEVFORK     0x00000004
    58 +#define PTRACE_O_TRACECLONE     0x00000008
    59 +#define PTRACE_O_TRACEEXEC      0x00000010
    60 +#define PTRACE_O_TRACEVFORKDONE 0x00000020
    61 +#define PTRACE_O_TRACEEXIT      0x00000040
    62 +
    63 +/* Wait extended result codes for the above trace options.  */
    64 +#define PTRACE_EVENT_FORK       1
    65 +#define PTRACE_EVENT_VFORK      2
    66 +#define PTRACE_EVENT_CLONE      3
    67 +#define PTRACE_EVENT_EXEC       4
    68 +#define PTRACE_EVENT_VFORK_DONE 5
    69 +#define PTRACE_EVENT_EXIT       6
    70 +
    71 +#endif /* PTRACE_EVENT_FORK */
    72 +#endif /* __SYSDEPS_TRACE_H__ */
    73 --- ltrace-0.5.3.orig/sysdeps/linux-gnu/ppc/plt.c	2009-07-25 09:13:02.000000000 -0600
    74 +++ ltrace-0.5.3/sysdeps/linux-gnu/ppc/plt.c	2010-09-28 18:30:07.091618190 -0600
    75 @@ -1,5 +1,6 @@
    76  #include <gelf.h>
    77  #include "common.h"
    78 +#include "ptrace.h"
    79  
    80  GElf_Addr
    81  arch_plt_sym_val(struct ltelf *lte, size_t ndx, GElf_Rela * rela) {