Skip to content

Commit e1f18b2

Browse files
committed
further restrict net package usage
Signed-off-by: leongross <[email protected]>
1 parent 513f947 commit e1f18b2

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

loader/goroot.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,19 @@ func needsSyscallPackage(buildTags []string) bool {
227227

228228
// linuxNetworking returns whether the unmodified go linux net stack should be used
229229
// until the full rework of the net package is done.
230+
// To ensure the correct build target, check for the following tags:
231+
// linux && !baremetal && !nintendoswitch && !tinygo.wasm
230232
func linuxNetworking(buildTags []string) bool {
233+
targetLinux := false
231234
for _, tag := range buildTags {
232235
if tag == "linux" {
233-
return true
236+
targetLinux = true
237+
}
238+
if tag == "baremetal" || tag == "nintendoswitch" || tag == "tinygo.wasm" {
239+
return false
234240
}
235241
}
236-
return false
242+
return targetLinux
237243
}
238244

239245
// The boolean indicates whether to merge the subdirs.

src/runtime/netpoll.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,5 @@ func poll_runtime_pollSetDeadline(pd *pollDesc, d int64, mode int) {
4343
//go:linkname poll_runtime_pollOpen internal/poll.runtime_pollOpen
4444
func poll_runtime_pollOpen(fd uintptr) (*pollDesc, int) {
4545
// println("poll_runtime_pollOpen not implemented", fd)
46-
return &pollDesc{runtimeCtx: uintptr(0xdeadbeef)}, pollNoError
46+
return &pollDesc{runtimeCtx: uintptr(0x1337)}, pollNoError
4747
}

src/syscall/forklock.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build tinygo && linux && !wasip1 && !wasip2 && !darwin
1+
//go:build tinygo && linux && !wasip1 && !wasip2 && !darwin && !baremetal
22

33
package syscall
44

0 commit comments

Comments
 (0)