Skip to content

Commit ea5b3fb

Browse files
authored
ci(sdk): fix release workflow (#881)
Signed-off-by: Andrii Holovko <andriy.holovko@gmail.com>
1 parent 3703848 commit ea5b3fb

3 files changed

Lines changed: 44 additions & 23 deletions

File tree

.github/workflows/release.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ jobs:
3333
git clone https://go.googlesource.com/go goroot
3434
cd goroot
3535
git checkout go1.25.3
36-
cp ../wallet-sdk/cmd/wallet-sdk-gomobile/gopatches/* ./
37-
git revert 3560cf0afb3c29300a6c88ccd98256949ca7a6f6
36+
git apply ../wallet-sdk/cmd/wallet-sdk-gomobile/gopatches/01-cgo-alignment-fix-go1.25.3.patch
3837
cd src && ./make.bash
3938
- name: Derive the new version
4039
run: |
@@ -99,8 +98,7 @@ jobs:
9998
git clone https://go.googlesource.com/go goroot
10099
cd goroot
101100
git checkout go1.25.3
102-
cp ../wallet-sdk/cmd/wallet-sdk-gomobile/gopatches/* ./
103-
git revert 3560cf0afb3c29300a6c88ccd98256949ca7a6f6
101+
git apply ../wallet-sdk/cmd/wallet-sdk-gomobile/gopatches/01-cgo-alignment-fix-go1.25.3.patch
104102
cd src && ./make.bash
105103
- name: Derive the new version
106104
run: |
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
Subject: [PATCH] cmd/cgo: fix unaligned arguments typedmemmove crash on iOS (go1.25.3)
2+
3+
---
4+
src/cmd/cgo/out.go | 9 ++++++++-
5+
1 file changed, 8 insertions(+), 1 deletion(-)
6+
7+
diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go
8+
index 10870b7c85..3027217b3f 100644
9+
--- a/src/cmd/cgo/out.go
10+
+++ b/src/cmd/cgo/out.go
11+
@@ -949,6 +949,8 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
12+
fmt.Fprintf(gotype, "struct {\n")
13+
off := int64(0)
14+
npad := 0
15+
+ // the align is at least 1 (for char)
16+
+ maxAlign := int64(1)
17+
argField := func(typ ast.Expr, namePat string, args ...interface{}) {
18+
name := fmt.Sprintf(namePat, args...)
19+
t := p.cgoType(typ)
20+
@@ -963,6 +965,11 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
21+
noSourceConf.Fprint(gotype, fset, typ)
22+
fmt.Fprintf(gotype, "\n")
23+
off += t.Size
24+
+ // keep track of the maximum alignment among all fields
25+
+ // so that we can align the struct correctly
26+
+ if t.Align > maxAlign {
27+
+ maxAlign = t.Align
28+
+ }
29+
}
30+
if fn.Recv != nil {
31+
argField(fn.Recv.List[0].Type, "recv")
32+
@@ -1051,7 +1058,7 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
33+
// string.h for memset, and is also robust to C++
34+
// types with constructors. Both GCC and LLVM optimize
35+
// this into just zeroing _cgo_a.
36+
- fmt.Fprintf(fgcc, "\ttypedef %s %v _cgo_argtype;\n", ctype.String(), p.packedAttribute())
37+
+ fmt.Fprintf(fgcc, "\ttypedef %s %v __attribute__((aligned(%d))) _cgo_argtype;\n", ctype.String(), p.packedAttribute(), maxAlign)
38+
fmt.Fprintf(fgcc, "\tstatic _cgo_argtype _cgo_zero;\n")
39+
fmt.Fprintf(fgcc, "\t_cgo_argtype _cgo_a = _cgo_zero;\n")
40+
if gccResult != "void" && (len(fntype.Results.List) > 1 || len(fntype.Results.List[0].Names) > 1) {
41+
--
42+
2.39.0

cmd/wallet-sdk-gomobile/gopatches/cmd_cgo__fix_unaligned_arguments_typedmemmove_crash_on_iOS.patch

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)