golang: bump version

This commit is contained in:
coolsnowwolf 2022-11-28 14:01:34 +08:00
parent 2ba6126582
commit cdc48015dd
7 changed files with 98 additions and 29 deletions

View File

@ -56,7 +56,7 @@ configure() {
if [ "$GO_INSTALL_ALL" != 1 ]; then
code="$(printf '%s\n' "$files" | grep '\.\(c\|cc\|cpp\|go\|h\|hh\|hpp\|proto\|s\)$')"
testdata="$(printf '%s\n' "$files" | grep '/testdata/')"
gomod="$(printf '%s\n' "$files" | grep '/go\.\(mod\|sum\)$')"
gomod="$(printf '%s\n' "$files" | grep '/go\.\(mod\|sum\|work\)$')"
for pattern in $GO_INSTALL_EXTRA; do
extra="$(printf '%s\n' "$extra"; printf '%s\n' "$files" | grep -e "$pattern")"

View File

@ -27,7 +27,10 @@ define GoCompiler/Default/Make
cd "$(1)/src" ; \
$(if $(2),GOROOT_FINAL="$(2)/lib/go-$(3)") \
$(4) \
$(BASH) make.bash --no-banner ; \
$(BASH) make.bash \
$(if $(findstring s,$(OPENWRT_VERBOSE)),-v) \
--no-banner \
; \
)
endef

View File

@ -107,10 +107,10 @@ GO_HOST_CUSTOM_LDFLAGS= \
GO_HOST_INSTALL_ARGS= \
-v \
-ldflags "all=$(GO_HOST_DEFAULT_LDFLAGS)" \
$(if $(filter $(GO_HOST_ENABLE_PIE),1),-buildmode pie) \
$(if $(GO_HOST_GCFLAGS),-gcflags "$(GO_HOST_GCFLAGS)") \
$(if $(GO_HOST_CUSTOM_LDFLAGS),-ldflags "$(GO_HOST_CUSTOM_LDFLAGS) $(GO_HOST_DEFAULT_LDFLAGS)") \
$(if $(GO_HOST_TAGS),-tags "$(GO_HOST_TAGS)")
$(if $(GO_HOST_ENABLE_PIE),-buildmode pie) \
$(if $(strip $(GO_HOST_GCFLAGS)),-gcflags "$(GO_HOST_GCFLAGS)") \
$(if $(strip $(GO_HOST_CUSTOM_LDFLAGS)),-ldflags "$(GO_HOST_CUSTOM_LDFLAGS) $(GO_HOST_DEFAULT_LDFLAGS)") \
$(if $(strip $(GO_HOST_TAGS)),-tags "$(GO_HOST_TAGS)")
define GoHost/Host/Configure
$(GO_GENERAL_BUILD_CONFIG_VARS) \

View File

@ -32,7 +32,7 @@ include $(GO_INCLUDE_DIR)/golang-values.mk
#
# * Files in any 'testdata' directory
#
# * go.mod and go.sum, in any directory
# * go.mod, go.sum and go.work, in any directory
#
# e.g. GO_PKG_INSTALL_EXTRA:=example.toml marshal_test.toml
#
@ -198,9 +198,11 @@ GO_PKG_TARGET_VARS= \
GOOS="$(GO_OS)" \
GOARCH="$(GO_ARCH)" \
GO386="$(GO_386)" \
GOAMD64="$(GO_AMD64)" \
GOARM="$(GO_ARM)" \
GOMIPS="$(GO_MIPS)" \
GOMIPS64="$(GO_MIPS64)" \
GOPPC64="$(GO_PPC64)" \
CGO_ENABLED=1 \
CC="$(TARGET_CC)" \
CXX="$(TARGET_CXX)" \
@ -236,17 +238,18 @@ GO_PKG_CUSTOM_LDFLAGS= \
GO_PKG_INSTALL_ARGS= \
-v \
-buildvcs=false \
-trimpath \
-ldflags "all=$(GO_PKG_DEFAULT_LDFLAGS)" \
$(if $(GO_PKG_DEFAULT_GCFLAGS),-gcflags "all=$(GO_PKG_DEFAULT_GCFLAGS)") \
$(if $(GO_PKG_DEFAULT_ASMFLAGS),-asmflags "all=$(GO_PKG_DEFAULT_ASMFLAGS)") \
$(if $(filter $(GO_PKG_ENABLE_PIE),1),-buildmode pie) \
$(if $(strip $(GO_PKG_DEFAULT_GCFLAGS)),-gcflags "all=$(GO_PKG_DEFAULT_GCFLAGS)") \
$(if $(strip $(GO_PKG_DEFAULT_ASMFLAGS)),-asmflags "all=$(GO_PKG_DEFAULT_ASMFLAGS)") \
$(if $(GO_PKG_ENABLE_PIE),-buildmode pie) \
$(if $(filter $(GO_ARCH),arm),-installsuffix "v$(GO_ARM)") \
$(if $(filter $(GO_ARCH),mips mipsle),-installsuffix "$(GO_MIPS)") \
$(if $(filter $(GO_ARCH),mips64 mips64le),-installsuffix "$(GO_MIPS64)") \
$(if $(GO_PKG_GCFLAGS),-gcflags "$(GO_PKG_GCFLAGS) $(GO_PKG_DEFAULT_GCFLAGS)") \
$(if $(GO_PKG_CUSTOM_LDFLAGS),-ldflags "$(GO_PKG_CUSTOM_LDFLAGS) $(GO_PKG_DEFAULT_LDFLAGS)") \
$(if $(GO_PKG_TAGS),-tags "$(GO_PKG_TAGS)")
$(if $(strip $(GO_PKG_GCFLAGS)),-gcflags "$(GO_PKG_GCFLAGS) $(GO_PKG_DEFAULT_GCFLAGS)") \
$(if $(strip $(GO_PKG_CUSTOM_LDFLAGS)),-ldflags "$(GO_PKG_CUSTOM_LDFLAGS) $(GO_PKG_DEFAULT_LDFLAGS)") \
$(if $(strip $(GO_PKG_TAGS)),-tags "$(GO_PKG_TAGS)")
define GoPackage/Build/Configure
$(GO_GENERAL_BUILD_CONFIG_VARS) \

View File

@ -29,7 +29,8 @@ unexport \
GOOS \
GOPATH \
GOROOT \
GOTMPDIR
GOTMPDIR \
GOWORK
# Unmodified:
# GOINSECURE
# GOPRIVATE
@ -58,8 +59,10 @@ unexport \
unexport \
GOARM \
GO386 \
GOAMD64 \
GOMIPS \
GOMIPS64 \
GOPPC64 \
GOWASM
# Special-purpose environment variables:
@ -86,13 +89,12 @@ unexport \
# CC_FOR_${GOOS}_${GOARCH}
# CXX_FOR_${GOOS}_${GOARCH}
# From https://golang.org/doc/install/source#environment
# From https://go.dev/doc/install/source#environment
unexport \
GOHOSTOS \
GOHOSTARCH \
GOPPC64
GOHOSTARCH
# From https://golang.org/src/make.bash
# From https://go.dev/src/make.bash
unexport \
GO_GCFLAGS \
GO_LDFLAGS \
@ -101,16 +103,16 @@ unexport \
GOBUILDTIMELOGFILE \
GOROOT_BOOTSTRAP
# From https://golang.org/doc/go1.9#parallel-compile
# From https://go.dev/doc/go1.9#parallel-compile
unexport \
GO19CONCURRENTCOMPILATION
# From https://golang.org/src/cmd/dist/build.go
# From https://go.dev/src/cmd/dist/build.go
unexport \
BOOT_GO_GCFLAGS \
BOOT_GO_LDFLAGS
# From https://golang.org/src/cmd/dist/buildtool.go
# From https://go.dev/src/cmd/dist/buildtool.go
unexport \
GOBOOTSTRAP_TOOLEXEC
@ -152,6 +154,9 @@ ifeq ($(GO_ARCH),386)
# -fno-plt: causes "unexpected GOT reloc for non-dynamic symbol" errors
GO_CFLAGS_TO_REMOVE:=-fno-plt
else ifeq ($(GO_ARCH),amd64)
GO_AMD64:=v1
else ifeq ($(GO_ARCH),arm)
GO_TARGET_FPU:=$(word 2,$(subst +,$(space),$(call qstrip,$(CONFIG_CPU_TYPE))))
@ -183,6 +188,9 @@ else ifneq ($(filter $(GO_ARCH),mips64 mips64le),)
GO_MIPS64:=softfloat
endif
else ifeq ($(GO_ARCH),ppc64)
GO_PPC64:=power8
endif
@ -193,7 +201,7 @@ GO_ARCH_DEPENDS:=@(aarch64||arm||i386||i686||mips||mips64||mips64el||mipsel||pow
# ASLR/PIE
# From https://golang.org/src/cmd/internal/sys/supported.go
# From https://go.dev/src/cmd/internal/sys/supported.go
GO_PIE_SUPPORTED_OS_ARCH:= \
android_386 android_amd64 android_arm android_arm64 \
linux_386 linux_amd64 linux_arm linux_arm64 \
@ -209,7 +217,7 @@ GO_PIE_SUPPORTED_OS_ARCH:= \
\
linux_ppc64le linux_riscv64 linux_s390x
# From https://golang.org/src/cmd/go/internal/work/init.go
# From https://go.dev/src/cmd/go/internal/work/init.go
go_pie_install_suffix=$(if $(filter $(1),aix_ppc64 windows_386 windows_amd64 windows_arm),,shared)
ifneq ($(filter $(GO_HOST_OS_ARCH),$(GO_PIE_SUPPORTED_OS_ARCH)),)

View File

@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
GO_VERSION_MAJOR_MINOR:=1.17
GO_VERSION_MAJOR_MINOR:=1.19
GO_VERSION_PATCH:=3
PKG_NAME:=golang
@ -20,7 +20,7 @@ GO_SOURCE_URLS:=https://dl.google.com/go/ \
PKG_SOURCE:=go$(PKG_VERSION).src.tar.gz
PKG_SOURCE_URL:=$(GO_SOURCE_URLS)
PKG_HASH:=705c64251e5b25d5d55ede1039c6aa22bea40a7a931d14c370339853643c3df0
PKG_HASH:=18ac263e39210bcf68d85f4370e97fb1734166995a1f63fb38b4f6e07d90d212
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
PKG_LICENSE:=BSD-3-Clause
@ -106,7 +106,7 @@ endif
define Package/golang/Default
$(call GoPackage/GoSubMenu)
TITLE:=Go programming language
URL:=https://golang.org/
URL:=https://go.dev/
DEPENDS:=$(GO_ARCH_DEPENDS)
endef
@ -202,17 +202,20 @@ endif
$(eval $(call GoCompiler/AddProfile,Host,$(HOST_BUILD_DIR),$(HOST_GO_PREFIX),$(HOST_GO_VERSION_ID),$(GO_HOST_OS_ARCH),$(HOST_GO_INSTALL_SUFFIX)))
HOST_GO_VARS= \
GOHOSTARCH="$(GO_HOST_ARCH)" \
GOCACHE="$(GO_BUILD_CACHE_DIR)" \
GOENV=off \
CC="$(HOSTCC_NOCACHE)" \
CXX="$(HOSTCXX_NOCACHE)"
define Host/Compile
define Host/Configure
$(call GoCompiler/Bootstrap/CheckHost,$(BOOTSTRAP_GO_VALID_OS_ARCH))
$(call GoCompiler/Host/CheckHost,$(HOST_GO_VALID_OS_ARCH))
mkdir -p "$(GO_BUILD_CACHE_DIR)"
endef
define Host/Compile
$(call GoCompiler/Bootstrap/Make, \
$(HOST_GO_VARS) \
)
@ -262,14 +265,16 @@ $(eval $(call GoCompiler/AddProfile,Package,$(PKG_BUILD_DIR),$(PKG_GO_PREFIX),$(
PKG_GO_ZBOOTSTRAP_MODS:= \
s/defaultGO386 = `[^`]*`/defaultGO386 = `$(or $(GO_386),sse2)`/; \
s/defaultGOAMD64 = `[^`]*`/defaultGOAMD64 = `$(or $(GO_AMD64),v1)`/; \
s/defaultGOARM = `[^`]*`/defaultGOARM = `$(or $(GO_ARM),5)`/; \
s/defaultGOMIPS = `[^`]*`/defaultGOMIPS = `$(or $(GO_MIPS),hardfloat)`/; \
s/defaultGOMIPS64 = `[^`]*`/defaultGOMIPS64 = `$(or $(GO_MIPS64),hardfloat)`/; \
s/defaultGOPPC64 = `[^`]*`/defaultGOPPC64 = `power8`/;
s/defaultGOPPC64 = `[^`]*`/defaultGOPPC64 = `$(or $(GO_PPC64),power8)`/;
PKG_GO_ZBOOTSTRAP_PATH:=$(PKG_BUILD_DIR)/src/internal/buildcfg/zbootstrap.go
PKG_GO_VARS= \
GOHOSTARCH="$(GO_HOST_ARCH)" \
GOCACHE="$(GO_BUILD_CACHE_DIR)" \
GOENV=off \
GO_GCC_HELPER_PATH="$$$$PATH" \
@ -299,9 +304,11 @@ PKG_GO_INSTALL_ARGS= \
$(if $(PKG_GO_ASMFLAGS),-asmflags "all=$(PKG_GO_ASMFLAGS)") \
$(if $(filter $(GO_PKG_ENABLE_PIE),1),-buildmode pie)
define Build/Compile
define Build/Configure
mkdir -p "$(GO_BUILD_CACHE_DIR)"
endef
define Build/Compile
@echo "Building target Go first stage"
$(call GoCompiler/Package/Make, \

View File

@ -0,0 +1,48 @@
From 5ccf9f47bf4f5ba53e0ab7338a7fd4626714cfb2 Mon Sep 17 00:00:00 2001
From: Jeffery To <jeffery.to@gmail.com>
Date: Tue, 23 Nov 2021 15:05:37 +0800
Subject: [PATCH] cmd/link: use gold on ARM/ARM64 only if gold is available
COPY relocation handling on ARM/ARM64 has been fixed in recent versions
of the GNU linker. This switches to gold only if gold is available.
Fixes #22040.
---
src/cmd/link/internal/ld/lib.go | 19 +++++++------------
1 file changed, 7 insertions(+), 12 deletions(-)
--- a/src/cmd/link/internal/ld/lib.go
+++ b/src/cmd/link/internal/ld/lib.go
@@ -1502,25 +1502,20 @@ func (ctxt *Link) hostlink() {
}
if ctxt.Arch.InFamily(sys.ARM, sys.ARM64) && buildcfg.GOOS == "linux" {
- // On ARM, the GNU linker will generate COPY relocations
- // even with -znocopyreloc set.
+ // On ARM, older versions of the GNU linker will generate
+ // COPY relocations even with -znocopyreloc set.
// https://sourceware.org/bugzilla/show_bug.cgi?id=19962
//
- // On ARM64, the GNU linker will fail instead of
- // generating COPY relocations.
+ // On ARM64, older versions of the GNU linker will fail
+ // instead of generating COPY relocations.
//
- // In both cases, switch to gold.
- altLinker = "gold"
-
- // If gold is not installed, gcc will silently switch
- // back to ld.bfd. So we parse the version information
- // and provide a useful error if gold is missing.
+ // In both cases, switch to gold if gold is available.
name, args := flagExtld[0], flagExtld[1:]
args = append(args, "-fuse-ld=gold", "-Wl,--version")
cmd := exec.Command(name, args...)
if out, err := cmd.CombinedOutput(); err == nil {
- if !bytes.Contains(out, []byte("GNU gold")) {
- log.Fatalf("ARM external linker must be gold (issue #15696), but is not: %s", out)
+ if bytes.Contains(out, []byte("GNU gold")) {
+ altLinker = "gold"
}
}
}