aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link
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/cmd/link
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/cmd/link')
-rw-r--r--src/cmd/link/internal/ld/elf.go15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/cmd/link/internal/ld/elf.go b/src/cmd/link/internal/ld/elf.go
index 12218feb31..8cd9e9f1b4 100644
--- a/src/cmd/link/internal/ld/elf.go
+++ b/src/cmd/link/internal/ld/elf.go
@@ -178,14 +178,7 @@ func Elfinit(ctxt *Link) {
switch ctxt.Arch.Family {
// 64-bit architectures
- case sys.PPC64, sys.S390X:
- if ctxt.Arch.ByteOrder == binary.BigEndian && ctxt.HeadType != objabi.Hopenbsd {
- ehdr.Flags = 1 // Version 1 ABI
- } else {
- ehdr.Flags = 2 // Version 2 ABI
- }
- fallthrough
- case sys.AMD64, sys.ARM64, sys.Loong64, sys.MIPS64, sys.RISCV64:
+ case sys.AMD64, sys.ARM64, sys.Loong64, sys.MIPS64, sys.PPC64, sys.RISCV64, sys.S390X:
if ctxt.Arch.Family == sys.MIPS64 {
ehdr.Flags = 0x20000004 // MIPS 3 CPIC
}
@@ -195,6 +188,12 @@ func Elfinit(ctxt *Link) {
if ctxt.Arch.Family == sys.RISCV64 {
ehdr.Flags = 0x4 // RISCV Float ABI Double
}
+ if ctxt.Arch.Family == sys.S390X {
+ ehdr.Flags = 1 // Version 1 ABI
+ }
+ if ctxt.Arch.Family == sys.PPC64 {
+ ehdr.Flags = 2 // Version 2 ABI
+ }
elf64 = true
ehdr.Phoff = ELF64HDRSIZE // Must be ELF64HDRSIZE: first PHdr must follow ELF header