aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDamian Gryski <[email protected]>2021-09-05 17:32:00 -0700
committerRon Evans <[email protected]>2021-09-07 08:00:11 +0200
commit32de906f6d8d76e8ad0ce663c34b23760b05d809 (patch)
tree174975064aec6cfd5a9febaa544715d5f05fee3c
parenteaab05fc43129d3ac816ece486498c0b752a1262 (diff)
downloadtinygo-32de906f6d8d76e8ad0ce663c34b23760b05d809.tar.gz
tinygo-32de906f6d8d76e8ad0ce663c34b23760b05d809.zip
internal/task, runtime: add subsections_via_symbols to assembly files on darwin
This allows the assembly routines in these files to be stripped as dead code if they're not referenced. This solves the link issues on MacOS when the `leaking` garbage collector or the `coroutines` scheduler are selected. Fixes #2081
-rw-r--r--src/internal/task/task_stack_amd64.S5
-rw-r--r--src/runtime/gc_amd64.S5
2 files changed, 10 insertions, 0 deletions
diff --git a/src/internal/task/task_stack_amd64.S b/src/internal/task/task_stack_amd64.S
index 44b5f065b..f9182d49f 100644
--- a/src/internal/task/task_stack_amd64.S
+++ b/src/internal/task/task_stack_amd64.S
@@ -72,3 +72,8 @@ tinygo_swapTask:
// Return into the new task, as if tinygo_swapTask was a regular call.
ret
+
+#ifdef __MACH__ // Darwin
+// allow these symbols to stripped as dead code
+.subsections_via_symbols
+#endif
diff --git a/src/runtime/gc_amd64.S b/src/runtime/gc_amd64.S
index fa89479f8..c0ad7bc88 100644
--- a/src/runtime/gc_amd64.S
+++ b/src/runtime/gc_amd64.S
@@ -27,3 +27,8 @@ _tinygo_scanCurrentStack:
// were only pushed to be discoverable by the GC.
addq $56, %rsp
retq
+
+#ifdef __MACH__ // Darwin
+// allow these symbols to stripped as dead code
+.subsections_via_symbols
+#endif