From 49a2ff493b46029e5acc1a902a1e850307bc20bc Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 12 May 2020 17:42:48 +0800 Subject: [PATCH 1/7] golang: Add option to use external bootstrap Go The default bootstrap Go (Go 1.4) can only be compiled on a limited number of platforms compared to newer versions of Go. This adds a config option to use an external bootstrap Go, e.g. installed through the build system's package manager or downloaded from golang.org. See: https://github.com/openwrt/packages/issues/11731 Signed-off-by: Jeffery To --- lang/golang/golang/Makefile | 34 +++++++++++++++++++++++++++++----- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/lang/golang/golang/Makefile b/lang/golang/golang/Makefile index 3df43d3de..25d1904a6 100644 --- a/lang/golang/golang/Makefile +++ b/lang/golang/golang/Makefile @@ -154,6 +154,23 @@ This package provides an assembler, compiler, linker, and compiled libraries for the Go programming language. endef +define Package/golang/config +menu "Configuration" + +config GOLANG_EXTERNAL_BOOTSTRAP_ROOT + string "External bootstrap Go root directory" + help + Path to a working Go tree (>= Go 1.4), with bin, pkg, and src + subdirectories and the Go compiler at bin/go. + + If specified, the existing Go installation will be used to + compile host (buildroot) Go. + + Leave blank to compile the default bootstrap Go. + +endmenu +endef + define Package/golang-doc $(call Package/golang/Default) TITLE+= (documentation) @@ -177,22 +194,29 @@ This package provides the Go programming language source files needed for cross-compilation. endef +EXTERNAL_BOOTSTRAP_DIR:=$(call qstrip,$(CONFIG_GOLANG_EXTERNAL_BOOTSTRAP_ROOT)) +USE_DEFAULT_BOOTSTRAP:=$(if $(EXTERNAL_BOOTSTRAP_DIR),,1) + define Download/golang-bootstrap FILE:=$(BOOTSTRAP_SOURCE) URL:=$(BOOTSTRAP_SOURCE_URL) HASH:=$(BOOTSTRAP_HASH) endef -$(eval $(call Download,golang-bootstrap)) -$(eval $(call GoCompiler/AddProfile,Bootstrap,$(BOOTSTRAP_BUILD_DIR),,bootstrap,$(GO_HOST_OS_ARCH))) $(eval $(call GoCompiler/AddProfile,Host,$(HOST_BUILD_DIR),$(HOST_GO_PREFIX),$(HOST_GO_VERSION_ID),$(GO_HOST_OS_ARCH),$(HOST_GO_INSTALL_SUFFIX))) $(eval $(call GoCompiler/AddProfile,Package,$(PKG_BUILD_DIR),$(PKG_GO_PREFIX),$(PKG_GO_VERSION_ID),$(GO_OS_ARCH),$(PKG_GO_INSTALL_SUFFIX))) -define Host/Prepare +ifeq ($(USE_DEFAULT_BOOTSTRAP),1) + $(eval $(call GoCompiler/AddProfile,Bootstrap,$(BOOTSTRAP_BUILD_DIR),,bootstrap,$(GO_HOST_OS_ARCH))) + + $(eval $(call Download,golang-bootstrap)) + + define Host/Prepare $(call Host/Prepare/Default) mkdir -p $(BOOTSTRAP_BUILD_DIR) $(BOOTSTRAP_UNPACK) -endef + endef +endif # when https://github.com/golang/go/issues/31544 is fixed, # we should be able to set GO_LDFLAGS=-buildmode=pie for host make @@ -212,7 +236,7 @@ define Host/Compile ) $(call GoCompiler/Host/Make, \ - GOROOT_BOOTSTRAP=$(BOOTSTRAP_BUILD_DIR) \ + GOROOT_BOOTSTRAP=$(if $(USE_DEFAULT_BOOTSTRAP),$(BOOTSTRAP_BUILD_DIR),$(EXTERNAL_BOOTSTRAP_DIR)) \ GOCACHE=$(HOST_GO_CACHE_DIR) \ CC=$(HOSTCC_NOCACHE) \ CXX=$(HOSTCXX_NOCACHE) \ From bcdd6e64fad2e04f06f62c32dd4d17ddcdeda5c8 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Tue, 12 May 2020 19:54:14 +0800 Subject: [PATCH 2/7] golang: Remove RSTRIP definition from golang-package.mk Since RSTRIP is defined in rules.mk as a recursively expanded variable, there is no need to define it again after setting STRIP in golang-package.mk. This also adds a note to the comment for GO_PKG_LDFLAGS to say that -s and -w flags are not necessary. Signed-off-by: Jeffery To --- lang/golang/golang-package.mk | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/lang/golang/golang-package.mk b/lang/golang/golang-package.mk index 303ae0eb3..de7ef336d 100644 --- a/lang/golang/golang-package.mk +++ b/lang/golang/golang-package.mk @@ -89,7 +89,12 @@ include $(GO_INCLUDE_DIR)/golang-values.mk # # Additional go tool link arguments to use when building targets. # -# e.g. GO_PKG_LDFLAGS:=-s -w +# Note that the OpenWrt build system has an option to strip binaries +# (enabled by default), so -s (Omit the symbol table and debug +# information) and -w (Omit the DWARF symbol table) flags are not +# necessary. +# +# e.g. GO_PKG_LDFLAGS:=-r dir1:dir2 -u # # # GO_PKG_LDFLAGS_X - list of string variable definitions, default empty @@ -147,16 +152,6 @@ ifneq ($(CONFIG_USE_SSTRIP),) GO_PKG_STRIP_ARGS:=--strip-all endif STRIP:=$(TARGET_CROSS)strip $(GO_PKG_STRIP_ARGS) - RSTRIP= \ - export CROSS="$(TARGET_CROSS)" \ - $(if $(PKG_BUILD_ID),KEEP_BUILD_ID=1) \ - $(if $(CONFIG_KERNEL_KALLSYMS),NO_RENAME=1) \ - $(if $(CONFIG_KERNEL_PROFILING),KEEP_SYMBOLS=1); \ - NM="$(TARGET_CROSS)nm" \ - STRIP="$(STRIP)" \ - STRIP_KMOD="$(SCRIPT_DIR)/strip-kmod.sh" \ - PATCHELF="$(STAGING_DIR_HOST)/bin/patchelf" \ - $(SCRIPT_DIR)/rstrip.sh endif define GoPackage/GoSubMenu From d2f5e6966b04f71e31e6fc8fbc02c096513fe284 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 13 May 2020 00:05:18 +0800 Subject: [PATCH 3/7] golang: Rename GoPackage/Environment to GO_PKG_VARS The variable is a list of shell variables; the new name is more in-line with other parts the build system (CONFIGURE_VARS, MAKE_VARS, etc.). GoPackage/Environment is kept (for now) in case other feeds are using it. Signed-off-by: Jeffery To --- lang/golang/golang-package.mk | 20 ++++++++++---------- lang/golang/golang/Makefile | 2 +- utils/containerd/Makefile | 2 +- utils/docker-ce/Makefile | 2 +- utils/runc/Makefile | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lang/golang/golang-package.mk b/lang/golang/golang-package.mk index de7ef336d..f336a8451 100644 --- a/lang/golang/golang-package.mk +++ b/lang/golang/golang-package.mk @@ -160,7 +160,7 @@ define GoPackage/GoSubMenu CATEGORY:=Languages endef -define GoPackage/Environment/Target +GO_PKG_TARGET_VARS= \ GOOS=$(GO_OS) \ GOARCH=$(GO_ARCH) \ GO386=$(GO_386) \ @@ -174,20 +174,20 @@ define GoPackage/Environment/Target CGO_CPPFLAGS="$(TARGET_CPPFLAGS)" \ CGO_CXXFLAGS="$(filter-out $(GO_CFLAGS_TO_REMOVE),$(TARGET_CXXFLAGS))" \ CGO_LDFLAGS="$(TARGET_LDFLAGS)" -endef -define GoPackage/Environment/Build +GO_PKG_BUILD_VARS= \ GOPATH=$(GO_PKG_BUILD_DIR) \ GOCACHE=$(GO_PKG_CACHE_DIR) \ GOENV=off -endef -define GoPackage/Environment/Default - $(call GoPackage/Environment/Target) \ - $(call GoPackage/Environment/Build) -endef +GO_PKG_DEFAULT_VARS= \ + $(GO_PKG_TARGET_VARS) \ + $(GO_PKG_BUILD_VARS) + +GO_PKG_VARS=$(GO_PKG_DEFAULT_VARS) -GoPackage/Environment=$(call GoPackage/Environment/Default) +# do not use for new code; this will be removed after the next OpenWrt release +GoPackage/Environment=$(GO_PKG_VARS) # false if directory does not exist GoPackage/is_dir_not_empty=$$$$($(FIND) $(1) -maxdepth 0 -type d \! -empty 2>/dev/null) @@ -273,7 +273,7 @@ endef define GoPackage/Build/Compile ( \ cd $(GO_PKG_BUILD_DIR) ; \ - export $(call GoPackage/Environment) ; \ + export $(GO_PKG_VARS) ; \ \ echo "Finding targets" ; \ targets=$$$$(go list $(GO_PKG_BUILD_PKG)) ; \ diff --git a/lang/golang/golang/Makefile b/lang/golang/golang/Makefile index 25d1904a6..21e261b1c 100644 --- a/lang/golang/golang/Makefile +++ b/lang/golang/golang/Makefile @@ -310,7 +310,7 @@ define Build/Compile ( \ cd $(PKG_BUILD_DIR)/bin ; \ - export $(call GoPackage/Environment/Target) ; \ + export $(GO_PKG_TARGET_VARS) ; \ $(CP) go go-host ; \ GOROOT_FINAL=$(PKG_GO_ROOT) \ GOCACHE=$(PKG_GO_TARGET_CACHE_DIR) \ diff --git a/utils/containerd/Makefile b/utils/containerd/Makefile index 3da8c8cb3..9afce5420 100644 --- a/utils/containerd/Makefile +++ b/utils/containerd/Makefile @@ -49,7 +49,7 @@ endef GO_PKG_INSTALL_ALL:=1 MAKE_PATH:=$(GO_PKG_WORK_DIR_NAME)/build/src/$(GO_PKG) -MAKE_VARS += $(call GoPackage/Environment) +MAKE_VARS += $(GO_PKG_VARS) MAKE_FLAGS += \ DESTDIR="$(PKG_INSTALL_DIR)" \ VERSION=$(PKG_VERSION) \ diff --git a/utils/docker-ce/Makefile b/utils/docker-ce/Makefile index a8735fcc7..0305a132f 100644 --- a/utils/docker-ce/Makefile +++ b/utils/docker-ce/Makefile @@ -78,7 +78,7 @@ endif define Build/Compile ( \ - export $(call GoPackage/Environment) \ + export $(GO_PKG_VARS) \ GITCOMMIT=$(PKG_SOURCE_VERSION) \ DOCKER_GITCOMMIT=$(PKG_SOURCE_VERSION) \ DOCKER_BUILDTAGS='$(BUILDTAGS)' \ diff --git a/utils/runc/Makefile b/utils/runc/Makefile index eef25fa8e..605b852b7 100644 --- a/utils/runc/Makefile +++ b/utils/runc/Makefile @@ -49,7 +49,7 @@ endef GO_PKG_INSTALL_ALL:=1 MAKE_PATH:=$(GO_PKG_WORK_DIR_NAME)/build/src/$(GO_PKG) -MAKE_VARS += $(call GoPackage/Environment) +MAKE_VARS += $(GO_PKG_VARS) MAKE_FLAGS += \ COMMIT=$(PKG_SOURCE_VERSION) From 25a7f0045e078cbd91d2d1de71ddd617ec4ff165 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 13 May 2020 02:08:56 +0800 Subject: [PATCH 4/7] golang: Move "go install" arguments logic, add buildid The moves the setting of arguments for "go install" out of the shell script in GoPackage/Build/Compile and into make. This also adds the -buildid link flag for reproducible builds. Signed-off-by: Jeffery To --- lang/golang/golang-package.mk | 59 ++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/lang/golang/golang-package.mk b/lang/golang/golang-package.mk index f336a8451..dc6038621 100644 --- a/lang/golang/golang-package.mk +++ b/lang/golang/golang-package.mk @@ -189,6 +189,43 @@ GO_PKG_VARS=$(GO_PKG_DEFAULT_VARS) # do not use for new code; this will be removed after the next OpenWrt release GoPackage/Environment=$(GO_PKG_VARS) +GO_PKG_DEFAULT_LDFLAGS= \ + -buildid '$(SOURCE_DATE_EPOCH)' \ + -linkmode external \ + -extldflags '$(patsubst -z%,-Wl$(comma)-z$(comma)%,$(TARGET_LDFLAGS))' + +GO_PKG_INSTALL_ARGS= \ + -v \ + -trimpath \ + -ldflags "all=$(GO_PKG_DEFAULT_LDFLAGS)" + +ifeq ($(GO_PKG_ENABLE_PIE),1) + GO_PKG_INSTALL_ARGS+= -buildmode pie +endif + +ifeq ($(GO_ARCH),arm) + GO_PKG_INSTALL_ARGS+= -installsuffix "v$(GO_ARM)" + +else ifneq ($(filter $(GO_ARCH),mips mipsle),) + GO_PKG_INSTALL_ARGS+= -installsuffix "$(GO_MIPS)" + +else ifneq ($(filter $(GO_ARCH),mips64 mips64le),) + GO_PKG_INSTALL_ARGS+= -installsuffix "$(GO_MIPS64)" + +endif + +ifneq ($(strip $(GO_PKG_GCFLAGS)),) + GO_PKG_INSTALL_ARGS+= -gcflags "$(GO_PKG_GCFLAGS)" +endif + +GO_PKG_CUSTOM_LDFLAGS= \ + $(GO_PKG_LDFLAGS) \ + $(patsubst %,-X %,$(GO_PKG_LDFLAGS_X)) + +ifneq ($(strip $(GO_PKG_CUSTOM_LDFLAGS)),) + GO_PKG_INSTALL_ARGS+= -ldflags "$(GO_PKG_CUSTOM_LDFLAGS) $(GO_PKG_DEFAULT_LDFLAGS)" +endif + # false if directory does not exist GoPackage/is_dir_not_empty=$$$$($(FIND) $(1) -maxdepth 0 -type d \! -empty 2>/dev/null) @@ -290,27 +327,7 @@ define GoPackage/Build/Compile \ if [ "$(strip $(GO_PKG_SOURCE_ONLY))" != 1 ]; then \ echo "Building targets" ; \ - case $(GO_ARCH) in \ - arm) installsuffix="v$(GO_ARM)" ;; \ - mips|mipsle) installsuffix="$(GO_MIPS)" ;; \ - mips64|mips64le) installsuffix="$(GO_MIPS64)" ;; \ - esac ; \ - ldflags="-linkmode external -extldflags '$(TARGET_LDFLAGS:-z%=-Wl,-z,%)'" ; \ - pkg_gcflags="$(strip $(GO_PKG_GCFLAGS))" ; \ - pkg_ldflags="$(strip $(GO_PKG_LDFLAGS))" ; \ - for def in $(GO_PKG_LDFLAGS_X); do \ - pkg_ldflags="$$$$pkg_ldflags -X $$$$def" ; \ - done ; \ - go install \ - $(if $(GO_PKG_ENABLE_PIE),-buildmode pie) \ - $$$${installsuffix:+-installsuffix $$$$installsuffix} \ - -trimpath \ - -ldflags "all=$$$$ldflags" \ - -v \ - $$$${pkg_gcflags:+-gcflags "$$$$pkg_gcflags"} \ - $$$${pkg_ldflags:+-ldflags "$$$$pkg_ldflags $$$$ldflags"} \ - $(1) \ - $$$$targets ; \ + go install $(GO_PKG_INSTALL_ARGS) $(1) $$$$targets ; \ retval=$$$$? ; \ echo ; \ \ From 74b02ca24c3e422f58a3eb59f31c5ec72455d3c4 Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 13 May 2020 02:35:28 +0800 Subject: [PATCH 5/7] golang: Blacklist older (or no) FPUs rather than whitelist newer FPUs This should be more future-proof (presumably all future ARM FPUs will be at least VFPv3). Signed-off-by: Jeffery To --- lang/golang/golang-values.mk | 31 +++++++------------------------ 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/lang/golang/golang-values.mk b/lang/golang/golang-values.mk index 9792cd8aa..d52ad481f 100644 --- a/lang/golang/golang-values.mk +++ b/lang/golang/golang-values.mk @@ -156,32 +156,15 @@ ifeq ($(GO_ARCH),386) else ifeq ($(GO_ARCH),arm) GO_TARGET_FPU:=$(word 2,$(subst +,$(space),$(call qstrip,$(CONFIG_CPU_TYPE)))) - # FPU names from https://gcc.gnu.org/onlinedocs/gcc-8.3.0/gcc/ARM-Options.html#index-mfpu-1 - # see also https://github.com/gcc-mirror/gcc/blob/gcc-8_3_0-release/gcc/config/arm/arm-cpus.in - # - # Assumptions: - # - # * -d16 variants (16 instead of 32 double-precision registers) acceptable - # Go doesn't appear to check the HWCAP_VFPv3D16 flag in - # https://github.com/golang/go/blob/release-branch.go1.13/src/runtime/os_linux_arm.go - # - # * Double-precision required - # Based on no evidence(!) - # Excludes vfpv3xd, vfpv3xd-fp16, fpv4-sp-d16, fpv5-sp-d16 - - GO_ARM_7_FPUS:= \ - vfpv3 vfpv3-fp16 vfpv3-d16 vfpv3-d16-fp16 neon neon-vfpv3 neon-fp16 \ - vfpv4 vfpv4-d16 neon-vfpv4 \ - fpv5-d16 fp-armv8 neon-fp-armv8 crypto-neon-fp-armv8 - - GO_ARM_6_FPUS:=vfp vfpv2 - - ifneq ($(filter $(GO_TARGET_FPU),$(GO_ARM_7_FPUS)),) - GO_ARM:=7 - else ifneq ($(filter $(GO_TARGET_FPU),$(GO_ARM_6_FPUS)),) + # FPU names from https://gcc.gnu.org/onlinedocs/gcc-8.4.0/gcc/ARM-Options.html#index-mfpu-1 + # see also https://github.com/gcc-mirror/gcc/blob/releases/gcc-8.4.0/gcc/config/arm/arm-cpus.in + + ifeq ($(GO_TARGET_FPU),) + GO_ARM:=5 + else ifneq ($(filter $(GO_TARGET_FPU),vfp vfpv2),) GO_ARM:=6 else - GO_ARM:=5 + GO_ARM:=7 endif else ifneq ($(filter $(GO_ARCH),mips mipsle),) From 46017682f43817144e4f4294d50b3bb7172cd1be Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Wed, 13 May 2020 16:02:09 +0800 Subject: [PATCH 6/7] golang: Set buildid and enable stripping for Go compiler Doing both should make the compiler reproducible. Signed-off-by: Jeffery To --- lang/golang/golang/Makefile | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lang/golang/golang/Makefile b/lang/golang/golang/Makefile index 21e261b1c..54091398e 100644 --- a/lang/golang/golang/Makefile +++ b/lang/golang/golang/Makefile @@ -12,7 +12,7 @@ GO_VERSION_PATCH:=2 PKG_NAME:=golang PKG_VERSION:=$(GO_VERSION_MAJOR_MINOR)$(if $(GO_VERSION_PATCH),.$(GO_VERSION_PATCH)) -PKG_RELEASE:=1 +PKG_RELEASE:=2 GO_SOURCE_URLS:=https://dl.google.com/go/ \ https://mirrors.ustc.edu.cn/golang/ \ @@ -101,7 +101,7 @@ PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/ 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) -# don't strip ELF executables in test data (and go itself) +# don't strip ELF executables in test data RSTRIP:=: STRIP:=: @@ -197,6 +197,23 @@ endef EXTERNAL_BOOTSTRAP_DIR:=$(call qstrip,$(CONFIG_GOLANG_EXTERNAL_BOOTSTRAP_ROOT)) USE_DEFAULT_BOOTSTRAP:=$(if $(EXTERNAL_BOOTSTRAP_DIR),,1) +PKG_GO_LDFLAGS= \ + -buildid '$(SOURCE_DATE_EPOCH)' + +ifeq ($(CONFIG_NO_STRIP)$(CONFIG_DEBUG),) + PKG_GO_LDFLAGS+= -s -w +endif + +# 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= \ + -ldflags "all=$(PKG_GO_LDFLAGS)" + +ifeq ($(PKG_GO_ENABLE_PIE),1) + PKG_GO_INSTALL_ARGS+= -buildmode pie +endif + define Download/golang-bootstrap FILE:=$(BOOTSTRAP_SOURCE) URL:=$(BOOTSTRAP_SOURCE_URL) @@ -322,7 +339,7 @@ define Build/Compile CXX=g++ \ PKG_CONFIG=pkg-config \ PATH=$(HOST_GO_ROOT)/openwrt:$$$$PATH \ - ./go-host install -a $(if $(PKG_GO_ENABLE_PIE),-buildmode=pie) std cmd ; \ + ./go-host install -a $(PKG_GO_INSTALL_ARGS) std cmd ; \ retval=$$$$? ; \ rm -f go-host ; \ exit $$$$retval ; \ From da3fb97b9cef4f705dda4b190f99536f27d0955d Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Thu, 14 May 2020 17:45:18 +0800 Subject: [PATCH 7/7] golang: Set/reset default platform options for target Go compiler Because the first stage for building target Go is actually a host build, the default platform options (GO386, GOARM, etc.) are detected from the host. These values are written to a source file and kept when building the second stage. This modifies this source file to set the appropriate values for the target platform, and reset values for other platforms to their cross-compiling / most compatible defaults. Signed-off-by: Jeffery To --- lang/golang/golang/Makefile | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lang/golang/golang/Makefile b/lang/golang/golang/Makefile index 54091398e..51020253b 100644 --- a/lang/golang/golang/Makefile +++ b/lang/golang/golang/Makefile @@ -197,6 +197,13 @@ endef EXTERNAL_BOOTSTRAP_DIR:=$(call qstrip,$(CONFIG_GOLANG_EXTERNAL_BOOTSTRAP_ROOT)) USE_DEFAULT_BOOTSTRAP:=$(if $(EXTERNAL_BOOTSTRAP_DIR),,1) +PKG_GO_ZBOOTSTRAP_MODS:= \ + s/defaultGO386 = `[^`]*`/defaultGO386 = `$(if $(GO_386),$(GO_386),387)`/; \ + s/defaultGOARM = `[^`]*`/defaultGOARM = `$(if $(GO_ARM),$(GO_ARM),5)`/; \ + s/defaultGOMIPS = `[^`]*`/defaultGOMIPS = `$(if $(GO_MIPS),$(GO_MIPS),hardfloat)`/; \ + s/defaultGOMIPS64 = `[^`]*`/defaultGOMIPS64 = `$(if $(GO_MIPS64),$(GO_MIPS64),hardfloat)`/; \ + s/defaultGOPPC64 = `[^`]*`/defaultGOPPC64 = `power8`/; + PKG_GO_LDFLAGS= \ -buildid '$(SOURCE_DATE_EPOCH)' @@ -323,6 +330,11 @@ define Build/Compile PATH=$(HOST_GO_ROOT)/openwrt:$$$$PATH \ ) + ifneq ($(PKG_GO_ZBOOTSTRAP_MODS),) + $(SED) '$(PKG_GO_ZBOOTSTRAP_MODS)' \ + $(PKG_BUILD_DIR)/src/cmd/internal/objabi/zbootstrap.go + endif + @echo "Building target Go second stage" ( \