Patchwork libgo patch committed: Recognize more archs, don't require files

login
register
mail settings
Submitter Ian Taylor
Date Jan. 24, 2011, 11:42 p.m.
Message ID <mcr7hdt7tsu.fsf@google.com>
Download mbox | patch
Permalink /patch/80291/
State New
Headers show

Comments

Ian Taylor - Jan. 24, 2011, 11:42 p.m.
This libgo patch recognizes some more architectures, specifically m68k,
mips, and PPC.  I also changed the configure/Makefile so that the two
files which depend on both the architecture and the OS are not required
to actually exist.  This is because in many (though not all) cases those
files can be empty.  Permitting them to not exist simplifies porting.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline.

Ian

Patch

diff -r d1f8610f189d libgo/Makefile.am
--- a/libgo/Makefile.am	Mon Jan 24 14:44:25 2011 -0800
+++ b/libgo/Makefile.am	Mon Jan 24 15:28:38 2011 -0800
@@ -957,7 +957,7 @@ 
 go_debug_proc_files = \
 	go/debug/proc/proc.go \
 	go/debug/proc/proc_$(GOOS).go \
-	go/debug/proc/regs_$(GOOS)_$(GOARCH).go
+	$(GO_DEBUG_PROC_REGS_OS_ARCH_FILE)
 
 go_encoding_ascii85_files = \
 	go/encoding/ascii85/ascii85.go
@@ -1189,7 +1189,7 @@ 
 	syscalls/syscall_unix.go \
 	syscalls/stringbyte.go \
 	syscalls/syscall_$(GOOS).go \
-	syscalls/syscall_$(GOOS)_$(GOARCH).go \
+	$(GO_SYSCALLS_SYSCALL_OS_ARCH_FILE) \
 	syscalls/sysfile_posix.go \
 	sysinfo.go \
 	syscall_arch.go
diff -r d1f8610f189d libgo/configure.ac
--- a/libgo/configure.ac	Mon Jan 24 14:44:25 2011 -0800
+++ b/libgo/configure.ac	Mon Jan 24 15:28:38 2011 -0800
@@ -135,11 +135,20 @@ 
 dnl N.B. Keep in sync with gcc/testsuite/go.test/go-test.exp (go-set-goarch).
 is_386=no
 is_arm=no
+is_m68k=no
+is_mips=no
+is_mips64=no
+is_ppc=no
+is_ppc64=no
 is_sparc=no
 is_sparc64=no
 is_x86_64=no
 GOARCH=unknown
 case ${host} in
+  arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*)
+    is_arm=yes
+    GOARCH=arm
+    ;;
 changequote(,)dnl
   i[34567]86-*-* | x86_64-*-*)
 changequote([,])dnl
@@ -149,16 +158,38 @@ 
 #endif],
 [is_386=yes], [is_x86_64=yes])
     if test "$is_386" = "yes"; then
-      is_386=yes
       GOARCH=386
     else
-      is_x86_64=yes
       GOARCH=amd64
     fi
     ;;
-  arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*)
-    is_arm=yes
-    GOARCH=arm
+  m68k*-*-*)
+    is_m68k=yes
+    GOARCH=m68k
+    ;;
+  mips*-*-*)
+    AC_PREPROC_IFELSE([
+#ifdef __mips64
+#error 64-bit
+#endif],
+[is_mips=yes], [is_mips64=yes])
+    if test "$is_mips" = "yes"; then
+      GOARCH=mips
+    else
+      GOARCH=mips64
+    fi
+    ;;
+  rs6000*-*-* | powerpc*-*-*)
+    AC_PREPROC_IFELSE([
+#ifdef _ARCH_PPC64
+#error 64-bit
+#endif],
+[is_ppc=yes], [is_ppc64=yes])
+    if test "$is_ppc" = "yes"; then
+      GOARCH=ppc
+    else
+      GOARCH=ppc64
+    fi
     ;;
   sparc*-*-*)
     AC_PREPROC_IFELSE([
@@ -167,21 +198,37 @@ 
 #endif],
 [is_sparc=yes], [is_sparc64=yes])
     if test "$is_sparc" = "yes"; then
-      is_sparc=yes
       GOARCH=sparc
     else
-      is_sparc64=yes
       GOARCH=sparc64
     fi
     ;;
 esac
 AM_CONDITIONAL(LIBGO_IS_386, test $is_386 = yes)
 AM_CONDITIONAL(LIBGO_IS_ARM, test $is_arm = yes)
+AM_CONDITIONAL(LIBGO_IS_M68K, test $is_m68k = yes)
+AM_CONDITIONAL(LIBGO_IS_MIPS, test $is_mips = yes)
+AM_CONDITIONAL(LIBGO_IS_MIPS64, test $is_mips64 = yes)
+AM_CONDITIONAL(LIBGO_IS_PPC, test $is_ppc = yes)
+AM_CONDITIONAL(LIBGO_IS_PPC64, test $is_ppc64 = yes)
 AM_CONDITIONAL(LIBGO_IS_SPARC, test $is_sparc = yes)
 AM_CONDITIONAL(LIBGO_IS_SPARC64, test $is_sparc64 = yes)
 AM_CONDITIONAL(LIBGO_IS_X86_64, test $is_x86_64 = yes)
 AC_SUBST(GOARCH)
 
+dnl Some files are only present when needed for specific architectures.
+GO_SYSCALLS_SYSCALL_OS_ARCH_FILE=
+if test -f ${srcdir}/syscalls/syscall_${GOOS}_${GOARCH}.go; then
+  GO_SYSCALLS_SYSCALL_OS_ARCH_FILE=syscalls/syscall_${GOOS}_${GOARCH}.go
+fi
+AC_SUBST(GO_SYSCALLS_SYSCALL_OS_ARCH_FILE)
+
+GO_DEBUG_PROC_REGS_OS_ARCH_FILE=
+if test -f ${srcdir}/go/debug/proc/regs_${GOOS}_${GOARCH}.go; then
+  GO_DEBUG_PROC_REGS_OS_ARCH_FILE=go/debug/proc/regs_${GOOS}_${GOARCH}.go
+fi
+AC_SUBST(GO_DEBUG_PROC_REGS_OS_ARCH_FILE)
+
 dnl Use -fsplit-stack when compiling C code if available.
 AC_CACHE_CHECK([whether -fsplit-stack is supported],
 [libgo_cv_c_split_stack_supported],
diff -r d1f8610f189d libgo/go/debug/proc/regs_rtems_386.go
--- a/libgo/go/debug/proc/regs_rtems_386.go	Mon Jan 24 14:44:25 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@ 
-// Copyright 2011 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.
-
-package proc
diff -r d1f8610f189d libgo/go/debug/proc/regs_rtems_amd64.go
--- a/libgo/go/debug/proc/regs_rtems_amd64.go	Mon Jan 24 14:44:25 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@ 
-// Copyright 2011 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.
-
-package proc
diff -r d1f8610f189d libgo/go/debug/proc/regs_solaris_386.go
--- a/libgo/go/debug/proc/regs_solaris_386.go	Mon Jan 24 14:44:25 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@ 
-// Copyright 2011 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.
-
-package proc
diff -r d1f8610f189d libgo/go/debug/proc/regs_solaris_amd64.go
--- a/libgo/go/debug/proc/regs_solaris_amd64.go	Mon Jan 24 14:44:25 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@ 
-// Copyright 2011 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.
-
-package proc
diff -r d1f8610f189d libgo/go/debug/proc/regs_solaris_sparc.go
--- a/libgo/go/debug/proc/regs_solaris_sparc.go	Mon Jan 24 14:44:25 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@ 
-// Copyright 2011 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.
-
-package proc
diff -r d1f8610f189d libgo/go/debug/proc/regs_solaris_sparc64.go
--- a/libgo/go/debug/proc/regs_solaris_sparc64.go	Mon Jan 24 14:44:25 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@ 
-// Copyright 2011 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.
-
-package proc
diff -r d1f8610f189d libgo/syscalls/syscall_rtems_386.go
--- a/libgo/syscalls/syscall_rtems_386.go	Mon Jan 24 14:44:25 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@ 
-// syscall_rtems_386.go -- RTEMS 386 specific syscall interface.
-
-// Copyright 2011 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.
-
-package syscall
diff -r d1f8610f189d libgo/syscalls/syscall_rtems_amd64.go
--- a/libgo/syscalls/syscall_rtems_amd64.go	Mon Jan 24 14:44:25 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@ 
-// syscall_rtems_amd64.go -- RTEMS AMD64 specific syscall interface.
-
-// Copyright 2011 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.
-
-package syscall
diff -r d1f8610f189d libgo/syscalls/syscall_rtems_sparc.go
--- a/libgo/syscalls/syscall_rtems_sparc.go	Mon Jan 24 14:44:25 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@ 
-// syscall_rtems_sparc.go -- RTEMS SPARC specific syscall interface.
-
-// Copyright 2011 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.
-
-package syscall