aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/rt0_darwin_arm64.s
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2020-10-12 13:44:21 -0400
committerCherry Zhang <cherryyz@google.com>2020-10-14 21:32:26 +0000
commite4ec30965b9ca629922e83b8d335224ae4bdf062 (patch)
tree02dc7a764ab2664d586ff306187608a360f44588 /src/runtime/rt0_darwin_arm64.s
parent2ec71e57323c4801bb70a8dab687991e551229f4 (diff)
downloadgo-e4ec30965b9ca629922e83b8d335224ae4bdf062.tar.gz
go-e4ec30965b9ca629922e83b8d335224ae4bdf062.zip
cmd/link: support internal linking on darwin/arm64
Add support of internal linking on darwin/arm64 (macOS). Still incomplete. Pure Go binaries work. Cgo doesn't. TLS is not set up when cgo is not used (as before) (so asynchronous preemption is not enabled). Internal linking is not enabled by default but can be requested via -ldflags=-linkmode=internal. Updates #38485. Change-Id: I1e0c81b6028edcb1ac26dcdafeb9bb3f788cf732 Reviewed-on: https://go-review.googlesource.com/c/go/+/261643 Trust: Cherry Zhang <cherryyz@google.com> Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'src/runtime/rt0_darwin_arm64.s')
-rw-r--r--src/runtime/rt0_darwin_arm64.s20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/runtime/rt0_darwin_arm64.s b/src/runtime/rt0_darwin_arm64.s
index e3972f4924..0040361215 100644
--- a/src/runtime/rt0_darwin_arm64.s
+++ b/src/runtime/rt0_darwin_arm64.s
@@ -4,11 +4,14 @@
#include "textflag.h"
-// No need for _rt0_arm64_darwin as darwin/arm64 only
-// supports external linking.
TEXT _rt0_arm64_darwin(SB),NOSPLIT|NOFRAME,$0
- MOVD $42, R0
- BL libc_exit(SB)
+ MOVD $runtime·rt0_go(SB), R2
+ BL (R2)
+exit:
+ MOVD $0, R0
+ MOVD $1, R16 // sys_exit
+ SVC $0x80
+ B exit
// When linking with -buildmode=c-archive or -buildmode=c-shared,
// this symbol is called from a global initialization function.
@@ -86,11 +89,6 @@ GLOBL _rt0_arm64_darwin_lib_argc<>(SB),NOPTR, $8
DATA _rt0_arm64_darwin_lib_argv<>(SB)/8, $0
GLOBL _rt0_arm64_darwin_lib_argv<>(SB),NOPTR, $8
+// external linking entry point.
TEXT main(SB),NOSPLIT|NOFRAME,$0
- MOVD $runtime·rt0_go(SB), R2
- BL (R2)
-exit:
- MOVD $0, R0
- MOVD $1, R16 // sys_exit
- SVC $0x80
- B exit
+ JMP _rt0_arm64_darwin(SB)