0
0
mirror of https://gitlab.com/cznic/sqlite.git synced 2025-04-27 23:07:44 +00:00

upgrade to SQLite 3.45.2, support linux/loong64

This commit is contained in:
Jan Mercl
2024-04-15 14:02:08 +02:00
parent 21d90b260e
commit 2baa790963
24 changed files with 298895 additions and 47074 deletions

@ -29,6 +29,8 @@ build_all_targets:
GOOS=linux GOARCH=arm go build -v ./...
GOOS=linux GOARCH=arm64 go test -c -o /dev/null
GOOS=linux GOARCH=arm64 go build -v ./...
GOOS=linux GOARCH=loong64 go test -c -o /dev/null
GOOS=linux GOARCH=loong64 go build -v ./...
GOOS=linux GOARCH=ppc64le go test -c -o /dev/null
GOOS=linux GOARCH=ppc64le go build -v ./...
GOOS=linux GOARCH=riscv64 go test -c -o /dev/null
@ -55,7 +57,7 @@ clean:
edit:
@touch log
@if [ -f "Session.vim" ]; then novim -S & else novim -p Makefile go.mod builder.json all_test.go generator.go & fi
@if [ -f "Session.vim" ]; then novim -S & else novim -p Makefile go.mod builder.json all_test.go vendor_libsqlite3.go & fi
editor:
gofmt -l -s -w . 2>&1 | tee log-editor
@ -64,7 +66,7 @@ editor:
go build -o /dev/null vendor_libsqlite3.go
test:
go test -v -timeout 24h 2>&1 | tee log-test
go test -v -timeout 24h . ./functest 2>&1 | tee log-test
vendor:
go run vendor_libsqlite3.go && make build_all_targets

@ -1,6 +1,6 @@
{
"autogen": "<none>",
"autotag": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|ppc64le|riscv64|s390x)|windows/(amd64|arm64)",
"autotag": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loong64|ppc64le|riscv64|s390x)|windows/(amd64|arm64)",
"autoupdate": "<none>",
"test": "darwin/(amd64|arm64)|freebsd/(amd64|arm64)|linux/(386|amd64|arm|arm64|loon64|ppc64le|riscv64|s390x)|windows/(amd64|arm64)"
}

27
doc.go

@ -19,19 +19,20 @@
//
// OS Arch SQLite version
// ------------------------------
// darwin amd64 3.45.1
// darwin arm64 3.45.1
// freebsd amd64 3.45.1
// freebsd arm64 3.45.1
// linux 386 3.45.1
// linux amd64 3.45.1
// linux arm 3.45.1
// linux arm64 3.45.1
// linux ppc64le 3.45.1
// linux riscv64 3.45.1
// linux s390x 3.45.1
// windows amd64 3.45.1
// windows arm64 3.45.1
// darwin amd64 3.45.2
// darwin arm64 3.45.2
// freebsd amd64 3.45.2
// freebsd arm64 3.45.2
// linux 386 3.45.2
// linux amd64 3.45.2
// linux arm 3.45.2
// linux arm64 3.45.2
// linux loong64 3.45.2
// linux ppc64le 3.45.2
// linux riscv64 3.45.2
// linux s390x 3.45.2
// windows amd64 3.45.2
// windows arm64 3.45.2
//
// # Builders
//

15
go.mod

@ -3,25 +3,24 @@ module modernc.org/sqlite
go 1.20
require (
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26
github.com/klauspost/cpuid/v2 v2.2.3
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd
github.com/klauspost/cpuid/v2 v2.2.7
github.com/mattn/go-sqlite3 v1.14.22
golang.org/x/sys v0.16.0
golang.org/x/sys v0.19.0
modernc.org/fileutil v1.3.0
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6
modernc.org/libc v1.41.0
modernc.org/libc v1.49.3
modernc.org/mathutil v1.6.0
)
require (
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
golang.org/x/tools v0.17.0 // indirect
modernc.org/memory v1.7.2 // indirect
modernc.org/memory v1.8.0 // indirect
modernc.org/strutil v1.2.0 // indirect
modernc.org/token v1.1.0 // indirect
)

42
go.sum

@ -1,15 +1,15 @@
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26 h1:Xim43kblpZXfIBQsbuBVKCudVG457BR2GZFIz3uw3hQ=
github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd h1:gbpYu9NMq8jhDVbvlGkMFWCjLFlqqEZjEmObmhUy6Vo=
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k=
github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM=
github.com/klauspost/cpuid/v2 v2.2.3 h1:sxCkb+qR91z4vsqw4vGGZlDgPz3G7gjaLyK3V8y70BU=
github.com/klauspost/cpuid/v2 v2.2.3/go.mod h1:RVVoqg1df56z8g3pUjL/3lE5UfnlrJX8tyFgg4nqhuY=
github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
@ -17,23 +17,27 @@ github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJm
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
golang.org/x/mod v0.14.0 h1:dGoOF9QVLYng8IHTm7BAyWqCqSheQ5pYWGhzW00YJr0=
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.16.0 h1:xWw16ngr6ZMtmxDyKyIgsE93KNKz5HKmMa3b8ALHidU=
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/tools v0.17.0 h1:FvmRgNOcs3kOa+T20R1uhfP9F6HgG2mfxDv1vrx1Htc=
golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps=
golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw=
modernc.org/cc/v4 v4.20.0 h1:45Or8mQfbUqJOG9WaxvlFYOAQO0lQ5RvqBcFCXngjxk=
modernc.org/ccgo/v4 v4.16.0 h1:ofwORa6vx2FMm0916/CkZjpFPSR70VwTjUCe2Eg5BnA=
modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE=
modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ=
modernc.org/gc/v2 v2.4.1 h1:9cNzOqPyMJBvrUipmynX0ZohMhcxPtMccYgGOJdOiBw=
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 h1:5D53IMaUuA5InSeMu9eJtlQXS2NxAhyWQvkKEgXZhHI=
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6/go.mod h1:Qz0X07sNOR1jWYCrJMEnbW/X55x206Q7Vt4mz6/wHp4=
modernc.org/libc v1.41.0 h1:g9YAc6BkKlgORsUWj+JwqoB1wU3o4DE3bM3yvA3k+Gk=
modernc.org/libc v1.41.0/go.mod h1:w0eszPsiXoOnoMJgrXjglgLuDy/bt5RR4y3QzUUeodY=
modernc.org/libc v1.49.3 h1:j2MRCRdwJI2ls/sGbeSk0t2bypOG/uvPZUsGQFDulqg=
modernc.org/libc v1.49.3/go.mod h1:yMZuGkn7pXbKfoT/M35gFJOAEdSKdxL0q64sF7KqCDo=
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo=
modernc.org/memory v1.7.2 h1:Klh90S215mmH8c9gO98QxQFsY+W451E8AnzjoE2ee1E=
modernc.org/memory v1.7.2/go.mod h1:NO4NVCQy0N7ln+T9ngWqOQfi7ley4vpwvARR+Hjw95E=
modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E=
modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU=
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc=
modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA=
modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

223815
lib/sqlite_linux_loong64.go Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1207,8 +1207,8 @@ func (c *conn) bindText(pstmt uintptr, idx1 int, value string) (uintptr, error)
//
// int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*));
func (c *conn) bindBlob(pstmt uintptr, idx1 int, value []byte) (uintptr, error) {
if value != nil && len(value) == 0 {
if rc := sqlite3.Xsqlite3_bind_zeroblob(c.tls, pstmt, int32(idx1), 0); rc != sqlite3.SQLITE_OK {
if value == nil {
if rc := sqlite3.Xsqlite3_bind_null(c.tls, pstmt, int32(idx1)); rc != sqlite3.SQLITE_OK {
return 0, c.errstr(rc)
}
return 0, nil

@ -35,6 +35,7 @@ func main() {
{"linux", "amd64"},
{"linux", "arm"},
{"linux", "arm64"},
{"linux", "loong64"},
{"linux", "ppc64le"},
{"linux", "riscv64"},
{"linux", "s390x"},

@ -51,16 +51,24 @@ edit:
@touch log
@if [ -f "Session.vim" ]; then gvim -S & else gvim -p Makefile *.c *.go & fi
FN=vfs_$(shell go env GOOS)_$(shell go env GOARCH).go
editor:
ccgo -o vfs_$(shell go env GOOS)_$(shell go env GOARCH).go c/vfs.c -I../testdata/sqlite-amalgamation-3390300 \
-lmodernc.org/sqlite/lib -pkgname vfs -nocapi \
-export-externs X -D SQLITE_OS_UNIX \
ccgo -o $(FN) c/vfs.c -Isqlite-amalgamation-3450200 \
-D SQLITE_OS_UNIX \
-extended-errors \
-hide=vfsAccess \
-hide=vfsClose \
-hide=vfsFileSize \
-hide=vfsFullPathname \
-hide=vfsOpen \
-hide=vfsRead \
-hide=vfsAccess \
-hide=vfsFileSize \
-hide=vfsClose
-ignore-link-errors \
-import modernc.org/sqlite/lib \
--package-name vfs \
--prefix-external X
sed -i 's/\<sqlite3_snprintf\>/sqlite3.Xsqlite3_snprintf/' $(FN)
sed -i 's/\<sqlite3_malloc\>/sqlite3.Xsqlite3_malloc/' $(FN)
go build -v
gofmt -l -s -w *.go
go test -o /dev/null -c

@ -207,7 +207,7 @@ static int vfsFlushBuffer(VFSFile *p){
/*
** Close a file.
*/
static int vfsClose(sqlite3_file *pFile){
int vfsClose(sqlite3_file *pFile){
hook
int rc;
VFSFile *p = (VFSFile*)pFile;
@ -220,7 +220,7 @@ static int vfsClose(sqlite3_file *pFile){
/*
** Read data from a file.
*/
static int vfsRead(
int vfsRead(
sqlite3_file *pFile,
void *zBuf,
int iAmt,
@ -344,7 +344,7 @@ static int vfsSync(sqlite3_file *pFile, int flags){
/*
** Write the size of the file in bytes to *pSize.
*/
static int vfsFileSize(sqlite3_file *pFile, sqlite_int64 *pSize){
int vfsFileSize(sqlite3_file *pFile, sqlite_int64 *pSize){
hook
VFSFile *p = (VFSFile*)pFile;
int rc; /* Return code from fstat() call */
@ -405,7 +405,7 @@ static int vfsDeviceCharacteristics(sqlite3_file *pFile){
/*
** Open a file handle.
*/
static int vfsOpen(
int vfsOpen(
sqlite3_vfs *pVfs, /* VFS */
const char *zName, /* File to open, or 0 for a temp file */
sqlite3_file *pFile, /* Pointer to VFSFile struct to populate */
@ -513,7 +513,7 @@ static int vfsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){
** Query the file-system to see if the named file exists, is readable or
** is both readable and writable.
*/
static int vfsAccess(
int vfsAccess(
sqlite3_vfs *pVfs,
const char *zPath,
int flags,
@ -547,7 +547,7 @@ static int vfsAccess(
** 1. Path components are separated by a '/'. and
** 2. Full paths begin with a '/' character.
*/
static int vfsFullPathname(
int vfsFullPathname(
sqlite3_vfs *pVfs, /* VFS */
const char *zPath, /* Input path (possibly a relative path) */
int nPathOut, /* Size of output buffer in bytes */

@ -1324,7 +1324,7 @@ func vfsWrite(tls *libc.TLS, pFile uintptr, zBuf uintptr, iAmt int32, iOfst sqli
}
if (*VFSFile)(unsafe.Pointer(p)).nBuffer == 0 || (*VFSFile)(unsafe.Pointer(p)).iBufferOfst+sqlite3_int64((*VFSFile)(unsafe.Pointer(p)).nBuffer) == i {
} else {
libc.X__assert_fail(tls, ts+43, ts+89, uint32(296), uintptr(unsafe.Pointer(&__func__4)))
libc.X__assert_fail(tls, ts+43, ts+89, 296, uintptr(unsafe.Pointer(&__func__4)))
}
(*VFSFile)(unsafe.Pointer(p)).iBufferOfst = i - sqlite3_int64((*VFSFile)(unsafe.Pointer(p)).nBuffer)

2756
vfs/vfs_linux_loong64.go Normal file

File diff suppressed because it is too large Load Diff