0
0
mirror of https://gitlab.com/cznic/sqlite.git synced 2025-08-26 01:02:26 +00:00

linux/arm64: patch libc bug at runtime, updates #199

This commit is contained in:
Jan Mercl
2024-12-16 14:58:06 +01:00
parent fe367e39dd
commit 7f15e6eb45
2 changed files with 26 additions and 0 deletions

View File

@@ -5,6 +5,10 @@
package sqlite3
import (
"runtime"
"syscall"
"unsafe"
"modernc.org/libc"
)
@@ -12,3 +16,20 @@ import (
func X__ccgo_sqlite3_log(t *libc.TLS, iErrCode int32, zFormat uintptr, va uintptr) { /* sqlite3.c:29405:17: */
libc.X__ccgo_sqlite3_log(t, iErrCode, zFormat, va)
}
// https://gitlab.com/cznic/sqlite/-/issues/199
//
// We are currently stuck on libc@v1.55.3. Until that is resolved - fix the
// problem at runtime.
func PatchIssue199() {
if runtime.GOOS != "linux" || runtime.GOARCH != "arm64" {
return
}
p := unsafe.Pointer(&_aSyscall)
*(*uintptr)(unsafe.Add(p, 608)) = __ccgo_fp(_unixGetpagesizeIssue199)
}
func _unixGetpagesizeIssue199(tls *libc.TLS) (r int32) {
return int32(syscall.Getpagesize())
}

View File

@@ -56,6 +56,11 @@ const (
sqliteLockedSharedcache = sqlite3.SQLITE_LOCKED | (1 << 8)
)
// https://gitlab.com/cznic/sqlite/-/issues/199
func init() {
sqlite3.PatchIssue199()
}
// Error represents sqlite library error code.
type Error struct {
msg string