From: Ian Lance Taylor Date: Fri, 1 Apr 2011 23:02:16 +0000 (+0000) Subject: libgo: Support for alpha. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e59b917109ad5ecb461cd4fc6b7fda924eda8fa7;p=gcc.git libgo: Support for alpha. From Uros Bizjak. From-SVN: r171860 --- diff --git a/libgo/configure b/libgo/configure index 30d1cdcd5cb..2821967d49a 100644 --- a/libgo/configure +++ b/libgo/configure @@ -644,6 +644,8 @@ LIBGO_IS_M68K_FALSE LIBGO_IS_M68K_TRUE LIBGO_IS_ARM_FALSE LIBGO_IS_ARM_TRUE +LIBGO_IS_ALPHA_FALSE +LIBGO_IS_ALPHA_TRUE LIBGO_IS_386_FALSE LIBGO_IS_386_TRUE GOOS @@ -10911,7 +10913,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10914 "configure" +#line 10916 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11017,7 +11019,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11020 "configure" +#line 11022 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13290,6 +13292,7 @@ fi is_386=no +is_alpha=no is_arm=no is_m68k=no mips_abi="" @@ -13300,6 +13303,10 @@ is_sparc64=no is_x86_64=no GOARCH=unknown case ${host} in + alpha*-*-*) + is_alpha=yes + GOARCH=alpha + ;; arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*) is_arm=yes GOARCH=arm @@ -13435,6 +13442,14 @@ else LIBGO_IS_386_FALSE= fi + if test $is_alpha = yes; then + LIBGO_IS_ALPHA_TRUE= + LIBGO_IS_ALPHA_FALSE='#' +else + LIBGO_IS_ALPHA_TRUE='#' + LIBGO_IS_ALPHA_FALSE= +fi + if test $is_arm = yes; then LIBGO_IS_ARM_TRUE= LIBGO_IS_ARM_FALSE='#' @@ -14612,6 +14627,10 @@ if test -z "${LIBGO_IS_386_TRUE}" && test -z "${LIBGO_IS_386_FALSE}"; then as_fn_error "conditional \"LIBGO_IS_386\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${LIBGO_IS_ALPHA_TRUE}" && test -z "${LIBGO_IS_ALPHA_FALSE}"; then + as_fn_error "conditional \"LIBGO_IS_ALPHA\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${LIBGO_IS_ARM_TRUE}" && test -z "${LIBGO_IS_ARM_FALSE}"; then as_fn_error "conditional \"LIBGO_IS_ARM\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff --git a/libgo/configure.ac b/libgo/configure.ac index cf0c17ff0a4..77b9f94aba0 100644 --- a/libgo/configure.ac +++ b/libgo/configure.ac @@ -137,6 +137,7 @@ AC_SUBST(GOOS) dnl N.B. Keep in sync with gcc/testsuite/go.test/go-test.exp (go-set-goarch). is_386=no +is_alpha=no is_arm=no is_m68k=no mips_abi="" @@ -147,6 +148,10 @@ is_sparc64=no is_x86_64=no GOARCH=unknown case ${host} in + alpha*-*-*) + is_alpha=yes + GOARCH=alpha + ;; arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*) is_arm=yes GOARCH=arm @@ -225,6 +230,7 @@ changequote([,])dnl ;; esac AM_CONDITIONAL(LIBGO_IS_386, test $is_386 = yes) +AM_CONDITIONAL(LIBGO_IS_ALPHA, test $is_alpha = 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 $mips_abi != "") diff --git a/libgo/go/debug/proc/regs_linux_alpha.go b/libgo/go/debug/proc/regs_linux_alpha.go new file mode 100644 index 00000000000..3c9f8d85f17 --- /dev/null +++ b/libgo/go/debug/proc/regs_linux_alpha.go @@ -0,0 +1,209 @@ +// 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 + +import ( + "os" + "strconv" + "syscall" +) + +type alphaRegs struct { + syscall.PtraceRegs + setter func(*syscall.PtraceRegs) os.Error +} + +var names = [...]string{ + "r0", + "r1", + "r2", + "r3", + "r4", + "r5", + "r6", + "r7", + "r8", + "r19", + "r20", + "r21", + "r22", + "r23", + "r24", + "r25", + "r26", + "r27", + "r28", + "hae", + "trap_a0", + "trap_a1", + "trap_a2", + "ps", + "pc", + "gp", + "r16", + "r17", + "r18", +} + +func (r *alphaRegs) PC() Word { return Word(r.Pc) } + +func (r *alphaRegs) SetPC(val Word) os.Error { + r.Pc = uint64(val) + return r.setter(&r.PtraceRegs) +} + +func (r *alphaRegs) Link() Word { + panic("No link register") +} + +func (r *alphaRegs) SetLink(val Word) os.Error { + panic("No link register") +} + +func (r *alphaRegs) SP() Word { return Word(r.Ps) } + +func (r *alphaRegs) SetSP(val Word) os.Error { + r.Ps = uint64(val) + return r.setter(&r.PtraceRegs) +} + +func (r *alphaRegs) Names() []string { return names[0:] } + +func (r *alphaRegs) Get(i int) Word { + switch i { + case 0: + return Word(r.R0) + case 1: + return Word(r.R1) + case 2: + return Word(r.R2) + case 3: + return Word(r.R3) + case 4: + return Word(r.R4) + case 5: + return Word(r.R5) + case 6: + return Word(r.R6) + case 7: + return Word(r.R7) + case 8: + return Word(r.R8) + case 9: + return Word(r.R19) + case 10: + return Word(r.R20) + case 11: + return Word(r.R21) + case 12: + return Word(r.R22) + case 13: + return Word(r.R23) + case 14: + return Word(r.R24) + case 15: + return Word(r.R25) + case 16: + return Word(r.R26) + case 17: + return Word(r.R27) + case 18: + return Word(r.R28) + case 19: + return Word(r.Hae) + case 20: + return Word(r.Trap_a0) + case 21: + return Word(r.Trap_a1) + case 22: + return Word(r.Trap_a2) + case 23: + return Word(r.Ps) + case 24: + return Word(r.Pc) + case 25: + return Word(r.Gp) + case 26: + return Word(r.R16) + case 27: + return Word(r.R17) + case 28: + return Word(r.R18) + } + panic("invalid register index " + strconv.Itoa(i)) +} + +func (r *alphaRegs) Set(i int, val Word) os.Error { + switch i { + case 0: + r.R0 = uint64(val) + case 1: + r.R1 = uint64(val) + case 2: + r.R2 = uint64(val) + case 3: + r.R3 = uint64(val) + case 4: + r.R4 = uint64(val) + case 5: + r.R5 = uint64(val) + case 6: + r.R6 = uint64(val) + case 7: + r.R7 = uint64(val) + case 8: + r.R8 = uint64(val) + case 9: + r.R19 = uint64(val) + case 10: + r.R20 = uint64(val) + case 11: + r.R21 = uint64(val) + case 12: + r.R22 = uint64(val) + case 13: + r.R23 = uint64(val) + case 14: + r.R24 = uint64(val) + case 15: + r.R25 = uint64(val) + case 16: + r.R26 = uint64(val) + case 17: + r.R27 = uint64(val) + case 18: + r.R28 = uint64(val) + case 19: + r.Hae = uint64(val) + case 20: + r.Trap_a0 = uint64(val) + case 21: + r.Trap_a1 = uint64(val) + case 22: + r.Trap_a2 = uint64(val) + case 23: + r.Ps = uint64(val) + case 24: + r.Pc = uint64(val) + case 25: + r.Gp = uint64(val) + case 26: + r.R16 = uint64(val) + case 27: + r.R17 = uint64(val) + case 28: + r.R18 = uint64(val) + default: + panic("invalid register index " + strconv.Itoa(i)) + } + return r.setter(&r.PtraceRegs) +} + +func newRegs(regs *syscall.PtraceRegs, setter func(*syscall.PtraceRegs) os.Error) Regs { + res := alphaRegs{} + res.PtraceRegs = *regs + res.setter = setter + return &res +} diff --git a/libgo/syscalls/syscall_linux_alpha.go b/libgo/syscalls/syscall_linux_alpha.go new file mode 100644 index 00000000000..35259b27fe7 --- /dev/null +++ b/libgo/syscalls/syscall_linux_alpha.go @@ -0,0 +1,15 @@ +// syscall_linux_alpha.go -- GNU/Linux ALPHA specific support + +// 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 + +func (r *PtraceRegs) PC() uint64 { + return r.Pc; +} + +func (r *PtraceRegs) SetPC(pc uint64) { + r.Pc = pc; +}