summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-devtools/go/go-1.8.inc22
-rw-r--r--meta/recipes-devtools/go/go-1.8/armhf-elf-header.patch23
-rw-r--r--meta/recipes-devtools/go/go-1.8/fix-cc-handling.patch50
-rw-r--r--meta/recipes-devtools/go/go-1.8/fix-target-cc-for-build.patch17
-rw-r--r--meta/recipes-devtools/go/go-1.8/gotooldir.patch30
-rw-r--r--meta/recipes-devtools/go/go-1.8/make-goroot-precious.patch21
-rw-r--r--meta/recipes-devtools/go/go-1.8/syslog.patch62
-rw-r--r--meta/recipes-devtools/go/go-1.9.inc18
-rw-r--r--meta/recipes-devtools/go/go-1.9/0001-make.bash-quote-CC_FOR_TARGET.patch32
-rw-r--r--meta/recipes-devtools/go/go-1.9/0002-cmd-go-fix-CC-and-CXX-environment-variable-construct.patch67
-rw-r--r--meta/recipes-devtools/go/go-1.9/0003-make.bash-better-separate-host-and-target-builds.patch (renamed from meta/recipes-devtools/go/go-1.8/split-host-and-target-build.patch)52
-rw-r--r--meta/recipes-devtools/go/go-1.9/0004-cmd-go-allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch68
-rw-r--r--meta/recipes-devtools/go/go-1.9/0005-cmd-go-make-GOROOT-precious-by-default.patch41
-rw-r--r--meta/recipes-devtools/go/go-1.9/0006-make.bash-add-GOTOOLDIR_BOOTSTRAP-environment-variab.patch (renamed from meta/recipes-devtools/go/go-1.8/set-gotooldir-during-bootstrap.patch)26
-rw-r--r--meta/recipes-devtools/go/go-1.9/0007-ld-add-soname-to-shareable-objects.patch (renamed from meta/recipes-devtools/go/go-1.8/0006-linker-add-soname-to-shareable-objects.patch)20
-rw-r--r--meta/recipes-devtools/go/go-cross-canadian.inc1
-rw-r--r--meta/recipes-devtools/go/go-cross-canadian_1.9.bb (renamed from meta/recipes-devtools/go/go-cross-canadian_1.8.bb)0
-rw-r--r--meta/recipes-devtools/go/go-cross.inc2
-rw-r--r--meta/recipes-devtools/go/go-cross_1.9.bb (renamed from meta/recipes-devtools/go/go-cross_1.8.bb)0
-rw-r--r--meta/recipes-devtools/go/go-crosssdk_1.9.bb (renamed from meta/recipes-devtools/go/go-crosssdk_1.8.bb)0
-rw-r--r--meta/recipes-devtools/go/go-native.inc2
-rw-r--r--meta/recipes-devtools/go/go-native_1.9.bb (renamed from meta/recipes-devtools/go/go-native_1.8.bb)0
-rw-r--r--meta/recipes-devtools/go/go-runtime_1.9.bb (renamed from meta/recipes-devtools/go/go-runtime_1.8.bb)0
-rw-r--r--meta/recipes-devtools/go/go_1.9.bb (renamed from meta/recipes-devtools/go/go_1.8.bb)0
24 files changed, 301 insertions, 253 deletions
diff --git a/meta/recipes-devtools/go/go-1.8.inc b/meta/recipes-devtools/go/go-1.8.inc
deleted file mode 100644
index 8c4b71e428..0000000000
--- a/meta/recipes-devtools/go/go-1.8.inc
+++ /dev/null
@@ -1,22 +0,0 @@
1require go-common.inc
2
3GOMINOR = "3"
4GO_BASEVERSION = "1.8"
5PV .= ".${GOMINOR}"
6FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
7
8LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
9
10SRC_URI += "\
11 file://armhf-elf-header.patch \
12 file://syslog.patch \
13 file://fix-target-cc-for-build.patch \
14 file://fix-cc-handling.patch \
15 file://split-host-and-target-build.patch \
16 file://gotooldir.patch \
17 file://make-goroot-precious.patch \
18 file://set-gotooldir-during-bootstrap.patch \
19 file://0006-linker-add-soname-to-shareable-objects.patch \
20"
21SRC_URI[main.md5sum] = "64e9380e07bba907e26a00cf5fcbe77e"
22SRC_URI[main.sha256sum] = "5f5dea2447e7dcfdc50fa6b94c512e58bfba5673c039259fd843f68829d99fa6"
diff --git a/meta/recipes-devtools/go/go-1.8/armhf-elf-header.patch b/meta/recipes-devtools/go/go-1.8/armhf-elf-header.patch
deleted file mode 100644
index 3508838e8b..0000000000
--- a/meta/recipes-devtools/go/go-1.8/armhf-elf-header.patch
+++ /dev/null
@@ -1,23 +0,0 @@
1Encode arm EABI ( hard/soft ) calling convention in ELF header
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/cmd/link/internal/ld/elf.go
6===================================================================
7--- go.orig/src/cmd/link/internal/ld/elf.go
8+++ go/src/cmd/link/internal/ld/elf.go
9@@ -950,7 +950,13 @@ func Elfinit(ctxt *Link) {
10 case sys.ARM, sys.MIPS:
11 if SysArch.Family == sys.ARM {
12 // we use EABI on linux/arm, freebsd/arm, netbsd/arm.
13- if Headtype == obj.Hlinux || Headtype == obj.Hfreebsd || Headtype == obj.Hnetbsd {
14+ if Headtype == obj.Hlinux {
15+ if obj.GOARM == 7 {
16+ ehdr.flags = 0x5000402 // has entry point, Version5 EABI, hard float
17+ } else {
18+ ehdr.flags = 0x5000202 // has entry point, Version5 EABI, soft float
19+ }
20+ } else if Headtype == obj.Hfreebsd || Headtype == obj.Hnetbsd {
21 // We set a value here that makes no indication of which
22 // float ABI the object uses, because this is information
23 // used by the dynamic linker to compare executables and
diff --git a/meta/recipes-devtools/go/go-1.8/fix-cc-handling.patch b/meta/recipes-devtools/go/go-1.8/fix-cc-handling.patch
deleted file mode 100644
index dc9b811b2a..0000000000
--- a/meta/recipes-devtools/go/go-1.8/fix-cc-handling.patch
+++ /dev/null
@@ -1,50 +0,0 @@
1Accept CC with multiple words in its name
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/cmd/go/build.go
6===================================================================
7--- go.orig/src/cmd/go/build.go
8+++ go/src/cmd/go/build.go
9@@ -3100,12 +3100,24 @@ func (b *builder) gccCmd(objdir string)
10 return b.ccompilerCmd("CC", defaultCC, objdir)
11 }
12
13+// gccCmd returns a gcc command line prefix
14+// defaultCC is defined in zdefaultcc.go, written by cmd/dist.
15+func (b *builder) gccCmdForReal() []string {
16+ return envList("CC", defaultCC)
17+}
18+
19 // gxxCmd returns a g++ command line prefix
20 // defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
21 func (b *builder) gxxCmd(objdir string) []string {
22 return b.ccompilerCmd("CXX", defaultCXX, objdir)
23 }
24
25+// gxxCmd returns a g++ command line prefix
26+// defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
27+func (b *builder) gxxCmdForReal() []string {
28+ return envList("CXX", defaultCXX)
29+}
30+
31 // gfortranCmd returns a gfortran command line prefix.
32 func (b *builder) gfortranCmd(objdir string) []string {
33 return b.ccompilerCmd("FC", "gfortran", objdir)
34Index: go/src/cmd/go/env.go
35===================================================================
36--- go.orig/src/cmd/go/env.go
37+++ go/src/cmd/go/env.go
38@@ -63,10 +63,9 @@ func mkEnv() []envVar {
39 }
40
41 cmd := b.gccCmd(".")
42- env = append(env, envVar{"CC", cmd[0]})
43+ env = append(env, envVar{"CC", strings.Join(b.gccCmdForReal(), " ")})
44 env = append(env, envVar{"GOGCCFLAGS", strings.Join(cmd[3:], " ")})
45- cmd = b.gxxCmd(".")
46- env = append(env, envVar{"CXX", cmd[0]})
47+ env = append(env, envVar{"CXX", strings.Join(b.gxxCmdForReal(), " ")})
48
49 if buildContext.CgoEnabled {
50 env = append(env, envVar{"CGO_ENABLED", "1"})
diff --git a/meta/recipes-devtools/go/go-1.8/fix-target-cc-for-build.patch b/meta/recipes-devtools/go/go-1.8/fix-target-cc-for-build.patch
deleted file mode 100644
index 2f6156ecd2..0000000000
--- a/meta/recipes-devtools/go/go-1.8/fix-target-cc-for-build.patch
+++ /dev/null
@@ -1,17 +0,0 @@
1Put Quotes around CC_FOR_TARGET since it can be mutliple words e.g. in OE
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/make.bash
6===================================================================
7--- go.orig/src/make.bash 2015-07-29 13:28:11.334031696 -0700
8+++ go/src/make.bash 2015-07-29 13:36:55.814465630 -0700
9@@ -158,7 +158,7 @@
10 fi
11
12 echo "##### Building packages and commands for $GOOS/$GOARCH."
13-CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
14+CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
15 echo
16
17 rm -f "$GOTOOLDIR"/go_bootstrap
diff --git a/meta/recipes-devtools/go/go-1.8/gotooldir.patch b/meta/recipes-devtools/go/go-1.8/gotooldir.patch
deleted file mode 100644
index 94670259f2..0000000000
--- a/meta/recipes-devtools/go/go-1.8/gotooldir.patch
+++ /dev/null
@@ -1,30 +0,0 @@
1Define tooldir in relation to GOTOOLDIR env var
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5Index: go/src/go/build/build.go
6===================================================================
7--- go.orig/src/go/build/build.go
8+++ go/src/go/build/build.go
9@@ -1388,7 +1388,7 @@ func init() {
10 }
11
12 // ToolDir is the directory containing build tools.
13-var ToolDir = filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
14+var ToolDir = envOr("GOTOOLDIR", filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH))
15
16 // IsLocalImport reports whether the import path is
17 // a local import path, like ".", "..", "./foo", or "../foo".
18Index: go/src/cmd/go/build.go
19===================================================================
20--- go.orig/src/cmd/go/build.go
21+++ go/src/cmd/go/build.go
22@@ -1312,7 +1312,7 @@ func (b *builder) build(a *action) (err
23 }
24
25 cgoExe := tool("cgo")
26- if a.cgo != nil && a.cgo.target != "" {
27+ if a.cgo != nil && a.cgo.target != "" && os.Getenv("GOTOOLDIR") == "" {
28 cgoExe = a.cgo.target
29 }
30 outGo, outObj, err := b.cgo(a.p, cgoExe, obj, pcCFLAGS, pcLDFLAGS, cgofiles, gccfiles, cxxfiles, a.p.MFiles)
diff --git a/meta/recipes-devtools/go/go-1.8/make-goroot-precious.patch b/meta/recipes-devtools/go/go-1.8/make-goroot-precious.patch
deleted file mode 100644
index 28a7a34773..0000000000
--- a/meta/recipes-devtools/go/go-1.8/make-goroot-precious.patch
+++ /dev/null
@@ -1,21 +0,0 @@
1Prevent GOROOT-resident packages from being rebuilt
2
3Signed-off-by: Matt Madison <matt@madison.systems>
4Upstream-Status: Pending
5
6--- go.orig/src/cmd/go/pkg.go
7+++ go/src/cmd/go/pkg.go
8@@ -1496,6 +1496,13 @@ func isStale(p *Package) (bool, string)
9 return true, "build ID mismatch"
10 }
11
12+ // For OE builds, make anything in GOROOT non-stale,
13+ // to prevent a package build from overwriting the
14+ // build root.
15+ if p.Goroot && os.Getenv("GOROOT_OVERRIDE") != "1" {
16+ return false, "GOROOT-resident packages do not get rebuilt"
17+ }
18+
19 // Package is stale if a dependency is.
20 for _, p1 := range p.deps {
21 if p1.Stale {
diff --git a/meta/recipes-devtools/go/go-1.8/syslog.patch b/meta/recipes-devtools/go/go-1.8/syslog.patch
deleted file mode 100644
index 29be06f1bd..0000000000
--- a/meta/recipes-devtools/go/go-1.8/syslog.patch
+++ /dev/null
@@ -1,62 +0,0 @@
1Add timeouts to logger
2
3Signed-off-by: Khem Raj <raj.khem@gmail.com>
4Upstream-Status: Pending
5
6diff -r -u go/src/log/syslog/syslog.go /home/achang/GOCOPY/go/src/log/syslog/syslog.go
7--- go/src/log/syslog/syslog.go 2013-11-28 13:38:28.000000000 -0800
8+++ /home/achang/GOCOPY/go/src/log/syslog/syslog.go 2014-10-03 11:44:37.710403200 -0700
9@@ -33,6 +33,9 @@
10 const severityMask = 0x07
11 const facilityMask = 0xf8
12
13+var writeTimeout = 1 * time.Second
14+var connectTimeout = 1 * time.Second
15+
16 const (
17 // Severity.
18
19@@ -100,6 +103,7 @@
20 type serverConn interface {
21 writeString(p Priority, hostname, tag, s, nl string) error
22 close() error
23+ setWriteDeadline(t time.Time) error
24 }
25
26 type netConn struct {
27@@ -273,7 +277,11 @@
28 nl = "\n"
29 }
30
31- err := w.conn.writeString(p, w.hostname, w.tag, msg, nl)
32+ err := w.conn.setWriteDeadline(time.Now().Add(writeTimeout))
33+ if err != nil {
34+ return 0, err
35+ }
36+ err = w.conn.writeString(p, w.hostname, w.tag, msg, nl)
37 if err != nil {
38 return 0, err
39 }
40@@ -305,6 +313,10 @@
41 return n.conn.Close()
42 }
43
44+func (n *netConn) setWriteDeadline(t time.Time) error {
45+ return n.conn.SetWriteDeadline(t)
46+}
47+
48 // NewLogger creates a log.Logger whose output is written to
49 // the system log service with the specified priority. The logFlag
50 // argument is the flag set passed through to log.New to create
51diff -r -u go/src/log/syslog/syslog_unix.go /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go
52--- go/src/log/syslog/syslog_unix.go 2013-11-28 13:38:28.000000000 -0800
53+++ /home/achang/GOCOPY/go/src/log/syslog/syslog_unix.go 2014-10-03 11:44:39.010403175 -0700
54@@ -19,7 +19,7 @@
55 logPaths := []string{"/dev/log", "/var/run/syslog"}
56 for _, network := range logTypes {
57 for _, path := range logPaths {
58- conn, err := net.Dial(network, path)
59+ conn, err := net.DialTimeout(network, path, connectTimeout)
60 if err != nil {
61 continue
62 } else {
diff --git a/meta/recipes-devtools/go/go-1.9.inc b/meta/recipes-devtools/go/go-1.9.inc
new file mode 100644
index 0000000000..d538f4c3a3
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.9.inc
@@ -0,0 +1,18 @@
1require go-common.inc
2
3GO_BASEVERSION = "1.9"
4FILESEXTRAPATHS_prepend := "${FILE_DIRNAME}/go-${GO_BASEVERSION}:"
5
6LIC_FILES_CHKSUM = "file://LICENSE;md5=5d4950ecb7b26d2c5e4e7b4e0dd74707"
7
8SRC_URI += "\
9 file://0001-make.bash-quote-CC_FOR_TARGET.patch \
10 file://0002-cmd-go-fix-CC-and-CXX-environment-variable-construct.patch \
11 file://0003-make.bash-better-separate-host-and-target-builds.patch \
12 file://0004-cmd-go-allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch \
13 file://0005-cmd-go-make-GOROOT-precious-by-default.patch \
14 file://0006-make.bash-add-GOTOOLDIR_BOOTSTRAP-environment-variab.patch \
15 file://0007-ld-add-soname-to-shareable-objects.patch \
16"
17SRC_URI[main.md5sum] = "da2d44ea384076efec43ee1f8b7d45d2"
18SRC_URI[main.sha256sum] = "a4ab229028ed167ba1986825751463605264e44868362ca8e7accc8be057e993"
diff --git a/meta/recipes-devtools/go/go-1.9/0001-make.bash-quote-CC_FOR_TARGET.patch b/meta/recipes-devtools/go/go-1.9/0001-make.bash-quote-CC_FOR_TARGET.patch
new file mode 100644
index 0000000000..7800975e48
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.9/0001-make.bash-quote-CC_FOR_TARGET.patch
@@ -0,0 +1,32 @@
1From d24734ad44006791fd48fc45ea34fe608ff672fb Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Wed, 13 Sep 2017 08:04:23 -0700
4Subject: [PATCH 1/7] make.bash: quote CC_FOR_TARGET
5
6For OE cross-builds, $CC_FOR_TARGET has more than
7one word and needs to be quoted.
8
9Upstream-Status: Pending
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12Signed-off-by: Matt Madison <matt@madison.systems>
13---
14 src/make.bash | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/src/make.bash b/src/make.bash
18index 71e7531..dcf3256 100755
19--- a/src/make.bash
20+++ b/src/make.bash
21@@ -175,7 +175,7 @@ echo "##### Building packages and commands for $GOOS/$GOARCH."
22
23 old_bin_files=$(cd $GOROOT/bin && echo *)
24
25-CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
26+CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
27
28 # Check that there are no new files in $GOROOT/bin other than go and gofmt
29 # and $GOOS_$GOARCH (a directory used when cross-compiling).
30--
312.7.4
32
diff --git a/meta/recipes-devtools/go/go-1.9/0002-cmd-go-fix-CC-and-CXX-environment-variable-construct.patch b/meta/recipes-devtools/go/go-1.9/0002-cmd-go-fix-CC-and-CXX-environment-variable-construct.patch
new file mode 100644
index 0000000000..a4e42261c3
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.9/0002-cmd-go-fix-CC-and-CXX-environment-variable-construct.patch
@@ -0,0 +1,67 @@
1From a7170d32a13aead608abd18996f6dab2e2a631b5 Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Wed, 13 Sep 2017 08:06:37 -0700
4Subject: [PATCH 2/7] cmd/go: fix CC and CXX environment variable construction
5
6For OE cross-builds, CC and CXX have multiple words, and
7we need their complete definitions when setting up the
8environment during Go builds.
9
10Upstream-Status: Pending
11
12Signed-off-by: Khem Raj <raj.khem@gmail.com>
13Signed-off-by: Matt Madison <matt@madison.systems>
14---
15 src/cmd/go/internal/envcmd/env.go | 4 ++--
16 src/cmd/go/internal/work/build.go | 12 ++++++++++++
17 2 files changed, 14 insertions(+), 2 deletions(-)
18
19diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go
20index 43d4334..529d21d 100644
21--- a/src/cmd/go/internal/envcmd/env.go
22+++ b/src/cmd/go/internal/envcmd/env.go
23@@ -74,10 +74,10 @@ func MkEnv() []cfg.EnvVar {
24 }
25
26 cmd := b.GccCmd(".")
27- env = append(env, cfg.EnvVar{Name: "CC", Value: cmd[0]})
28+ env = append(env, cfg.EnvVar{Name: "CC", Value: strings.Join(b.GccCmdForReal(), " ")})
29 env = append(env, cfg.EnvVar{Name: "GOGCCFLAGS", Value: strings.Join(cmd[3:], " ")})
30 cmd = b.GxxCmd(".")
31- env = append(env, cfg.EnvVar{Name: "CXX", Value: cmd[0]})
32+ env = append(env, cfg.EnvVar{Name: "CXX", Value: strings.Join(b.GxxCmdForReal(), " ")})
33
34 if cfg.BuildContext.CgoEnabled {
35 env = append(env, cfg.EnvVar{Name: "CGO_ENABLED", Value: "1"})
36diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go
37index 7d667ff..85df0b3 100644
38--- a/src/cmd/go/internal/work/build.go
39+++ b/src/cmd/go/internal/work/build.go
40@@ -3127,12 +3127,24 @@ func (b *Builder) GccCmd(objdir string) []string {
41 return b.ccompilerCmd("CC", cfg.DefaultCC, objdir)
42 }
43
44+// gccCmd returns a gcc command line prefix
45+// defaultCC is defined in zdefaultcc.go, written by cmd/dist.
46+func (b *Builder) GccCmdForReal() []string {
47+ return envList("CC", cfg.DefaultCC)
48+}
49+
50 // gxxCmd returns a g++ command line prefix
51 // defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
52 func (b *Builder) GxxCmd(objdir string) []string {
53 return b.ccompilerCmd("CXX", cfg.DefaultCXX, objdir)
54 }
55
56+// gxxCmd returns a g++ command line prefix
57+// defaultCXX is defined in zdefaultcc.go, written by cmd/dist.
58+func (b *Builder) GxxCmdForReal() []string {
59+ return envList("CXX", cfg.DefaultCXX)
60+}
61+
62 // gfortranCmd returns a gfortran command line prefix.
63 func (b *Builder) gfortranCmd(objdir string) []string {
64 return b.ccompilerCmd("FC", "gfortran", objdir)
65--
662.7.4
67
diff --git a/meta/recipes-devtools/go/go-1.8/split-host-and-target-build.patch b/meta/recipes-devtools/go/go-1.9/0003-make.bash-better-separate-host-and-target-builds.patch
index b0dd95bbe7..ffd9f2359c 100644
--- a/meta/recipes-devtools/go/go-1.8/split-host-and-target-build.patch
+++ b/meta/recipes-devtools/go/go-1.9/0003-make.bash-better-separate-host-and-target-builds.patch
@@ -1,13 +1,26 @@
1Add new option --target-only to build target components 1From 31e88f06af7ab787d8fe0c1ca625193e1799e167 Mon Sep 17 00:00:00 2001
2Separates the host and target pieces of build 2From: Matt Madison <matt@madison.systems>
3Date: Wed, 13 Sep 2017 08:12:04 -0700
4Subject: [PATCH 3/7] make.bash: better separate host and target builds
5
6Fore OE cross-builds, the simple checks in make.bash are
7insufficient for distinguishing host and target build
8environments, so add some options for telling the
9script which parts are being built.
3 10
4Signed-off-by: Khem Raj <raj.khem@gmail.com>
5Upstream-Status: Pending 11Upstream-Status: Pending
6Index: go/src/make.bash 12
7=================================================================== 13Signed-off-by: Khem Raj <raj.khem@gmail.com>
8--- go.orig/src/make.bash 14Signed-off-by: Matt Madison <matt@madison.systems>
9+++ go/src/make.bash 15---
10@@ -154,13 +154,22 @@ if [ "$1" = "--no-clean" ]; then 16 src/make.bash | 51 ++++++++++++++++++++++++++++-----------------------
17 1 file changed, 28 insertions(+), 23 deletions(-)
18
19diff --git a/src/make.bash b/src/make.bash
20index dcf3256..9553623 100755
21--- a/src/make.bash
22+++ b/src/make.bash
23@@ -156,13 +156,22 @@ if [ "$1" = "--no-clean" ]; then
11 buildall="" 24 buildall=""
12 shift 25 shift
13 fi 26 fi
@@ -35,13 +48,28 @@ Index: go/src/make.bash
35 echo "##### Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH." 48 echo "##### Building packages and commands for host, $GOHOSTOS/$GOHOSTARCH."
36 # CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however, 49 # CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however,
37 # use the host compiler, CC, from `cmd/dist/dist env` instead. 50 # use the host compiler, CC, from `cmd/dist/dist env` instead.
38@@ -169,11 +178,20 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOH 51@@ -171,24 +180,20 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then
39 echo 52 echo
40 fi 53 fi
41 54
42-echo "##### Building packages and commands for $GOOS/$GOARCH." 55-echo "##### Building packages and commands for $GOOS/$GOARCH."
56-
57-old_bin_files=$(cd $GOROOT/bin && echo *)
58-
43-CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd 59-CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
60-
61-# Check that there are no new files in $GOROOT/bin other than go and gofmt
62-# and $GOOS_$GOARCH (a directory used when cross-compiling).
63-(cd $GOROOT/bin && for f in *; do
64- if ! expr " $old_bin_files go gofmt ${GOOS}_${GOARCH} " : ".* $f " >/dev/null 2>/dev/null; then
65- echo 1>&2 "ERROR: unexpected new file in $GOROOT/bin: $f"
66- exit 1
67- fi
68-done)
69-
44-echo 70-echo
71-
72-rm -f "$GOTOOLDIR"/go_bootstrap
45+if [ "$do_target_build" = "yes" ]; then 73+if [ "$do_target_build" = "yes" ]; then
46+ GO_INSTALL="${GO_TARGET_INSTALL:-std cmd}" 74+ GO_INSTALL="${GO_TARGET_INSTALL:-std cmd}"
47+ echo "##### Building packages and commands for $GOOS/$GOARCH." 75+ echo "##### Building packages and commands for $GOOS/$GOARCH."
@@ -53,10 +81,12 @@ Index: go/src/make.bash
53+ fi 81+ fi
54+ GOTOOLDIR="$GOTOOLDIR" CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v ${GO_INSTALL} 82+ GOTOOLDIR="$GOTOOLDIR" CC="$CC_FOR_TARGET" "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v ${GO_INSTALL}
55+ echo 83+ echo
56 84+
57-rm -f "$GOTOOLDIR"/go_bootstrap
58+ rm -f "$GOTOOLDIR"/go_bootstrap 85+ rm -f "$GOTOOLDIR"/go_bootstrap
59+fi 86+fi
60 87
61 if [ "$1" != "--no-banner" ]; then 88 if [ "$1" != "--no-banner" ]; then
62 "$GOTOOLDIR"/dist banner 89 "$GOTOOLDIR"/dist banner
90--
912.7.4
92
diff --git a/meta/recipes-devtools/go/go-1.9/0004-cmd-go-allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch b/meta/recipes-devtools/go/go-1.9/0004-cmd-go-allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch
new file mode 100644
index 0000000000..180b06a4d3
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.9/0004-cmd-go-allow-GOTOOLDIR-to-be-overridden-in-the-envir.patch
@@ -0,0 +1,68 @@
1From 1369178b497b12088ec4c2794606cc9f14cc327c Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Wed, 13 Sep 2017 08:15:03 -0700
4Subject: [PATCH 4/7] cmd/go: allow GOTOOLDIR to be overridden in the
5 environment
6
7For OE cross-builds, host-side tools reside in the native
8GOROOT, not the target GOROOT. Allow GOTOOLDIR to be set
9in the environment to allow that split, rather than always
10computing GOTOOLDIR relative to the GOROOT setting.
11
12Upstream-Status: Pending
13
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15Signed-off-by: Matt Madison <matt@madison.systems>
16---
17 src/cmd/go/internal/cfg/cfg.go | 7 ++++++-
18 src/cmd/go/internal/work/build.go | 2 +-
19 src/go/build/build.go | 2 +-
20 3 files changed, 8 insertions(+), 3 deletions(-)
21
22diff --git a/src/cmd/go/internal/cfg/cfg.go b/src/cmd/go/internal/cfg/cfg.go
23index b3ad1ce..c1dc974 100644
24--- a/src/cmd/go/internal/cfg/cfg.go
25+++ b/src/cmd/go/internal/cfg/cfg.go
26@@ -91,7 +91,12 @@ func init() {
27 // as the tool directory does not move based on environment variables.
28 // This matches the initialization of ToolDir in go/build,
29 // except for using GOROOT rather than runtime.GOROOT().
30- build.ToolDir = filepath.Join(GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
31+ s := os.Getenv("GOTOOLDIR")
32+ if s == "" {
33+ build.ToolDir = filepath.Join(GOROOT, "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
34+ } else {
35+ build.ToolDir = s
36+ }
37 }
38
39 func findGOROOT() string {
40diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go
41index 85df0b3..7b9a69e 100644
42--- a/src/cmd/go/internal/work/build.go
43+++ b/src/cmd/go/internal/work/build.go
44@@ -1337,7 +1337,7 @@ func (b *Builder) build(a *Action) (err error) {
45 }
46
47 var cgoExe string
48- if a.cgo != nil && a.cgo.Target != "" {
49+ if a.cgo != nil && a.cgo.Target != "" && os.Getenv("GOTOOLDIR") == "" {
50 cgoExe = a.cgo.Target
51 } else {
52 cgoExe = base.Tool("cgo")
53diff --git a/src/go/build/build.go b/src/go/build/build.go
54index fd89871..e16145b 100644
55--- a/src/go/build/build.go
56+++ b/src/go/build/build.go
57@@ -1588,7 +1588,7 @@ func init() {
58 }
59
60 // ToolDir is the directory containing build tools.
61-var ToolDir = filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH)
62+var ToolDir = envOr("GOTOOLDIR", filepath.Join(runtime.GOROOT(), "pkg/tool/"+runtime.GOOS+"_"+runtime.GOARCH))
63
64 // IsLocalImport reports whether the import path is
65 // a local import path, like ".", "..", "./foo", or "../foo".
66--
672.7.4
68
diff --git a/meta/recipes-devtools/go/go-1.9/0005-cmd-go-make-GOROOT-precious-by-default.patch b/meta/recipes-devtools/go/go-1.9/0005-cmd-go-make-GOROOT-precious-by-default.patch
new file mode 100644
index 0000000000..6e93bcb6ce
--- /dev/null
+++ b/meta/recipes-devtools/go/go-1.9/0005-cmd-go-make-GOROOT-precious-by-default.patch
@@ -0,0 +1,41 @@
1From 44f961975dac6cf464a77b5f6dd0c47cc192c4fd Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Wed, 13 Sep 2017 08:19:52 -0700
4Subject: [PATCH 5/7] cmd/go: make GOROOT precious by default
5
6For OE builds, we never want packages that have
7already been installed into the build root to be
8modified, so prevent the go build tool from checking
9if they should be rebuilt.
10
11Also add an environment variable to override this
12behavior, just for building the Go runtime.
13
14Upstream-Status: Pending
15
16Signed-off-by: Matt Madison <matt@madison.systems>
17---
18 src/cmd/go/internal/load/pkg.go | 7 +++++++
19 1 file changed, 7 insertions(+)
20
21diff --git a/src/cmd/go/internal/load/pkg.go b/src/cmd/go/internal/load/pkg.go
22index 60de666..2660d3f 100644
23--- a/src/cmd/go/internal/load/pkg.go
24+++ b/src/cmd/go/internal/load/pkg.go
25@@ -1530,6 +1530,13 @@ func isStale(p *Package) (bool, string) {
26 return true, "build ID mismatch"
27 }
28
29+ // For OE builds, make anything in GOROOT non-stale,
30+ // to prevent a package build from overwriting the
31+ // build root.
32+ if p.Goroot && os.Getenv("GOROOT_OVERRIDE") != "1" {
33+ return false, "GOROOT-resident packages do not get rebuilt"
34+ }
35+
36 // Package is stale if a dependency is.
37 for _, p1 := range p.Internal.Deps {
38 if p1.Stale {
39--
402.7.4
41
diff --git a/meta/recipes-devtools/go/go-1.8/set-gotooldir-during-bootstrap.patch b/meta/recipes-devtools/go/go-1.9/0006-make.bash-add-GOTOOLDIR_BOOTSTRAP-environment-variab.patch
index 4b5e424d96..f0f564044b 100644
--- a/meta/recipes-devtools/go/go-1.8/set-gotooldir-during-bootstrap.patch
+++ b/meta/recipes-devtools/go/go-1.9/0006-make.bash-add-GOTOOLDIR_BOOTSTRAP-environment-variab.patch
@@ -1,12 +1,23 @@
1Set GOTOOLDIR during bootstrap 1From aae74d1045ca03306ba4159206ee3bac72bcdfbb Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems>
3Date: Wed, 13 Sep 2017 08:23:23 -0700
4Subject: [PATCH 6/7] make.bash: add GOTOOLDIR_BOOTSTRAP environment variable
5
6For cross-canadian builds, we need to use the native
7GOTOOLDIR during the bootstrap phase, so provide a way
8to pass that setting into the build script.
2 9
3Signed-off-by: Matt Madison <matt@madison.systems>
4Upstream-Status: Pending 10Upstream-Status: Pending
5 11
6Index: go/src/make.bash 12Signed-off-by: Matt Madison <matt@madison.systems>
7=================================================================== 13---
8--- go.orig/src/make.bash 14 src/make.bash | 3 ++-
9+++ go/src/make.bash 15 1 file changed, 2 insertions(+), 1 deletion(-)
16
17diff --git a/src/make.bash b/src/make.bash
18index 9553623..2e6fb05 100755
19--- a/src/make.bash
20+++ b/src/make.bash
10@@ -172,10 +172,11 @@ if [ "$do_host_build" = "yes" ]; then 21@@ -172,10 +172,11 @@ if [ "$do_host_build" = "yes" ]; then
11 mv cmd/dist/dist "$GOTOOLDIR"/dist 22 mv cmd/dist/dist "$GOTOOLDIR"/dist
12 echo 23 echo
@@ -20,3 +31,6 @@ Index: go/src/make.bash
20 "$GOTOOLDIR"/go_bootstrap install -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd 31 "$GOTOOLDIR"/go_bootstrap install -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
21 echo 32 echo
22 fi 33 fi
34--
352.7.4
36
diff --git a/meta/recipes-devtools/go/go-1.8/0006-linker-add-soname-to-shareable-objects.patch b/meta/recipes-devtools/go/go-1.9/0007-ld-add-soname-to-shareable-objects.patch
index 74e1f2459e..6459782d81 100644
--- a/meta/recipes-devtools/go/go-1.8/0006-linker-add-soname-to-shareable-objects.patch
+++ b/meta/recipes-devtools/go/go-1.9/0007-ld-add-soname-to-shareable-objects.patch
@@ -1,22 +1,24 @@
1From 81e9e322297d83f57f02548689c71859bfce10ee Mon Sep 17 00:00:00 2001 1From e957c3458d53e37bf416f51d2f8bf54c195e50f5 Mon Sep 17 00:00:00 2001
2From: Matt Madison <matt@madison.systems> 2From: Matt Madison <matt@madison.systems>
3Date: Sun, 15 Jan 2017 05:24:49 -0800 3Date: Wed, 13 Sep 2017 08:27:02 -0700
4Subject: [PATCH 6/6] linker: add soname to shareable objects 4Subject: [PATCH 7/7] ld: add soname to shareable objects
5 5
6Shared library handling in OE builds works better when shared 6Shared library handling in OE depends on the inclusion
7libraries are tagged with SONAMEs. 7of an soname header, so update the go linker to add that
8header for both internal and external linking.
8 9
9Upstream-Status: Pending 10Upstream-Status: Pending
11
10Signed-off-by: Matt Madison <matt@madison.systems> 12Signed-off-by: Matt Madison <matt@madison.systems>
11--- 13---
12 src/cmd/link/internal/ld/lib.go | 3 +++ 14 src/cmd/link/internal/ld/lib.go | 3 +++
13 1 file changed, 3 insertions(+) 15 1 file changed, 3 insertions(+)
14 16
15diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go 17diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
16index 74d79d3..6d03005 100644 18index 0234105..0b9e2d0 100644
17--- a/src/cmd/link/internal/ld/lib.go 19--- a/src/cmd/link/internal/ld/lib.go
18+++ b/src/cmd/link/internal/ld/lib.go 20+++ b/src/cmd/link/internal/ld/lib.go
19@@ -1040,12 +1040,14 @@ func (l *Link) hostlink() { 21@@ -1124,12 +1124,14 @@ func (l *Link) hostlink() {
20 // Pass -z nodelete to mark the shared library as 22 // Pass -z nodelete to mark the shared library as
21 // non-closeable: a dlclose will do nothing. 23 // non-closeable: a dlclose will do nothing.
22 argv = append(argv, "-shared", "-Wl,-z,nodelete") 24 argv = append(argv, "-shared", "-Wl,-z,nodelete")
@@ -29,9 +31,9 @@ index 74d79d3..6d03005 100644
29 argv = append(argv, "-shared") 31 argv = append(argv, "-shared")
30+ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile))) 32+ argv = append(argv, fmt.Sprintf("-Wl,-soname,%s", filepath.Base(*flagOutfile)))
31 case BuildmodePlugin: 33 case BuildmodePlugin:
32 if Headtype == obj.Hdarwin { 34 if Headtype == objabi.Hdarwin {
33 argv = append(argv, "-dynamiclib") 35 argv = append(argv, "-dynamiclib")
34@@ -1054,6 +1056,7 @@ func (l *Link) hostlink() { 36@@ -1138,6 +1140,7 @@ func (l *Link) hostlink() {
35 argv = append(argv, "-Wl,-z,relro") 37 argv = append(argv, "-Wl,-z,relro")
36 } 38 }
37 argv = append(argv, "-shared") 39 argv = append(argv, "-shared")
diff --git a/meta/recipes-devtools/go/go-cross-canadian.inc b/meta/recipes-devtools/go/go-cross-canadian.inc
index f0315d558a..0068f34d04 100644
--- a/meta/recipes-devtools/go/go-cross-canadian.inc
+++ b/meta/recipes-devtools/go/go-cross-canadian.inc
@@ -52,6 +52,7 @@ do_install() {
52 (cd ${S}/src; for d in *; do \ 52 (cd ${S}/src; for d in *; do \
53 [ -d $d ] && cp --preserve=mode,timestamps -R ${S}/src/$d ${D}${libdir}/go/src/; \ 53 [ -d $d ] && cp --preserve=mode,timestamps -R ${S}/src/$d ${D}${libdir}/go/src/; \
54 done) 54 done)
55 rm -rf ${D}${libdir}/go/src/runtime/pprof/testdata
55 install -d ${D}${bindir} ${D}${libdir}/go/bin 56 install -d ${D}${bindir} ${D}${libdir}/go/bin
56 for f in ${B}/bin/* 57 for f in ${B}/bin/*
57 do 58 do
diff --git a/meta/recipes-devtools/go/go-cross-canadian_1.8.bb b/meta/recipes-devtools/go/go-cross-canadian_1.9.bb
index 7ac9449e47..7ac9449e47 100644
--- a/meta/recipes-devtools/go/go-cross-canadian_1.8.bb
+++ b/meta/recipes-devtools/go/go-cross-canadian_1.9.bb
diff --git a/meta/recipes-devtools/go/go-cross.inc b/meta/recipes-devtools/go/go-cross.inc
index d18d9613ff..234528ab98 100644
--- a/meta/recipes-devtools/go/go-cross.inc
+++ b/meta/recipes-devtools/go/go-cross.inc
@@ -49,7 +49,7 @@ do_install() {
49 (cd ${S}/src; for d in *; do \ 49 (cd ${S}/src; for d in *; do \
50 [ ! -d $d ] || cp --preserve=mode,timestamps -R ${S}/src/$d ${D}${libdir}/go/src/; \ 50 [ ! -d $d ] || cp --preserve=mode,timestamps -R ${S}/src/$d ${D}${libdir}/go/src/; \
51 done) 51 done)
52 52 rm -rf ${D}${libdir}/go/src/runtime/pprof/testdata
53 install -d ${D}${bindir} ${D}${libdir}/go/bin 53 install -d ${D}${bindir} ${D}${libdir}/go/bin
54 for f in ${B}/bin/* 54 for f in ${B}/bin/*
55 do 55 do
diff --git a/meta/recipes-devtools/go/go-cross_1.8.bb b/meta/recipes-devtools/go/go-cross_1.9.bb
index 80b5a03f6c..80b5a03f6c 100644
--- a/meta/recipes-devtools/go/go-cross_1.8.bb
+++ b/meta/recipes-devtools/go/go-cross_1.9.bb
diff --git a/meta/recipes-devtools/go/go-crosssdk_1.8.bb b/meta/recipes-devtools/go/go-crosssdk_1.9.bb
index 1857c8a577..1857c8a577 100644
--- a/meta/recipes-devtools/go/go-crosssdk_1.8.bb
+++ b/meta/recipes-devtools/go/go-crosssdk_1.9.bb
diff --git a/meta/recipes-devtools/go/go-native.inc b/meta/recipes-devtools/go/go-native.inc
index 9eb2b3211f..66b845c633 100644
--- a/meta/recipes-devtools/go/go-native.inc
+++ b/meta/recipes-devtools/go/go-native.inc
@@ -51,7 +51,7 @@ do_install() {
51 (cd ${S}/src; for d in *; do \ 51 (cd ${S}/src; for d in *; do \
52 [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \ 52 [ -d $d ] && cp -a ${S}/src/$d ${D}${libdir}/go/src/; \
53 done) 53 done)
54 54 rm -rf ${D}${libdir}/go/src/runtime/pprof/testdata
55 install -d ${D}${bindir} ${D}${libdir}/go/bin 55 install -d ${D}${bindir} ${D}${libdir}/go/bin
56 for f in ${B}/bin/* 56 for f in ${B}/bin/*
57 do 57 do
diff --git a/meta/recipes-devtools/go/go-native_1.8.bb b/meta/recipes-devtools/go/go-native_1.9.bb
index bbf3c0dd73..bbf3c0dd73 100644
--- a/meta/recipes-devtools/go/go-native_1.8.bb
+++ b/meta/recipes-devtools/go/go-native_1.9.bb
diff --git a/meta/recipes-devtools/go/go-runtime_1.8.bb b/meta/recipes-devtools/go/go-runtime_1.9.bb
index 43b68b4e46..43b68b4e46 100644
--- a/meta/recipes-devtools/go/go-runtime_1.8.bb
+++ b/meta/recipes-devtools/go/go-runtime_1.9.bb
diff --git a/meta/recipes-devtools/go/go_1.8.bb b/meta/recipes-devtools/go/go_1.9.bb
index 08ab793f86..08ab793f86 100644
--- a/meta/recipes-devtools/go/go_1.8.bb
+++ b/meta/recipes-devtools/go/go_1.9.bb