aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/rt0_linux_ppc64le.s
diff options
context:
space:
mode:
authorPaul Murphy <murp@redhat.com>2026-01-07 13:48:53 -0600
committerPaul Murphy <murp@redhat.com>2026-01-30 08:06:41 -0800
commit35c5deb1d43b245c19059d1532929ee087e44a84 (patch)
treea0cbc862f9933c9b781b340eb8acef60d629f954 /src/runtime/rt0_linux_ppc64le.s
parentafae85307206cb56851c31652bd9ae45ba60c800 (diff)
downloadgo-35c5deb1d43b245c19059d1532929ee087e44a84.tar.xz
all: switch linux-ppc64 target to ELFv2 ABI
Go is only capable of producing internally linked, static binaries on linux-ppc64. As such, binaries should run in either ELFv1 or ELFv2 ppc64 userspaces today. This opens the door to enabling cgo and external linking which will require ELFv2 support and userspace, eventually. Fixes #76244 Change-Id: I5ca15037cbe546f352e8693dcf14da51a308b8ca Reviewed-on: https://go-review.googlesource.com/c/go/+/734540 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Diffstat (limited to 'src/runtime/rt0_linux_ppc64le.s')
-rw-r--r--src/runtime/rt0_linux_ppc64le.s54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/runtime/rt0_linux_ppc64le.s b/src/runtime/rt0_linux_ppc64le.s
deleted file mode 100644
index 3a6e8863b2..0000000000
--- a/src/runtime/rt0_linux_ppc64le.s
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2016 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-#include "go_asm.h"
-#include "textflag.h"
-#include "asm_ppc64x.h"
-
-TEXT _rt0_ppc64le_linux(SB),NOSPLIT,$0
- XOR R0, R0 // Make sure R0 is zero before _main
- BR _main<>(SB)
-
-TEXT _rt0_ppc64le_linux_lib(SB),NOSPLIT|NOFRAME,$0
- JMP _rt0_ppc64x_lib(SB)
-
-TEXT _main<>(SB),NOSPLIT,$-8
- // In a statically linked binary, the stack contains argc,
- // argv as argc string pointers followed by a NULL, envv as a
- // sequence of string pointers followed by a NULL, and auxv.
- // The TLS pointer should be initialized to 0.
- //
- // In an ELFv2 compliant dynamically linked binary, R3 contains argc,
- // R4 contains argv, R5 contains envp, R6 contains auxv, and R13
- // contains the TLS pointer.
- //
- // When loading via glibc, the first doubleword on the stack points
- // to NULL a value. (that is *(uintptr)(R1) == 0). This is used to
- // differentiate static vs dynamically linked binaries.
- //
- // If loading with the musl loader, it doesn't follow the ELFv2 ABI. It
- // passes argc/argv similar to the linux kernel, R13 (TLS) is
- // initialized, and R3/R4 are undefined.
- MOVD (R1), R12
- CMP R12, $0
- BEQ tls_and_argcv_in_reg
-
- // Arguments are passed via the stack (musl loader or a static binary)
- MOVD 0(R1), R3 // argc
- ADD $8, R1, R4 // argv
-
- // Did the TLS pointer get set? If so, don't change it (e.g musl).
- CMP R13, $0
- BNE tls_and_argcv_in_reg
-
- MOVD $runtimeĀ·m0+m_tls(SB), R13 // TLS
- ADD $0x7000, R13
-
-tls_and_argcv_in_reg:
- BR main(SB)
-
-TEXT main(SB),NOSPLIT,$-8
- MOVD $runtimeĀ·rt0_go(SB), R12
- MOVD R12, CTR
- BR (CTR)