diff options
author | Gregory P. Smith <greg@krypto.org> | 2013-03-18 17:11:20 -0700 |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2013-03-18 17:11:20 -0700 |
commit | 886edc68f41f74b07fb0e3a72d00ef979d8ea623 (patch) | |
tree | 05c30cd51c5b77445b07b9c6bf14009c2053f4ce /Modules/_ctypes/libffi/src/alpha | |
parent | 5a43c024aa5d5ad981bf71362e26c0080b4a2e6f (diff) | |
download | cpython-886edc68f41f74b07fb0e3a72d00ef979d8ea623.tar.gz |
Fixes issue #17192: Update the ctypes module's libffi to v3.0.13. This
specifically addresses a stack misalignment issue on x86 and issues on
some more recent platforms.
Diffstat (limited to 'Modules/_ctypes/libffi/src/alpha')
-rw-r--r-- | Modules/_ctypes/libffi/src/alpha/ffi.c | 6 | ||||
-rw-r--r-- | Modules/_ctypes/libffi/src/alpha/ffitarget.h | 7 | ||||
-rw-r--r-- | Modules/_ctypes/libffi/src/alpha/osf.S | 57 |
3 files changed, 50 insertions, 20 deletions
diff --git a/Modules/_ctypes/libffi/src/alpha/ffi.c b/Modules/_ctypes/libffi/src/alpha/ffi.c index 8d6b2ba279..192f691c4a 100644 --- a/Modules/_ctypes/libffi/src/alpha/ffi.c +++ b/Modules/_ctypes/libffi/src/alpha/ffi.c @@ -1,5 +1,6 @@ /* ----------------------------------------------------------------------- - ffi.c - Copyright (c) 1998, 2001, 2007, 2008 Red Hat, Inc. + ffi.c - Copyright (c) 2012 Anthony Green + Copyright (c) 1998, 2001, 2007, 2008 Red Hat, Inc. Alpha Foreign Function Interface @@ -178,6 +179,9 @@ ffi_prep_closure_loc (ffi_closure* closure, { unsigned int *tramp; + if (cif->abi != FFI_OSF) + return FFI_BAD_ABI; + tramp = (unsigned int *) &closure->tramp[0]; tramp[0] = 0x47fb0401; /* mov $27,$1 */ tramp[1] = 0xa77b0010; /* ldq $27,16($27) */ diff --git a/Modules/_ctypes/libffi/src/alpha/ffitarget.h b/Modules/_ctypes/libffi/src/alpha/ffitarget.h index 7d06eb0bc2..af145bce83 100644 --- a/Modules/_ctypes/libffi/src/alpha/ffitarget.h +++ b/Modules/_ctypes/libffi/src/alpha/ffitarget.h @@ -1,5 +1,6 @@ /* -----------------------------------------------------------------*-C-*- - ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + ffitarget.h - Copyright (c) 2012 Anthony Green + Copyright (c) 1996-2003 Red Hat, Inc. Target configuration macros for Alpha. Permission is hereby granted, free of charge, to any person obtaining @@ -27,6 +28,10 @@ #ifndef LIBFFI_TARGET_H #define LIBFFI_TARGET_H +#ifndef LIBFFI_H +#error "Please do not include ffitarget.h directly into your source. Use ffi.h instead." +#endif + #ifndef LIBFFI_ASM typedef unsigned long ffi_arg; typedef signed long ffi_sarg; diff --git a/Modules/_ctypes/libffi/src/alpha/osf.S b/Modules/_ctypes/libffi/src/alpha/osf.S index d0e77828f5..6b9f4dfa03 100644 --- a/Modules/_ctypes/libffi/src/alpha/osf.S +++ b/Modules/_ctypes/libffi/src/alpha/osf.S @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------- - osf.S - Copyright (c) 1998, 2001, 2007, 2008 Red Hat + osf.S - Copyright (c) 1998, 2001, 2007, 2008, 2011 Red Hat Alpha/OSF Foreign Function Interface @@ -299,33 +299,51 @@ $load_table: #endif #ifdef __ELF__ +# define UA_SI .4byte +# define FDE_ENCODING 0x1b /* pcrel sdata4 */ +# define FDE_ENCODE(X) .4byte X-. +# define FDE_ARANGE(X) .4byte X +#elif defined __osf__ +# define UA_SI .align 0; .long +# define FDE_ENCODING 0x50 /* aligned absolute */ +# define FDE_ENCODE(X) .align 3; .quad X +# define FDE_ARANGE(X) .align 0; .quad X +#endif + +#ifdef __ELF__ .section .eh_frame,EH_FRAME_FLAGS,@progbits +#elif defined __osf__ + .data + .align 3 + .globl _GLOBAL__F_ffi_call_osf +_GLOBAL__F_ffi_call_osf: +#endif __FRAME_BEGIN__: - .4byte $LECIE1-$LSCIE1 # Length of Common Information Entry + UA_SI $LECIE1-$LSCIE1 # Length of Common Information Entry $LSCIE1: - .4byte 0x0 # CIE Identifier Tag + UA_SI 0x0 # CIE Identifier Tag .byte 0x1 # CIE Version .ascii "zR\0" # CIE Augmentation .byte 0x1 # uleb128 0x1; CIE Code Alignment Factor .byte 0x78 # sleb128 -8; CIE Data Alignment Factor .byte 26 # CIE RA Column .byte 0x1 # uleb128 0x1; Augmentation size - .byte 0x1b # FDE Encoding (pcrel sdata4) + .byte FDE_ENCODING # FDE Encoding .byte 0xc # DW_CFA_def_cfa .byte 30 # uleb128 column 30 .byte 0 # uleb128 offset 0 .align 3 $LECIE1: $LSFDE1: - .4byte $LEFDE1-$LASFDE1 # FDE Length + UA_SI $LEFDE1-$LASFDE1 # FDE Length $LASFDE1: - .4byte $LASFDE1-__FRAME_BEGIN__ # FDE CIE offset - .4byte $LFB1-. # FDE initial location - .4byte $LFE1-$LFB1 # FDE address range + UA_SI $LASFDE1-__FRAME_BEGIN__ # FDE CIE offset + FDE_ENCODE($LFB1) # FDE initial location + FDE_ARANGE($LFE1-$LFB1) # FDE address range .byte 0x0 # uleb128 0x0; Augmentation size .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI1-$LFB1 + UA_SI $LCFI1-$LFB1 .byte 0x9a # DW_CFA_offset, column 26 .byte 4 # uleb128 4*-8 .byte 0x8f # DW_CFA_offset, column 15 @@ -335,32 +353,35 @@ $LASFDE1: .byte 32 # uleb128 offset 32 .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI2-$LCFI1 + UA_SI $LCFI2-$LCFI1 .byte 0xda # DW_CFA_restore, column 26 .align 3 $LEFDE1: $LSFDE3: - .4byte $LEFDE3-$LASFDE3 # FDE Length + UA_SI $LEFDE3-$LASFDE3 # FDE Length $LASFDE3: - .4byte $LASFDE3-__FRAME_BEGIN__ # FDE CIE offset - .4byte $LFB2-. # FDE initial location - .4byte $LFE2-$LFB2 # FDE address range + UA_SI $LASFDE3-__FRAME_BEGIN__ # FDE CIE offset + FDE_ENCODE($LFB2) # FDE initial location + FDE_ARANGE($LFE2-$LFB2) # FDE address range .byte 0x0 # uleb128 0x0; Augmentation size .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI5-$LFB2 + UA_SI $LCFI5-$LFB2 .byte 0xe # DW_CFA_def_cfa_offset .byte 0x80,0x1 # uleb128 128 .byte 0x4 # DW_CFA_advance_loc4 - .4byte $LCFI6-$LCFI5 + UA_SI $LCFI6-$LCFI5 .byte 0x9a # DW_CFA_offset, column 26 .byte 16 # uleb128 offset 16*-8 .align 3 $LEFDE3: +#if defined __osf__ + .align 0 + .long 0 # End of Table +#endif -#ifdef __linux__ +#if defined __ELF__ && defined __linux__ .section .note.GNU-stack,"",@progbits #endif -#endif |