diff options
| author | qmuntal <quimmuntal@gmail.com> | 2026-03-05 10:07:49 +0100 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2026-03-18 15:32:53 -0700 |
| commit | 6bdfdb5f51951584732e6a95a7ee8a5ba5e8cb93 (patch) | |
| tree | 5de5bf3d98eda9a353de1028b9e0836adb77ea2f /src/runtime/asm_arm64.s | |
| parent | 8e137ff9953d7a535170c9f3ff2c55811e7e13c3 (diff) | |
| download | go-6bdfdb5f51951584732e6a95a7ee8a5ba5e8cb93.tar.xz | |
runtime: implement part of library initialization in Go
All architectures supporting c-shared and c-archive share the same
initialization code in assembly, and most of it can be implemented in
pure Go.
Cq-Include-Trybots: luci.golang.try:gotip-darwin-arm64-longtest,gotip-linux-ppc64le_power10,gotip-linux-riscv64,gotip-linux-loong64,gotip-linux-s390x
Change-Id: Iaa9fb7d6f9ca8785f1098461646d607ef6b00d47
Reviewed-on: https://go-review.googlesource.com/c/go/+/706417
Auto-Submit: Quim Muntal <quimmuntal@gmail.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Diffstat (limited to 'src/runtime/asm_arm64.s')
| -rw-r--r-- | src/runtime/asm_arm64.s | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/src/runtime/asm_arm64.s b/src/runtime/asm_arm64.s index 02ecfc51a1..b16e9151fc 100644 --- a/src/runtime/asm_arm64.s +++ b/src/runtime/asm_arm64.s @@ -41,35 +41,15 @@ TEXT _rt0_arm64_lib(SB),NOSPLIT,$184 MOVD R0, _rt0_arm64_lib_argc<>(SB) MOVD R1, _rt0_arm64_lib_argv<>(SB) - // Synchronous initialization. - MOVD $runtime·libpreinit(SB), R4 + MOVD $runtime·libInit(SB), R4 BL (R4) - // Create a new thread to do the runtime initialization and return. - MOVD _cgo_sys_thread_create(SB), R4 - CBZ R4, nocgo - MOVD $_rt0_arm64_lib_go(SB), R0 - MOVD $0, R1 - SUB $16, RSP // reserve 16 bytes for sp-8 where fp may be saved. - BL (R4) - ADD $16, RSP - B restore - -nocgo: - MOVD $0x800000, R0 // stacksize = 8192KB - MOVD $_rt0_arm64_lib_go(SB), R1 - MOVD R0, 8(RSP) - MOVD R1, 16(RSP) - MOVD $runtime·newosproc0(SB),R4 - BL (R4) - -restore: // Restore callee-save registers. RESTORE_R19_TO_R28(24) RESTORE_F8_TO_F15(104) RET -TEXT _rt0_arm64_lib_go(SB),NOSPLIT,$0 +TEXT runtime·rt0_lib_go<ABIInternal>(SB),NOSPLIT,$0 MOVD _rt0_arm64_lib_argc<>(SB), R0 MOVD _rt0_arm64_lib_argv<>(SB), R1 MOVD $runtime·rt0_go(SB),R4 |
