Skip to content

Commit 2a2234a

Browse files
committed
align GOOS=tamago support to go1.14
1 parent 5e437af commit 2a2234a

30 files changed

+617
-51
lines changed

src/cmd/dist/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1556,10 +1556,10 @@ var cgoEnabled = map[string]bool{
15561556
"plan9/amd64": false,
15571557
"plan9/arm": false,
15581558
"solaris/amd64": true,
1559+
"tamago/arm": true,
15591560
"windows/386": true,
15601561
"windows/amd64": true,
15611562
"windows/arm": false,
1562-
"tamago/arm": true,
15631563
}
15641564

15651565
// List of platforms which are supported but not complete yet. These get

src/cmd/dist/util.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,10 @@ func xsamefile(f1, f2 string) bool {
383383
}
384384

385385
func xgetgoarm() string {
386+
if goos == "tamago" {
387+
// tamago guarantees VFPv3 and is always cross-compiled.
388+
return "7"
389+
}
386390
if goos == "darwin" || goos == "android" {
387391
// Assume all darwin/arm and android devices have VFPv3.
388392
// These ports are also mostly cross-compiled, so it makes little

src/internal/poll/fcntl_tamago.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2019 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
// +build tamago
6+
7+
package poll
8+
9+
import "syscall"
10+
11+
// fcntl not supported on tamago
12+
func fcntl(fd int, cmd int, arg int) (int, error) {
13+
return 0, syscall.ENOSYS
14+
}

src/os/stat_js.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build js,wasm tamago
5+
// +build js,wasm
66

77
package os
88

src/os/stat_tamago.go

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Copyright 2009 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
// +build tamago
6+
7+
package os
8+
9+
import (
10+
"syscall"
11+
"time"
12+
)
13+
14+
func fillFileStatFromSys(fs *fileStat, name string) {
15+
fs.name = basename(name)
16+
fs.size = fs.sys.Size
17+
fs.modTime = timespecToTime(fs.sys.Mtime, fs.sys.MtimeNsec)
18+
fs.mode = FileMode(fs.sys.Mode & 0777)
19+
switch fs.sys.Mode & syscall.S_IFMT {
20+
case syscall.S_IFBLK:
21+
fs.mode |= ModeDevice
22+
case syscall.S_IFCHR:
23+
fs.mode |= ModeDevice | ModeCharDevice
24+
case syscall.S_IFDIR:
25+
fs.mode |= ModeDir
26+
case syscall.S_IFIFO:
27+
fs.mode |= ModeNamedPipe
28+
case syscall.S_IFLNK:
29+
fs.mode |= ModeSymlink
30+
case syscall.S_IFREG:
31+
// nothing to do
32+
case syscall.S_IFSOCK:
33+
fs.mode |= ModeSocket
34+
}
35+
if fs.sys.Mode&syscall.S_ISGID != 0 {
36+
fs.mode |= ModeSetgid
37+
}
38+
if fs.sys.Mode&syscall.S_ISUID != 0 {
39+
fs.mode |= ModeSetuid
40+
}
41+
if fs.sys.Mode&syscall.S_ISVTX != 0 {
42+
fs.mode |= ModeSticky
43+
}
44+
}
45+
46+
func timespecToTime(sec, nsec int64) time.Time {
47+
return time.Unix(sec, nsec)
48+
}
49+
50+
// For testing.
51+
func atime(fi FileInfo) time.Time {
52+
st := fi.Sys().(*syscall.Stat_t)
53+
return timespecToTime(st.Atime, st.AtimeNsec)
54+
}

src/runtime/alg.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,6 @@ func alginit() {
331331
initAlgAES()
332332
return
333333
}
334-
if GOOS == "tamago" {
335-
initRNG()
336-
}
337334
getRandomData((*[len(hashkey) * sys.PtrSize]byte)(unsafe.Pointer(&hashkey))[:])
338335
hashkey[0] |= 1 // make sure these numbers are odd
339336
hashkey[1] |= 1

src/runtime/internal/sys/zgoos_aix.go

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/runtime/internal/sys/zgoos_android.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/runtime/internal/sys/zgoos_darwin.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/runtime/internal/sys/zgoos_dragonfly.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)