diff options
author | deadprogram <[email protected]> | 2024-12-02 13:48:52 +0100 |
---|---|---|
committer | Ron Evans <[email protected]> | 2024-12-04 15:53:49 +0100 |
commit | 3eee686932d9b04534ea83bdbed7a7faf6f6b910 (patch) | |
tree | 84b8bf1b800158be569a62dfc5b19a795af2c804 | |
parent | 4aac3cd7b1ca59e339fcb0953e7641b8aac27cd2 (diff) | |
download | tinygo-3eee686932d9b04534ea83bdbed7a7faf6f6b910.tar.gz tinygo-3eee686932d9b04534ea83bdbed7a7faf6f6b910.zip |
fix: allow nintendoswitch target to compile
Signed-off-by: deadprogram <[email protected]>
-rw-r--r-- | src/os/dir_other.go | 2 | ||||
-rw-r--r-- | src/os/dir_unix.go | 2 | ||||
-rw-r--r-- | src/os/dirent_linux.go | 2 | ||||
-rw-r--r-- | src/os/exec_linux.go | 2 | ||||
-rw-r--r-- | src/os/exec_other.go | 2 | ||||
-rw-r--r-- | src/os/file_anyos.go | 2 | ||||
-rw-r--r-- | src/os/file_other.go | 2 | ||||
-rw-r--r-- | src/os/file_unix.go | 2 | ||||
-rw-r--r-- | src/os/osexec.go | 2 | ||||
-rw-r--r-- | src/os/removeall_noat.go | 2 | ||||
-rw-r--r-- | src/os/removeall_other.go | 2 | ||||
-rw-r--r-- | src/os/stat_linuxlike.go | 2 | ||||
-rw-r--r-- | src/os/stat_other.go | 2 | ||||
-rw-r--r-- | src/os/stat_unix.go | 2 | ||||
-rw-r--r-- | src/os/types_anyos.go | 2 | ||||
-rw-r--r-- | src/os/types_unix.go | 2 | ||||
-rw-r--r-- | src/runtime/nonhosted.go | 2 | ||||
-rw-r--r-- | src/runtime/runtime_nintendoswitch.go | 21 | ||||
-rw-r--r-- | src/runtime/runtime_unix.go | 2 | ||||
-rw-r--r-- | src/syscall/proc_emulated.go | 2 | ||||
-rw-r--r-- | src/syscall/proc_hosted.go | 2 |
21 files changed, 41 insertions, 20 deletions
diff --git a/src/os/dir_other.go b/src/os/dir_other.go index 60cd9f8e6..0f32a12e4 100644 --- a/src/os/dir_other.go +++ b/src/os/dir_other.go @@ -1,4 +1,4 @@ -//go:build baremetal || js || windows || wasm_unknown +//go:build baremetal || js || windows || wasm_unknown || nintendoswitch // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/src/os/dir_unix.go b/src/os/dir_unix.go index 03624e9cf..7ff92d231 100644 --- a/src/os/dir_unix.go +++ b/src/os/dir_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build linux && !baremetal && !wasip1 && !wasip2 && !wasm_unknown +//go:build linux && !baremetal && !wasip1 && !wasip2 && !wasm_unknown && !nintendoswitch package os diff --git a/src/os/dirent_linux.go b/src/os/dirent_linux.go index 92e2b3a65..9c2f61108 100644 --- a/src/os/dirent_linux.go +++ b/src/os/dirent_linux.go @@ -1,4 +1,4 @@ -//go:build !baremetal && !js && !wasip1 && !wasip2 && !wasm_unknown +//go:build !baremetal && !js && !wasip1 && !wasip2 && !wasm_unknown && !nintendoswitch // Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/src/os/exec_linux.go b/src/os/exec_linux.go index 58ee79cc8..6914a2c28 100644 --- a/src/os/exec_linux.go +++ b/src/os/exec_linux.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build linux && !baremetal && !tinygo.wasm +//go:build linux && !baremetal && !tinygo.wasm && !nintendoswitch package os diff --git a/src/os/exec_other.go b/src/os/exec_other.go index 5494f0896..b05e2830d 100644 --- a/src/os/exec_other.go +++ b/src/os/exec_other.go @@ -1,4 +1,4 @@ -//go:build (!aix && !android && !freebsd && !linux && !netbsd && !openbsd && !plan9 && !solaris) || baremetal || tinygo.wasm +//go:build (!aix && !android && !freebsd && !linux && !netbsd && !openbsd && !plan9 && !solaris) || baremetal || tinygo.wasm || nintendoswitch package os diff --git a/src/os/file_anyos.go b/src/os/file_anyos.go index da70d7284..593512cb5 100644 --- a/src/os/file_anyos.go +++ b/src/os/file_anyos.go @@ -1,4 +1,4 @@ -//go:build !baremetal && !js && !wasm_unknown +//go:build !baremetal && !js && !wasm_unknown && !nintendoswitch // Portions copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/src/os/file_other.go b/src/os/file_other.go index 977fcac12..4e8f859b7 100644 --- a/src/os/file_other.go +++ b/src/os/file_other.go @@ -1,4 +1,4 @@ -//go:build baremetal || (tinygo.wasm && !wasip1 && !wasip2) +//go:build baremetal || (tinygo.wasm && !wasip1 && !wasip2) || nintendoswitch package os diff --git a/src/os/file_unix.go b/src/os/file_unix.go index 76d35a62c..d94b80cc3 100644 --- a/src/os/file_unix.go +++ b/src/os/file_unix.go @@ -1,4 +1,4 @@ -//go:build darwin || (linux && !baremetal && !wasm_unknown) || wasip1 || wasip2 +//go:build darwin || (linux && !baremetal && !wasm_unknown && !nintendoswitch) || wasip1 || wasip2 // target wasi sets GOOS=linux and thus the +linux build tag, // even though it doesn't show up in "tinygo info target -wasi" diff --git a/src/os/osexec.go b/src/os/osexec.go index 65e3ab695..57139d1b6 100644 --- a/src/os/osexec.go +++ b/src/os/osexec.go @@ -1,4 +1,4 @@ -//go:build linux && !baremetal && !tinygo.wasm +//go:build linux && !baremetal && !tinygo.wasm && !nintendoswitch package os diff --git a/src/os/removeall_noat.go b/src/os/removeall_noat.go index 40fc80137..4b37b3bab 100644 --- a/src/os/removeall_noat.go +++ b/src/os/removeall_noat.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -//go:build !baremetal && !js && !wasip1 && !wasip2 && !wasm_unknown +//go:build !baremetal && !js && !wasip1 && !wasip2 && !wasm_unknown && !nintendoswitch package os diff --git a/src/os/removeall_other.go b/src/os/removeall_other.go index dc65aaab2..bf3265dee 100644 --- a/src/os/removeall_other.go +++ b/src/os/removeall_other.go @@ -1,4 +1,4 @@ -//go:build baremetal || js || wasip1 || wasip2 || wasm_unknown +//go:build baremetal || js || wasip1 || wasip2 || wasm_unknown || nintendoswitch // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/src/os/stat_linuxlike.go b/src/os/stat_linuxlike.go index 7c512ec04..c9cfd396f 100644 --- a/src/os/stat_linuxlike.go +++ b/src/os/stat_linuxlike.go @@ -1,4 +1,4 @@ -//go:build (linux && !baremetal && !wasm_unknown) || wasip1 || wasip2 +//go:build (linux && !baremetal && !wasm_unknown && !nintendoswitch) || wasip1 || wasip2 // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/src/os/stat_other.go b/src/os/stat_other.go index 234c59db2..59331bc51 100644 --- a/src/os/stat_other.go +++ b/src/os/stat_other.go @@ -1,4 +1,4 @@ -//go:build baremetal || (tinygo.wasm && !wasip1 && !wasip2) +//go:build baremetal || (tinygo.wasm && !wasip1 && !wasip2) || nintendoswitch // Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/src/os/stat_unix.go b/src/os/stat_unix.go index af5110cf8..9882608d6 100644 --- a/src/os/stat_unix.go +++ b/src/os/stat_unix.go @@ -1,4 +1,4 @@ -//go:build darwin || (linux && !baremetal && !wasm_unknown) || wasip1 || wasip2 +//go:build darwin || (linux && !baremetal && !wasm_unknown && !nintendoswitch) || wasip1 || wasip2 // Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/src/os/types_anyos.go b/src/os/types_anyos.go index 939c00967..9109fa617 100644 --- a/src/os/types_anyos.go +++ b/src/os/types_anyos.go @@ -1,4 +1,4 @@ -//go:build !baremetal && !js && !wasm_unknown +//go:build !baremetal && !js && !wasm_unknown && !nintendoswitch // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/src/os/types_unix.go b/src/os/types_unix.go index 0629b3bbc..54c5c4969 100644 --- a/src/os/types_unix.go +++ b/src/os/types_unix.go @@ -1,4 +1,4 @@ -//go:build darwin || (linux && !baremetal && !wasm_unknown) || wasip1 || wasip2 +//go:build darwin || (linux && !baremetal && !wasm_unknown && !nintendoswitch) || wasip1 || wasip2 // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/src/runtime/nonhosted.go b/src/runtime/nonhosted.go index ca5ab4c3c..9f01a7621 100644 --- a/src/runtime/nonhosted.go +++ b/src/runtime/nonhosted.go @@ -1,4 +1,4 @@ -//go:build baremetal || js || wasm_unknown +//go:build baremetal || js || wasm_unknown || nintendoswitch package runtime diff --git a/src/runtime/runtime_nintendoswitch.go b/src/runtime/runtime_nintendoswitch.go index d2567b1cc..2d3677bf0 100644 --- a/src/runtime/runtime_nintendoswitch.go +++ b/src/runtime/runtime_nintendoswitch.go @@ -84,6 +84,19 @@ func ticks() timeUnit { return timeUnit(ticksToNanoseconds(timeUnit(getArmSystemTick()))) } +// timeOffset is how long the monotonic clock started after the Unix epoch. It +// should be a positive integer under normal operation or zero when it has not +// been set. +var timeOffset int64 + +//go:linkname now time.now +func now() (sec int64, nsec int32, mono int64) { + mono = nanotime() + sec = (mono + timeOffset) / (1000 * 1000 * 1000) + nsec = int32((mono + timeOffset) - sec*(1000*1000*1000)) + return +} + var stdoutBuffer = make([]byte, 120) var position = 0 @@ -98,6 +111,14 @@ func putchar(c byte) { position++ } +func buffered() int { + return 0 +} + +func getchar() byte { + return 0 +} + func abort() { for { exit(1) diff --git a/src/runtime/runtime_unix.go b/src/runtime/runtime_unix.go index e6f81778d..08e3e7426 100644 --- a/src/runtime/runtime_unix.go +++ b/src/runtime/runtime_unix.go @@ -1,4 +1,4 @@ -//go:build (darwin || (linux && !baremetal && !wasip1 && !wasm_unknown && !wasip2)) && !nintendoswitch +//go:build darwin || (linux && !baremetal && !wasip1 && !wasm_unknown && !wasip2 && !nintendoswitch) package runtime diff --git a/src/syscall/proc_emulated.go b/src/syscall/proc_emulated.go index d8e7ff7a9..bcf8eabe9 100644 --- a/src/syscall/proc_emulated.go +++ b/src/syscall/proc_emulated.go @@ -1,4 +1,4 @@ -//go:build baremetal || tinygo.wasm +//go:build baremetal || tinygo.wasm || nintendoswitch // This file emulates some process-related functions that are only available // under a real operating system. diff --git a/src/syscall/proc_hosted.go b/src/syscall/proc_hosted.go index 05c509e6f..8b8f1fafd 100644 --- a/src/syscall/proc_hosted.go +++ b/src/syscall/proc_hosted.go @@ -1,4 +1,4 @@ -//go:build !baremetal && !tinygo.wasm +//go:build !baremetal && !tinygo.wasm && !nintendoswitch // This file assumes there is a libc available that runs on a real operating // system. |