internal/cabi: support riscv64/riscv32 target-abi

This commit is contained in:
visualfc
2025-09-15 21:18:23 +08:00
parent 8bfe133bee
commit db28648d29
142 changed files with 93780 additions and 2580 deletions

View File

@@ -6,6 +6,8 @@ const (
LLGoFiles = "../wrap/struct_mixed.c"
)
type pointer = *int8
//go:linkname printf C.printf
func printf(format *byte, __llgo_va_list ...any) int32
@@ -110,7 +112,7 @@ func init() {
type point6 struct {
x0 int8
x1 uintptr
x1 pointer
}
//go:linkname cdemo6 C.demo6
@@ -121,7 +123,7 @@ func demo6(a point6) point6 {
}
func init() {
a := point6{1, 2}
a := point6{1, func() pointer { var a int8 = 2; return &a}()}
assert("cdemo6\000", cdemo6(a) == a)
assert("demo6\000", demo6(a) == a)
}
@@ -218,7 +220,7 @@ func init() {
type point12 struct {
x0 int16
x1 uintptr
x1 pointer
}
//go:linkname cdemo12 C.demo12
@@ -229,7 +231,7 @@ func demo12(a point12) point12 {
}
func init() {
a := point12{1, 2}
a := point12{1, func() pointer { var a int8 = 2; return &a}()}
assert("cdemo12\000", cdemo12(a) == a)
assert("demo12\000", demo12(a) == a)
}
@@ -326,7 +328,7 @@ func init() {
type point18 struct {
x0 int32
x1 uintptr
x1 pointer
}
//go:linkname cdemo18 C.demo18
@@ -337,7 +339,7 @@ func demo18(a point18) point18 {
}
func init() {
a := point18{1, 2}
a := point18{1, func() pointer { var a int8 = 2; return &a}()}
assert("cdemo18\000", cdemo18(a) == a)
assert("demo18\000", demo18(a) == a)
}
@@ -434,7 +436,7 @@ func init() {
type point24 struct {
x0 int64
x1 uintptr
x1 pointer
}
//go:linkname cdemo24 C.demo24
@@ -445,7 +447,7 @@ func demo24(a point24) point24 {
}
func init() {
a := point24{1, 2}
a := point24{1, func() pointer { var a int8 = 2; return &a}()}
assert("cdemo24\000", cdemo24(a) == a)
assert("demo24\000", demo24(a) == a)
}
@@ -542,7 +544,7 @@ func init() {
type point30 struct {
x0 float32
x1 uintptr
x1 pointer
}
//go:linkname cdemo30 C.demo30
@@ -553,7 +555,7 @@ func demo30(a point30) point30 {
}
func init() {
a := point30{1, 2}
a := point30{1, func() pointer { var a int8 = 2; return &a}()}
assert("cdemo30\000", cdemo30(a) == a)
assert("demo30\000", demo30(a) == a)
}
@@ -650,7 +652,7 @@ func init() {
type point36 struct {
x0 float64
x1 uintptr
x1 pointer
}
//go:linkname cdemo36 C.demo36
@@ -661,13 +663,13 @@ func demo36(a point36) point36 {
}
func init() {
a := point36{1, 2}
a := point36{1, func() pointer { var a int8 = 2; return &a}()}
assert("cdemo36\000", cdemo36(a) == a)
assert("demo36\000", demo36(a) == a)
}
type point37 struct {
x0 uintptr
x0 pointer
x1 int8
}
@@ -679,13 +681,13 @@ func demo37(a point37) point37 {
}
func init() {
a := point37{1, 2}
a := point37{func() pointer { var a int8 = 1; return &a}(), 2}
assert("cdemo37\000", cdemo37(a) == a)
assert("demo37\000", demo37(a) == a)
}
type point38 struct {
x0 uintptr
x0 pointer
x1 int16
}
@@ -697,13 +699,13 @@ func demo38(a point38) point38 {
}
func init() {
a := point38{1, 2}
a := point38{func() pointer { var a int8 = 1; return &a}(), 2}
assert("cdemo38\000", cdemo38(a) == a)
assert("demo38\000", demo38(a) == a)
}
type point39 struct {
x0 uintptr
x0 pointer
x1 int32
}
@@ -715,13 +717,13 @@ func demo39(a point39) point39 {
}
func init() {
a := point39{1, 2}
a := point39{func() pointer { var a int8 = 1; return &a}(), 2}
assert("cdemo39\000", cdemo39(a) == a)
assert("demo39\000", demo39(a) == a)
}
type point40 struct {
x0 uintptr
x0 pointer
x1 int64
}
@@ -733,13 +735,13 @@ func demo40(a point40) point40 {
}
func init() {
a := point40{1, 2}
a := point40{func() pointer { var a int8 = 1; return &a}(), 2}
assert("cdemo40\000", cdemo40(a) == a)
assert("demo40\000", demo40(a) == a)
}
type point41 struct {
x0 uintptr
x0 pointer
x1 float32
}
@@ -751,13 +753,13 @@ func demo41(a point41) point41 {
}
func init() {
a := point41{1, 2}
a := point41{func() pointer { var a int8 = 1; return &a}(), 2}
assert("cdemo41\000", cdemo41(a) == a)
assert("demo41\000", demo41(a) == a)
}
type point42 struct {
x0 uintptr
x0 pointer
x1 float64
}
@@ -769,7 +771,7 @@ func demo42(a point42) point42 {
}
func init() {
a := point42{1, 2}
a := point42{func() pointer { var a int8 = 1; return &a}(), 2}
assert("cdemo42\000", cdemo42(a) == a)
assert("demo42\000", demo42(a) == a)
}