From patchwork Fri Jan 16 19:39:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 429997 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 56CB814015A for ; Sat, 17 Jan 2015 06:39:26 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=gzNPa7PjzTw75T34f 8C2ftySi/RRpWsRfyG9A11X6t8+K8ZhvObxviU7DuA6mM2g1Tx1ZvZ+Ft2fMEbNu 9oDNBA0QYZh/PSZtjWIUSD0ETghEzzB5ukeLbCHCWhgGcDcoOxyyLRh8M1XtajLq 32+IiblXh1ZOCUR/FkhJloz+N0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=2hOmrnzvlQGxB9qoXxfxNWz b70s=; b=Jkd1uwaI0nF0SGtE1b9aUR6rGxUdh+sadw4/x+0bkXLMjoJ0uR26r5j Sdabzo+XNENuANPrs88aD1tYPLY31uVAeSPte0zbfy1iDdCUDuwOWqBw8lQ8N4yj jBQSYtUy5wrtp1YdGWq9h8rw/Qn7kh5Bvx611yx6m/Jd81/rT4GQ= Received: (qmail 17432 invoked by alias); 16 Jan 2015 19:39:18 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 17419 invoked by uid 89); 16 Jan 2015 19:39:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_HELO_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 16 Jan 2015 19:39:15 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0GJd90u032674 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 16 Jan 2015 14:39:10 -0500 Received: from anchor.twiddle.net (vpn-227-132.phx2.redhat.com [10.3.227.132]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t0GJd8Y6005193; Fri, 16 Jan 2015 14:39:08 -0500 Message-ID: <54B968DB.1010706@redhat.com> Date: Fri, 16 Jan 2015 11:39:07 -0800 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: Rainer Orth CC: gcc-patches@gcc.gnu.org, iant@golang.org, Jeff Law Subject: Re: [COMMITTED] Merge libffi with upstream References: <54B3F790.9050507@redhat.com> In-Reply-To: X-IsSubscribed: yes On 01/15/2015 08:40 AM, Rainer Orth wrote: > * on Solaris/SPARC, /bin/as requires > > .type fn,#function Gas accepts this as well, so let's just use that. > * Yet unfixed for Solaris/SPARC /bin/as: > > as: "v8.s", line 128: error: invalid digit in radix 10 > > as seems to only understand single-digit labels > > as: "v8.s", line 140: error: statement syntax > as: "v8.s", line 157: error: unknown opcode ".rept" > as: "v8.s", line 157: error: statement syntax > as: "v8.s", line 163: error: unknown opcode ".endr" > as: "v8.s", line 163: error: statement syntax > > and knows nothing about .rept/.endr Here's a diff of v8.S that I've just tested on linux. That should fix the remaining problems for Solaris. r~ diff --git a/libffi/src/sparc/v8.S b/libffi/src/sparc/v8.S index 3a811ef..f675151 100644 --- a/libffi/src/sparc/v8.S +++ b/libffi/src/sparc/v8.S @@ -48,7 +48,7 @@ #ifndef __GNUC__ .align 8 .globl C(ffi_flush_icache) - .type C(ffi_flush_icache),@function + .type C(ffi_flush_icache),#function FFI_HIDDEN(C(ffi_flush_icache)) C(ffi_flush_icache): @@ -66,14 +66,15 @@ C(ffi_flush_icache): .size C(ffi_flush_icache), . - C(ffi_flush_icache) #endif -.macro E index - .align 16 - .org 2b + \index * 16 -.endm +#if defined(__sun__) && defined(__svr4__) +# define E(INDEX) .align 16 +#else +# define E(INDEX) .align 16; .org 2b + INDEX * 16 +#endif .align 8 .globl C(ffi_call_v8) - .type C(ffi_call_v8),@function + .type C(ffi_call_v8),#function FFI_HIDDEN(C(ffi_call_v8)) C(ffi_call_v8): @@ -114,71 +115,71 @@ C(ffi_call_v8): ! Note that each entry is 4 insns, enforced by the E macro. .align 16 2: -E SPARC_RET_VOID +E(SPARC_RET_VOID) ret restore -E SPARC_RET_STRUCT +E(SPARC_RET_STRUCT) unimp -E SPARC_RET_UINT8 +E(SPARC_RET_UINT8) and %o0, 0xff, %o0 st %o0, [%i2] ret restore -E SPARC_RET_SINT8 +E(SPARC_RET_SINT8) sll %o0, 24, %o0 b 7f sra %o0, 24, %o0 -E SPARC_RET_UINT16 +E(SPARC_RET_UINT16) sll %o0, 16, %o0 b 7f srl %o0, 16, %o0 -E SPARC_RET_SINT16 +E(SPARC_RET_SINT16) sll %o0, 16, %o0 b 7f sra %o0, 16, %o0 -E SPARC_RET_UINT32 +E(SPARC_RET_UINT32) 7: st %o0, [%i2] ret restore -E SP_V8_RET_CPLX16 +E(SP_V8_RET_CPLX16) sth %o0, [%i2+2] b 9f srl %o0, 16, %o0 -E SPARC_RET_INT64 +E(SPARC_RET_INT64) st %o0, [%i2] st %o1, [%i2+4] ret restore -E SPARC_RET_INT128 +E(SPARC_RET_INT128) std %o0, [%i2] std %o2, [%i2+8] ret restore -E SPARC_RET_F_8 +E(SPARC_RET_F_8) st %f7, [%i2+7*4] nop st %f6, [%i2+6*4] nop -E SPARC_RET_F_6 +E(SPARC_RET_F_6) st %f5, [%i2+5*4] nop st %f4, [%i2+4*4] nop -E SPARC_RET_F_4 +E(SPARC_RET_F_4) st %f3, [%i2+3*4] nop st %f2, [%i2+2*4] nop -E SPARC_RET_F_2 +E(SPARC_RET_F_2) st %f1, [%i2+4] st %f0, [%i2] ret restore -E SP_V8_RET_CPLX8 +E(SP_V8_RET_CPLX8) stb %o0, [%i2+1] - b 10f + b 0f srl %o0, 8, %o0 -E SPARC_RET_F_1 +E(SPARC_RET_F_1) st %f0, [%i2] ret restore @@ -188,7 +189,7 @@ E SPARC_RET_F_1 ret restore .align 8 -10: stb %o0, [%i2] +0: stb %o0, [%i2] ret restore @@ -201,17 +202,35 @@ E SPARC_RET_F_1 sll %l1, 2, %l0 ! size * 4 1: sll %l1, 4, %l1 ! size * 16 add %l0, %l1, %l0 ! size * 20 - add %o7, %l0, %o7 ! o7 = 0b + size*20 + add %o7, %l0, %o7 ! o7 = 8b + size*20 jmp %o7+(2f-8b) mov %i5, %g2 ! load static chain 2: -.rept 0x1000 - call %i1 - nop - unimp (. - 2b) / 20 - ret + +/* The Sun assembler doesn't understand .rept 0x1000. */ +#define rept1 \ + call %i1; \ + nop; \ + unimp (. - 2b) / 20; \ + ret; \ restore -.endr + +#define rept16 \ + rept1; rept1; rept1; rept1; \ + rept1; rept1; rept1; rept1; \ + rept1; rept1; rept1; rept1; \ + rept1; rept1; rept1; rept1 + +#define rept256 \ + rept16; rept16; rept16; rept16; \ + rept16; rept16; rept16; rept16; \ + rept16; rept16; rept16; rept16; \ + rept16; rept16; rept16; rept16 + + rept256; rept256; rept256; rept256 + rept256; rept256; rept256; rept256 + rept256; rept256; rept256; rept256 + rept256; rept256; rept256; rept256 cfi_endproc .size C(ffi_call_v8),. - C(ffi_call_v8) @@ -231,7 +250,7 @@ E SPARC_RET_F_1 .align 8 .globl C(ffi_go_closure_v8) - .type C(ffi_go_closure_v8),@function + .type C(ffi_go_closure_v8),#function FFI_HIDDEN(C(ffi_go_closure_v8)) C(ffi_go_closure_v8): @@ -249,7 +268,7 @@ C(ffi_go_closure_v8): .align 8 .globl C(ffi_closure_v8) - .type C(ffi_closure_v8),@function + .type C(ffi_closure_v8),#function FFI_HIDDEN(C(ffi_closure_v8)) C(ffi_closure_v8): @@ -285,70 +304,70 @@ C(ffi_closure_v8): ! Note that each entry is 4 insns, enforced by the E macro. .align 16 2: -E SPARC_RET_VOID +E(SPARC_RET_VOID) ret restore -E SPARC_RET_STRUCT +E(SPARC_RET_STRUCT) ld [%i2], %i0 jmp %i7+12 restore -E SPARC_RET_UINT8 +E(SPARC_RET_UINT8) ldub [%i2+3], %i0 ret restore -E SPARC_RET_SINT8 +E(SPARC_RET_SINT8) ldsb [%i2+3], %i0 ret restore -E SPARC_RET_UINT16 +E(SPARC_RET_UINT16) lduh [%i2+2], %i0 ret restore -E SPARC_RET_SINT16 +E(SPARC_RET_SINT16) ldsh [%i2+2], %i0 ret restore -E SPARC_RET_UINT32 +E(SPARC_RET_UINT32) ld [%i2], %i0 ret restore -E SP_V8_RET_CPLX16 +E(SP_V8_RET_CPLX16) ld [%i2], %i0 ret restore -E SPARC_RET_INT64 +E(SPARC_RET_INT64) ldd [%i2], %i0 ret restore -E SPARC_RET_INT128 +E(SPARC_RET_INT128) ldd [%i2], %i0 ldd [%i2+8], %i2 ret restore -E SPARC_RET_F_8 +E(SPARC_RET_F_8) ld [%i2+7*4], %f7 nop ld [%i2+6*4], %f6 nop -E SPARC_RET_F_6 +E(SPARC_RET_F_6) ld [%i2+5*4], %f5 nop ld [%i2+4*4], %f4 nop -E SPARC_RET_F_4 +E(SPARC_RET_F_4) ld [%i2+3*4], %f3 nop ld [%i2+2*4], %f2 nop -E SPARC_RET_F_2 +E(SPARC_RET_F_2) ldd [%i2], %f0 ret restore -E SP_V8_RET_CPLX8 +E(SP_V8_RET_CPLX8) lduh [%i2], %i0 ret restore -E SPARC_RET_F_1 +E(SPARC_RET_F_1) ld [%i2], %f0 ret restore