From e5af6155f2d6e0758d11d6c12d6f47ea8e65b141 Mon Sep 17 00:00:00 2001
From: Alexander Kanavin <alex.kanavin@gmail.com>
Date: Tue, 10 Nov 2020 16:33:27 +0000
Subject: [PATCH] src/cmd/dist/buildgo.go: do not hardcode host compilers into
 target binaries

These come from $CC/$CXX on the build host and are not useful on targets;
additionally as they contain host specific paths, this helps reproducibility.

Upstream-Status: Inappropriate [needs upstream discussion]

Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Jose Quaresma <jose.quaresma@foundries.io>
---
 src/cmd/dist/buildgo.go | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/cmd/dist/buildgo.go b/src/cmd/dist/buildgo.go
index 884e9d7..2f52eda 100644
--- a/src/cmd/dist/buildgo.go
+++ b/src/cmd/dist/buildgo.go
@@ -51,8 +51,8 @@ func mkzdefaultcc(dir, file string) {
 		fmt.Fprintf(&buf, "package cfg\n")
 		fmt.Fprintln(&buf)
 		fmt.Fprintf(&buf, "const DefaultPkgConfig = `%s`\n", defaultpkgconfig)
-		buf.WriteString(defaultCCFunc("DefaultCC", defaultcc))
-		buf.WriteString(defaultCCFunc("DefaultCXX", defaultcxx))
+		buf.WriteString(defaultCCFunc("DefaultCC", map[string]string{"":"gcc"}))
+		buf.WriteString(defaultCCFunc("DefaultCXX", map[string]string{"":"g++"}))
 		writefile(buf.String(), file, writeSkipSame)
 		return
 	}
@@ -62,8 +62,8 @@ func mkzdefaultcc(dir, file string) {
 	fmt.Fprintf(&buf, "package main\n")
 	fmt.Fprintln(&buf)
 	fmt.Fprintf(&buf, "const defaultPkgConfig = `%s`\n", defaultpkgconfig)
-	buf.WriteString(defaultCCFunc("defaultCC", defaultcc))
-	buf.WriteString(defaultCCFunc("defaultCXX", defaultcxx))
+	buf.WriteString(defaultCCFunc("defaultCC", map[string]string{"":"gcc"}))
+	buf.WriteString(defaultCCFunc("defaultCXX", map[string]string{"":"g++"}))
 	writefile(buf.String(), file, writeSkipSame)
 }
 
