Skip to content

Commit

Permalink
fix: allow nintendoswitch target to compile
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Dec 2, 2024
1 parent 3b80621 commit 473f085
Show file tree
Hide file tree
Showing 21 changed files with 33 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/os/dir_other.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/os/dir_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/os/dirent_linux.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/os/exec_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/os/exec_other.go
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/os/file_anyos.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/os/file_other.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build baremetal || (tinygo.wasm && !wasip1 && !wasip2)
//go:build baremetal || (tinygo.wasm && !wasip1 && !wasip2) || nintendoswitch

package os

Expand Down
2 changes: 1 addition & 1 deletion src/os/file_unix.go
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/os/osexec.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build linux && !baremetal && !tinygo.wasm
//go:build linux && !baremetal && !tinygo.wasm && !nintendoswitch

package os

Expand Down
2 changes: 1 addition & 1 deletion src/os/removeall_noat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/os/removeall_other.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/os/stat_linuxlike.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/os/stat_other.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/os/stat_unix.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/os/types_anyos.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/os/types_unix.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/nonhosted.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//go:build baremetal || js || wasm_unknown
//go:build baremetal || js || wasm_unknown || nintendoswitch

package runtime

Expand Down
13 changes: 13 additions & 0 deletions src/runtime/runtime_nintendoswitch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/runtime/runtime_unix.go
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/syscall/proc_emulated.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/syscall/proc_hosted.go
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit 473f085

Please sign in to comment.