Merge branch 'master' into el6

Rebase to 1.11
Ignore test failure on x86_64
This commit is contained in:
Jakub Čajka 2018-10-07 14:45:45 +02:00
commit be0aa0461a
10 changed files with 123 additions and 253 deletions

1
.gitignore vendored
View File

@ -51,3 +51,4 @@
/go1.9.5.src.tar.gz
/go1.9.6.src.tar.gz
/go1.9.7.src.tar.gz
/go1.11.1.src.tar.gz

View File

@ -0,0 +1,88 @@
From edce31a2904846ae74e3c011f2cf5fddc963459e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20=C4=8Cajka?= <jcajka@redhat.com>
Date: Thu, 22 Mar 2018 12:07:32 +0100
Subject: [PATCH 1/3] Don't use the bundled tzdata at runtime, except for the
internal test suite
---
src/time/internal_test.go | 7 +++++--
src/time/zoneinfo_test.go | 3 ++-
src/time/zoneinfo_unix.go | 2 --
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/time/internal_test.go b/src/time/internal_test.go
index 76d5524124..e81ace5f64 100644
--- a/src/time/internal_test.go
+++ b/src/time/internal_test.go
@@ -4,13 +4,15 @@
package time
+import "runtime"
+
func init() {
// force US/Pacific for time zone tests
ForceUSPacificForTesting()
}
func initTestingZone() {
- z, err := loadLocation("America/Los_Angeles", zoneSources[len(zoneSources)-1:])
+ z, err := loadLocation("America/Los_Angeles", zoneSources)
if err != nil {
panic("cannot load America/Los_Angeles for testing: " + err.Error())
}
@@ -21,8 +23,9 @@ func initTestingZone() {
var OrigZoneSources = zoneSources
func forceZipFileForTesting(zipOnly bool) {
- zoneSources = make([]string, len(OrigZoneSources))
+ zoneSources = make([]string, len(OrigZoneSources)+1)
copy(zoneSources, OrigZoneSources)
+ zoneSources = append(zoneSources, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
if zipOnly {
zoneSources = zoneSources[len(zoneSources)-1:]
}
diff --git a/src/time/zoneinfo_test.go b/src/time/zoneinfo_test.go
index 7a55d4f618..6063ca1195 100644
--- a/src/time/zoneinfo_test.go
+++ b/src/time/zoneinfo_test.go
@@ -8,6 +8,7 @@ import (
"fmt"
"os"
"reflect"
+ "runtime"
"testing"
"time"
)
@@ -128,7 +129,7 @@ func TestLoadLocationFromTZData(t *testing.T) {
t.Fatal(err)
}
- tzinfo, err := time.LoadTzinfo(locationName, time.OrigZoneSources[len(time.OrigZoneSources)-1])
+ tzinfo, err := time.LoadTzinfo(locationName, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
if err != nil {
t.Fatal(err)
}
diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go
index 88313aa0ed..d9596115ef 100644
--- a/src/time/zoneinfo_unix.go
+++ b/src/time/zoneinfo_unix.go
@@ -12,7 +12,6 @@
package time
import (
- "runtime"
"syscall"
)
@@ -22,7 +21,6 @@ var zoneSources = []string{
"/usr/share/zoneinfo/",
"/usr/share/lib/zoneinfo/",
"/usr/lib/locale/TZ/",
- runtime.GOROOT() + "/lib/time/zoneinfo.zip",
}
func initLocal() {
--
2.14.3

View File

@ -1,34 +0,0 @@
From 2f52dca801a86a729fb69dc9123d111a9e995895 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20=C4=8Cajka?= <jcajka@redhat.com>
Date: Thu, 22 Mar 2018 12:39:16 +0100
Subject: [PATCH 1/6] Make build little bit more verbose
---
src/make.bash | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/make.bash b/src/make.bash
index 71e75318f2..14c4424392 100755
--- a/src/make.bash
+++ b/src/make.bash
@@ -167,7 +167,7 @@ if [ "$GOHOSTARCH" != "$GOARCH" -o "$GOHOSTOS" != "$GOOS" ]; then
# CC_FOR_TARGET is recorded as the default compiler for the go tool. When building for the host, however,
# use the host compiler, CC, from `cmd/dist/dist env` instead.
CC=$CC GOOS=$GOHOSTOS GOARCH=$GOHOSTARCH \
- "$GOTOOLDIR"/go_bootstrap install -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
+ "$GOTOOLDIR"/go_bootstrap install -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v -x std cmd
echo
fi
@@ -175,7 +175,7 @@ echo "##### Building packages and commands for $GOOS/$GOARCH."
old_bin_files=$(cd $GOROOT/bin && echo *)
-CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v std cmd
+CC=$CC_FOR_TARGET "$GOTOOLDIR"/go_bootstrap install $GO_FLAGS -gcflags "$GO_GCFLAGS" -ldflags "$GO_LDFLAGS" -v -x std cmd
# Check that there are no new files in $GOROOT/bin other than go and gofmt
# and $GOOS_$GOARCH (a directory used when cross-compiling).
--
2.14.3

View File

@ -1,33 +0,0 @@
From 63c8189910c1cc2a45a7fb21fbc5c516ce01f46c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20=C4=8Cajka?= <jcajka@redhat.com>
Date: Thu, 22 Mar 2018 12:41:12 +0100
Subject: [PATCH 2/6] Don't use the bundled tzdata
---
src/time/zoneinfo_unix.go | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go
index bbf263a16f..ec14bc0f7b 100644
--- a/src/time/zoneinfo_unix.go
+++ b/src/time/zoneinfo_unix.go
@@ -32,14 +32,14 @@ var zoneDirs = []string{
"/usr/share/zoneinfo/",
"/usr/share/lib/zoneinfo/",
"/usr/lib/locale/TZ/",
- runtime.GOROOT() + "/lib/time/zoneinfo.zip",
}
var origZoneDirs = zoneDirs
func forceZipFileForTesting(zipOnly bool) {
- zoneDirs = make([]string, len(origZoneDirs))
+ zoneDirs = make([]string, len(origZoneDirs)+1)
copy(zoneDirs, origZoneDirs)
+ zoneDirs = append(zoneDirs, runtime.GOROOT()+"/lib/time/zoneinfo.zip")
if zipOnly {
for i := 0; i < len(zoneDirs)-1; i++ {
zoneDirs[i] = "/XXXNOEXIST"
--
2.14.3

View File

@ -1,7 +1,7 @@
From d53a3784bbeab6ac7405c88e56528024061d2ef2 Mon Sep 17 00:00:00 2001
From 817407fc2d6a861e65086388766f58082d38bc0b Mon Sep 17 00:00:00 2001
From: Michael Munday <munday@ca.ibm.com>
Date: Tue, 17 Jan 2017 11:33:38 -0500
Subject: [PATCH 3/6] syscall: expose IfInfomsg.X__ifi_pad on s390x
Subject: [PATCH 2/3] syscall: expose IfInfomsg.X__ifi_pad on s390x
Exposing this field on s390x improves compatibility with the other
linux architectures, all of which already expose it.

View File

@ -1,30 +0,0 @@
From a170a330e0598ad67240a4080a2ab185491884f5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20=C4=8Cajka?= <jcajka@redhat.com>
Date: Thu, 22 Mar 2018 12:42:33 +0100
Subject: [PATCH 4/6] Ignore L0^A during linking
---
src/cmd/link/internal/ld/ldelf.go | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/cmd/link/internal/ld/ldelf.go b/src/cmd/link/internal/ld/ldelf.go
index d4f9fc44d7..9b02bf5d36 100644
--- a/src/cmd/link/internal/ld/ldelf.go
+++ b/src/cmd/link/internal/ld/ldelf.go
@@ -799,6 +799,13 @@ func ldelf(ctxt *Link, f *bio.Reader, pkg string, length int64, pn string) {
continue
}
+ if sect.name == ".debug_str" && sym.name == "L0" && sym.type_ == 0 {
+ // introduced by https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=49fced1206db40c71208c201165d65f92c69cebe on s390x
+ // TODO investigate from where they are actually coming from, could be possible issue with elf parsing as seeing 0x1 in name is weird
+ // See issue https://github.com/golang/go/issues/20996
+ continue
+ }
+
if strings.HasPrefix(sym.name, ".LASF") { // gcc on s390x does this
continue
}
--
2.14.3

View File

@ -1,65 +0,0 @@
From 6d91532e4da10746ced62f714783017f682f83e1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20=C4=8Cajka?= <jcajka@redhat.com>
Date: Thu, 22 Mar 2018 12:44:25 +0100
Subject: [PATCH 5/6] Backport of
https://github.com/golang/go/commit/ca8c361d867d62bd46013c5abbaaad0b2ca6077f
---
src/cmd/dist/test.go | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go
index 73432d31ea..ed7151ab66 100644
--- a/src/cmd/dist/test.go
+++ b/src/cmd/dist/test.go
@@ -852,6 +852,16 @@ func (t *tester) supportedBuildmode(mode string) bool {
return true
}
return false
+ case "pie":
+ switch pair {
+ case "linux-386", "linux-amd64", "linux-arm", "linux-arm64", "linux-ppc64le", "linux-s390x",
+ "android-amd64", "android-arm", "android-arm64", "android-386":
+ return true
+ case "darwin-amd64":
+ return true
+ }
+ return false
+
default:
log.Fatalf("internal error: unknown buildmode %s", mode)
return false
@@ -953,24 +963,16 @@ func (t *tester) cgoTest(dt *distTest) error {
}
}
- if pair != "freebsd-amd64" { // clang -pie fails to link misc/cgo/test
- cmd := t.dirCmd("misc/cgo/test",
- cc, "-xc", "-o", "/dev/null", "-pie", "-")
+ if t.supportedBuildmode("pie") {
+ cmd = t.addCmd(dt, "misc/cgo/test", "go", "test", "-buildmode=pie")
cmd.Env = env
- cmd.Stdin = strings.NewReader("int main() {}")
- if err := cmd.Run(); err != nil {
- fmt.Println("No support for -pie found, skip cgo PIE test.")
- } else {
- cmd = t.addCmd(dt, "misc/cgo/test", "go", "test", "-ldflags", `-linkmode=external -extldflags "-pie"`)
- cmd.Env = env
- cmd = t.addCmd(dt, "misc/cgo/testtls", "go", "test", "-ldflags", `-linkmode=external -extldflags "-pie"`)
- cmd.Env = env
+ cmd = t.addCmd(dt, "misc/cgo/testtls", "go", "test", "-buildmode=pie")
+ cmd.Env = env
- cmd = t.addCmd(dt, "misc/cgo/nocgo", "go", "test", "-ldflags", `-linkmode=external -extldflags "-pie"`)
- cmd.Env = env
+ cmd = t.addCmd(dt, "misc/cgo/nocgo", "go", "test", "-buildmode=pie")
+ cmd.Env = env
- }
}
}
}
--
2.14.3

View File

@ -1,66 +0,0 @@
From 0c99703e993fe8a68bdf311b51bfe7b03b9eced0 Mon Sep 17 00:00:00 2001
From: Lynn Boger <laboger@linux.vnet.ibm.com>
Date: Wed, 11 Oct 2017 16:02:59 -0400
Subject: [PATCH 6/6] misc/cgo/testcarchive: use -no-pie where needed
Starting in gcc 6, -pie is passed to the linker by default
on some platforms, including ppc64le. If the objects
being linked are not built for -pie then in some cases the
executable could be in error. To avoid that problem, -no-pie
should be used with gcc to override the default -pie option
and generate a correct executable that can be run without error.
Fixes #22126
Change-Id: I4a052bba8b9b3bd6706f5d27ca9a7cebcb504c95
Reviewed-on: https://go-review.googlesource.com/70072
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
---
misc/cgo/testcarchive/carchive_test.go | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/misc/cgo/testcarchive/carchive_test.go b/misc/cgo/testcarchive/carchive_test.go
index 74897c7f6f..958d9d739e 100644
--- a/misc/cgo/testcarchive/carchive_test.go
+++ b/misc/cgo/testcarchive/carchive_test.go
@@ -6,6 +6,7 @@ package carchive_test
import (
"bufio"
+ "bytes"
"debug/elf"
"fmt"
"io/ioutil"
@@ -605,9 +606,26 @@ func TestCompileWithoutShared(t *testing.T) {
}
exe := "./testnoshared" + exeSuffix
- ccArgs := append(cc, "-o", exe, "main5.c", "libgo2.a")
+
+ // In some cases, -no-pie is needed here, but not accepted everywhere. First try
+ // if -no-pie is accepted. See #22126.
+ ccArgs := append(cc, "-o", exe, "-no-pie", "main5.c", "libgo2.a")
t.Log(ccArgs)
out, err = exec.Command(ccArgs[0], ccArgs[1:]...).CombinedOutput()
+
+ // If -no-pie unrecognized, try -nopie if this is possibly clang
+ if err != nil && bytes.Contains(out, []byte("unknown")) && !strings.Contains(cc[0], "gcc") {
+ ccArgs = append(cc, "-o", exe, "-nopie", "main5.c", "libgo2.a")
+ t.Log(ccArgs)
+ out, err = exec.Command(ccArgs[0], ccArgs[1:]...).CombinedOutput()
+ }
+
+ // Don't use either -no-pie or -nopie
+ if err != nil && bytes.Contains(out, []byte("unrecognized")) {
+ ccArgs := append(cc, "-o", exe, "main5.c", "libgo2.a")
+ t.Log(ccArgs)
+ out, err = exec.Command(ccArgs[0], ccArgs[1:]...).CombinedOutput()
+ }
t.Logf("%s", out)
if err != nil {
t.Fatal(err)
--
2.14.3

View File

@ -50,7 +50,7 @@
%endif
# Controls what ever we fail on failed tests
%if %{with ignore_tests}
%ifarch x86_64
%global fail_on_tests 0
%else
%global fail_on_tests 1
@ -98,11 +98,11 @@
%global gohostarch s390x
%endif
%global go_api 1.9
%global go_version 1.9.7
%global go_api 1.11
%global go_version 1.11.1
Name: golang
Version: 1.9.7
Version: 1.11.1
Release: 1%{?dist}
Summary: The Go Programming Language
# source tree includes several copies of Mark.Twain-Tom.Sawyer.txt under Public Domain
@ -129,23 +129,27 @@ BuildRequires: pcre-devel, glibc-static, perl
Provides: go = %{version}-%{release}
Provides: go-srpm-macros
# Bundled/Vendored provides generated by
# go list -f {{.ImportPath}} ./src/vendor/... | sed "s:_$PWD/src/vendor/::g;s:_:.:;s:.*:Provides\: bundled(golang(&)):" && go list -f {{.ImportPath}} ./src/cmd/vendor/... | sed "s:_$PWD/src/cmd/vendor/::g;s:_:.:;s:.*:Provides\: bundled(golang(&)):"
Provides: bundled(golang(golang.org/x/crypto/chacha20poly1305))
Provides: bundled(golang(golang.org/x/crypto/chacha20poly1305/internal/chacha20))
Provides: bundled(golang(golang.org/x/crypto/cryptobyte))
Provides: bundled(golang(golang.org/x/crypto/cryptobyte/asn1))
Provides: bundled(golang(golang.org/x/crypto/curve25519))
Provides: bundled(golang(golang.org/x/crypto/internal/chacha20))
Provides: bundled(golang(golang.org/x/crypto/poly1305))
Provides: bundled(golang(golang.org/x/net/dns/dnsmessage))
Provides: bundled(golang(golang.org/x/net/http/httpguts))
Provides: bundled(golang(golang.org/x/net/http/httpproxy))
Provides: bundled(golang(golang.org/x/net/http2/hpack))
Provides: bundled(golang(golang.org/x/net/idna))
Provides: bundled(golang(golang.org/x/net/lex/httplex))
Provides: bundled(golang(golang.org/x/net/internal/nettest))
Provides: bundled(golang(golang.org/x/net/nettest))
Provides: bundled(golang(golang.org/x/net/proxy))
Provides: bundled(golang(golang.org/x/text/secure))
Provides: bundled(golang(golang.org/x/text/secure/bidirule))
Provides: bundled(golang(golang.org/x/text/transform))
Provides: bundled(golang(golang.org/x/text/unicode))
Provides: bundled(golang(golang.org/x/text/unicode/bidi))
Provides: bundled(golang(golang.org/x/text/unicode/norm))
Provides: bundled(golang(github.com/google/pprof))
Provides: bundled(golang(github.com/google/pprof/driver))
Provides: bundled(golang(github.com/google/pprof/internal/binutils))
Provides: bundled(golang(github.com/google/pprof/internal/driver))
@ -158,22 +162,25 @@ Provides: bundled(golang(github.com/google/pprof/internal/report))
Provides: bundled(golang(github.com/google/pprof/internal/symbolizer))
Provides: bundled(golang(github.com/google/pprof/internal/symbolz))
Provides: bundled(golang(github.com/google/pprof/profile))
Provides: bundled(golang(github.com/google/pprof/third.party/svg))
Provides: bundled(golang(github.com/google/pprof/third.party/d3))
Provides: bundled(golang(github.com/google/pprof/third.party/d3flamegraph))
Provides: bundled(golang(github.com/google/pprof/third.party/svgpan))
Provides: bundled(golang(github.com/ianlancetaylor/demangle))
Provides: bundled(golang(golang.org/x/arch/arm/armasm))
Provides: bundled(golang(golang.org/x/arch/arm64/arm64asm))
Provides: bundled(golang(golang.org/x/arch/ppc64/ppc64asm))
Provides: bundled(golang(golang.org/x/arch/x86/x86asm))
Provides: bundled(golang(golang.org/x/crypto/ssh/terminal))
Provides: bundled(golang(golang.org/x/sys/unix))
Provides: bundled(golang(golang.org/x/sys/windows))
Provides: bundled(golang(golang.org/x/sys/windows/registry))
Requires: %{name}-bin = %{version}-%{release}
Requires: %{name}-src = %{version}-%{release}
Requires: go-srpm-macros
Patch1: 0001-Make-build-little-bit-more-verbose.patch
Patch2: 0002-Don-t-use-the-bundled-tzdata.patch
Patch3: 0003-syscall-expose-IfInfomsg.X__ifi_pad-on-s390x.patch
Patch4: 0004-Ignore-L0-A-during-linking.patch
Patch5: 0005-Backport-of-https-github.com-golang-go-commit-ca8c36.patch
Patch6: 0006-misc-cgo-testcarchive-use-no-pie-where-needed.patch
Patch1: 0001-Don-t-use-the-bundled-tzdata-at-runtime-except-for-t.patch
Patch2: 0002-syscall-expose-IfInfomsg.X__ifi_pad-on-s390x.patch
# Having documentation separate was broken
Obsoletes: %{name}-docs < 1.1-4
@ -264,6 +271,7 @@ Requires(postun): %{_sbindir}/update-alternatives
# This is an odd issue, still looking for a better fix.
Requires: glibc
Requires: gcc
Requires: git, subversion, mercurial
%description bin
%{summary}
@ -300,10 +308,6 @@ Requires: %{name} = %{version}-%{release}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
cp %{SOURCE1} ./src/runtime/
@ -340,20 +344,22 @@ export GO_LDFLAGS="-linkmode internal"
%if !%{cgo_enabled}
export CGO_ENABLED=0
%endif
./make.bash --no-clean
./make.bash --no-clean -v
popd
# build shared std lib
%if %{shared}
GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -buildmode=shared std
GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -buildmode=shared -v -x std
%endif
%if %{race}
GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -race std
GOROOT=$(pwd) PATH=$(pwd)/bin:$PATH go install -race -v -x std
%endif
%install
rm -rf $RPM_BUILD_ROOT
# remove GC build cache
rm -rf pkg/obj/go-build/*
# create the top level directories
mkdir -p $RPM_BUILD_ROOT%{_bindir}
@ -565,6 +571,9 @@ fi
%endif
%changelog
* Sun Oct 07 2018 Jakub Čajka <jcajka@redhat.com> - 1.11.1-1
- Rebase to go1.11.1
* Mon Jun 11 2018 Jakub Čajka <jcajka@redhat.com> - 1.9.7-1
- Rebase to 1.9.7

View File

@ -1 +1 @@
SHA512 (go1.9.7.src.tar.gz) = 1ed3375870223a73c9cf94839bfd8894b92f44f9a3ba3b2bec1e9cd8d2212519344c8afcb87a516d6ad3e1ccdc74d9dba225a222bdc5e60f6d73cb474d5f7664
SHA512 (go1.11.1.src.tar.gz) = 9c19f40b24f2180563705511a5692932c0db3585939053e6d78eea1f394902d37f05b0386f0e7d0c0266178de7e9bd7b003324ed232ce2e5050c9faafafdd979