File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -635,6 +635,7 @@ endif
635
635
GOOS=linux GOARCH=arm $(TINYGO) build -size short -o test.elf ./testdata/cgo
636
636
GOOS=windows GOARCH=amd64 $(TINYGO) build -size short -o test.exe ./testdata/cgo
637
637
GOOS=darwin GOARCH=amd64 $(TINYGO) build -o test ./testdata/cgo
638
+ GOOS=darwin GOARCH=arm64 $(TINYGO) build -o test ./testdata/cgo
638
639
ifneq ($(OS ) ,Windows_NT)
639
640
# TODO: this does not yet work on Windows. Somehow, unused functions are
640
641
# not garbage collected.
Original file line number Diff line number Diff line change
1
+ #ifdef __MACH__
2
+ . global _tinygo_startTask
3
+ _tinygo_startTask:
4
+ #else
1
5
. section .text.tinygo_startTask
2
6
. global tinygo_startTask
3
7
.type tinygo_startTask , %function
4
8
tinygo_startTask:
9
+ #endif
5
10
.cfi_startproc
6
11
// Small assembly stub for starting a goroutine. This is already run on the
7
12
// new stack , with the callee - saved registers already loaded.
@@ -23,13 +28,25 @@ tinygo_startTask:
23
28
blr x19
24
29
25
30
// After return , exit this goroutine. This is a tail call .
31
+ #ifdef __MACH__
32
+ b _tinygo_pause
33
+ #else
26
34
b tinygo_pause
35
+ #endif
27
36
.cfi_endproc
37
+ #ifndef __MACH__
28
38
.size tinygo_startTask , . - tinygo_startTask
39
+ #endif
29
40
41
+
42
+ #ifdef __MACH__
43
+ . global _tinygo_swapTask
44
+ _tinygo_swapTask:
45
+ #else
30
46
. global tinygo_swapTask
31
47
.type tinygo_swapTask , %function
32
48
tinygo_swapTask:
49
+ #endif
33
50
// This function gets the following parameters:
34
51
// x0 = newStack uintptr
35
52
// x1 = oldStack * uintptr
Original file line number Diff line number Diff line change
1
+ #ifdef __MACH__
2
+ . global _tinygo_scanCurrentStack
3
+ _tinygo_scanCurrentStack:
4
+ #else
1
5
. section .text.tinygo_scanCurrentStack
2
6
. global tinygo_scanCurrentStack
3
7
.type tinygo_scanCurrentStack , %function
4
8
tinygo_scanCurrentStack:
9
+ #endif
5
10
// Sources:
6
11
// * https://developer.arm.com/architectures/learn - the - architecture/armv8 - a - instruction - set - architecture/procedure - call - standard
7
12
// * https://godbolt.org/z/qrvrEh
@@ -16,7 +21,11 @@ tinygo_scanCurrentStack:
16
21
17
22
// Scan the stack.
18
23
mov x0 , sp
24
+ #ifdef __MACH__
25
+ bl _tinygo_scanstack
26
+ #else
19
27
bl tinygo_scanstack
28
+ #endif
20
29
21
30
// Restore stack state and return.
22
31
ldp x29 , x30 , [ sp ], # 96
You can’t perform that action at this time.
0 commit comments