Ticket #13308: leopard-compilation-fix.patch

File leopard-compilation-fix.patch, 5.8 KB (added by greg@…, 16 years ago)

files/leopard-compilation-fix.patch file

  • asmrun/signals_asm.c

    RCS file: /caml/ocaml/asmrun/signals_asm.c,v
    retrieving revision 1.2
    diff -u -r1.2 signals_asm.c
     
    238238  /* Stack overflow handling */
    239239#ifdef HAS_STACK_OVERFLOW_DETECTION
    240240  {
    241     struct sigaltstack stk;
     241    stack_t stk;
    242242    struct sigaction act;
    243243    stk.ss_sp = sig_alt_stack;
    244244    stk.ss_size = SIGSTKSZ;
  • asmrun/signals_osdep.h

    RCS file: /caml/ocaml/asmrun/signals_osdep.h,v
    retrieving revision 1.8
    diff -u -r1.8 signals_osdep.h
     
    8888
    8989  #include <sys/ucontext.h>
    9090
    91   #define CONTEXT_STATE (((struct ucontext *)context)->uc_mcontext->ss)
    92   #define CONTEXT_PC (CONTEXT_STATE.eip)
     91  #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
     92    #define CONTEXT_STATE (((ucontext_t *)context)->uc_mcontext->ss)
     93    #define CONTEXT_PC (CONTEXT_STATE.eip)
     94  #else
     95    #define CONTEXT_STATE (((ucontext_t *)context)->uc_mcontext->__ss)
     96    #define CONTEXT_PC (CONTEXT_STATE.__eip)
     97  #endif
    9398  #define CONTEXT_FAULTING_ADDRESS ((char *) info->si_addr)
    9499
    95100/****************** MIPS, all OS */
     
    113118
    114119#elif defined(TARGET_power) && defined(SYS_rhapsody)
    115120
    116 #ifdef __ppc64__
    117 
    118121  #define DECLARE_SIGNAL_HANDLER(name) \
    119122     static void name(int sig, siginfo_t * info, void * context)
    120123
    121   #define SET_SIGACT(sigact,name) \
    122      sigact.sa_sigaction = (name); \
    123      sigact.sa_flags = SA_SIGINFO | SA_64REGSET
    124 
    125   typedef unsigned long long context_reg;
    126 
    127124  #include <sys/ucontext.h>
    128 
    129   #define CONTEXT_STATE (((struct ucontext64 *)context)->uc_mcontext64->ss)
    130 
    131   #define CONTEXT_PC (CONTEXT_STATE.srr0)
    132   #define CONTEXT_EXCEPTION_POINTER (CONTEXT_STATE.r29)
    133   #define CONTEXT_YOUNG_LIMIT (CONTEXT_STATE.r30)
    134   #define CONTEXT_YOUNG_PTR (CONTEXT_STATE.r31)
    135   #define CONTEXT_FAULTING_ADDRESS ((char *) info->si_addr)
    136   #define CONTEXT_SP (CONTEXT_STATE.r1)
    137 
    138 #else
    139 
    140   #include <sys/utsname.h>
    141 
    142   #define DECLARE_SIGNAL_HANDLER(name) \
    143      static void name(int sig, siginfo_t * info, void * context)
    144 
    145   #define SET_SIGACT(sigact,name) \
    146      sigact.sa_handler = (void (*)(int)) (name); \
    147      sigact.sa_flags = SA_SIGINFO
    148 
    149   typedef unsigned long context_reg;
    150 
    151   #define CONTEXT_PC (*context_gpr_p(context, -2))
    152   #define CONTEXT_EXCEPTION_POINTER (*context_gpr_p(context, 29))
    153   #define CONTEXT_YOUNG_LIMIT (*context_gpr_p(context, 30))
    154   #define CONTEXT_YOUNG_PTR (*context_gpr_p(context, 31))
    155   #define CONTEXT_FAULTING_ADDRESS ((char *) info->si_addr)
    156   #define CONTEXT_SP (*context_gpr_p(context, 1))
    157 
    158   static int ctx_version = 0;
    159   static void init_ctx (void)
    160   {
    161     struct utsname name;
    162     if (uname (&name) == 0){
    163       if (name.release[1] == '.' && name.release[0] <= '5'){
    164         ctx_version = 1;
    165       }else{
    166         ctx_version = 2;
    167       }
    168     }else{
    169       caml_fatal_error ("cannot determine SIGCONTEXT format");
    170     }
    171   }
    172 
    173   #ifdef DARWIN_VERSION_6
    174     #include <sys/ucontext.h>
    175     static unsigned long *context_gpr_p (void *ctx, int regno)
    176     {
    177       unsigned long *regs;
    178       if (ctx_version == 0) init_ctx ();
    179       if (ctx_version == 1){
    180         /* old-style context (10.0 and 10.1) */
    181         regs = (unsigned long *)(((struct sigcontext *)ctx)->sc_regs);
    182       }else{
    183         Assert (ctx_version == 2);
    184         /* new-style context (10.2) */
    185         regs = (unsigned long *)&(((struct ucontext *)ctx)->uc_mcontext->ss);
    186       }
    187       return &(regs[2 + regno]);
    188     }
     125 
     126  #ifdef __LP64__
     127    #define SET_SIGACT(sigact,name) \
     128       sigact.sa_sigaction = (name); \
     129       sigact.sa_flags = SA_SIGINFO | SA_64REGSET
     130   
     131    typedef unsigned long long context_reg;
     132   
     133    #define CONTEXT_MCONTEXT (((ucontext64_t *)context)->uc_mcontext64)
    189134  #else
    190     #define SA_SIGINFO 0x0040
    191     struct ucontext {
    192       int       uc_onstack;
    193       sigset_t  uc_sigmask;
    194       struct sigaltstack uc_stack;
    195       struct ucontext   *uc_link;
    196       size_t    uc_mcsize;
    197       unsigned long     *uc_mcontext;
    198     };
    199     static unsigned long *context_gpr_p (void *ctx, int regno)
    200     {
    201       unsigned long *regs;
    202       if (ctx_version == 0) init_ctx ();
    203       if (ctx_version == 1){
    204         /* old-style context (10.0 and 10.1) */
    205         regs = (unsigned long *)(((struct sigcontext *)ctx)->sc_regs);
    206       }else{
    207         Assert (ctx_version == 2);
    208         /* new-style context (10.2) */
    209         regs = (unsigned long *)((struct ucontext *)ctx)->uc_mcontext + 8;
    210       }
    211       return &(regs[2 + regno]);
    212     }
     135    #define SET_SIGACT(sigact,name) \
     136       sigact.sa_sigaction = (name); \
     137       sigact.sa_flags = SA_SIGINFO
     138   
     139    typedef unsigned long context_reg;
     140   
     141    #define CONTEXT_MCONTEXT (((ucontext_t *)context)->uc_mcontext)
    213142  #endif
    214 
    215 #endif
     143 
     144  #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
     145    #define CONTEXT_STATE (CONTEXT_MCONTEXT->ss)
     146    #define CONTEXT_PC (CONTEXT_STATE.srr0)
     147    #define CONTEXT_EXCEPTION_POINTER (CONTEXT_STATE.r29)
     148    #define CONTEXT_YOUNG_LIMIT (CONTEXT_STATE.r30)
     149    #define CONTEXT_YOUNG_PTR (CONTEXT_STATE.r31)
     150    #define CONTEXT_SP (CONTEXT_STATE.r1)
     151  #else
     152    #define CONTEXT_STATE (CONTEXT_MCONTEXT->__ss)
     153    #define CONTEXT_PC (CONTEXT_STATE.__srr0)
     154    #define CONTEXT_EXCEPTION_POINTER (CONTEXT_STATE.__r29)
     155    #define CONTEXT_YOUNG_LIMIT (CONTEXT_STATE.__r30)
     156    #define CONTEXT_YOUNG_PTR (CONTEXT_STATE.__r31)
     157    #define CONTEXT_SP (CONTEXT_STATE.__r1)
     158  #endif
     159 
     160  #define CONTEXT_FAULTING_ADDRESS ((char *) info->si_addr)
    216161
    217162/****************** PowerPC, ELF (Linux) */
    218163