Mail archive
alpine-aports

[alpine-aports] [PATCH] community/go update version to 1.6

From: Nathan Johnson <nathan_at_nathanjohnson.info>
Date: Tue, 23 Feb 2016 10:36:08 -0600

Including patch to fix 386 build.
https://github.com/golang/go/issues/14476

Removed default-sc-getpw-r-size-max.patch, fixed upstream.
https://github.com/golang/go/issues/11319

Changed the offset for no-pic.patch to match new code.
---
 community/go/APKBUILD                          | 32 ++++++------
 community/go/default-sc-getpw-r-size-max.patch | 57 ---------------------
 community/go/fix-musl.patch                    | 70 ++++++++++++++++++++++++++
 community/go/no-pic.patch                      |  2 +-
 4 files changed, 87 insertions(+), 74 deletions(-)
 delete mode 100644 community/go/default-sc-getpw-r-size-max.patch
 create mode 100644 community/go/fix-musl.patch
diff --git a/community/go/APKBUILD b/community/go/APKBUILD
index 1ef3a5d..4e56478 100644
--- a/community/go/APKBUILD
+++ b/community/go/APKBUILD
_at_@ -1,10 +1,10 @@
 # Contributor: Sören Tempel <soeren+alpine_at_soeren-tempel.net>
 # Maintainer: Eivind Uggedal <eivind_at_uggedal.com>
 pkgname=go
-pkgver=1.5.3
+pkgver=1.6
 # This should be the latest commit on the corresponding release branch
-_toolsver="d02228d1857b9f49cd0252788516ff5584266eb6"
-pkgrel=1
+_toolsver="c887be1b2ebd11663d4bf2fbca508c449172339e"
+pkgrel=2
 pkgdesc="Go programming language compiler"
 url="http://www.golang.org/"
 arch="all"
_at_@ -18,7 +18,7 @@ subpackages="$pkgname-doc $pkgname-tools $pkgname-cross"
 source="http://golang.org/dl/go${pkgver}.src.tar.gz
 	$pkgname-tools-$pkgver.tar.gz::https://github.com/golang/tools/archive/${_toolsver}.tar.gz
 	no-pic.patch
-	default-sc-getpw-r-size-max.patch"
+	fix-musl.patch"
 
 # NOTE: building go for x86 with grsec kernel requires:
 #           sysctl -w kernel.modify_ldt=1
_at_@ -136,15 +136,15 @@ cross() {
 	done
 }
 
-md5sums="80a0eac7ab750b01b3f7096a1d4667b8  go1.5.3.src.tar.gz
-c64b28ba5df8499bcc19adc995da991a  go-tools-1.5.3.tar.gz
-b303cb36017c5f1303b1567b31b48de3  no-pic.patch
-12a36502180b9801f8d9e60824563c92  default-sc-getpw-r-size-max.patch"
-sha256sums="754e06dab1c31ab168fc9db9e32596734015ea9e24bc44cae7f237f417ce4efe  go1.5.3.src.tar.gz
-80db6fc563df50eb924dbf4f96cef287fc6b89cc8b98595c1dac3c80a118f290  go-tools-1.5.3.tar.gz
-973144c68d10cdc740501ad814841912bae7c3936480fabb3f7fe092ba82ba7f  no-pic.patch
-70f8f9b3ad6b8639db2b401ae14747a6e8d762443ca054c358a5aa4815df7d1f  default-sc-getpw-r-size-max.patch"
-sha512sums="b348832ea7cb095cf793960cf9f4da5e9f6ca8de7b5262bb819de97efea4835643e30a18efd4a82d01ea3854a1905af9e134271716c4b68c9d2a8f6e15f65ff0  go1.5.3.src.tar.gz
-80813c2da74c7b25fa2cfd15b2505757e7f466469ac701cb22d190dc83a607f091c4dea207a2e371e53d7a1f5459e7b53e5eea53c95565e958a6eb7fcb212359  go-tools-1.5.3.tar.gz
-e21084dc07a74c7b6437ae22034b62e3a255692d32dba767c15efdb123d3159c03a02437a41350e512eaa2478a7afbd8b409317a779c56ee4939512d060d57fa  no-pic.patch
-d59c977341b9ab15664b4b0c4f3df9e74ce48ffbd59594a7abb5a0907469f9d362c4e558606dd4b7cd102c165dd53027bae6aa1c48623c2105461dcad4cee14d  default-sc-getpw-r-size-max.patch"
+md5sums="e67833ea37fbc002fbe38efe6c1bcd98  go1.6.src.tar.gz
+733a96b59562ed84ff552542f16a3ab3  go-tools-1.6.tar.gz
+efa8ac40fa8429f7cd6f23eca05a0a0f  no-pic.patch
+b7b8ea485b39a99e7959d27cbd57a32b  fix-musl.patch"
+sha256sums="a96cce8ce43a9bf9b2a4c7d470bc7ee0cb00410da815980681c8353218dcf146  go1.6.src.tar.gz
+955e5a119babad356d9cf00cdaaf3c27648d4451109b467c872fad8cc94d5b56  go-tools-1.6.tar.gz
+1eb60ded9035e9692e4c17b2bb6e9c073e21261eaafa56ee0528d5d2c43a936d  no-pic.patch
+d9cb3c128f198d2aabfa96a117e2238a1ac0aaec3e50b9c6b7cf63ab8850f5a4  fix-musl.patch"
+sha512sums="59e9d72a80558fd5e3f176e068897a45333b36e35f6c00393647941a70e741168e65941b6059397378020c3b78ec3471a48809682f7efd97cf33eec6325fc3e8  go1.6.src.tar.gz
+955def7cc3e5ceb5d8e47477400007d32c25f3bc2764f04a0451bd0235af507e63a0966d201a345f51ac764471da8620b5357d1099ec39e2422bd04d25fd71b8  go-tools-1.6.tar.gz
+51e4c3ee0cda98090db5d00468072bcbf5f0a1a429dd8dedddccaa1467b285f724b012be96d329566b195470bea0aaf4b464e8ba6d2029b0dd42678a7a14b663  no-pic.patch
+5132a833f34ca8a0ebc7ee9eb66d75a6e0c45adf19980996bdb18b9c886077ef752e2b27d2bb23397245b9a225baf8c45f265a8f4521e136e69eb5d85d070e31  fix-musl.patch"
diff --git a/community/go/default-sc-getpw-r-size-max.patch b/community/go/default-sc-getpw-r-size-max.patch
deleted file mode 100644
index 77be27d..0000000
--- a/community/go/default-sc-getpw-r-size-max.patch
+++ /dev/null
_at_@ -1,57 +0,0 @@
-From cb867d2fd64adc851f82be3c6eb6e38ec008930b Mon Sep 17 00:00:00 2001
-From: Dominik Honnef <dominik_at_honnef.co>
-Date: Sun, 21 Jun 2015 20:07:29 +0200
-Subject: [PATCH] os/user: don't depend on _SC_GETPW_R_SIZE_MAX on Linux
-
-Even Linux systems may not have _SC_GETPW_R_SIZE_MAX if using a
-different libc than glibc (e.g. musl). Instead of having special-cases
-for the BSDs, handle -1 correctly by always using a default buffer size.
-
-Fixes #11319.
-
-Change-Id: I8b1b260eb9830e6dbe7667f3f33d115ae4de4ce8
-Reviewed-on: https://go-review.googlesource.com/13772
-Reviewed-by: Brad Fitzpatrick <bradfitz_at_golang.org>
-Run-TryBot: Brad Fitzpatrick <bradfitz_at_golang.org>
----
- src/os/user/lookup_unix.go | 19 ++++++++-----------
- 1 file changed, 8 insertions(+), 11 deletions(-)
-
-diff --git a/src/os/user/lookup_unix.go b/src/os/user/lookup_unix.go
-index f4f603e..e8a1eb1 100644
---- a/src/os/user/lookup_unix.go
-+++ b/src/os/user/lookup_unix.go
-_at_@ -9,7 +9,6 @@ package user
- 
- import (
- 	"fmt"
--	"runtime"
- 	"strconv"
- 	"strings"
- 	"syscall"
-_at_@ -55,17 +54,15 @@ func lookupUnix(uid int, username string, lookupByName bool) (*User, error) {
- 	var pwd C.struct_passwd
- 	var result *C.struct_passwd
- 
--	var bufSize C.long
--	if runtime.GOOS == "dragonfly" || runtime.GOOS == "freebsd" {
--		// DragonFly and FreeBSD do not have _SC_GETPW_R_SIZE_MAX
--		// and just return -1.  So just use the same
--		// size that Linux returns.
-+	bufSize := C.sysconf(C._SC_GETPW_R_SIZE_MAX)
-+	if bufSize == -1 {
-+		// DragonFly and FreeBSD do not have _SC_GETPW_R_SIZE_MAX.
-+		// Additionally, not all Linux systems have it, either. For
-+		// example, the musl libc returns -1.
- 		bufSize = 1024
--	} else {
--		bufSize = C.sysconf(C._SC_GETPW_R_SIZE_MAX)
--		if bufSize <= 0 || bufSize > 1<<20 {
--			return nil, fmt.Errorf("user: unreasonable _SC_GETPW_R_SIZE_MAX of %d", bufSize)
--		}
-+	}
-+	if bufSize <= 0 || bufSize > 1<<20 {
-+		return nil, fmt.Errorf("user: unreasonable _SC_GETPW_R_SIZE_MAX of %d", bufSize)
- 	}
- 	buf := C.malloc(C.size_t(bufSize))
- 	defer C.free(buf)
diff --git a/community/go/fix-musl.patch b/community/go/fix-musl.patch
new file mode 100644
index 0000000..e702001
--- /dev/null
+++ b/community/go/fix-musl.patch
_at_@ -0,0 +1,70 @@
+From 0f783bde485796c8e97789d285c825024d1ca8e4 Mon Sep 17 00:00:00 2001
+From: Shenghou Ma <minux_at_golang.org>
+Date: Tue, 23 Feb 2016 01:26:50 -0500
+Subject: [PATCH] runtime, syscall: switch linux/386 to use int 0x80
+
+Like bionic, musl also doesn't provide vsyscall helper in %gs:0x10,
+and as int $0x80 is as fast as calling %gs:0x10, just use int $0x80
+always.
+
+Fixes #14476.
+
+Change-Id: I00ec8652060700e0a3c9b524bfe3c16a810263f6
+---
+
+diff --git a/src/runtime/sys_linux_386.s b/src/runtime/sys_linux_386.s
+index 1a3aaf0..29ebd5e 100644
+--- a/src/runtime/sys_linux_386.s
++++ b/src/runtime/sys_linux_386.s
+_at_@ -12,16 +12,17 @@
+ 
+ // Most linux systems use glibc's dynamic linker, which puts the
+ // __kernel_vsyscall vdso helper at 0x10(GS) for easy access from position
+-// independent code and setldt in this file does the same in the statically
+-// linked case. Android, however, uses bionic's dynamic linker, which does not
+-// save the helper anywhere, and so the only way to invoke a syscall from
+-// position independent code is boring old int $0x80 (which is also what
+-// bionic's syscall wrappers use).
+-#ifdef GOOS_android
++// independent code and setldt in runtime does the same in the statically
++// linked case. However, systems that use alternative libc such as Android's
++// bionic and musl, do not save the helper anywhere, and so the only way to
++// invoke a syscall from position independent code is boring old int $0x80
++// (which is also what syscall wrappers in bionic/musl use).
++//
++// The benchmarks also showed that using int $0x80 is as fast as calling
++// *%gs:0x10 even on CPUs more than 6 years old. See https://golang.org/cl/16996
++// for the benchmark program and raw data.
++//#define INVOKE_SYSCALL	CALL	0x10(GS) // non-portable
+ #define INVOKE_SYSCALL	INT	$0x80
+-#else
+-#define INVOKE_SYSCALL	CALL	0x10(GS)
+-#endif
+ 
+ TEXT runtime·exit(SB),NOSPLIT,$0
+ 	MOVL	$252, AX	// syscall number
+diff --git a/src/syscall/asm_linux_386.s b/src/syscall/asm_linux_386.s
+index c940605..d5b1022 100644
+--- a/src/syscall/asm_linux_386.s
++++ b/src/syscall/asm_linux_386.s
+_at_@ -12,18 +12,9 @@
+ // func Syscall(trap uintptr, a1, a2, a3 uintptr) (r1, r2, err uintptr);
+ // Trap # in AX, args in BX CX DX SI DI, return in AX
+ 
+-// Most linux systems use glibc's dynamic linker, which puts the
+-// __kernel_vsyscall vdso helper at 0x10(GS) for easy access from position
+-// independent code and setldt in runtime does the same in the statically
+-// linked case. Android, however, uses bionic's dynamic linker, which does not
+-// save the helper anywhere, and so the only way to invoke a syscall from
+-// position independent code is boring old int $0x80 (which is also what
+-// bionic's syscall wrappers use).
+-#ifdef GOOS_android
++// See ../runtime/sys_linux_386.s for rationales.
++//#define INVOKE_SYSCALL	CALL	0x10(GS) // non-portable
+ #define INVOKE_SYSCALL	INT	$0x80
+-#else
+-#define INVOKE_SYSCALL	CALL	0x10(GS)
+-#endif
+ 
+ TEXT	·Syscall(SB),NOSPLIT,$0-28
+ 	CALL	runtime·entersyscall(SB)
diff --git a/community/go/no-pic.patch b/community/go/no-pic.patch
index 5a4e396..db1f809 100644
--- a/community/go/no-pic.patch
+++ b/community/go/no-pic.patch
_at_@ -2,7 +2,7 @@ diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
 index 8ccbec9dd634..4e96bfadc260 100644
 --- a/src/cmd/link/internal/ld/lib.go
 +++ b/src/cmd/link/internal/ld/lib.go
-_at_@ -1071,6 +1071,11 @@ func hostlink() {
+_at_@ -1194,6 +1194,11 @@ func hostlink() {
  		argv = append(argv, peimporteddlls()...)
  	}
  
-- 
2.6.4
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Tue Feb 23 2016 - 10:36:08 GMT