Skip to content

Commit

Permalink
runtime,syscall: invert openbsd architecture tests
Browse files Browse the repository at this point in the history
Rather than testing for architectures that use libc-based system calls,
test that it is not the single architecture that Go is still using direct
system calls. This reduces the number of changes needed for new openbsd
ports.

Updates #36435
Updates #61546

Change-Id: I79c4597c629b8b372e9efcda79e8f6ff778b9e8e
Reviewed-on: https://go-review.googlesource.com/c/go/+/516016
Reviewed-by: Ian Lance Taylor <[email protected]>
Auto-Submit: Ian Lance Taylor <[email protected]>
Run-TryBot: Ian Lance Taylor <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
Run-TryBot: Joel Sing <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
  • Loading branch information
4a6f656c authored and gopherbot committed Aug 5, 2023
1 parent 5d53050 commit 9fc3feb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/runtime/proc.go
Original file line number Diff line number Diff line change
Expand Up @@ -1497,7 +1497,7 @@ func usesLibcall() bool {
case "aix", "darwin", "illumos", "ios", "solaris", "windows":
return true
case "openbsd":
return GOARCH == "386" || GOARCH == "amd64" || GOARCH == "arm" || GOARCH == "arm64"
return GOARCH != "mips64"
}
return false
}
Expand All @@ -1509,10 +1509,7 @@ func mStackIsSystemAllocated() bool {
case "aix", "darwin", "plan9", "illumos", "ios", "solaris", "windows":
return true
case "openbsd":
switch GOARCH {
case "386", "amd64", "arm", "arm64":
return true
}
return GOARCH != "mips64"
}
return false
}
Expand Down
2 changes: 1 addition & 1 deletion src/syscall/exec_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func Exec(argv0 string, argv []string, envv []string) (err error) {
} else if runtime.GOOS == "darwin" || runtime.GOOS == "ios" {
// Similarly on Darwin.
err1 = execveDarwin(argv0p, &argvp[0], &envvp[0])
} else if runtime.GOOS == "openbsd" && (runtime.GOARCH == "386" || runtime.GOARCH == "amd64" || runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") {
} else if runtime.GOOS == "openbsd" && runtime.GOARCH != "mips64" {
// Similarly on OpenBSD.
err1 = execveOpenBSD(argv0p, &argvp[0], &envvp[0])
} else {
Expand Down

0 comments on commit 9fc3feb

Please sign in to comment.