Hello! Attached ports go to ALPHA architecture.
There are however several problems with the build: a) Bootstrap compare failure in the gcc/go directory due to binutils bug [1], fixed in latest binutils SVN, use --disable-bootstrap b) alpha doesn't define "struct user_regs_struct" from which "type PtraceRegs" is derived. I have manually created PtraceRegs from pt_regs structure and patched generated libgo/sysinfo.go in build directory after the build broke. However - the comment from sys/user.h says that this file is for GDB and GDB only... c) some weird issue with double definition of "const _SOCK_NONBLOCK" in gen-sysinfo.go and consequently sysinfo.go. The test results from "make -k check" in libgo directory are quite encouraging: PASS: asn1 PASS: big PASS: bufio PASS: bytes FAIL: cmath panic: runtime error: integer divide by zero or floating point error ../../../gcc-svn/trunk/libgo/testsuite/gotest: line 356: 1637 Aborted ./a.out "$@" PASS: ebnf PASS: exec PASS: expvar PASS: flag FAIL: fmt mallocs per Sprintf(""): 1 mallocs per Sprintf("xxx"): 1 mallocs per Sprintf("%x"): 3 mallocs per Sprintf("%x %x"): 4 panic: runtime error: integer divide by zero or floating point error [recovered] panic: runtime error: integer divide by zero or floating point error ../../../gcc-svn/trunk/libgo/testsuite/gotest: line 356: 2309 Aborted ./a.out "$@" PASS: gob PASS: html FAIL: http ../../../gcc-svn/trunk/libgo/testsuite/gotest: line 356: 3133 Segmentation faul t ./a.out "$@" PASS: io PASS: json PASS: log FAIL: math panic: runtime error: integer divide by zero or floating point error ../../../gcc-svn/trunk/libgo/testsuite/gotest: line 356: 4321 Aborted ./a.out "$@" PASS: mime PASS: netchan PASS: os PASS: patch PASS: path PASS: rand PASS: reflect PASS: regexp FAIL: rpc 2011/03/30 21:31:20 Test RPC server listening on 127.0.0.1:47781 2011/03/30 21:31:20 Test HTTP RPC server listening on 127.0.0.1:59606 2011/03/30 21:31:20 rpc.Serve: accept:accept tcp 127.0.0.1:47781: Resource tempo rarily unavailable FAIL: runtime panic: runtime error: integer divide by zero or floating point error ../../../gcc-svn/trunk/libgo/testsuite/gotest: line 356: 5980 Aborted ./a.out "$@" PASS: scanner PASS: smtp PASS: sort FAIL: strconv panic: runtime error: integer divide by zero or floating point error ../../../gcc-svn/trunk/libgo/testsuite/gotest: line 356: 6561 Aborted ./a.out "$@" PASS: strings PASS: sync PASS: tabwriter PASS: template PASS: time PASS: try PASS: unicode PASS: utf16 PASS: utf8 FAIL: websocket 2011/03/30 21:32:19 Test WebSocket server listening on 127.0.0.1:33252 --- FAIL: websocket.TestEcho (0.0 seconds) dialing dial tcp 127.0.0.1:33252: Connection refused --- FAIL: websocket.TestEchoDraft75 (0.0 seconds) dialing dial tcp 127.0.0.1:33252: Connection refused --- FAIL: websocket.TestWithQuery (0.0 seconds) dialing dial tcp 127.0.0.1:33252: Connection refused --- FAIL: websocket.TestWithProtocol (0.0 seconds) dialing dial tcp 127.0.0.1:33252: Connection refused --- FAIL: websocket.TestHTTP (0.0 seconds) Get: error &http.URLError{Op:"Get", URL:"http://127.0.0.1:33252/echo", E rror:(*net.OpError)(0xf840026d00)} --- FAIL: websocket.TestHTTPDraft75 (0.0 seconds) Get: error &http.URLError{Op:"Get", URL:"http://127.0.0.1:33252/echoDraf t75", Error:(*net.OpError)(0xf840026c40)} panic: Dial failed: websocket.Dial ws://127.0.0.1:33252/echo: dial tcp 127.0.0.1 :33252: Connection refused ../../../gcc-svn/trunk/libgo/testsuite/gotest: line 356: 8493 Aborted ./a.out "$@" PASS: xml PASS: archive/tar PASS: archive/zip PASS: compress/bzip2 FAIL: compress/flate ../../../gcc-svn/trunk/libgo/testsuite/gotest: line 356: 9194 Segmentation faul t ./a.out "$@" PASS: compress/gzip PASS: compress/lzw PASS: compress/zlib PASS: container/heap PASS: container/list PASS: container/ring PASS: container/vector PASS: crypto/aes PASS: crypto/block PASS: crypto/blowfish PASS: crypto/cipher PASS: crypto/dsa PASS: crypto/ecdsa PASS: crypto/elliptic PASS: crypto/hmac PASS: crypto/md4 PASS: crypto/md5 PASS: crypto/ocsp PASS: crypto/openpgp PASS: crypto/rand PASS: crypto/rc4 PASS: crypto/ripemd160 PASS: crypto/rsa PASS: crypto/sha1 PASS: crypto/sha256 PASS: crypto/sha512 PASS: crypto/subtle PASS: crypto/tls PASS: crypto/twofish PASS: crypto/x509 PASS: crypto/xtea PASS: crypto/openpgp/armor PASS: crypto/openpgp/packet PASS: crypto/openpgp/s2k PASS: debug/dwarf PASS: debug/elf PASS: debug/macho PASS: debug/pe PASS: encoding/ascii85 PASS: encoding/base32 PASS: encoding/base64 PASS: encoding/binary PASS: encoding/git85 PASS: encoding/hex PASS: encoding/line PASS: encoding/pem PASS: exp/datafmt PASS: exp/draw PASS: exp/eval PASS: go/parser PASS: go/printer PASS: go/scanner PASS: go/token PASS: go/typechecker PASS: hash/adler32 PASS: hash/crc32 PASS: hash/crc64 PASS: hash/fnv PASS: http/cgi PASS: image/png PASS: index/suffixarray PASS: io/ioutil PASS: mime/multipart PASS: net/textproto PASS: os/signal PASS: path/filepath PASS: rpc/jsonrpc PASS: sync/atomic PASS: testing/quick PASS: testing/script [1] http://sourceware.org/bugzilla/show_bug.cgi?id=12610
Index: gcc/testsuite/go.test/go-test.exp =================================================================== --- gcc/testsuite/go.test/go-test.exp (revision 171716) +++ gcc/testsuite/go.test/go-test.exp (working copy) @@ -123,6 +123,9 @@ global target_triplet switch -glob $target_triplet { + "alpha*-*-*" { + set goarch "alpha" + } "arm*-*-*" - "ep9312*-*-*" - "strongarm*-*-*" - Index: libgo/configure =================================================================== --- libgo/configure (revision 171716) +++ libgo/configure (working copy) @@ -633,6 +633,8 @@ 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 @@ -10898,7 +10900,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10901 "configure" +#line 10903 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11004,7 +11006,7 @@ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11007 "configure" +#line 11009 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -13267,6 +13269,7 @@ is_386=no +is_alpha=no is_arm=no is_m68k=no is_mips=no @@ -13278,6 +13281,10 @@ is_x86_64=no GOARCH=unknown case ${host} in + alpha*-*-*) + is_alpha=yes + GOARCH=alpha + ;; arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*) is_arm=yes GOARCH=arm @@ -13375,6 +13382,14 @@ 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='#' @@ -14492,6 +14507,10 @@ 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 Index: libgo/syscalls/syscall_linux_alpha.go =================================================================== --- libgo/syscalls/syscall_linux_alpha.go (revision 0) +++ libgo/syscalls/syscall_linux_alpha.go (revision 0) @@ -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; +} Index: libgo/configure.ac =================================================================== --- libgo/configure.ac (revision 171716) +++ libgo/configure.ac (working copy) @@ -134,6 +134,7 @@ 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 is_mips=no @@ -145,6 +146,10 @@ is_x86_64=no GOARCH=unknown case ${host} in + alpha*-*-*) + is_alpha=yes + GOARCH=alpha + ;; arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*) is_arm=yes GOARCH=arm @@ -205,6 +210,7 @@ ;; 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 $is_mips = yes) Index: libgo/go/debug/proc/regs_linux_alpha.go =================================================================== --- libgo/go/debug/proc/regs_linux_alpha.go (revision 0) +++ libgo/go/debug/proc/regs_linux_alpha.go (revision 0) @@ -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 +}