add initial netbsd/amd64 support, updates libc#12

This commit is contained in:
Jan Mercl
2021-09-24 17:01:05 +02:00
parent fa683c81c6
commit 2ee0830c56
13 changed files with 480632 additions and 16 deletions

View File

@@ -42,6 +42,7 @@ build_all_targets:
GOOS=linux GOARCH=amd64 go build -v ./...
GOOS=linux GOARCH=arm go build -v ./...
GOOS=linux GOARCH=arm64 go build -v ./...
GOOS=netbsd GOARCH=amd64 go build -v ./...
#TODO GOOS=linux GOARCH=s390x go build -v ./...
GOOS=windows GOARCH=386 go build -v ./...
GOOS=windows GOARCH=amd64 go build -v ./...
@@ -59,6 +60,10 @@ freebsd_amd64:
TARGET_GOOS=freebsd TARGET_GOARCH=amd64 go generate 2>&1 | tee /tmp/log-generate-sqlite-freebsd-amd64
GOOS=freebsd GOARCH=amd64 go build -v ./...
netbsd_amd64:
TARGET_GOOS=netbsd TARGET_GOARCH=amd64 go generate 2>&1 | tee /tmp/log-generate-sqlite-netbsd-amd64
GOOS=netbsd GOARCH=amd64 go build -v ./...
linux_amd64:
TARGET_GOOS=linux TARGET_GOARCH=amd64 go generate 2>&1 | tee /tmp/log-generate-sqlite-linux-amd64
GOOS=linux GOARCH=amd64 go build -v ./...

View File

@@ -399,7 +399,7 @@ func main() {
configTest = append(configTest, "-DSQLITE_MUTEX_NOOP")
}
switch goos {
case "linux", "freebsd":
case "linux", "freebsd", "netbsd":
configProduction = append(configProduction, "-DSQLITE_OS_UNIX=1")
case "darwin":
configProduction = append(configProduction,
@@ -447,7 +447,7 @@ func configure(goos, goarch string) {
cmd.Run()
var args []string
switch goos {
case "linux", "freebsd":
case "linux", "freebsd", "netbsd":
// nop
case "darwin":
args = append(args, "--with-tcl=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework")
@@ -584,7 +584,7 @@ func makeTestfixture(goos, goarch string, more []string) {
"-DSQLITE_SERVER=1",
"-DTCLSH_INIT_PROC=sqlite3TestInit",
"-D_HAVE_SQLITE_CONFIG_H",
"-I/usr/include/tcl8.6", //TODO should not be hardcoded
"-I/usr/include/tcl8.6", //TODO linux: should not be hardcoded
"-export-defines", "",
"-export-fields", "F",
"-trace-translation-units",

8
go.mod
View File

@@ -5,9 +5,9 @@ go 1.15
require (
github.com/mattn/go-sqlite3 v1.14.8
golang.org/x/sys v0.0.0-20210902050250-f475640dd07b
modernc.org/ccgo/v3 v3.11.2
modernc.org/libc v1.11.3
modernc.org/ccgo/v3 v3.12.7
modernc.org/libc v1.11.13
modernc.org/mathutil v1.4.1
modernc.org/tcl v1.5.9
modernc.org/z v1.1.2
modernc.org/tcl v1.6.0
modernc.org/z v1.1.3
)

26
go.sum
View File

@@ -44,22 +44,30 @@ lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl
modernc.org/cc/v3 v3.33.6/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.33.9/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.33.11/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.34.0 h1:dFhZc/HKR3qp92sYQxKRRaDMz+sr1bwcFD+m7LSCrAs=
modernc.org/cc/v3 v3.34.0/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.0/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/cc/v3 v3.35.4 h1:6lfZjDfr/QMVeD+M2JumqK0479TsTGuVRt1+bNtiOdY=
modernc.org/cc/v3 v3.35.4/go.mod h1:iPJg1pkwXqAV16SNgFBVYmggfMg6xhs+2oiO0vclK3g=
modernc.org/ccgo/v3 v3.9.5/go.mod h1:umuo2EP2oDSBnD3ckjaVUXMrmeAw8C8OSICVa0iFf60=
modernc.org/ccgo/v3 v3.10.0/go.mod h1:c0yBmkRFi7uW4J7fwx/JiijwOjeAeR2NoSaRVFPmjMw=
modernc.org/ccgo/v3 v3.11.0/go.mod h1:dGNposbDp9TOZ/1KBxghxtUp/bzErD0/0QW4hhSaBMI=
modernc.org/ccgo/v3 v3.11.1/go.mod h1:lWHxfsn13L3f7hgGsGlU28D9eUOf6y3ZYHKoPaKU0ag=
modernc.org/ccgo/v3 v3.11.2 h1:gqa8PQ2v7SjrhHCgxUO5dzoAJWSLAveJqZTNkPCN0kc=
modernc.org/ccgo/v3 v3.11.2/go.mod h1:6kii3AptTDI+nUrM9RFBoIEUEisSWCbdczD9ZwQH2FE=
modernc.org/ccgo/v3 v3.11.3/go.mod h1:0oHunRBMBiXOKdaglfMlRPBALQqsfrCKXgw9okQ3GEw=
modernc.org/ccgo/v3 v3.12.4/go.mod h1:Bk+m6m2tsooJchP/Yk5ji56cClmN6R1cqc9o/YtbgBQ=
modernc.org/ccgo/v3 v3.12.6/go.mod h1:0Ji3ruvpFPpz+yu+1m0wk68pdr/LENABhTrDkMDWH6c=
modernc.org/ccgo/v3 v3.12.7 h1:gcMawTkfKjw9CKV2CbZE7dYFSBEawoTQ5p/PYPikO1M=
modernc.org/ccgo/v3 v3.12.7/go.mod h1:Hq9keM4ZfjCDuDXxaHptpv9N24JhgBZmUG5q60iLgUo=
modernc.org/httpfs v1.0.6 h1:AAgIpFZRXuYnkjftxTAZwMIiwEqAfk8aVB2/oA6nAeM=
modernc.org/httpfs v1.0.6/go.mod h1:7dosgurJGp0sPaRanU53W4xZYKh14wfzX420oZADeHM=
modernc.org/libc v1.9.8/go.mod h1:U1eq8YWr/Kc1RWCMFUWEdkTg8OTcfLw2kY8EDwl039w=
modernc.org/libc v1.9.11/go.mod h1:NyF3tsA5ArIjJ83XB0JlqhjTabTCHm9aX4XMPHyQn0Q=
modernc.org/libc v1.11.0/go.mod h1:2lOfPmj7cz+g1MrPNmX65QCzVxgNq2C5o0jdLY2gAYg=
modernc.org/libc v1.11.2/go.mod h1:ioIyrl3ETkugDO3SGZ+6EOKvlP3zSOycUETe4XM4n8M=
modernc.org/libc v1.11.3 h1:q//spBhqp23lC/if8/o8hlyET57P8mCZqrqftzT2WmY=
modernc.org/libc v1.11.3/go.mod h1:k3HDCP95A6U111Q5TmG3nAyUcp3kR5YFZTeDS9v8vSU=
modernc.org/libc v1.11.5/go.mod h1:k3HDCP95A6U111Q5TmG3nAyUcp3kR5YFZTeDS9v8vSU=
modernc.org/libc v1.11.6/go.mod h1:ddqmzR6p5i4jIGK1d/EiSw97LBcE3dK24QEwCFvgNgE=
modernc.org/libc v1.11.11/go.mod h1:lXEp9QOOk4qAYOtL3BmMve99S5Owz7Qyowzvg6LiZso=
modernc.org/libc v1.11.13 h1:D38X+lInBsmq9LYZUWOVY4X0O4569GZGXhSZ4p/j0Y4=
modernc.org/libc v1.11.13/go.mod h1:ZYawJWlXIzXy2Pzghaf7YfM8OKacP3eZQI81PDLFdY8=
modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/mathutil v1.2.2/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
modernc.org/mathutil v1.4.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
@@ -72,9 +80,9 @@ modernc.org/opt v0.1.1 h1:/0RX92k9vwVeDXj+Xn23DKp2VJubL7k8qNffND6qn3A=
modernc.org/opt v0.1.1/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
modernc.org/strutil v1.1.1 h1:xv+J1BXY3Opl2ALrBwyfEikFAj8pmqcpnfmuwUwcozs=
modernc.org/strutil v1.1.1/go.mod h1:DE+MQQ/hjKBZS2zNInV5hhcipt5rLPWkmpbGeW5mmdw=
modernc.org/tcl v1.5.9 h1:DZMfR+RDJRhcrmMEMTJgVIX+Wf5qhfVX0llI0rsc20w=
modernc.org/tcl v1.5.9/go.mod h1:bcwjvBJ2u0exY6K35eAmxXBBij5kXb1dHlAWmfhqThE=
modernc.org/tcl v1.6.0 h1:s7GY9KIdNsqdI9spYrLAd3g9bQWEU1n1Y62S8bWFtQA=
modernc.org/tcl v1.6.0/go.mod h1:cXRqaBK2zDfeEcVntrhph2Ac0lRZ4EFYhpVeVT+5kxg=
modernc.org/token v1.0.0 h1:a0jaWiNMDhDUtqOj09wvjWWAqd3q7WpBulmL9H2egsk=
modernc.org/token v1.0.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
modernc.org/z v1.1.2 h1:IjjzDsIFbl0wuF2KfwvdyUAJVwxD4iwZ6akLNiDoClM=
modernc.org/z v1.1.2/go.mod h1:sj9T1AGBG0dm6SCVzldPOHWrif6XBpooJtbttMn1+Js=
modernc.org/z v1.1.3 h1:9dRGDjXZsufTUenaOrJV0DJ84WoOJ8xuSvzNm2W7eP8=
modernc.org/z v1.1.3/go.mod h1:WdTpNodeZgXniBwc57KsEy+4LSFc0VJoUXQlvn22MUk=

View File

@@ -0,0 +1,34 @@
// Copyright 2021 The Sqlite Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package libc2 // import "modernc.org/sqlite/internal/libc2"
var CAPI = map[string]struct{}{
"__libc_cond_broadcast": {},
"__libc_cond_destroy": {},
"__libc_cond_init": {},
"__libc_cond_signal": {},
"__libc_cond_wait": {},
"__libc_create": {},
"__libc_detach": {},
"__libc_mutex_destroy": {},
"__libc_mutex_init": {},
"__libc_mutex_lock": {},
"__libc_mutex_trylock": {},
"__libc_mutex_unlock": {},
"__libc_thr_yield": {},
"pthread_cond_broadcast": {},
"pthread_cond_destroy": {},
"pthread_cond_init": {},
"pthread_cond_signal": {},
"pthread_cond_wait": {},
"pthread_create": {},
"pthread_detach": {},
"pthread_mutex_destroy": {},
"pthread_mutex_init": {},
"pthread_mutex_lock": {},
"pthread_mutex_trylock": {},
"pthread_mutex_unlock": {},
"sched_yield": {},
}

View File

@@ -0,0 +1,168 @@
// Copyright 2020 The Sqlite Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package libc2 // import "modernc.org/sqlite/internal/libc2"
import (
"fmt"
"os"
"runtime"
"strings"
"modernc.org/libc"
"modernc.org/libc/sys/types"
)
func todo(s string, args ...interface{}) string { //TODO-
switch {
case s == "":
s = fmt.Sprintf(strings.Repeat("%v ", len(args)), args...)
default:
s = fmt.Sprintf(s, args...)
}
pc, fn, fl, _ := runtime.Caller(1)
f := runtime.FuncForPC(pc)
var fns string
if f != nil {
fns = f.Name()
if x := strings.LastIndex(fns, "."); x > 0 {
fns = fns[x+1:]
}
}
r := fmt.Sprintf("%s:%d:%s: TODOTODO %s", fn, fl, fns, s) //TODOOK
fmt.Fprintf(os.Stdout, "%s\n", r)
os.Stdout.Sync()
return r
}
func trc(s string, args ...interface{}) string { //TODO-
switch {
case s == "":
s = fmt.Sprintf(strings.Repeat("%v ", len(args)), args...)
default:
s = fmt.Sprintf(s, args...)
}
_, fn, fl, _ := runtime.Caller(1)
r := fmt.Sprintf("\n%s:%d: TRC %s", fn, fl, s)
fmt.Fprintf(os.Stdout, "%s\n", r)
os.Stdout.Sync()
return r
}
// int sched_yield(void);
func Xsched_yield(tls *libc.TLS) int32 {
panic(todo(""))
}
func X__libc_thr_yield(tls *libc.TLS) int32 {
panic(todo(""))
}
// int pthread_create(pthread_t *thread, const pthread_attr_t *attr, void *(*start_routine) (void *), void *arg);
func X__libc_create(tls *libc.TLS, thread, attr, start_routine, arg uintptr) int32 {
panic(todo(""))
}
func Xpthread_create(tls *libc.TLS, thread, attr, start_routine, arg uintptr) int32 {
panic(todo(""))
}
// int pthread_detach(pthread_t thread);
func X__libc_detach(tls *libc.TLS, thread types.Pthread_t) int32 {
panic(todo(""))
}
func Xpthread_detach(tls *libc.TLS, thread types.Pthread_t) int32 {
panic(todo(""))
}
// int pthread_mutex_lock(pthread_mutex_t *mutex);
func X__libc_mutex_lock(tls *libc.TLS, mutex uintptr) int32 {
panic(todo(""))
}
func Xpthread_mutex_lock(tls *libc.TLS, mutex uintptr) int32 {
panic(todo(""))
}
// int pthread_cond_signal(pthread_cond_t *cond);
func X__libc_cond_signal(tls *libc.TLS, cond uintptr) int32 {
panic(todo(""))
}
func Xpthread_cond_signal(tls *libc.TLS, cond uintptr) int32 {
panic(todo(""))
}
// int pthread_mutex_unlock(pthread_mutex_t *mutex);
func X__libc_mutex_unlock(tls *libc.TLS, mutex uintptr) int32 {
panic(todo(""))
}
func Xpthread_mutex_unlock(tls *libc.TLS, mutex uintptr) int32 {
panic(todo(""))
}
// int pthread_mutex_init(pthread_mutex_t *restrict mutex, const pthread_mutexattr_t *restrict attr);
func X__libc_mutex_init(tls *libc.TLS, mutex, attr uintptr) int32 {
panic(todo(""))
}
func Xpthread_mutex_init(tls *libc.TLS, mutex, attr uintptr) int32 {
panic(todo(""))
}
// int pthread_cond_init(pthread_cond_t *restrict cond, const pthread_condattr_t *restrict attr);
func X__libc_cond_init(tls *libc.TLS, cond, attr uintptr) int32 {
panic(todo(""))
}
func Xpthread_cond_init(tls *libc.TLS, cond, attr uintptr) int32 {
panic(todo(""))
}
// int pthread_cond_wait(pthread_cond_t *restrict cond, pthread_mutex_t *restrict mutex);
func X__libc_cond_wait(tls *libc.TLS, cond, mutex uintptr) int32 {
panic(todo(""))
}
func Xpthread_cond_wait(tls *libc.TLS, cond, mutex uintptr) int32 {
panic(todo(""))
}
// int pthread_cond_destroy(pthread_cond_t *cond);
func X__libc_cond_destroy(tls *libc.TLS, cond uintptr) int32 {
panic(todo(""))
}
func Xpthread_cond_destroy(tls *libc.TLS, cond uintptr) int32 {
panic(todo(""))
}
// int pthread_mutex_destroy(pthread_mutex_t *mutex);
func X__libc_mutex_destroy(tls *libc.TLS, mutex uintptr) int32 {
panic(todo(""))
}
func Xpthread_mutex_destroy(tls *libc.TLS, mutex uintptr) int32 {
panic(todo(""))
}
// int pthread_mutex_trylock(pthread_mutex_t *mutex);
func X__libc_mutex_trylock(tls *libc.TLS, mutex uintptr) int32 {
panic(todo(""))
}
func Xpthread_mutex_trylock(tls *libc.TLS, mutex uintptr) int32 {
panic(todo(""))
}
// int pthread_cond_broadcast(pthread_cond_t *cond);
func X__libc_cond_broadcast(tls *libc.TLS, cond uintptr) int32 {
panic(todo(""))
}
func Xpthread_cond_broadcast(tls *libc.TLS, cond uintptr) int32 {
panic(todo(""))
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

1304
lib/capi_netbsd_amd64.go Normal file

File diff suppressed because it is too large Load Diff

190486
lib/sqlite_netbsd_amd64.go Normal file

File diff suppressed because one or more lines are too long

1345
libtest/capi_netbsd_amd64.go Normal file

File diff suppressed because it is too large Load Diff

194192
libtest/sqlite_netbsd_amd64.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