detached 2a9cea4

all: NetBSD: fix failing tests (#433)

Applied several missing build tags to NetBSD files which fixes the segmentation
fault observed in #304

Closes #349
commit
2a9cea4a86dd602ca79702f3e19a0184ce6eb4ed
author
George Adams · · 2026-03-06 13:59 UTC
committer
GitHub · · 2026-03-06 13:59 UTC
parent
5110604
signature
GPG UnverifiedB5690EEEBB952194 The key is unknown
8 files · +15 -18
M .github/scripts/bsd_tests.sh +5 -3
@@ -43,9 +43,11 @@ env GOOS=freebsd GOARCH=arm64 go build -gcflags="github.com/ebitengine/purego/in
4343 env GOOS=netbsd GOARCH=amd64 go build -v ./...
4444 env GOOS=netbsd GOARCH=arm64 go build -v ./...
4545
46-echo "=> go build (plugin)"
47-# Make sure that plugin buildmode works since we save the R15 register (#254)
48-go build -buildmode=plugin ./examples/libc
46+if [ "$(uname)" = "FreeBSD" ]; then
47+ echo "=> go build (plugin)"
48+ # Make sure that plugin buildmode works since we save the R15 register (#254)
49+ go build -buildmode=plugin ./examples/libc
50+fi
4951
5052 echo "=> go mod vendor"
5153 mkdir /tmp/vendoring
@@ -43,9 +43,11 @@ env GOOS=freebsd GOARCH=arm64 go build -gcflags="github.com/ebitengine/purego/in
43 env GOOS=netbsd GOARCH=amd64 go build -v ./...43 env GOOS=netbsd GOARCH=amd64 go build -v ./...
44 env GOOS=netbsd GOARCH=arm64 go build -v ./...44 env GOOS=netbsd GOARCH=arm64 go build -v ./...
45 45
46-echo "=> go build (plugin)"46+if [ "$(uname)" = "FreeBSD" ]; then
47-# Make sure that plugin buildmode works since we save the R15 register (#254)47+ echo "=> go build (plugin)"
48-go build -buildmode=plugin ./examples/libc48+ # Make sure that plugin buildmode works since we save the R15 register (#254)
49+ go build -buildmode=plugin ./examples/libc
50+fi
49 51
50 echo "=> go mod vendor"52 echo "=> go mod vendor"
51 mkdir /tmp/vendoring53 mkdir /tmp/vendoring
M .github/workflows/test.yml +2 -10
@@ -251,16 +251,8 @@ jobs:
251251 bsd:
252252 strategy:
253253 matrix:
254- os: ['FreeBSD'] # TODO: Add 'NetBSD' again (#304)
255- go: ['1.18.10', '1.19.13', '1.20.14', '1.21.13', '1.22.12', '1.23.12', '1.24.13', '1.25.7', '1.26.0']
256- exclude:
257- # there are no prebuilt download links for these versions of Go for NetBSD
258- - os: NetBSD
259- go: '1.18.10'
260- - os: NetBSD
261- go: '1.19.13'
262- - os: NetBSD
263- go: '1.20.14'
254+ os: ['FreeBSD', 'NetBSD']
255+ go: ['1.25.8', '1.26.1']
264256 name: Test with Go ${{ matrix.go }} on ${{ matrix.os }}
265257 runs-on: ubuntu-22.04
266258 defaults:
@@ -251,16 +251,8 @@ jobs:
251 bsd:251 bsd:
252 strategy:252 strategy:
253 matrix:253 matrix:
254- os: ['FreeBSD'] # TODO: Add 'NetBSD' again (#304)254+ os: ['FreeBSD', 'NetBSD']
255- go: ['1.18.10', '1.19.13', '1.20.14', '1.21.13', '1.22.12', '1.23.12', '1.24.13', '1.25.7', '1.26.0']255+ go: ['1.25.8', '1.26.1']
256- exclude:
257- # there are no prebuilt download links for these versions of Go for NetBSD
258- - os: NetBSD
259- go: '1.18.10'
260- - os: NetBSD
261- go: '1.19.13'
262- - os: NetBSD
263- go: '1.20.14'
264 name: Test with Go ${{ matrix.go }} on ${{ matrix.os }}256 name: Test with Go ${{ matrix.go }} on ${{ matrix.os }}
265 runs-on: ubuntu-22.04257 runs-on: ubuntu-22.04
266 defaults:258 defaults:
M README.md +1 -0
@@ -43,6 +43,7 @@ Tier 2 platforms are supported by PureGo on a best-effort basis. Critical bugs o
4343 - **Android**: 386<sup>1</sup>, arm<sup>1</sup>
4444 - **FreeBSD**: amd64<sup>2</sup>, arm64<sup>2</sup>
4545 - **Linux**: 386, arm, loong64, ppc64le, riscv64, s390x<sup>1</sup>
46+- **NetBSD**: amd64<sup>2</sup>, arm64<sup>2</sup>
4647 - **Windows**: 386<sup>3</sup>, arm<sup>3,4</sup>
4748
4849 #### Support Notes
@@ -43,6 +43,7 @@ Tier 2 platforms are supported by PureGo on a best-effort basis. Critical bugs o
43 - **Android**: 386<sup>1</sup>, arm<sup>1</sup>43 - **Android**: 386<sup>1</sup>, arm<sup>1</sup>
44 - **FreeBSD**: amd64<sup>2</sup>, arm64<sup>2</sup>44 - **FreeBSD**: amd64<sup>2</sup>, arm64<sup>2</sup>
45 - **Linux**: 386, arm, loong64, ppc64le, riscv64, s390x<sup>1</sup>45 - **Linux**: 386, arm, loong64, ppc64le, riscv64, s390x<sup>1</sup>
46+- **NetBSD**: amd64<sup>2</sup>, arm64<sup>2</sup>
46 - **Windows**: 386<sup>3</sup>, arm<sup>3,4</sup>47 - **Windows**: 386<sup>3</sup>, arm<sup>3,4</sup>
47 48
48 #### Support Notes49 #### Support Notes
M dlfcn_nocgo_netbsd.go +2 -0
@@ -1,6 +1,8 @@
11 // SPDX-License-Identifier: Apache-2.0
22 // SPDX-FileCopyrightText: 2025 The Ebitengine Authors
33
4+//go:build !cgo
5+
46 package purego
57
68 //go:cgo_import_dynamic purego_dlopen dlopen "libc.so"
@@ -1,6 +1,8 @@
1 // SPDX-License-Identifier: Apache-2.01 // SPDX-License-Identifier: Apache-2.0
2 // SPDX-FileCopyrightText: 2025 The Ebitengine Authors2 // SPDX-FileCopyrightText: 2025 The Ebitengine Authors
3 3
4+//go:build !cgo
5+
4 package purego6 package purego
5 7
6 //go:cgo_import_dynamic purego_dlopen dlopen "libc.so"8 //go:cgo_import_dynamic purego_dlopen dlopen "libc.so"
M internal/fakecgo/libcgo_netbsd.go +2 -2
@@ -15,11 +15,11 @@ var (
1515 PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t(0)
1616 )
1717
18-// Source: https://github.com/NetBSD/src/blob/613e27c65223fd2283b6ed679da1197e12f50e27/sys/compat/linux/arch/m68k/linux_signal.h#L133
18+// Source: https://github.com/NetBSD/src/blob/613e27c65223fd2283b6ed679da1197e12f50e27/sys/sys/signal.h#L225
1919 type stack_t struct {
2020 ss_sp uintptr
21- ss_flags int32
2221 ss_size uintptr
22+ ss_flags int32
2323 }
2424
2525 // Source: https://github.com/NetBSD/src/blob/613e27c65223fd2283b6ed679da1197e12f50e27/sys/sys/signal.h#L261
@@ -15,11 +15,11 @@ var (
15 PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t(0)15 PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t(0)
16 )16 )
17 17
18-// Source: https://github.com/NetBSD/src/blob/613e27c65223fd2283b6ed679da1197e12f50e27/sys/compat/linux/arch/m68k/linux_signal.h#L13318+// Source: https://github.com/NetBSD/src/blob/613e27c65223fd2283b6ed679da1197e12f50e27/sys/sys/signal.h#L225
19 type stack_t struct {19 type stack_t struct {
20 ss_sp uintptr20 ss_sp uintptr
21- ss_flags int32
22 ss_size uintptr21 ss_size uintptr
22+ ss_flags int32
23 }23 }
24 24
25 // Source: https://github.com/NetBSD/src/blob/613e27c65223fd2283b6ed679da1197e12f50e27/sys/sys/signal.h#L26125 // Source: https://github.com/NetBSD/src/blob/613e27c65223fd2283b6ed679da1197e12f50e27/sys/sys/signal.h#L261
M internal/fakecgo/netbsd.go +1 -1
@@ -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-//go:build netbsd
5+//go:build !cgo && netbsd
66
77 package fakecgo
88
@@ -2,7 +2,7 @@
2 // Use of this source code is governed by a BSD-style2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.3 // license that can be found in the LICENSE file.
4 4
5-//go:build netbsd5+//go:build !cgo && netbsd
6 6
7 package fakecgo7 package fakecgo
8 8
M internal/fakecgo/trampolines_amd64.s +1 -1
@@ -1,7 +1,7 @@
11 // SPDX-License-Identifier: Apache-2.0
22 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors
33
4-//go:build !cgo && (darwin || linux || freebsd)
4+//go:build !cgo && (darwin || freebsd || linux || netbsd)
55
66 /*
77 trampoline for emulating required C functions for cgo in go (see cgo.go)
@@ -1,7 +1,7 @@
1 // SPDX-License-Identifier: Apache-2.01 // SPDX-License-Identifier: Apache-2.0
2 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors2 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3 3
4-//go:build !cgo && (darwin || linux || freebsd)4+//go:build !cgo && (darwin || freebsd || linux || netbsd)
5 5
6 /*6 /*
7 trampoline for emulating required C functions for cgo in go (see cgo.go)7 trampoline for emulating required C functions for cgo in go (see cgo.go)
M internal/fakecgo/trampolines_arm64.s +1 -1
@@ -1,7 +1,7 @@
11 // SPDX-License-Identifier: Apache-2.0
22 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors
33
4-//go:build !cgo && (darwin || freebsd || linux)
4+//go:build !cgo && (darwin || freebsd || linux || netbsd)
55
66 #include "textflag.h"
77 #include "go_asm.h"
@@ -1,7 +1,7 @@
1 // SPDX-License-Identifier: Apache-2.01 // SPDX-License-Identifier: Apache-2.0
2 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors2 // SPDX-FileCopyrightText: 2022 The Ebitengine Authors
3 3
4-//go:build !cgo && (darwin || freebsd || linux)4+//go:build !cgo && (darwin || freebsd || linux || netbsd)
5 5
6 #include "textflag.h"6 #include "textflag.h"
7 #include "go_asm.h"7 #include "go_asm.h"

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close