Cannot compile with Tinygo: pthread_musl.go:43:5: (constant -8 of type uintptr) overflows

Results in the following error during the build:

# modernc.org/libc
../../../../go/pkg/mod/modernc.org/libc@v1.61.13/pthread_musl.go:43:5: unsafe.Sizeof(Tpthread_mutex_t{}) - unsafe.Sizeof(pthreadMutex{}) (constant -8 of type uintptr) overflows uintptr

The original libc (a pure Go implementation) compares two structs to ensure there is enough memory for struct mapping:

https://gitlab.com/cznic/libc/-/blob/master/pthread_musl.go?ref_type=heads#L43

But in tinygo, struct sync.Mutex has different sizes.

func main() {
	fmt.Println(unsafe.Sizeof(sync.Mutex{}))
}

In Go 1.24.1, it is 8, while in TinyGo 0.36.0, it is 16.

This results in the structure pthreadMutex having a size of 48 on tinygo, instead of 28 in Go.

Edited by Tryanks