-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sdk): patched GO to fix iOS missaligment bug. (#765)
feat(sdk): patched GO to fix iOS missaligment bug Signed-off-by: Volodymyr Kubiv <[email protected]>
- Loading branch information
Showing
2 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...t-sdk-gomobile/gopatches/cmd_cgo__fix_unaligned_arguments_typedmemmove_crash_on_iOS.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Subject: [PATCH] cmd/cgo: fix unaligned arguments typedmemmove crash on iOS | ||
--- | ||
Index: src/cmd/cgo/out.go | ||
IDEA additional info: | ||
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | ||
<+>UTF-8 | ||
=================================================================== | ||
diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go | ||
--- a/src/cmd/cgo/out.go (revision dddf0ae40fa0c1223aba191d73a44425a08e1035) | ||
+++ b/src/cmd/cgo/out.go (date 1712322519672) | ||
@@ -1029,7 +1029,7 @@ | ||
// string.h for memset, and is also robust to C++ | ||
// types with constructors. Both GCC and LLVM optimize | ||
// this into just zeroing _cgo_a. | ||
- fmt.Fprintf(fgcc, "\ttypedef %s %v _cgo_argtype;\n", ctype, p.packedAttribute()) | ||
+ fmt.Fprintf(fgcc, "\ttypedef %s %v __attribute__((aligned(%d))) _cgo_argtype;\n", ctype, p.packedAttribute(), p.PtrSize) | ||
fmt.Fprintf(fgcc, "\tstatic _cgo_argtype _cgo_zero;\n") | ||
fmt.Fprintf(fgcc, "\t_cgo_argtype _cgo_a = _cgo_zero;\n") | ||
if gccResult != "void" && (len(fntype.Results.List) > 1 || len(fntype.Results.List[0].Names) > 1) { |