Blame SOURCES/cmd-link-use-correct-path-for-dynamic-loader-on-ppc6.patch

aad1b4
From 241192ecd31ca03a6f68fa7e55bb9f66040d3a2f Mon Sep 17 00:00:00 2001
aad1b4
From: Lynn Boger <laboger@linux.vnet.ibm.com>
aad1b4
Date: Thu, 14 Jul 2022 10:47:28 -0500
aad1b4
Subject: [PATCH] cmd/link: use correct path for dynamic loader on ppc64le
aad1b4
aad1b4
The setting of the path for the dynamic loader when building for
aad1b4
linux/ppc64le ELF v2 was incorrectly set to the path for
aad1b4
PPC64 ELF v1. This has not caused issues in the common cases
aad1b4
because this string can be set based on the default GO_LDSO setting.
aad1b4
It does result in an incorrect value when cross compiling binaries
aad1b4
with -buildmode=pie.
aad1b4
aad1b4
Updates #53813
aad1b4
aad1b4
Change-Id: I84de1c97b42e0434760b76a57c5a05e055fbb730
aad1b4
---
aad1b4
 src/cmd/link/internal/ppc64/obj.go | 13 +++++++------
aad1b4
 1 file changed, 7 insertions(+), 6 deletions(-)
aad1b4
aad1b4
diff --git a/src/cmd/link/internal/ppc64/obj.go b/src/cmd/link/internal/ppc64/obj.go
aad1b4
index b6d5ad92af..bca8fa9212 100644
aad1b4
--- a/src/cmd/link/internal/ppc64/obj.go
aad1b4
+++ b/src/cmd/link/internal/ppc64/obj.go
aad1b4
@@ -38,9 +38,12 @@ import (
aad1b4
 )
aad1b4
 
aad1b4
 func Init() (*sys.Arch, ld.Arch) {
aad1b4
-	arch := sys.ArchPPC64
aad1b4
-	if buildcfg.GOARCH == "ppc64le" {
aad1b4
-		arch = sys.ArchPPC64LE
aad1b4
+	arch := sys.ArchPPC64LE
aad1b4
+	dynld := "/lib64/ld64.so.2"
aad1b4
+
aad1b4
+	if buildcfg.GOARCH == "ppc64" {
aad1b4
+		arch = sys.ArchPPC64
aad1b4
+		dynld = "/lib64/ld64.so.1"
aad1b4
 	}
aad1b4
 
aad1b4
 	theArch := ld.Arch{
aad1b4
@@ -64,9 +67,7 @@ func Init() (*sys.Arch, ld.Arch) {
aad1b4
 		Machoreloc1:      machoreloc1,
aad1b4
 		Xcoffreloc1:      xcoffreloc1,
aad1b4
 
aad1b4
-		// TODO(austin): ABI v1 uses /usr/lib/ld.so.1,
aad1b4
-		Linuxdynld: "/lib64/ld64.so.1",
aad1b4
-
aad1b4
+		Linuxdynld:     dynld,
aad1b4
 		Freebsddynld:   "XXX",
aad1b4
 		Openbsddynld:   "XXX",
aad1b4
 		Netbsddynld:    "XXX",
aad1b4
-- 
aad1b4
2.35.3
aad1b4