1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Update golang

This commit is contained in:
Ycarus (Yannick Chabanois) 2023-04-06 21:01:09 +02:00
parent e992652783
commit d322ac87b8
4 changed files with 130 additions and 31 deletions

View file

@ -7,7 +7,7 @@
include $(TOPDIR)/rules.mk
GO_VERSION_MAJOR_MINOR:=1.17
GO_VERSION_MAJOR_MINOR:=1.20
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:=e447b498cde50215c4f7619e5124b0fc4e25fb5d16ea47271c47f278e7aa763a
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
PKG_LICENSE:=BSD-3-Clause
@ -63,9 +63,11 @@ HOST_GO_VALID_OS_ARCH:= \
aix_ppc64 \
js_wasm \
\
freebsd_riscv64 \
\
linux_ppc64 linux_ppc64le \
linux_mips linux_mipsle linux_mips64 linux_mips64le \
linux_riscv64 linux_s390x \
linux_loong64 linux_riscv64 linux_s390x \
\
openbsd_mips64
@ -86,6 +88,12 @@ BOOTSTRAP_GO_VALID_OS_ARCH:= \
solaris_amd64 \
windows_386 windows_amd64
BOOTSTRAP_1_17_SOURCE:=go1.17.13.src.tar.gz
BOOTSTRAP_1_17_SOURCE_URL:=$(GO_SOURCE_URLS)
BOOTSTRAP_1_17_HASH:=a1a48b23afb206f95e7bbaa9b898d965f90826f6f1d1fc0c1d784ada0cd300fd
BOOTSTRAP_1_17_BUILD_DIR:=$(HOST_BUILD_DIR)/.go_bootstrap_1.17
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
include ../golang-compiler.mk
@ -94,6 +102,7 @@ include ../golang-package.mk
PKG_UNPACK:=$(HOST_TAR) -C "$(PKG_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(PKG_SOURCE)"
HOST_UNPACK:=$(HOST_TAR) -C "$(HOST_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(PKG_SOURCE)"
BOOTSTRAP_UNPACK:=$(HOST_TAR) -C "$(BOOTSTRAP_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(BOOTSTRAP_SOURCE)"
BOOTSTRAP_1_17_UNPACK:=$(HOST_TAR) -C "$(BOOTSTRAP_1_17_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(BOOTSTRAP_1_17_SOURCE)"
# don't strip ELF executables in test data
RSTRIP:=:
@ -106,7 +115,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
@ -181,8 +190,7 @@ ifeq ($(BOOTSTRAP_ROOT_DIR),)
$(eval $(call Download,golang-bootstrap))
define Bootstrap/Prepare
mkdir -p "$(BOOTSTRAP_BUILD_DIR)"
$(BOOTSTRAP_UNPACK)
mkdir -p "$(BOOTSTRAP_BUILD_DIR)" && $(BOOTSTRAP_UNPACK) ;
endef
Hooks/HostPrepare/Post+=Bootstrap/Prepare
@ -190,6 +198,23 @@ ifeq ($(BOOTSTRAP_ROOT_DIR),)
endif
# Bootstrap 1.17
define Download/golang-bootstrap-1.17
FILE:=$(BOOTSTRAP_1_17_SOURCE)
URL:=$(BOOTSTRAP_1_17_SOURCE_URL)
HASH:=$(BOOTSTRAP_1_17_HASH)
endef
$(eval $(call Download,golang-bootstrap-1.17))
define Bootstrap-1.17/Prepare
mkdir -p "$(BOOTSTRAP_1_17_BUILD_DIR)" && $(BOOTSTRAP_1_17_UNPACK) ;
endef
Hooks/HostPrepare/Post+=Bootstrap-1.17/Prepare
$(eval $(call GoCompiler/AddProfile,Bootstrap-1.17,$(BOOTSTRAP_1_17_BUILD_DIR),,bootstrap-1.17,$(GO_HOST_OS_ARCH)))
# Host
ifeq ($(GO_HOST_PIE_SUPPORTED),1)
@ -202,23 +227,31 @@ 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) \
)
$(call GoCompiler/Host/Make, \
$(call GoCompiler/Bootstrap-1.17/Make, \
GOROOT_BOOTSTRAP="$(BOOTSTRAP_ROOT_DIR)" \
$(HOST_GO_VARS) \
)
$(call GoCompiler/Host/Make, \
GOROOT_BOOTSTRAP="$(BOOTSTRAP_1_17_BUILD_DIR)" \
$(if $(HOST_GO_ENABLE_PIE),GO_LDFLAGS="-buildmode pie") \
$(HOST_GO_VARS) \
)
@ -262,14 +295,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" \
@ -290,18 +325,19 @@ PKG_GO_LDFLAGS= \
-extldflags '$(patsubst -z%,-Wl$(comma)-z$(comma)%,$(TARGET_LDFLAGS))' \
$(if $(CONFIG_NO_STRIP)$(CONFIG_DEBUG),,-s -w)
# setting -trimpath is not necessary here because the paths inside the
# compiler binary are relative to GOROOT_FINAL (PKG_GO_ROOT), which is
# static / not dependent on the build environment
PKG_GO_INSTALL_ARGS= \
-buildvcs=false \
-trimpath \
-ldflags "all=$(PKG_GO_LDFLAGS)" \
$(if $(PKG_GO_GCFLAGS),-gcflags "all=$(PKG_GO_GCFLAGS)") \
$(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
@@ -1535,25 +1535,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"
}
}
}