summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2022-01-01 12:29:58 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-01-05 17:18:15 +0000
commitab38db4926c310dc7d9b5e7356b21d80d6ac7a39 (patch)
tree2d72167dceecace9c2c3d660f06c60323f635ac2
parent0111724c3405c422730aaf1353269e3665aea6e2 (diff)
downloadpoky-ab38db4926c310dc7d9b5e7356b21d80d6ac7a39.tar.gz
go: additional patches to help reproducibility
(From OE-Core rev: c7299f4e1cd38856885a2451c7c448c99d94b781) Signed-off-by: Alexander Kanavin <alex@linutronix.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/go/go-1.17.5.inc2
-rw-r--r--meta/recipes-devtools/go/go-1.17/0001-exec.go-do-not-write-linker-flags-into-buildids.patch41
-rw-r--r--meta/recipes-devtools/go/go-1.17/0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch41
3 files changed, 84 insertions, 0 deletions
diff --git a/meta/recipes-devtools/go/go-1.17.5.inc b/meta/recipes-devtools/go/go-1.17.5.inc
index baddd3b215..56957f7c6e 100644
--- a/meta/recipes-devtools/go/go-1.17.5.inc
+++ b/meta/recipes-devtools/go/go-1.17.5.inc
@@ -14,6 +14,8 @@ SRC_URI += "\
14 file://0007-cmd-go-make-GOROOT-precious-by-default.patch \ 14 file://0007-cmd-go-make-GOROOT-precious-by-default.patch \
15 file://0008-use-GOBUILDMODE-to-set-buildmode.patch \ 15 file://0008-use-GOBUILDMODE-to-set-buildmode.patch \
16 file://0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch \ 16 file://0009-Revert-cmd-go-make-sure-CC-and-CXX-are-absolute.patch \
17 file://0001-exec.go-do-not-write-linker-flags-into-buildids.patch \
18 file://0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch \
17" 19"
18SRC_URI[main.sha256sum] = "3defb9a09bed042403195e872dcbc8c6fae1485963332279668ec52e80a95a2d" 20SRC_URI[main.sha256sum] = "3defb9a09bed042403195e872dcbc8c6fae1485963332279668ec52e80a95a2d"
19 21
diff --git a/meta/recipes-devtools/go/go-1.17/0001-exec.go-do-not-write-linker-flags-into-buildids.patch b/meta/recipes-devtools/go/go-1.17/0001-exec.go-do-not-write-linker-flags-into-buildids.patch
new file mode 100644
index 0000000000..20b6636f65
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.17/0001-exec.go-do-not-write-linker-flags-into-buildids.patch
@@ -0,0 +1,41 @@
1From bdd69b55387f80c8df18d0af5008bf5e1a66be6a Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Mon, 23 Nov 2020 19:22:04 +0000
4Subject: [PATCH] exec.go: do not write linker flags into buildids
5
6The flags can contain build-specific paths, breaking reproducibility.
7
8To make this acceptable to upstream, we probably need to trim the flags,
9removing those known to be buildhost-specific.
10
11Upstream-Status: Inappropriate [needs upstream discussion]
12Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
13---
14 src/cmd/go/internal/work/exec.go | 4 ++--
15 1 file changed, 2 insertions(+), 2 deletions(-)
16
17diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
18index 696db23..727d40b 100644
19--- a/src/cmd/go/internal/work/exec.go
20+++ b/src/cmd/go/internal/work/exec.go
21@@ -1136,7 +1136,7 @@ func (b *Builder) linkActionID(a *Action) cache.ActionID {
22 }
23
24 // Toolchain-dependent configuration, shared with b.linkSharedActionID.
25- b.printLinkerConfig(h, p)
26+ //b.printLinkerConfig(h, p)
27
28 // Input files.
29 for _, a1 := range a.Deps {
30@@ -1418,7 +1418,7 @@ func (b *Builder) linkSharedActionID(a *Action) cache.ActionID {
31 fmt.Fprintf(h, "goos %s goarch %s\n", cfg.Goos, cfg.Goarch)
32
33 // Toolchain-dependent configuration, shared with b.linkActionID.
34- b.printLinkerConfig(h, nil)
35+ //b.printLinkerConfig(h, nil)
36
37 // Input files.
38 for _, a1 := range a.Deps {
39--
402.17.1
41
diff --git a/meta/recipes-devtools/go/go-1.17/0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch b/meta/recipes-devtools/go/go-1.17/0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch
new file mode 100644
index 0000000000..257454a67d
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.17/0001-src-cmd-dist-buildgo.go-do-not-hardcode-host-compile.patch
@@ -0,0 +1,41 @@
1From 2055a46b396e272616c0b2273903e02c3b49a2ff Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Tue, 10 Nov 2020 16:33:27 +0000
4Subject: [PATCH] src/cmd/dist/buildgo.go: do not hardcode host compilers into
5 target binaries
6
7These come from $CC/$CXX on the build host and are not useful on targets;
8additionally as they contain host specific paths, this helps reproducibility.
9
10Upstream-Status: Inappropriate [needs upstream discussion]
11Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
12---
13 src/cmd/dist/buildgo.go | 8 ++++----
14 1 file changed, 4 insertions(+), 4 deletions(-)
15
16diff --git a/src/cmd/dist/buildgo.go b/src/cmd/dist/buildgo.go
17index caafc13..4eb1c96 100644
18--- a/src/cmd/dist/buildgo.go
19+++ b/src/cmd/dist/buildgo.go
20@@ -34,8 +34,8 @@ func mkzdefaultcc(dir, file string) {
21 fmt.Fprintf(&buf, "package cfg\n")
22 fmt.Fprintln(&buf)
23 fmt.Fprintf(&buf, "const DefaultPkgConfig = `%s`\n", defaultpkgconfig)
24- buf.WriteString(defaultCCFunc("DefaultCC", defaultcc))
25- buf.WriteString(defaultCCFunc("DefaultCXX", defaultcxx))
26+ buf.WriteString(defaultCCFunc("DefaultCC", map[string]string{"":"gcc"}))
27+ buf.WriteString(defaultCCFunc("DefaultCXX", map[string]string{"":"g++"}))
28 writefile(buf.String(), file, writeSkipSame)
29 return
30 }
31@@ -46,8 +46,8 @@ func mkzdefaultcc(dir, file string) {
32 fmt.Fprintf(&buf, "package main\n")
33 fmt.Fprintln(&buf)
34 fmt.Fprintf(&buf, "const defaultPkgConfig = `%s`\n", defaultpkgconfig)
35- buf.WriteString(defaultCCFunc("defaultCC", defaultcc))
36- buf.WriteString(defaultCCFunc("defaultCXX", defaultcxx))
37+ buf.WriteString(defaultCCFunc("defaultCC", map[string]string{"":"gcc"}))
38+ buf.WriteString(defaultCCFunc("defaultCXX", map[string]string{"":"g++"}))
39 writefile(buf.String(), file, writeSkipSame)
40 }
41