aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/asm_arm.s
diff options
context:
space:
mode:
authorqmuntal <quimmuntal@gmail.com>2026-03-05 10:07:49 +0100
committerGopher Robot <gobot@golang.org>2026-03-18 15:32:53 -0700
commit6bdfdb5f51951584732e6a95a7ee8a5ba5e8cb93 (patch)
tree5de5bf3d98eda9a353de1028b9e0836adb77ea2f /src/runtime/asm_arm.s
parent8e137ff9953d7a535170c9f3ff2c55811e7e13c3 (diff)
downloadgo-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_arm.s')
-rw-r--r--src/runtime/asm_arm.s22
1 files changed, 3 insertions, 19 deletions
diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s
index d9bf04f4c3..f5c2454752 100644
--- a/src/runtime/asm_arm.s
+++ b/src/runtime/asm_arm.s
@@ -58,24 +58,8 @@ skipfpsave:
MOVW $0, g // Initialize g.
- // Synchronous initialization.
- CALL runtime·libpreinit(SB)
+ CALL runtime·libInit(SB)
- // Create a new thread to do the runtime initialization.
- MOVW _cgo_sys_thread_create(SB), R2
- CMP $0, R2
- BEQ nocgo
- MOVW $_rt0_arm_lib_go<>(SB), R0
- MOVW $0, R1
- BL (R2)
- B rr
-nocgo:
- MOVW $0x800000, R0 // stacksize = 8192KB
- MOVW $_rt0_arm_lib_go<>(SB), R1 // fn
- MOVW R0, 4(R13)
- MOVW R1, 8(R13)
- BL runtime·newosproc0(SB)
-rr:
// Restore callee-save registers and return.
MOVB runtime·goarmsoftfp(SB), R11
CMP $0, R11
@@ -98,9 +82,9 @@ skipfprest:
MOVW 36(R13), R11
RET
-// _rt0_arm_lib_go initializes the Go runtime.
+// rt0_lib_go initializes the Go runtime.
// This is started in a separate thread by _rt0_arm_lib.
-TEXT _rt0_arm_lib_go<>(SB),NOSPLIT,$8
+TEXT runtime·rt0_lib_go<ABIInternal>(SB),NOSPLIT,$8
MOVW _rt0_arm_lib_argc<>(SB), R0
MOVW _rt0_arm_lib_argv<>(SB), R1
B runtime·rt0_go(SB)