diff options
Diffstat (limited to 'src/runtime/rt0_linux_arm64.s')
-rw-r--r-- | src/runtime/rt0_linux_arm64.s | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/runtime/rt0_linux_arm64.s b/src/runtime/rt0_linux_arm64.s index 2b32e35209..31c2367bca 100644 --- a/src/runtime/rt0_linux_arm64.s +++ b/src/runtime/rt0_linux_arm64.s @@ -11,11 +11,17 @@ TEXT _rt0_arm64_linux(SB),NOSPLIT,$-8 // When building with -buildmode=c-shared, this symbol is called when the shared // library is loaded. -TEXT _rt0_arm64_linux_lib(SB),NOSPLIT,$40 - // R27 is REGTMP, reserved for liblink. It is used below to - // move R0/R1 into globals. However in the standard ARM64 calling - // convention, it is a callee-saved register. - MOVD R27, 24(RSP) +TEXT _rt0_arm64_linux_lib(SB),NOSPLIT,$88 + // Preserve callee-save registers. + MOVD R19, 24(RSP) + MOVD R20, 32(RSP) + MOVD R21, 40(RSP) + MOVD R22, 48(RSP) + MOVD R23, 56(RSP) + MOVD R24, 64(RSP) + MOVD R25, 72(RSP) + MOVD R26, 80(RSP) + MOVD R27, 88(RSP) MOVD R0, _rt0_arm64_linux_lib_argc<>(SB) MOVD R1, _rt0_arm64_linux_lib_argv<>(SB) @@ -42,7 +48,16 @@ nocgo: BL (R4) restore: - MOVD 24(RSP), R27 + // Restore callee-save registers. + MOVD 24(RSP), R19 + MOVD 32(RSP), R20 + MOVD 40(RSP), R21 + MOVD 48(RSP), R22 + MOVD 56(RSP), R23 + MOVD 64(RSP), R24 + MOVD 72(RSP), R25 + MOVD 80(RSP), R26 + MOVD 88(RSP), R27 RET TEXT _rt0_arm64_linux_lib_go(SB),NOSPLIT,$0 |