From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7963 invoked by alias); 7 Nov 2014 15:30:57 -0000 Mailing-List: contact libffi-discuss-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libffi-discuss-owner@sourceware.org Received: (qmail 7949 invoked by uid 89); 7 Nov 2014 15:30:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f178.google.com Received: from mail-wi0-f178.google.com (HELO mail-wi0-f178.google.com) (209.85.212.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 07 Nov 2014 15:30:55 +0000 Received: by mail-wi0-f178.google.com with SMTP id bs8so4889748wib.17 for ; Fri, 07 Nov 2014 07:30:52 -0800 (PST) X-Received: by 10.180.36.229 with SMTP id t5mr6103743wij.56.1415374252497; Fri, 07 Nov 2014 07:30:52 -0800 (PST) Received: from pike.twiddle.home.com ([87.111.149.167]) by mx.google.com with ESMTPSA id p1sm12186731wjy.22.2014.11.07.07.30.51 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 07 Nov 2014 07:30:51 -0800 (PST) From: Richard Henderson To: libffi-discuss@sourceware.org Subject: [PATCH 01/13] x86: Tidy ffi_abi Date: Fri, 07 Nov 2014 15:31:00 -0000 Message-Id: <1415374240-1792-2-git-send-email-rth@twiddle.net> In-Reply-To: <1415374240-1792-1-git-send-email-rth@twiddle.net> References: <1415374240-1792-1-git-send-email-rth@twiddle.net> X-SW-Source: 2014/txt/msg00192.txt.bz2 The x86_64 unix port only handles one ABI; don't define all of the other symbols. The UNIX64 symbol retains the same value. The i386 ports ought to have the same symbols, even if we can't yet unify the values without incrementing the libffi soname. --- src/x86/ffi.c | 2 +- src/x86/ffitarget.h | 60 ++++++++++++++++++++++++++--------------------------- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/x86/ffi.c b/src/x86/ffi.c index c387fb5..90e3f79 100644 --- a/src/x86/ffi.c +++ b/src/x86/ffi.c @@ -260,7 +260,7 @@ ffi_status ffi_prep_cif_machdep(ffi_cif *cif) } #ifndef X86_WIN32 - if (cif->abi == FFI_SYSV || cif->abi == FFI_UNIX64) + if (cif->abi == FFI_SYSV) cif->bytes = (cif->bytes + 15) & ~0xF; #endif diff --git a/src/x86/ffitarget.h b/src/x86/ffitarget.h index 8c52573..a4c9573 100644 --- a/src/x86/ffitarget.h +++ b/src/x86/ffitarget.h @@ -76,44 +76,44 @@ typedef signed long ffi_sarg; #endif typedef enum ffi_abi { +#if defined(X86_WIN64) FFI_FIRST_ABI = 0, - - /* ---- Intel x86 Win32 ---------- */ -#ifdef X86_WIN32 - FFI_SYSV, - FFI_STDCALL, - FFI_THISCALL, - FFI_FASTCALL, - FFI_MS_CDECL, - FFI_PASCAL, - FFI_REGISTER, - FFI_LAST_ABI, -#ifdef _MSC_VER - FFI_DEFAULT_ABI = FFI_MS_CDECL -#else - FFI_DEFAULT_ABI = FFI_SYSV -#endif - -#elif defined(X86_WIN64) FFI_WIN64, FFI_LAST_ABI, FFI_DEFAULT_ABI = FFI_WIN64 -#else - /* ---- Intel x86 and AMD x86-64 - */ - FFI_SYSV, - FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */ - FFI_THISCALL, - FFI_FASTCALL, - FFI_STDCALL, - FFI_PASCAL, - FFI_REGISTER, +#elif defined(X86_64) || (defined (__x86_64__) && defined (X86_DARWIN)) + FFI_FIRST_ABI = 1, + FFI_UNIX64, FFI_LAST_ABI, -#if defined(__i386__) || defined(__i386) + FFI_DEFAULT_ABI = FFI_UNIX64 + +#elif defined(X86_WIN32) + FFI_FIRST_ABI = 0, + FFI_SYSV = 1, + FFI_STDCALL = 2, + FFI_THISCALL = 3, + FFI_FASTCALL = 4, + FFI_MS_CDECL = 5, + FFI_PASCAL = 6, + FFI_REGISTER = 7, + FFI_LAST_ABI, +# ifdef _MSC_VER + FFI_DEFAULT_ABI = FFI_MS_CDECL +# else FFI_DEFAULT_ABI = FFI_SYSV +# endif #else - FFI_DEFAULT_ABI = FFI_UNIX64 -#endif + FFI_FIRST_ABI = 0, + FFI_SYSV = 1, + FFI_THISCALL = 3, + FFI_FASTCALL = 4, + FFI_STDCALL = 5, + FFI_PASCAL = 6, + FFI_REGISTER = 7, + FFI_MS_CDECL = 8, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV #endif } ffi_abi; #endif -- 1.9.3