mirror of
https://github.com/golang/go
synced 2024-11-25 08:57:58 -07:00
cmd/cgo: fix unaligned arguments typedmemmove crash on iOS
Irregularly typedmemmove and bulkBarrierPreWrite crashes on unaligned arguments. By aligning the arguments on 8 bytes this is fixed. Fixes #46893
This commit is contained in:
parent
7791e934c8
commit
f0cb9ff35c
@ -1003,7 +1003,7 @@ func (p *Package) writeExports(fgo2, fm, fgcc, fgcch io.Writer) {
|
||||
// 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(8))) _cgo_argtype;\n", ctype, p.packedAttribute())
|
||||
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) {
|
||||
|
Loading…
Reference in New Issue
Block a user