Change the dynamic linker hardcoding to use musl when not using glibc
this should be applied conditional to musl being the system C library

Upstream-Status: Inappropriate [Real Fix should be portable across libcs]

Signed-off-by: Khem Raj <raj.khem@gmail.com>

Index: go/src/cmd/link/internal/amd64/obj.go
===================================================================
--- go.orig/src/cmd/link/internal/amd64/obj.go
+++ go/src/cmd/link/internal/amd64/obj.go
@@ -67,7 +67,7 @@ func Init() {
 	ld.Thearch.Append64 = ld.Append64l
 	ld.Thearch.TLSIEtoLE = tlsIEtoLE
 
-	ld.Thearch.Linuxdynld = "/lib64/ld-linux-x86-64.so.2"
+	ld.Thearch.Linuxdynld = "/lib/ld-musl-x86_64.so.1"
 	ld.Thearch.Freebsddynld = "/libexec/ld-elf.so.1"
 	ld.Thearch.Openbsddynld = "/usr/libexec/ld.so"
 	ld.Thearch.Netbsddynld = "/libexec/ld.elf_so"
Index: go/src/cmd/link/internal/arm/obj.go
===================================================================
--- go.orig/src/cmd/link/internal/arm/obj.go
+++ go/src/cmd/link/internal/arm/obj.go
@@ -63,7 +63,7 @@ func Init() {
 	ld.Thearch.Append32 = ld.Append32l
 	ld.Thearch.Append64 = ld.Append64l
 
-	ld.Thearch.Linuxdynld = "/lib/ld-linux.so.3" // 2 for OABI, 3 for EABI
+	ld.Thearch.Linuxdynld = "/lib/ld-musl-armhf.so.1"
 	ld.Thearch.Freebsddynld = "/usr/libexec/ld-elf.so.1"
 	ld.Thearch.Openbsddynld = "/usr/libexec/ld.so"
 	ld.Thearch.Netbsddynld = "/libexec/ld.elf_so"
Index: go/src/cmd/link/internal/arm64/obj.go
===================================================================
--- go.orig/src/cmd/link/internal/arm64/obj.go
+++ go/src/cmd/link/internal/arm64/obj.go
@@ -62,7 +62,7 @@ func Init() {
 	ld.Thearch.Append32 = ld.Append32l
 	ld.Thearch.Append64 = ld.Append64l
 
-	ld.Thearch.Linuxdynld = "/lib/ld-linux-aarch64.so.1"
+	ld.Thearch.Linuxdynld = "/lib/ld-musl-aarch64.so.1"
 
 	ld.Thearch.Freebsddynld = "XXX"
 	ld.Thearch.Openbsddynld = "XXX"
Index: go/src/cmd/link/internal/mips/obj.go
===================================================================
--- go.orig/src/cmd/link/internal/mips/obj.go
+++ go/src/cmd/link/internal/mips/obj.go
@@ -77,7 +77,7 @@ func Init() {
 		ld.Thearch.Append64 = ld.Append64b
 	}
 
-	ld.Thearch.Linuxdynld = "/lib/ld.so.1"
+	ld.Thearch.Linuxdynld = "/lib/ld-musl-mipsle.so.1"
 
 	ld.Thearch.Freebsddynld = "XXX"
 	ld.Thearch.Openbsddynld = "XXX"
Index: go/src/cmd/link/internal/mips64/obj.go
===================================================================
--- go.orig/src/cmd/link/internal/mips64/obj.go
+++ go/src/cmd/link/internal/mips64/obj.go
@@ -75,7 +75,7 @@ func Init() {
 		ld.Thearch.Append64 = ld.Append64b
 	}
 
-	ld.Thearch.Linuxdynld = "/lib64/ld64.so.1"
+	ld.Thearch.Linuxdynld = "/lib64/ld-musl-mips64le.so.1"
 
 	ld.Thearch.Freebsddynld = "XXX"
 	ld.Thearch.Openbsddynld = "XXX"
Index: go/src/cmd/link/internal/ppc64/obj.go
===================================================================
--- go.orig/src/cmd/link/internal/ppc64/obj.go
+++ go/src/cmd/link/internal/ppc64/obj.go
@@ -77,7 +77,7 @@ func Init() {
 	}
 
 	// TODO(austin): ABI v1 uses /usr/lib/ld.so.1
-	ld.Thearch.Linuxdynld = "/lib64/ld64.so.1"
+	ld.Thearch.Linuxdynld = "/lib/ld-musl-powerpc64le.so.1"
 
 	ld.Thearch.Freebsddynld = "XXX"
 	ld.Thearch.Openbsddynld = "XXX"
Index: go/src/cmd/link/internal/s390x/obj.go
===================================================================
--- go.orig/src/cmd/link/internal/s390x/obj.go
+++ go/src/cmd/link/internal/s390x/obj.go
@@ -62,7 +62,7 @@ func Init() {
 	ld.Thearch.Append32 = ld.Append32b
 	ld.Thearch.Append64 = ld.Append64b
 
-	ld.Thearch.Linuxdynld = "/lib64/ld64.so.1"
+	ld.Thearch.Linuxdynld = "/lib/ld-musl-s390x.so.1"
 
 	// not relevant for s390x
 	ld.Thearch.Freebsddynld = "XXX"
Index: go/src/cmd/link/internal/x86/obj.go
===================================================================
--- go.orig/src/cmd/link/internal/x86/obj.go
+++ go/src/cmd/link/internal/x86/obj.go
@@ -63,7 +63,7 @@ func Init() {
 	ld.Thearch.Append32 = ld.Append32l
 	ld.Thearch.Append64 = ld.Append64l
 
-	ld.Thearch.Linuxdynld = "/lib/ld-linux.so.2"
+	ld.Thearch.Linuxdynld = "/lib/ld-musl-i386.so.1"
 	ld.Thearch.Freebsddynld = "/usr/libexec/ld-elf.so.1"
 	ld.Thearch.Openbsddynld = "/usr/libexec/ld.so"
 	ld.Thearch.Netbsddynld = "/usr/libexec/ld.elf_so"
