From patchwork Mon Oct 7 12:24:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rainer Orth X-Patchwork-Id: 281101 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 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 235A12C00A3 for ; Mon, 7 Oct 2013 23:24:28 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; q=dns; s=default; b=KhPnhcqbWaOM+jpn gxiEoQxhSz/NAOhMhgFtEM/0gKRTm1U/KIedCCUqIh5ecWExi1/+90xsk50mqA9G LurKYEC1u4yzLKeiN3nq7H1DAXoKWWUR+Lp2d3Ecv2K2YQNHZqOmOAPDoabE3bVK VPdVAkotdxR+UaL8HV60Xaqvm+k= 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:from :to:cc:subject:references:date:in-reply-to:message-id :mime-version:content-type; s=default; bh=ZJuXmmgutx6gIBN2nc3R+m gHhsM=; b=R8KqtXmzElHIZcP8YhDjy0C3Cz7C0eMEtUTk2fBTKv9x/fHISAMwbp L7sE6bKCrmlLCVdNOwi/AAV8J1AqO2J7kLHbFl71cbmPR7KL7md69L0+vSfUE2YD 1DXXB1fzEE2c2ZvijAbUViD7NBKPw68Ci+/PRsjKvMXsouz0Clc8I= Received: (qmail 2463 invoked by alias); 7 Oct 2013 12:24:19 -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 2452 invoked by uid 89); 7 Oct 2013 12:24:19 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: smtp-relay.CeBiTec.Uni-Bielefeld.DE Received: from snape.CeBiTec.Uni-Bielefeld.DE (HELO smtp-relay.CeBiTec.Uni-Bielefeld.DE) (129.70.160.84) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 07 Oct 2013 12:24:17 +0000 Received: from localhost (localhost.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTP id B5575857; Mon, 7 Oct 2013 14:24:14 +0200 (CEST) Received: from smtp-relay.CeBiTec.Uni-Bielefeld.DE ([127.0.0.1]) by localhost (malfoy.CeBiTec.Uni-Bielefeld.DE [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 445KKcX5AM5h; Mon, 7 Oct 2013 14:24:11 +0200 (CEST) Received: from lokon.CeBiTec.Uni-Bielefeld.DE (lokon.CeBiTec.Uni-Bielefeld.DE [129.70.161.110]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-relay.CeBiTec.Uni-Bielefeld.DE (Postfix) with ESMTPS id 614C8856; Mon, 7 Oct 2013 14:24:11 +0200 (CEST) Received: (from ro@localhost) by lokon.CeBiTec.Uni-Bielefeld.DE (8.14.5+Sun/8.14.5/Submit) id r97COB7j003302; Mon, 7 Oct 2013 14:24:11 +0200 (MEST) From: Rainer Orth To: Ian Lance Taylor Cc: gcc-patches , "gofrontend-dev\@googlegroups.com" Subject: Re: libgo patch committed: Implement reflect.MakeFunc for 386 References: Date: Mon, 07 Oct 2013 14:24:10 +0200 In-Reply-To: (Ian Lance Taylor's message of "Wed, 2 Oct 2013 10:32:45 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (usg-unix-v) MIME-Version: 1.0 X-IsSubscribed: yes Ian Lance Taylor writes: > On Wed, Oct 2, 2013 at 7:45 AM, Rainer Orth wrote: >> >> Here's what I came up with. As I said, it is inspired by the libffi >> code, but a bit simplified since e.g. stuff like no .ascii support >> aren't relevant on the Solaris versions supported on mainline and 4.8 >> branch. >> >> Bootstrapped on x86_64-unknown-linux-gnu and i386-pc-solaris2.10 with >> Sun as and gas. I've also compared the readelf --debug-dump=frames >> output for the 32 and 64-bit makefunc.o, both PIC and non-PIC. 64-bit >> is completely unchanged, while for 32-bit there are FDE encoding changes >> as expected from the FDE_ENCODING/FDE_ENCODE macros. >> >> Rainer >> >> >> 2013-10-01 Rainer Orth >> >> * configure.ac (libgo_cv_ro_eh_frame): New test. >> (libgo_cv_as_comdat_gnu): Likewise. >> (libgo_cv_as_x86_pcrel): Likewise. >> (libgo_cv_as_x86_64_unwind_section_type): Likewise. >> * configure: Regenerate. >> * config.h.in: Regenerate. >> * go/reflect/makefunc_386.S: Replace CFI directives by hand-coded >> .eh_frame section. >> Restrict .note.* sections to Linux. >> * go/reflect/makefunc_amd64.S: Likewise. > > Great, thanks for working on this. Committed to trunk and 4.8 branch. Unfortunately, Solaris 9 testing with Sun as revealed two problems: that assembler cannot handle either # comments or .global instead of .globl. The following patch fixes this and allows makefunc_386.S to assemble. Also compiled with a gas build to make nothing broke there. I didn't touch makefunc_amd64.S, but could to keep the two consistent. Rainer diff --git a/libgo/go/reflect/makefunc_386.S b/libgo/go/reflect/makefunc_386.S --- a/libgo/go/reflect/makefunc_386.S +++ b/libgo/go/reflect/makefunc_386.S @@ -1,12 +1,12 @@ -# Copyright 2013 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. +/* Copyright 2013 The Go Authors. All rights reserved. + Use of this source code is governed by a BSD-style + license that can be found in the LICENSE file. -# MakeFunc 386 assembly code. + MakeFunc 386 assembly code. */ #include "config.h" - .global reflect.makeFuncStub + .globl reflect.makeFuncStub #ifdef __ELF__ .type reflect.makeFuncStub,@function @@ -15,25 +15,26 @@ reflect.makeFuncStub: .LFB1: - # Go does not provide any equivalent to the regparm function - # attribute, so on Go we do not need to worry about passing - # parameters in registers. We just pass a pointer to the - # arguments on the stack. - # - # We do need to pick up the return values, though, so we pass - # a pointer to a struct that looks like this. - # struct { - # esp uint32 // 0x0 - # eax uint32 // 0x4 - # st0 uint64 // 0x8 - # } + /* Go does not provide any equivalent to the regparm function + attribute, so on Go we do not need to worry about passing + parameters in registers. We just pass a pointer to the + arguments on the stack. + + We do need to pick up the return values, though, so we pass + a pointer to a struct that looks like this. + struct { + esp uint32 // 0x0 + eax uint32 // 0x4 + st0 uint64 // 0x8 + } + */ pushl %ebp .LCFI0: movl %esp, %ebp .LCFI1: - pushl %ebx # In case this is PIC. - subl $36, %esp # Enough for args and to align stack. + pushl %ebx /* In case this is PIC. */ + subl $36, %esp /* Enough for args and to align stack. */ .LCFI2: #ifdef __PIC__ @@ -41,7 +42,7 @@ reflect.makeFuncStub: addl $_GLOBAL_OFFSET_TABLE_, %ebx #endif - leal 8(%ebp), %eax # Set esp field in struct. + leal 8(%ebp), %eax /* Set esp field in struct. */ movl %eax, -24(%ebp) #ifdef __PIC__ @@ -61,14 +62,14 @@ reflect.makeFuncStub: call reflect.MakeFuncStubGo #endif - # Set return registers. + /* Set return registers. */ movl -20(%ebp), %eax fldl -16(%ebp) #ifdef __SSE2__ - # In case we are compiling with -msseregparm. This won't work - # correctly if only SSE1 is supported, but that seems unlikely. + /* In case we are compiling with -msseregparm. This won't work + correctly if only SSE1 is supported, but that seems unlikely. */ movsd -16(%ebp), %xmm0 #endif