diff mbox

libgo patch committed: Implement reflect.MakeFunc for 386

Message ID ydda9il5kwl.fsf@lokon.CeBiTec.Uni-Bielefeld.DE
State New
Headers show

Commit Message

Rainer Orth Oct. 7, 2013, 12:24 p.m. UTC
Ian Lance Taylor <iant@google.com> writes:

> On Wed, Oct 2, 2013 at 7:45 AM, Rainer Orth <ro@cebitec.uni-bielefeld.de> 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  <ro@CeBiTec.Uni-Bielefeld.DE>
>>
>>         * 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

Comments

Ian Lance Taylor Oct. 7, 2013, 3:32 p.m. UTC | #1
On Mon, Oct 7, 2013 at 5:24 AM, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>
> 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.

Thanks.  Committed to mainline and 4.8 branch.

Ian
diff mbox

Patch

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