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 generated file: collapsed
M vendor/github.com/ebitengine/purego/internal/fakecgo/go_netbsd.go +4 -25
| @@ -73,34 +73,13 @@ var setg_func uintptr | |||
| 73 | 73 | //go:nosplit | |
| 74 | 74 | func x_cgo_init(g *G, setg uintptr) { | |
| 75 | 75 | var size size_t | |
| 76 | - | var attr *pthread_attr_t | |
| 77 | - | ||
| 78 | - | /* The memory sanitizer distributed with versions of clang | |
| 79 | - | before 3.8 has a bug: if you call mmap before malloc, mmap | |
| 80 | - | may return an address that is later overwritten by the msan | |
| 81 | - | library. Avoid this problem by forcing a call to malloc | |
| 82 | - | here, before we ever call malloc. | |
| 83 | - | ||
| 84 | - | This is only required for the memory sanitizer, so it's | |
| 85 | - | unfortunate that we always run it. It should be possible | |
| 86 | - | to remove this when we no longer care about versions of | |
| 87 | - | clang before 3.8. The test for this is | |
| 88 | - | misc/cgo/testsanitizers. | |
| 89 | - | ||
| 90 | - | GCC works hard to eliminate a seemingly unnecessary call to | |
| 91 | - | malloc, so we actually use the memory we allocate. */ | |
| 76 | + | var attr pthread_attr_t | |
| 92 | 77 | ||
| 93 | 78 | setg_func = setg | |
| 94 | - | attr = (*pthread_attr_t)(malloc(unsafe.Sizeof(*attr))) | |
| 95 | - | if attr == nil { | |
| 96 | - | println("fakecgo: malloc failed") | |
| 97 | - | abort() | |
| 98 | - | } | |
| 99 | - | pthread_attr_init(attr) | |
| 100 | - | pthread_attr_getstacksize(attr, &size) | |
| 79 | + | pthread_attr_init(&attr) | |
| 80 | + | pthread_attr_getstacksize(&attr, &size) | |
| 101 | 81 | // runtime/cgo uses __builtin_frame_address(0) instead of `uintptr(unsafe.Pointer(&size))` | |
| 102 | 82 | // but this should be OK since we are taking the address of the first variable in this function. | |
| 103 | 83 | g.stacklo = uintptr(unsafe.Pointer(&size)) - uintptr(size) + 4096 | |
| 104 | - | pthread_attr_destroy(attr) | |
| 105 | - | free(unsafe.Pointer(attr)) | |
| 84 | + | pthread_attr_destroy(&attr) | |
| 106 | 85 | } | |
| @@ -73,34 +73,13 @@ var setg_func uintptr | |||||
| 73 | //go:nosplit | 73 | //go:nosplit | ||
| 74 | func x_cgo_init(g *G, setg uintptr) { | 74 | func x_cgo_init(g *G, setg uintptr) { | ||
| 75 | var size size_t | 75 | var size size_t | ||
| 76 | - | var attr *pthread_attr_t | 76 | + | var attr pthread_attr_t |
| 77 | - | ||||
| 78 | - | /* The memory sanitizer distributed with versions of clang | |||
| 79 | - | before 3.8 has a bug: if you call mmap before malloc, mmap | |||
| 80 | - | may return an address that is later overwritten by the msan | |||
| 81 | - | library. Avoid this problem by forcing a call to malloc | |||
| 82 | - | here, before we ever call malloc. | |||
| 83 | - | ||||
| 84 | - | This is only required for the memory sanitizer, so it's | |||
| 85 | - | unfortunate that we always run it. It should be possible | |||
| 86 | - | to remove this when we no longer care about versions of | |||
| 87 | - | clang before 3.8. The test for this is | |||
| 88 | - | misc/cgo/testsanitizers. | |||
| 89 | - | ||||
| 90 | - | GCC works hard to eliminate a seemingly unnecessary call to | |||
| 91 | - | malloc, so we actually use the memory we allocate. */ | |||
| 92 | 77 | ||||
| 93 | setg_func = setg | 78 | setg_func = setg | ||
| 94 | - | attr = (*pthread_attr_t)(malloc(unsafe.Sizeof(*attr))) | 79 | + | pthread_attr_init(&attr) |
| 95 | - | if attr == nil { | 80 | + | pthread_attr_getstacksize(&attr, &size) |
| 96 | - | println("fakecgo: malloc failed") | |||
| 97 | - | abort() | |||
| 98 | - | } | |||
| 99 | - | pthread_attr_init(attr) | |||
| 100 | - | pthread_attr_getstacksize(attr, &size) | |||
| 101 | // runtime/cgo uses __builtin_frame_address(0) instead of `uintptr(unsafe.Pointer(&size))` | 81 | // runtime/cgo uses __builtin_frame_address(0) instead of `uintptr(unsafe.Pointer(&size))` | ||
| 102 | // but this should be OK since we are taking the address of the first variable in this function. | 82 | // but this should be OK since we are taking the address of the first variable in this function. | ||
| 103 | g.stacklo = uintptr(unsafe.Pointer(&size)) - uintptr(size) + 4096 | 83 | g.stacklo = uintptr(unsafe.Pointer(&size)) - uintptr(size) + 4096 | ||
| 104 | - | pthread_attr_destroy(attr) | 84 | + | pthread_attr_destroy(&attr) |
| 105 | - | free(unsafe.Pointer(attr)) | |||
| 106 | } | 85 | } | ||