slidge-whatsapp 0.3.0b0__cp313-cp313-manylinux_2_36_aarch64.whl → 0.3.1__cp313-cp313-manylinux_2_36_aarch64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. slidge_whatsapp/contact.py +2 -0
  2. slidge_whatsapp/event.go +72 -22
  3. slidge_whatsapp/generated/_whatsapp.cpython-313-aarch64-linux-gnu.h +180 -180
  4. slidge_whatsapp/generated/_whatsapp.cpython-313-aarch64-linux-gnu.so +0 -0
  5. slidge_whatsapp/generated/build.py +138 -138
  6. slidge_whatsapp/generated/whatsapp.c +1532 -1532
  7. slidge_whatsapp/generated/whatsapp.go +1224 -1224
  8. slidge_whatsapp/generated/whatsapp.py +1302 -1302
  9. slidge_whatsapp/generated/whatsapp_go.h +180 -180
  10. slidge_whatsapp/go.mod +5 -5
  11. slidge_whatsapp/go.sum +14 -14
  12. slidge_whatsapp/session.go +4 -4
  13. slidge_whatsapp/vendor/github.com/ebitengine/purego/README.md +21 -5
  14. slidge_whatsapp/vendor/github.com/ebitengine/purego/abi_loong64.h +60 -0
  15. slidge_whatsapp/vendor/github.com/ebitengine/purego/cgo.go +1 -1
  16. slidge_whatsapp/vendor/github.com/ebitengine/purego/dlerror.go +1 -1
  17. slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn.go +1 -1
  18. slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn_netbsd.go +15 -0
  19. slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn_nocgo_netbsd.go +9 -0
  20. slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn_stubs.s +1 -1
  21. slidge_whatsapp/vendor/github.com/ebitengine/purego/func.go +113 -60
  22. slidge_whatsapp/vendor/github.com/ebitengine/purego/gen.go +6 -0
  23. slidge_whatsapp/vendor/github.com/ebitengine/purego/go_runtime.go +1 -1
  24. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/cgo/dlfcn_cgo_unix.go +2 -2
  25. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/cgo/syscall_cgo_unix.go +2 -2
  26. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/abi_loong64.h +60 -0
  27. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/asm_loong64.s +40 -0
  28. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/callbacks.go +1 -1
  29. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/doc.go +1 -1
  30. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_libinit.go +1 -1
  31. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_linux_loong64.go +92 -0
  32. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_netbsd.go +106 -0
  33. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_setenv.go +1 -1
  34. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_util.go +1 -1
  35. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/iscgo.go +1 -1
  36. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo.go +1 -1
  37. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_darwin.go +4 -0
  38. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_freebsd.go +4 -0
  39. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_linux.go +4 -0
  40. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_netbsd.go +26 -0
  41. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/netbsd.go +23 -0
  42. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/setenv.go +1 -1
  43. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols.go +11 -1
  44. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_darwin.go +1 -0
  45. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_freebsd.go +1 -0
  46. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_linux.go +1 -0
  47. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_netbsd.go +30 -0
  48. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_loong64.s +71 -0
  49. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_stubs.s +5 -1
  50. slidge_whatsapp/vendor/github.com/ebitengine/purego/nocgo.go +1 -1
  51. slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_amd64.go +8 -4
  52. slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_arm64.go +16 -6
  53. slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_loong64.go +190 -0
  54. slidge_whatsapp/vendor/github.com/ebitengine/purego/struct_other.go +6 -2
  55. slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_amd64.s +1 -1
  56. slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_arm64.s +1 -1
  57. slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_loong64.s +96 -0
  58. slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_unix_arm64.s +1 -1
  59. slidge_whatsapp/vendor/github.com/ebitengine/purego/sys_unix_loong64.s +75 -0
  60. slidge_whatsapp/vendor/github.com/ebitengine/purego/syscall.go +6 -3
  61. slidge_whatsapp/vendor/github.com/ebitengine/purego/syscall_cgo_linux.go +3 -3
  62. slidge_whatsapp/vendor/github.com/ebitengine/purego/syscall_sysv.go +13 -10
  63. slidge_whatsapp/vendor/github.com/ebitengine/purego/syscall_windows.go +1 -1
  64. slidge_whatsapp/vendor/github.com/ebitengine/purego/zcallback_amd64.s +2002 -2002
  65. slidge_whatsapp/vendor/github.com/ebitengine/purego/zcallback_arm64.s +4002 -4002
  66. slidge_whatsapp/vendor/github.com/ebitengine/purego/zcallback_loong64.s +4014 -0
  67. slidge_whatsapp/vendor/go.mau.fi/util/dbutil/log.go +1 -0
  68. slidge_whatsapp/vendor/go.mau.fi/util/dbutil/module.go +118 -0
  69. slidge_whatsapp/vendor/go.mau.fi/util/dbutil/upgradetable.go +0 -34
  70. slidge_whatsapp/vendor/go.mau.fi/util/exbytes/string.go +20 -0
  71. slidge_whatsapp/vendor/go.mau.fi/util/exbytes/writer.go +78 -0
  72. slidge_whatsapp/vendor/go.mau.fi/util/exslices/cast.go +42 -0
  73. slidge_whatsapp/vendor/go.mau.fi/util/exslices/chunk.go +28 -0
  74. slidge_whatsapp/vendor/go.mau.fi/util/exslices/deduplicate.go +67 -0
  75. slidge_whatsapp/vendor/go.mau.fi/util/exslices/diff.go +63 -0
  76. slidge_whatsapp/vendor/go.mau.fi/util/exsync/event.go +15 -1
  77. slidge_whatsapp/vendor/go.mau.fi/util/random/string.go +47 -7
  78. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/decode.go +1 -0
  79. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/encode.go +34 -0
  80. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/hash.go +1 -0
  81. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate.go +3 -0
  82. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/armadillomessage.go +1 -2
  83. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/call.go +6 -0
  84. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/errors.go +1 -0
  85. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/group.go +63 -42
  86. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/internals.go +14 -10
  87. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/message.go +45 -18
  88. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/msgsecret.go +23 -0
  89. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/notification.go +5 -1
  90. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair.go +3 -7
  91. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waAICommon/WAAICommon.pb.go +7747 -0
  92. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/{waBotMetadata/WABotMetadata.proto → waAICommon/WAAICommon.proto} +269 -9
  93. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.pb.go +128 -14
  94. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.proto +10 -0
  95. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go +3236 -4732
  96. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto +125 -273
  97. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.go +11 -2
  98. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.proto +1 -0
  99. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.pb.go +220 -81
  100. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.proto +13 -0
  101. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go +705 -449
  102. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto +23 -0
  103. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.go +78 -24
  104. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.proto +6 -0
  105. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.go +516 -267
  106. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.proto +22 -0
  107. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/receipt.go +2 -0
  108. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/request.go +4 -0
  109. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/retry.go +2 -3
  110. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/send.go +110 -28
  111. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/clientpayload.go +1 -1
  112. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/noop.go +12 -0
  113. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/lidmap.go +82 -4
  114. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go +112 -55
  115. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/00-latest-schema.sql +8 -7
  116. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/11-redacted-phone-contacts.sql +2 -0
  117. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/store.go +20 -0
  118. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/call.go +6 -5
  119. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/message.go +7 -1
  120. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/user.go +3 -0
  121. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/user.go +31 -2
  122. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/desc.go +35 -17
  123. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/desc_init.go +14 -0
  124. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/desc_lazy.go +20 -0
  125. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/version/version.go +1 -1
  126. slidge_whatsapp/vendor/modules.txt +8 -6
  127. {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.1.dist-info}/METADATA +4 -3
  128. {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.1.dist-info}/RECORD +131 -107
  129. {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.1.dist-info}/WHEEL +1 -1
  130. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waBotMetadata/WABotMetadata.pb.go +0 -5156
  131. {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.1.dist-info}/entry_points.txt +0 -0
  132. {slidge_whatsapp-0.3.0b0.dist-info → slidge_whatsapp-0.3.1.dist-info/licenses}/LICENSE +0 -0
@@ -0,0 +1,106 @@
1
+ // Copyright 2011 The Go Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ //go:build !cgo && (amd64 || arm64)
6
+
7
+ package fakecgo
8
+
9
+ import "unsafe"
10
+
11
+ //go:nosplit
12
+ func _cgo_sys_thread_start(ts *ThreadStart) {
13
+ var attr pthread_attr_t
14
+ var ign, oset sigset_t
15
+ var p pthread_t
16
+ var size size_t
17
+ var err int
18
+
19
+ // fprintf(stderr, "runtime/cgo: _cgo_sys_thread_start: fn=%p, g=%p\n", ts->fn, ts->g); // debug
20
+ sigfillset(&ign)
21
+ pthread_sigmask(SIG_SETMASK, &ign, &oset)
22
+
23
+ pthread_attr_init(&attr)
24
+ pthread_attr_getstacksize(&attr, &size)
25
+ // Leave stacklo=0 and set stackhi=size; mstart will do the rest.
26
+ ts.g.stackhi = uintptr(size)
27
+
28
+ err = _cgo_try_pthread_create(&p, &attr, unsafe.Pointer(threadentry_trampolineABI0), ts)
29
+
30
+ pthread_sigmask(SIG_SETMASK, &oset, nil)
31
+
32
+ if err != 0 {
33
+ print("fakecgo: pthread_create failed: ")
34
+ println(err)
35
+ abort()
36
+ }
37
+ }
38
+
39
+ // threadentry_trampolineABI0 maps the C ABI to Go ABI then calls the Go function
40
+ //
41
+ //go:linkname x_threadentry_trampoline threadentry_trampoline
42
+ var x_threadentry_trampoline byte
43
+ var threadentry_trampolineABI0 = &x_threadentry_trampoline
44
+
45
+ //go:nosplit
46
+ func threadentry(v unsafe.Pointer) unsafe.Pointer {
47
+ var ss stack_t
48
+ ts := *(*ThreadStart)(v)
49
+ free(v)
50
+
51
+ // On NetBSD, a new thread inherits the signal stack of the
52
+ // creating thread. That confuses minit, so we remove that
53
+ // signal stack here before calling the regular mstart. It's
54
+ // a bit baroque to remove a signal stack here only to add one
55
+ // in minit, but it's a simple change that keeps NetBSD
56
+ // working like other OS's. At this point all signals are
57
+ // blocked, so there is no race.
58
+ ss.ss_flags = SS_DISABLE
59
+ sigaltstack(&ss, nil)
60
+
61
+ setg_trampoline(setg_func, uintptr(unsafe.Pointer(ts.g)))
62
+
63
+ // faking funcs in go is a bit a... involved - but the following works :)
64
+ fn := uintptr(unsafe.Pointer(&ts.fn))
65
+ (*(*func())(unsafe.Pointer(&fn)))()
66
+
67
+ return nil
68
+ }
69
+
70
+ // here we will store a pointer to the provided setg func
71
+ var setg_func uintptr
72
+
73
+ //go:nosplit
74
+ func x_cgo_init(g *G, setg uintptr) {
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. */
92
+
93
+ 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)
101
+ // 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.
103
+ g.stacklo = uintptr(unsafe.Pointer(&size)) - uintptr(size) + 4096
104
+ pthread_attr_destroy(attr)
105
+ free(unsafe.Pointer(attr))
106
+ }
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // 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
6
  package fakecgo
7
7
 
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // 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
6
  package fakecgo
7
7
 
@@ -2,7 +2,7 @@
2
2
  // Use of this source code is governed by a BSD-style
3
3
  // license that can be found in the LICENSE file.
4
4
 
5
- //go:build !cgo && (darwin || freebsd || linux)
5
+ //go:build !cgo && (darwin || freebsd || linux || netbsd)
6
6
 
7
7
  // The runtime package contains an uninitialized definition
8
8
  // for runtime·iscgo. Override it to tell the runtime we're here.
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // 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
6
  package fakecgo
7
7
 
@@ -20,3 +20,7 @@ var (
20
20
  PTHREAD_COND_INITIALIZER = pthread_cond_t{sig: 0x3CB0B1BB}
21
21
  PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t{sig: 0x32AAABA7}
22
22
  )
23
+
24
+ type stack_t struct {
25
+ /* not implemented */
26
+ }
@@ -14,3 +14,7 @@ var (
14
14
  PTHREAD_COND_INITIALIZER = pthread_cond_t(0)
15
15
  PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t(0)
16
16
  )
17
+
18
+ type stack_t struct {
19
+ /* not implemented */
20
+ }
@@ -14,3 +14,7 @@ var (
14
14
  PTHREAD_COND_INITIALIZER = pthread_cond_t{}
15
15
  PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t{}
16
16
  )
17
+
18
+ type stack_t struct {
19
+ /* not implemented */
20
+ }
@@ -0,0 +1,26 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // SPDX-FileCopyrightText: 2025 The Ebitengine Authors
3
+
4
+ //go:build !cgo
5
+
6
+ package fakecgo
7
+
8
+ type (
9
+ pthread_cond_t uintptr
10
+ pthread_mutex_t uintptr
11
+ )
12
+
13
+ var (
14
+ PTHREAD_COND_INITIALIZER = pthread_cond_t(0)
15
+ PTHREAD_MUTEX_INITIALIZER = pthread_mutex_t(0)
16
+ )
17
+
18
+ // Source: https://github.com/NetBSD/src/blob/613e27c65223fd2283b6ed679da1197e12f50e27/sys/compat/linux/arch/m68k/linux_signal.h#L133
19
+ type stack_t struct {
20
+ ss_sp uintptr
21
+ ss_flags int32
22
+ ss_size uintptr
23
+ }
24
+
25
+ // Source: https://github.com/NetBSD/src/blob/613e27c65223fd2283b6ed679da1197e12f50e27/sys/sys/signal.h#L261
26
+ const SS_DISABLE = 0x004
@@ -0,0 +1,23 @@
1
+ // Copyright 2010 The Go Authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style
3
+ // license that can be found in the LICENSE file.
4
+
5
+ //go:build netbsd
6
+
7
+ package fakecgo
8
+
9
+ import _ "unsafe" // for go:linkname
10
+
11
+ // Supply environ and __progname, because we don't
12
+ // link against the standard NetBSD crt0.o and the
13
+ // libc dynamic library needs them.
14
+
15
+ //go:linkname _environ environ
16
+ //go:linkname _progname __progname
17
+ //go:linkname ___ps_strings __ps_strings
18
+
19
+ var (
20
+ _environ uintptr
21
+ _progname uintptr
22
+ ___ps_strings uintptr
23
+ )
@@ -2,7 +2,7 @@
2
2
  // Use of this source code is governed by a BSD-style
3
3
  // license that can be found in the LICENSE file.
4
4
 
5
- //go:build !cgo && (darwin || freebsd || linux)
5
+ //go:build !cgo && (darwin || freebsd || linux || netbsd)
6
6
 
7
7
  package fakecgo
8
8
 
@@ -3,7 +3,7 @@
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  // SPDX-FileCopyrightText: 2022 The Ebitengine Authors
5
5
 
6
- //go:build !cgo && (darwin || freebsd || linux)
6
+ //go:build !cgo && (darwin || freebsd || linux || netbsd)
7
7
 
8
8
  package fakecgo
9
9
 
@@ -62,6 +62,12 @@ func abort() {
62
62
  call5(abortABI0, 0, 0, 0, 0, 0)
63
63
  }
64
64
 
65
+ //go:nosplit
66
+ //go:norace
67
+ func sigaltstack(ss *stack_t, old_ss *stack_t) int32 {
68
+ return int32(call5(sigaltstackABI0, uintptr(unsafe.Pointer(ss)), uintptr(unsafe.Pointer(old_ss)), 0, 0, 0))
69
+ }
70
+
65
71
  //go:nosplit
66
72
  //go:norace
67
73
  func pthread_attr_init(attr *pthread_attr_t) int32 {
@@ -168,6 +174,10 @@ var nanosleepABI0 = uintptr(unsafe.Pointer(&_nanosleep))
168
174
  var _abort uint8
169
175
  var abortABI0 = uintptr(unsafe.Pointer(&_abort))
170
176
 
177
+ //go:linkname _sigaltstack _sigaltstack
178
+ var _sigaltstack uint8
179
+ var sigaltstackABI0 = uintptr(unsafe.Pointer(&_sigaltstack))
180
+
171
181
  //go:linkname _pthread_attr_init _pthread_attr_init
172
182
  var _pthread_attr_init uint8
173
183
  var pthread_attr_initABI0 = uintptr(unsafe.Pointer(&_pthread_attr_init))
@@ -14,6 +14,7 @@ package fakecgo
14
14
  //go:cgo_import_dynamic purego_sigfillset sigfillset "/usr/lib/libSystem.B.dylib"
15
15
  //go:cgo_import_dynamic purego_nanosleep nanosleep "/usr/lib/libSystem.B.dylib"
16
16
  //go:cgo_import_dynamic purego_abort abort "/usr/lib/libSystem.B.dylib"
17
+ //go:cgo_import_dynamic purego_sigaltstack sigaltstack "/usr/lib/libSystem.B.dylib"
17
18
  //go:cgo_import_dynamic purego_pthread_attr_init pthread_attr_init "/usr/lib/libSystem.B.dylib"
18
19
  //go:cgo_import_dynamic purego_pthread_create pthread_create "/usr/lib/libSystem.B.dylib"
19
20
  //go:cgo_import_dynamic purego_pthread_detach pthread_detach "/usr/lib/libSystem.B.dylib"
@@ -14,6 +14,7 @@ package fakecgo
14
14
  //go:cgo_import_dynamic purego_sigfillset sigfillset "libc.so.7"
15
15
  //go:cgo_import_dynamic purego_nanosleep nanosleep "libc.so.7"
16
16
  //go:cgo_import_dynamic purego_abort abort "libc.so.7"
17
+ //go:cgo_import_dynamic purego_sigaltstack sigaltstack "libc.so.7"
17
18
  //go:cgo_import_dynamic purego_pthread_attr_init pthread_attr_init "libpthread.so"
18
19
  //go:cgo_import_dynamic purego_pthread_create pthread_create "libpthread.so"
19
20
  //go:cgo_import_dynamic purego_pthread_detach pthread_detach "libpthread.so"
@@ -14,6 +14,7 @@ package fakecgo
14
14
  //go:cgo_import_dynamic purego_sigfillset sigfillset "libc.so.6"
15
15
  //go:cgo_import_dynamic purego_nanosleep nanosleep "libc.so.6"
16
16
  //go:cgo_import_dynamic purego_abort abort "libc.so.6"
17
+ //go:cgo_import_dynamic purego_sigaltstack sigaltstack "libc.so.6"
17
18
  //go:cgo_import_dynamic purego_pthread_attr_init pthread_attr_init "libpthread.so.0"
18
19
  //go:cgo_import_dynamic purego_pthread_create pthread_create "libpthread.so.0"
19
20
  //go:cgo_import_dynamic purego_pthread_detach pthread_detach "libpthread.so.0"
@@ -0,0 +1,30 @@
1
+ // Code generated by 'go generate' with gen.go. DO NOT EDIT.
2
+
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // SPDX-FileCopyrightText: 2022 The Ebitengine Authors
5
+
6
+ //go:build !cgo
7
+
8
+ package fakecgo
9
+
10
+ //go:cgo_import_dynamic purego_malloc malloc "libc.so"
11
+ //go:cgo_import_dynamic purego_free free "libc.so"
12
+ //go:cgo_import_dynamic purego_setenv setenv "libc.so"
13
+ //go:cgo_import_dynamic purego_unsetenv unsetenv "libc.so"
14
+ //go:cgo_import_dynamic purego_sigfillset sigfillset "libc.so"
15
+ //go:cgo_import_dynamic purego_nanosleep nanosleep "libc.so"
16
+ //go:cgo_import_dynamic purego_abort abort "libc.so"
17
+ //go:cgo_import_dynamic purego_sigaltstack sigaltstack "libc.so"
18
+ //go:cgo_import_dynamic purego_pthread_attr_init pthread_attr_init "libpthread.so"
19
+ //go:cgo_import_dynamic purego_pthread_create pthread_create "libpthread.so"
20
+ //go:cgo_import_dynamic purego_pthread_detach pthread_detach "libpthread.so"
21
+ //go:cgo_import_dynamic purego_pthread_sigmask pthread_sigmask "libpthread.so"
22
+ //go:cgo_import_dynamic purego_pthread_self pthread_self "libpthread.so"
23
+ //go:cgo_import_dynamic purego_pthread_get_stacksize_np pthread_get_stacksize_np "libpthread.so"
24
+ //go:cgo_import_dynamic purego_pthread_attr_getstacksize pthread_attr_getstacksize "libpthread.so"
25
+ //go:cgo_import_dynamic purego_pthread_attr_setstacksize pthread_attr_setstacksize "libpthread.so"
26
+ //go:cgo_import_dynamic purego_pthread_attr_destroy pthread_attr_destroy "libpthread.so"
27
+ //go:cgo_import_dynamic purego_pthread_mutex_lock pthread_mutex_lock "libpthread.so"
28
+ //go:cgo_import_dynamic purego_pthread_mutex_unlock pthread_mutex_unlock "libpthread.so"
29
+ //go:cgo_import_dynamic purego_pthread_cond_broadcast pthread_cond_broadcast "libpthread.so"
30
+ //go:cgo_import_dynamic purego_pthread_setspecific pthread_setspecific "libpthread.so"
@@ -0,0 +1,71 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // SPDX-FileCopyrightText: 2025 The Ebitengine Authors
3
+
4
+ //go:build !cgo && linux
5
+
6
+ #include "textflag.h"
7
+ #include "go_asm.h"
8
+
9
+ // these trampolines map the gcc ABI to Go ABI and then calls into the Go equivalent functions.
10
+
11
+ TEXT x_cgo_init_trampoline(SB), NOSPLIT, $16
12
+ MOVV R4, 8(R3)
13
+ MOVV R5, 16(R3)
14
+ MOVV ·x_cgo_init_call(SB), R6
15
+ MOVV (R6), R7
16
+ CALL (R7)
17
+ RET
18
+
19
+ TEXT x_cgo_thread_start_trampoline(SB), NOSPLIT, $8
20
+ MOVV R4, 8(R3)
21
+ MOVV ·x_cgo_thread_start_call(SB), R5
22
+ MOVV (R5), R6
23
+ CALL (R6)
24
+ RET
25
+
26
+ TEXT x_cgo_setenv_trampoline(SB), NOSPLIT, $8
27
+ MOVV R4, 8(R3)
28
+ MOVV ·x_cgo_setenv_call(SB), R5
29
+ MOVV (R5), R6
30
+ CALL (R6)
31
+ RET
32
+
33
+ TEXT x_cgo_unsetenv_trampoline(SB), NOSPLIT, $8
34
+ MOVV R4, 8(R3)
35
+ MOVV ·x_cgo_unsetenv_call(SB), R5
36
+ MOVV (R5), R6
37
+ CALL (R6)
38
+ RET
39
+
40
+ TEXT x_cgo_notify_runtime_init_done_trampoline(SB), NOSPLIT, $0
41
+ CALL ·x_cgo_notify_runtime_init_done(SB)
42
+ RET
43
+
44
+ TEXT x_cgo_bindm_trampoline(SB), NOSPLIT, $0
45
+ CALL ·x_cgo_bindm(SB)
46
+ RET
47
+
48
+ // func setg_trampoline(setg uintptr, g uintptr)
49
+ TEXT ·setg_trampoline(SB), NOSPLIT, $0
50
+ MOVV G+8(FP), R4
51
+ MOVV setg+0(FP), R5
52
+ CALL (R5)
53
+ RET
54
+
55
+ TEXT threadentry_trampoline(SB), NOSPLIT, $16
56
+ MOVV R4, 8(R3)
57
+ MOVV ·threadentry_call(SB), R5
58
+ MOVV (R5), R6
59
+ CALL (R6)
60
+ RET
61
+
62
+ TEXT ·call5(SB), NOSPLIT, $0-0
63
+ MOVV fn+0(FP), R9
64
+ MOVV a1+8(FP), R4
65
+ MOVV a2+16(FP), R5
66
+ MOVV a3+24(FP), R6
67
+ MOVV a4+32(FP), R7
68
+ MOVV a5+40(FP), R8
69
+ CALL (R9)
70
+ MOVV R4, ret+48(FP)
71
+ RET
@@ -3,7 +3,7 @@
3
3
  // SPDX-License-Identifier: Apache-2.0
4
4
  // SPDX-FileCopyrightText: 2022 The Ebitengine Authors
5
5
 
6
- //go:build !cgo && (darwin || freebsd || linux)
6
+ //go:build !cgo && (darwin || freebsd || linux || netbsd)
7
7
 
8
8
  #include "textflag.h"
9
9
 
@@ -37,6 +37,10 @@ TEXT _abort(SB), NOSPLIT|NOFRAME, $0-0
37
37
  JMP purego_abort(SB)
38
38
  RET
39
39
 
40
+ TEXT _sigaltstack(SB), NOSPLIT|NOFRAME, $0-0
41
+ JMP purego_sigaltstack(SB)
42
+ RET
43
+
40
44
  TEXT _pthread_attr_init(SB), NOSPLIT|NOFRAME, $0-0
41
45
  JMP purego_pthread_attr_init(SB)
42
46
  RET
@@ -1,7 +1,7 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // 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
6
  package purego
7
7
 
@@ -85,7 +85,7 @@ const (
85
85
  _MEMORY = 0b1111
86
86
  )
87
87
 
88
- func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []interface{}) []interface{} {
88
+ func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []any) []any {
89
89
  if v.Type().Size() == 0 {
90
90
  return keepAlive
91
91
  }
@@ -120,7 +120,7 @@ func postMerger(t reflect.Type) (passInMemory bool) {
120
120
  if t.Size() <= 2*8 {
121
121
  return false
122
122
  }
123
- return true // Go does not have an SSE/SEEUP type so this is always true
123
+ return true // Go does not have an SSE/SSEUP type so this is always true
124
124
  }
125
125
 
126
126
  func tryPlaceRegister(v reflect.Value, addFloat func(uintptr), addInt func(uintptr)) (ok bool) {
@@ -200,7 +200,7 @@ func tryPlaceRegister(v reflect.Value, addFloat func(uintptr), addInt func(uintp
200
200
  val |= f.Uint() << shift
201
201
  shift += 32
202
202
  class |= _INTEGER
203
- case reflect.Uint64, reflect.Uint:
203
+ case reflect.Uint64, reflect.Uint, reflect.Uintptr:
204
204
  val = f.Uint()
205
205
  shift = 64
206
206
  class = _INTEGER
@@ -245,7 +245,7 @@ func placeStack(v reflect.Value, addStack func(uintptr)) {
245
245
  addStack(f.Pointer())
246
246
  case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
247
247
  addStack(uintptr(f.Int()))
248
- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
248
+ case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:
249
249
  addStack(uintptr(f.Uint()))
250
250
  case reflect.Float32:
251
251
  addStack(uintptr(math.Float32bits(float32(f.Float()))))
@@ -258,3 +258,7 @@ func placeStack(v reflect.Value, addStack func(uintptr)) {
258
258
  }
259
259
  }
260
260
  }
261
+
262
+ func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr)) {
263
+ panic("purego: not needed on amd64")
264
+ }
@@ -65,7 +65,7 @@ const (
65
65
  _INT = 0b11
66
66
  )
67
67
 
68
- func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []interface{}) []interface{} {
68
+ func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFloat, addStack func(uintptr), keepAlive []any) []any {
69
69
  if v.Type().Size() == 0 {
70
70
  return keepAlive
71
71
  }
@@ -73,8 +73,8 @@ func addStruct(v reflect.Value, numInts, numFloats, numStack *int, addInt, addFl
73
73
  if hva, hfa, size := isHVA(v.Type()), isHFA(v.Type()), v.Type().Size(); hva || hfa || size <= 16 {
74
74
  // if this doesn't fit entirely in registers then
75
75
  // each element goes onto the stack
76
- if hfa && *numFloats+v.NumField() > numOfFloats {
77
- *numFloats = numOfFloats
76
+ if hfa && *numFloats+v.NumField() > numOfFloatRegisters {
77
+ *numFloats = numOfFloatRegisters
78
78
  } else if hva && *numInts+v.NumField() > numOfIntegerRegisters() {
79
79
  *numInts = numOfIntegerRegisters()
80
80
  }
@@ -107,6 +107,8 @@ func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr
107
107
  } else {
108
108
  f = v.Index(k)
109
109
  }
110
+ align := byte(f.Type().Align()*8 - 1)
111
+ shift = (shift + align) &^ align
110
112
  if shift >= 64 {
111
113
  shift = 0
112
114
  flushed = true
@@ -137,10 +139,11 @@ func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr
137
139
  val |= f.Uint() << shift
138
140
  shift += 32
139
141
  class |= _INT
140
- case reflect.Uint64:
142
+ case reflect.Uint64, reflect.Uint, reflect.Uintptr:
141
143
  addInt(uintptr(f.Uint()))
142
144
  shift = 0
143
145
  flushed = true
146
+ class = _NO_CLASS
144
147
  case reflect.Int8:
145
148
  val |= uint64(f.Int()&0xFF) << shift
146
149
  shift += 8
@@ -153,10 +156,11 @@ func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr
153
156
  val |= uint64(f.Int()&0xFFFF_FFFF) << shift
154
157
  shift += 32
155
158
  class |= _INT
156
- case reflect.Int64:
159
+ case reflect.Int64, reflect.Int:
157
160
  addInt(uintptr(f.Int()))
158
161
  shift = 0
159
162
  flushed = true
163
+ class = _NO_CLASS
160
164
  case reflect.Float32:
161
165
  if class == _FLOAT {
162
166
  addFloat(uintptr(val))
@@ -170,6 +174,12 @@ func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr
170
174
  addFloat(uintptr(math.Float64bits(float64(f.Float()))))
171
175
  shift = 0
172
176
  flushed = true
177
+ class = _NO_CLASS
178
+ case reflect.Ptr:
179
+ addInt(f.Pointer())
180
+ shift = 0
181
+ flushed = true
182
+ class = _NO_CLASS
173
183
  case reflect.Array:
174
184
  place(f)
175
185
  default:
@@ -187,7 +197,7 @@ func placeRegisters(v reflect.Value, addFloat func(uintptr), addInt func(uintptr
187
197
  }
188
198
  }
189
199
 
190
- func placeStack(v reflect.Value, keepAlive []interface{}, addInt func(uintptr)) []interface{} {
200
+ func placeStack(v reflect.Value, keepAlive []any, addInt func(uintptr)) []any {
191
201
  // Struct is too big to be placed in registers.
192
202
  // Copy to heap and place the pointer in register
193
203
  ptrStruct := reflect.New(v.Type())