chore: switch purego dependency to bnema/purego fork
Replace local path replace directive with GitHub URL pointing to bnema/purego@91aa177 to avoid accidental pushes to upstream.
- commit
- 8b029581aa8aebd90aa84a2b638058062afa9bdd
- author
- brice · · 2026-03-23 19:51 UTC
- parent
- f14f9b6
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
51 files · +1860 -488
M go.mod +2 -0
| @@ -3,3 +3,5 @@ module github.com/bnema/puregotk | |||
| 3 | 3 | go 1.26.1 | |
| 4 | 4 | ||
| 5 | 5 | require github.com/ebitengine/purego v0.10.0 | |
| 6 | + | ||
| 7 | + | replace github.com/ebitengine/purego => github.com/bnema/purego v0.0.0-20260323095903-91aa177a2704 | |
| @@ -3,3 +3,5 @@ module github.com/bnema/puregotk | |||||
| 3 | go 1.26.1 | 3 | go 1.26.1 | ||
| 4 | 4 | ||||
| 5 | require github.com/ebitengine/purego v0.10.0 | 5 | require github.com/ebitengine/purego v0.10.0 | ||
| 6 | + | ||||
| 7 | + | replace github.com/ebitengine/purego => github.com/bnema/purego v0.0.0-20260323095903-91aa177a2704 | |||
M go.sum +2 -2 generated file: collapsed
M vendor/github.com/ebitengine/purego/README.md +3 -0 generated file: collapsed
M vendor/github.com/ebitengine/purego/dlfcn_nocgo_netbsd.go +2 -0 generated file: collapsed
M vendor/github.com/ebitengine/purego/func.go +220 -107 generated file: collapsed
A vendor/github.com/ebitengine/purego/hostlayout_go123.go +12 -0 generated file: collapsed
A vendor/github.com/ebitengine/purego/hostlayout_nogo123.go +11 -0 generated file: collapsed
A vendor/github.com/ebitengine/purego/internal/fakecgo/abi_riscv64.h +72 -0 generated file: collapsed
M vendor/github.com/ebitengine/purego/internal/fakecgo/asm_riscv64.s +14 -55 generated file: collapsed
M vendor/github.com/ebitengine/purego/internal/fakecgo/go_freebsd.go +4 -25 generated file: collapsed
M vendor/github.com/ebitengine/purego/internal/fakecgo/go_linux.go +4 -25
| @@ -67,34 +67,13 @@ var setg_func uintptr | |||
| 67 | 67 | //go:nosplit | |
| 68 | 68 | func x_cgo_init(g *G, setg uintptr) { | |
| 69 | 69 | var size size_t | |
| 70 | - | var attr *pthread_attr_t | |
| 71 | - | ||
| 72 | - | /* The memory sanitizer distributed with versions of clang | |
| 73 | - | before 3.8 has a bug: if you call mmap before malloc, mmap | |
| 74 | - | may return an address that is later overwritten by the msan | |
| 75 | - | library. Avoid this problem by forcing a call to malloc | |
| 76 | - | here, before we ever call malloc. | |
| 77 | - | ||
| 78 | - | This is only required for the memory sanitizer, so it's | |
| 79 | - | unfortunate that we always run it. It should be possible | |
| 80 | - | to remove this when we no longer care about versions of | |
| 81 | - | clang before 3.8. The test for this is | |
| 82 | - | misc/cgo/testsanitizers. | |
| 83 | - | ||
| 84 | - | GCC works hard to eliminate a seemingly unnecessary call to | |
| 85 | - | malloc, so we actually use the memory we allocate. */ | |
| 70 | + | var attr pthread_attr_t | |
| 86 | 71 | ||
| 87 | 72 | setg_func = setg | |
| 88 | - | attr = (*pthread_attr_t)(malloc(unsafe.Sizeof(*attr))) | |
| 89 | - | if attr == nil { | |
| 90 | - | println("fakecgo: malloc failed") | |
| 91 | - | abort() | |
| 92 | - | } | |
| 93 | - | pthread_attr_init(attr) | |
| 94 | - | pthread_attr_getstacksize(attr, &size) | |
| 73 | + | pthread_attr_init(&attr) | |
| 74 | + | pthread_attr_getstacksize(&attr, &size) | |
| 95 | 75 | // runtime/cgo uses __builtin_frame_address(0) instead of `uintptr(unsafe.Pointer(&size))` | |
| 96 | 76 | // but this should be OK since we are taking the address of the first variable in this function. | |
| 97 | 77 | g.stacklo = uintptr(unsafe.Pointer(&size)) - uintptr(size) + 4096 | |
| 98 | - | pthread_attr_destroy(attr) | |
| 99 | - | free(unsafe.Pointer(attr)) | |
| 78 | + | pthread_attr_destroy(&attr) | |
| 100 | 79 | } | |
| @@ -67,34 +67,13 @@ var setg_func uintptr | |||||
| 67 | //go:nosplit | 67 | //go:nosplit | ||
| 68 | func x_cgo_init(g *G, setg uintptr) { | 68 | func x_cgo_init(g *G, setg uintptr) { | ||
| 69 | var size size_t | 69 | var size size_t | ||
| 70 | - | var attr *pthread_attr_t | 70 | + | var attr pthread_attr_t |
| 71 | - | ||||
| 72 | - | /* The memory sanitizer distributed with versions of clang | |||
| 73 | - | before 3.8 has a bug: if you call mmap before malloc, mmap | |||
| 74 | - | may return an address that is later overwritten by the msan | |||
| 75 | - | library. Avoid this problem by forcing a call to malloc | |||
| 76 | - | here, before we ever call malloc. | |||
| 77 | - | ||||
| 78 | - | This is only required for the memory sanitizer, so it's | |||
| 79 | - | unfortunate that we always run it. It should be possible | |||
| 80 | - | to remove this when we no longer care about versions of | |||
| 81 | - | clang before 3.8. The test for this is | |||
| 82 | - | misc/cgo/testsanitizers. | |||
| 83 | - | ||||
| 84 | - | GCC works hard to eliminate a seemingly unnecessary call to | |||
| 85 | - | malloc, so we actually use the memory we allocate. */ | |||
| 86 | 71 | ||||
| 87 | setg_func = setg | 72 | setg_func = setg | ||
| 88 | - | attr = (*pthread_attr_t)(malloc(unsafe.Sizeof(*attr))) | 73 | + | pthread_attr_init(&attr) |
| 89 | - | if attr == nil { | 74 | + | pthread_attr_getstacksize(&attr, &size) |
| 90 | - | println("fakecgo: malloc failed") | |||
| 91 | - | abort() | |||
| 92 | - | } | |||
| 93 | - | pthread_attr_init(attr) | |||
| 94 | - | pthread_attr_getstacksize(attr, &size) | |||
| 95 | // runtime/cgo uses __builtin_frame_address(0) instead of `uintptr(unsafe.Pointer(&size))` | 75 | // runtime/cgo uses __builtin_frame_address(0) instead of `uintptr(unsafe.Pointer(&size))` | ||
| 96 | // but this should be OK since we are taking the address of the first variable in this function. | 76 | // but this should be OK since we are taking the address of the first variable in this function. | ||
| 97 | g.stacklo = uintptr(unsafe.Pointer(&size)) - uintptr(size) + 4096 | 77 | g.stacklo = uintptr(unsafe.Pointer(&size)) - uintptr(size) + 4096 | ||
| 98 | - | pthread_attr_destroy(attr) | 78 | + | pthread_attr_destroy(&attr) |
| 99 | - | free(unsafe.Pointer(attr)) | |||
| 100 | } | 79 | } | ||