From 895fcea724edcb357cd2b0da3b64d36155b159d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net>
Date: Sat, 22 May 2021 01:39:04 +0200
Subject: [PATCH] community/go-bootstrap: remove aport

This was used previously to bootstrap community/go. While this is still
possible on some architectures, community/go-bootstrap doesn't support
newer architectures. For this and other reasons, we bootstrap
community/go manually these days. For this purpose community/go provides
the virtual package go-bootstrap.
---
 community/go-bootstrap/APKBUILD               |  76 -------
 .../default-sc-getpw-r-size-max.patch         |  15 --
 community/go-bootstrap/fix-arm-hackery.patch  |  98 ---------
 community/go-bootstrap/new-binutils.patch     | 186 ------------------
 .../go-bootstrap/no-longjmp-redefine.patch    |  10 -
 community/go-bootstrap/no-pic.patch           |  14 --
 6 files changed, 399 deletions(-)
 delete mode 100644 community/go-bootstrap/APKBUILD
 delete mode 100644 community/go-bootstrap/default-sc-getpw-r-size-max.patch
 delete mode 100644 community/go-bootstrap/fix-arm-hackery.patch
 delete mode 100644 community/go-bootstrap/new-binutils.patch
 delete mode 100644 community/go-bootstrap/no-longjmp-redefine.patch
 delete mode 100644 community/go-bootstrap/no-pic.patch

diff --git a/community/go-bootstrap/APKBUILD b/community/go-bootstrap/APKBUILD
deleted file mode 100644
index fb2097aa281c..000000000000
--- a/community/go-bootstrap/APKBUILD
+++ /dev/null
@@ -1,76 +0,0 @@
-# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
-# Contributor: Eivind Uggedal <eu@eju.no>
-# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
-pkgname=go-bootstrap
-_realname="${pkgname%-*}"
-pkgver=1.4.3
-pkgrel=3
-pkgdesc="Go programming language compiler used for bootstraping"
-url="http://www.golang.org/"
-arch="armel armhf armv7 x86 x86_64"
-license="BSD"
-depends=""
-depends_dev=""
-makedepends="bash"
-options="!strip"
-install=""
-subpackages=""
-source="
-	https://storage.googleapis.com/golang/${_realname}${pkgver}.src.tar.gz
-	no-pic.patch
-	no-longjmp-redefine.patch
-	fix-arm-hackery.patch
-	default-sc-getpw-r-size-max.patch
-	new-binutils.patch
-	"
-builddir="$srcdir"/$_realname
-
-# NOTE: building go-bootstrap for x86 with grsec kernel requires:
-#           sysctl -w kernel.modify_ldt=1
-
-build() {
-	cd "$builddir/src"
-
-	export GOPATH="$srcdir"
-	export GOROOT="$builddir"
-	export GOBIN="$GOROOT"/bin
-	export GOROOT_FINAL=/usr/lib/$pkgname
-
-	export CGO_ENABLED=0
-
-	case "$CARCH" in
-	armel)    export GOARCH="arm" GOARM="5" ;;
-	armhf)    export GOARCH="arm" GOARM="6" ;;
-	armv7)    export GOARCH="arm" GOARM="7" ;;
-	x86)      export GOARCH="386" GO386="387" ;;
-	x86_64)   export GOARCH="amd64" ;;
-	*)        return 1 ;;
-	esac
-
-	./make.bash --no-clean || return 1
-}
-
-package() {
-	cd "$builddir"
-	mkdir -p "$pkgdir"/usr/lib/$pkgname "$pkgdir"/usr/lib/$pkgname
-
-	# The source needs to be installed due to an upstream
-	# bug (https://github.com/golang/go/issues/2775).
-	cp -a bin pkg src "$pkgdir"/usr/lib/$pkgname || return 1
-
-	# Remove tests and bashscripts from /usr/lib/go/src.
-	# Those shouldn't be affacted by the upstream bug (see above).
-	find "$pkgdir"/usr/lib/$pkgname/src \( -type f -a -name "*_test.go" \) \
-		-exec rm -rf \{\} \+ || return 1
-	find "$pkgdir"/usr/lib/$pkgname/src \( -type d -a -name "testdata" \) \
-		-exec rm -rf \{\} \+ || return 1
-	find "$pkgdir"/usr/lib/$pkgname/src \( -type f -a -name "*.bash" \) \
-		-exec rm -rf \{\} \+ || return 1
-}
-
-sha512sums="12bade4bce9aa4b34e2b9495ae65a1fc6a2449b3a43bc4de85c8b87ba223c2f999b2f37c1e2fe1188d8521118b5e5357d27afb8b85c0b8ebb4503d4125d25273  go1.4.3.src.tar.gz
-a8e95c3c536a30e15b9bad5e623a085c521739639a58ac638679d99413a1bee8823729783123cbe4495ac42822df31f4776f0380a63786b9f4fc73190e012ae5  no-pic.patch
-3a9b665f8fda89729c4c269ea82f82ee515f0026d26f1d51e2cf84054456e394afc14875e7ed29280a12488907d50c70af313e2e4a5b62c328bbade098db9d4d  no-longjmp-redefine.patch
-573146b72c980af5e41540fd7912b5579b050e41ac9d808e8d14268cf0a0fa1a70e6fade85011c0f18f1a428bc95b225d8b8345be1c50656dc69046ef1eb0b40  fix-arm-hackery.patch
-5de9747fe60bbc60aa8ac9870f397fa8750723f919fea25a6afc22066be45a8ad193f7935d3deacbe85c032be89b8ace0a7e82b6c9981ddaf3b7f6e8d140c61f  default-sc-getpw-r-size-max.patch
-9c25d58d8172ade339d468b86b51a2ad964bf1a2e80d917934f318a78b9e5820f261d4742afec467ef567a905039184829c449ee9ac8f08385029d130badaebf  new-binutils.patch"
diff --git a/community/go-bootstrap/default-sc-getpw-r-size-max.patch b/community/go-bootstrap/default-sc-getpw-r-size-max.patch
deleted file mode 100644
index f242b5a3cc97..000000000000
--- a/community/go-bootstrap/default-sc-getpw-r-size-max.patch
+++ /dev/null
@@ -1,15 +0,0 @@
---- a/src/os/user/lookup_unix.go
-+++ b/src/os/user/lookup_unix.go
-@@ -57,6 +57,12 @@
- 		bufSize = 1024
- 	} else {
- 		bufSize = C.sysconf(C._SC_GETPW_R_SIZE_MAX)
-+		// The musl alternative standard library on Linux
-+		// return -1 as specified by POSIX if there are no
-+		// hard limit on _SC_GETPW_R_SIZE_MAX.
-+		if bufSize == -1 {
-+			bufSize = 1024
-+		}
- 		if bufSize <= 0 || bufSize > 1<<20 {
- 			return nil, fmt.Errorf("user: unreasonable _SC_GETPW_R_SIZE_MAX of %d", bufSize)
- 		}
diff --git a/community/go-bootstrap/fix-arm-hackery.patch b/community/go-bootstrap/fix-arm-hackery.patch
deleted file mode 100644
index f5a447264c22..000000000000
--- a/community/go-bootstrap/fix-arm-hackery.patch
+++ /dev/null
@@ -1,98 +0,0 @@
---- go/src/cmd/dist/arm.c
-+++ go.fixed/src/cmd/dist/arm.c
-@@ -11,8 +11,8 @@
- 	return "6";
- }
- #else
--static void useVFPv3(void);
--static void useVFPv1(void);
-+void useVFPv3(void);
-+void useVFPv1(void);
- 
- char *
- xgetgoarm(void)
-@@ -26,46 +26,6 @@
- 	else if(xtryexecfunc(useVFPv1))
- 		return "6";
- 	return "5";
--}
--
--static void
--useVFPv3(void)
--{
--	// try to run VFPv3-only "vmov.f64 d0, #112" instruction
--	// we can't use that instruction directly, because we
--	// might be compiling with a soft-float only toolchain.
--	//
--	// some newer toolchains are configured to use thumb
--	// by default, so we need to do some mode changing magic
--	// here.
--	// We can use "bx pc; nop" here, but GNU as(1) insists
--	// on warning us
--	// "use of r15 in bx in ARM mode is not really useful"
--	// so we workaround that by using "bx r0"
--	__asm__ __volatile__ ("mov r0, pc");
--	__asm__ __volatile__ ("bx r0");
--	__asm__ __volatile__ (".word 0xeeb70b00"); // vmov.f64 d0, #112
--	__asm__ __volatile__ (".word 0xe12fff1e"); // bx lr
--}
--
--static void
--useVFPv1(void)
--{
--	// try to run "vmov.f64 d0, d0" instruction
--	// we can't use that instruction directly, because we
--	// might be compiling with a soft-float only toolchain
--	//
--	// some newer toolchains are configured to use thumb
--	// by default, so we need to do some mode changing magic
--	// here.
--	// We can use "bx pc; nop" here, but GNU as(1) insists
--	// on warning us
--	// "use of r15 in bx in ARM mode is not really useful"
--	// so we workaround that by using "bx r0"
--	__asm__ __volatile__ ("mov r0, pc");
--	__asm__ __volatile__ ("bx r0");
--	__asm__ __volatile__ (".word 0xeeb00b40"); // vomv.f64 d0, d0
--	__asm__ __volatile__ (".word 0xe12fff1e"); // bx lr
- }
- 
- #endif
---- go/src/make.bash
-+++ go.fixed/src/make.bash
-@@ -129,7 +132,7 @@
- if [ -z "$CC" -a -z "$(type -t gcc)" -a -n "$(type -t clang)" ]; then
- 	export CC=clang CXX=clang++
- fi
--${CC:-gcc} $mflag -O2 -Wall -Werror -o cmd/dist/dist -Icmd/dist "$DEFGOROOT" cmd/dist/*.c
-+${CC:-gcc} $mflag -O2 -Wall -Werror -o cmd/dist/dist -Icmd/dist "$DEFGOROOT" cmd/dist/*.c cmd/dist/*.S
- 
- # -e doesn't propagate out of eval, so check success by hand.
- eval $(./cmd/dist/dist env -p || echo FAIL=true)
---- /dev/null	2014-12-09 07:52:31.203329541 -0200
-+++ go.fixed/src/cmd/dist/arm.S	2014-12-09 10:29:34.149969243 -0200
-@@ -0,0 +1,24 @@
-+#ifdef __ARMEL__
-+
-+.text
-+
-+.global useVFPv3
-+.hidden useVFPv3
-+.type useVFPv3,%function
-+useVFPv3:
-+	mov r0, pc
-+	bx r0
-+	.word 0xeeb70b00 // vmov.f64 d0, #112
-+	.word 0xe12fff1e // bx lr
-+
-+
-+.global useVFPv1
-+.hidden useVFPv1
-+.type useVFPv1,%function
-+useVFPv1:
-+	mov r0, pc
-+	bx r0
-+	.word 0xeeb00b40 // vomv.f64 d0, d0
-+	.word 0xe12fff1e // bx lr
-+
-+#endif
diff --git a/community/go-bootstrap/new-binutils.patch b/community/go-bootstrap/new-binutils.patch
deleted file mode 100644
index 6669bd633037..000000000000
--- a/community/go-bootstrap/new-binutils.patch
+++ /dev/null
@@ -1,186 +0,0 @@
-https://github.com/golang/go/issues/13114
-https://gnats.netbsd.org/50777
-
---- a/src/cmd/6l/asm.c	2014-12-11 01:18:10.000000000 +0000
-+++ b/src/cmd/6l/asm.c
-@@ -118,6 +118,8 @@ adddynrel(LSym *s, Reloc *r)
- 		return;
- 	
- 	case 256 + R_X86_64_GOTPCREL:
-+	case 256 + R_X86_64_GOTPCRELX:
-+	case 256 + R_X86_64_REX_GOTPCRELX:
- 		if(targ->type != SDYNIMPORT) {
- 			// have symbol
- 			if(r->off >= 2 && s->p[r->off-2] == 0x8b) {
-
---- a/src/cmd/ld/ldelf.c.orig	2015-09-23 04:37:36.000000000 +0000
-+++ b/src/cmd/ld/ldelf.c
-@@ -888,12 +888,15 @@ reltype(char *pn, int elftype, uchar *si
- 	case R('6', R_X86_64_PC32):
- 	case R('6', R_X86_64_PLT32):
- 	case R('6', R_X86_64_GOTPCREL):
-+	case R('6', R_X86_64_GOTPCRELX):
-+	case R('6', R_X86_64_REX_GOTPCRELX):
- 	case R('8', R_386_32):
- 	case R('8', R_386_PC32):
- 	case R('8', R_386_GOT32):
- 	case R('8', R_386_PLT32):
- 	case R('8', R_386_GOTOFF):
- 	case R('8', R_386_GOTPC):
-+	case R('8', R_386_GOT32X):
- 		*siz = 4;
- 		break;
- 	case R('6', R_X86_64_64):
-
---- a/src/cmd/ld/elf.h.orig	2015-09-23 04:37:36.000000000 +0000
-+++ b/src/cmd/ld/elf.h
-@@ -478,32 +478,47 @@ typedef struct {
-  * Relocation types.
-  */
- 
--#define	R_X86_64_NONE	0	/* No relocation. */
--#define	R_X86_64_64	1	/* Add 64 bit symbol value. */
--#define	R_X86_64_PC32	2	/* PC-relative 32 bit signed sym value. */
--#define	R_X86_64_GOT32	3	/* PC-relative 32 bit GOT offset. */
--#define	R_X86_64_PLT32	4	/* PC-relative 32 bit PLT offset. */
--#define	R_X86_64_COPY	5	/* Copy data from shared object. */
--#define	R_X86_64_GLOB_DAT 6	/* Set GOT entry to data address. */
--#define	R_X86_64_JMP_SLOT 7	/* Set GOT entry to code address. */
--#define	R_X86_64_RELATIVE 8	/* Add load address of shared object. */
--#define	R_X86_64_GOTPCREL 9	/* Add 32 bit signed pcrel offset to GOT. */
--#define	R_X86_64_32	10	/* Add 32 bit zero extended symbol value */
--#define	R_X86_64_32S	11	/* Add 32 bit sign extended symbol value */
--#define	R_X86_64_16	12	/* Add 16 bit zero extended symbol value */
--#define	R_X86_64_PC16	13	/* Add 16 bit signed extended pc relative symbol value */
--#define	R_X86_64_8	14	/* Add 8 bit zero extended symbol value */
--#define	R_X86_64_PC8	15	/* Add 8 bit signed extended pc relative symbol value */
--#define	R_X86_64_DTPMOD64 16	/* ID of module containing symbol */
--#define	R_X86_64_DTPOFF64 17	/* Offset in TLS block */
--#define	R_X86_64_TPOFF64 18	/* Offset in static TLS block */
--#define	R_X86_64_TLSGD	19	/* PC relative offset to GD GOT entry */
--#define	R_X86_64_TLSLD	20	/* PC relative offset to LD GOT entry */
--#define	R_X86_64_DTPOFF32 21	/* Offset in TLS block */
--#define	R_X86_64_GOTTPOFF 22	/* PC relative offset to IE GOT entry */
--#define	R_X86_64_TPOFF32 23	/* Offset in static TLS block */
--
--#define	R_X86_64_COUNT	24	/* Count of defined relocation types. */
-+#define	R_X86_64_NONE           0
-+#define	R_X86_64_64             1
-+#define	R_X86_64_PC32           2
-+#define	R_X86_64_GOT32          3
-+#define	R_X86_64_PLT32          4
-+#define	R_X86_64_COPY           5
-+#define	R_X86_64_GLOB_DAT       6
-+#define	R_X86_64_JMP_SLOT       7
-+#define	R_X86_64_RELATIVE       8
-+#define	R_X86_64_GOTPCREL       9
-+#define	R_X86_64_32             10
-+#define	R_X86_64_32S            11
-+#define	R_X86_64_16             12
-+#define	R_X86_64_PC16           13
-+#define	R_X86_64_8              14
-+#define	R_X86_64_PC8            15
-+#define	R_X86_64_DTPMOD64       16
-+#define	R_X86_64_DTPOFF64       17
-+#define	R_X86_64_TPOFF64        18
-+#define	R_X86_64_TLSGD          19
-+#define	R_X86_64_TLSLD          20
-+#define	R_X86_64_DTPOFF32       21
-+#define	R_X86_64_GOTTPOFF       22
-+#define	R_X86_64_TPOFF32        23
-+#define	R_X86_64_PC64           24
-+#define	R_X86_64_GOTOFF64       25
-+#define	R_X86_64_GOTPC32        26
-+#define	R_X86_64_GOT64          27
-+#define	R_X86_64_GOTPCREL64     28
-+#define	R_X86_64_GOTPC64        29
-+#define	R_X86_64_GOTPLT64       30
-+#define	R_X86_64_PLTOFF64       31
-+#define	R_X86_64_SIZE32         32
-+#define	R_X86_64_SIZE64         33
-+#define	R_X86_64_GOTPC32_TLSDEC 34
-+#define	R_X86_64_TLSDESC_CALL   35
-+#define	R_X86_64_TLSDESC        36
-+#define	R_X86_64_IRELATIVE      37
-+#define	R_X86_64_PC32_BND       40
-+#define	R_X86_64_GOTPCRELX      41
-+#define	R_X86_64_REX_GOTPCRELX  42
- 
- 
- #define	R_ALPHA_NONE		0	/* No reloc */
-@@ -581,39 +596,42 @@ typedef struct {
- #define	R_ARM_COUNT		38	/* Count of defined relocation types. */
- 
- 
--#define	R_386_NONE	0	/* No relocation. */
--#define	R_386_32	1	/* Add symbol value. */
--#define	R_386_PC32	2	/* Add PC-relative symbol value. */
--#define	R_386_GOT32	3	/* Add PC-relative GOT offset. */
--#define	R_386_PLT32	4	/* Add PC-relative PLT offset. */
--#define	R_386_COPY	5	/* Copy data from shared object. */
--#define	R_386_GLOB_DAT	6	/* Set GOT entry to data address. */
--#define	R_386_JMP_SLOT	7	/* Set GOT entry to code address. */
--#define	R_386_RELATIVE	8	/* Add load address of shared object. */
--#define	R_386_GOTOFF	9	/* Add GOT-relative symbol address. */
--#define	R_386_GOTPC	10	/* Add PC-relative GOT table address. */
--#define	R_386_TLS_TPOFF	14	/* Negative offset in static TLS block */
--#define	R_386_TLS_IE	15	/* Absolute address of GOT for -ve static TLS */
--#define	R_386_TLS_GOTIE	16	/* GOT entry for negative static TLS block */
--#define	R_386_TLS_LE	17	/* Negative offset relative to static TLS */
--#define	R_386_TLS_GD	18	/* 32 bit offset to GOT (index,off) pair */
--#define	R_386_TLS_LDM	19	/* 32 bit offset to GOT (index,zero) pair */
--#define	R_386_TLS_GD_32	24	/* 32 bit offset to GOT (index,off) pair */
--#define	R_386_TLS_GD_PUSH 25	/* pushl instruction for Sun ABI GD sequence */
--#define	R_386_TLS_GD_CALL 26	/* call instruction for Sun ABI GD sequence */
--#define	R_386_TLS_GD_POP 27	/* popl instruction for Sun ABI GD sequence */
--#define	R_386_TLS_LDM_32 28	/* 32 bit offset to GOT (index,zero) pair */
--#define	R_386_TLS_LDM_PUSH 29	/* pushl instruction for Sun ABI LD sequence */
--#define	R_386_TLS_LDM_CALL 30	/* call instruction for Sun ABI LD sequence */
--#define	R_386_TLS_LDM_POP 31	/* popl instruction for Sun ABI LD sequence */
--#define	R_386_TLS_LDO_32 32	/* 32 bit offset from start of TLS block */
--#define	R_386_TLS_IE_32	33	/* 32 bit offset to GOT static TLS offset entry */
--#define	R_386_TLS_LE_32	34	/* 32 bit offset within static TLS block */
--#define	R_386_TLS_DTPMOD32 35	/* GOT entry containing TLS index */
--#define	R_386_TLS_DTPOFF32 36	/* GOT entry containing TLS offset */
--#define	R_386_TLS_TPOFF32 37	/* GOT entry of -ve static TLS offset */
--
--#define	R_386_COUNT	38	/* Count of defined relocation types. */
-+#define	R_386_NONE          0
-+#define	R_386_32            1
-+#define	R_386_PC32          2
-+#define	R_386_GOT32         3
-+#define	R_386_PLT32         4
-+#define	R_386_COPY          5
-+#define	R_386_GLOB_DAT      6
-+#define	R_386_JMP_SLOT      7
-+#define	R_386_RELATIVE      8
-+#define	R_386_GOTOFF        9
-+#define	R_386_GOTPC         10
-+#define	R_386_TLS_TPOFF     14
-+#define	R_386_TLS_IE        15
-+#define	R_386_TLS_GOTIE     16
-+#define	R_386_TLS_LE        17
-+#define	R_386_TLS_GD        18
-+#define	R_386_TLS_LDM       19
-+#define	R_386_TLS_GD_32     24
-+#define	R_386_TLS_GD_PUSH   25
-+#define	R_386_TLS_GD_CALL   26
-+#define	R_386_TLS_GD_POP    27
-+#define	R_386_TLS_LDM_32    28
-+#define	R_386_TLS_LDM_PUSH  29
-+#define	R_386_TLS_LDM_CALL  30
-+#define	R_386_TLS_LDM_POP   31
-+#define	R_386_TLS_LDO_32    32
-+#define	R_386_TLS_IE_32     33
-+#define	R_386_TLS_LE_32     34
-+#define	R_386_TLS_DTPMOD32  35
-+#define	R_386_TLS_DTPOFF32  36
-+#define	R_386_TLS_TPOFF32   37
-+#define	R_386_TLS_GOTDESC   39
-+#define	R_386_TLS_DESC_CALL 40
-+#define	R_386_TLS_DESC      41
-+#define	R_386_IRELATIVE     42
-+#define	R_386_GOT32X        43
- 
- #define	R_PPC_NONE		0	/* No relocation. */
- #define	R_PPC_ADDR32		1
diff --git a/community/go-bootstrap/no-longjmp-redefine.patch b/community/go-bootstrap/no-longjmp-redefine.patch
deleted file mode 100644
index 36566d7a8296..000000000000
--- a/community/go-bootstrap/no-longjmp-redefine.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/include/libc.h
-+++ b/include/libc.h
-@@ -102,7 +102,6 @@ extern	void	sysfatal(char*, ...);
- #define atoll		p9atoll
- #define getenv		p9getenv
- #define	getwd		p9getwd
--#define	longjmp		p9longjmp
- #undef  setjmp
- #define setjmp		p9setjmp
- #define putenv		p9putenv
diff --git a/community/go-bootstrap/no-pic.patch b/community/go-bootstrap/no-pic.patch
deleted file mode 100644
index 633dd9a1cf0d..000000000000
--- a/community/go-bootstrap/no-pic.patch
+++ /dev/null
@@ -1,14 +0,0 @@
---- a/src/cmd/ld/lib.c
-+++ b/src/cmd/ld/lib.c
-@@ -786,6 +786,11 @@ hostlink(void)
- 		p = strchr(p + 1, ' ');
- 	}
- 
-+	// The Go linker does not currently support building objects that
-+	// may be linked into a PIE. See:
-+	// https://code.google.com/p/go/issues/detail?id=6940
-+	argv[argc++] = "-fno-PIC";
-+
- 	argv[argc] = nil;
- 
- 	quotefmtinstall();
-- 
GitLab