From 22ee6e86a08d1e59608c50495d25e49378174e5a Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Fri, 13 Sep 2019 17:28:42 +0800 Subject: golang: Use new -trimpath option when compiling Go packages Go 1.13 added a new -trimpath option to the "go build" command[1] that removes system paths from compiled executables. This replaces the previous -trimpath flags. There are still system paths in the compiled executable (for crti.o and crtn.o, when cross-compiling); these appear to be stripped during the packaging process. [1]: https://golang.org/doc/go1.13#trimpath Signed-off-by: Jeffery To --- lang/golang/golang-package.mk | 4 +--- lang/golang/golang-values.mk | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'lang/golang') diff --git a/lang/golang/golang-package.mk b/lang/golang/golang-package.mk index d1d189eb5..172b77897 100644 --- a/lang/golang/golang-package.mk +++ b/lang/golang/golang-package.mk @@ -275,7 +275,6 @@ define GoPackage/Build/Compile mips|mipsle) installsuffix="$(GO_MIPS)" ;; \ mips64|mips64le) installsuffix="$(GO_MIPS64)" ;; \ esac ; \ - trimpath="all=-trimpath=$(GO_PKG_BUILD_DIR)" ; \ ldflags="all=-linkmode external -extldflags '$(TARGET_LDFLAGS)'" ; \ pkg_gcflags="$(GO_PKG_GCFLAGS)" ; \ pkg_ldflags="$(GO_PKG_LDFLAGS)" ; \ @@ -284,8 +283,7 @@ define GoPackage/Build/Compile done ; \ go install \ $$$${installsuffix:+-installsuffix $$$$installsuffix} \ - -gcflags "$$$$trimpath" \ - -asmflags "$$$$trimpath" \ + -trimpath \ -ldflags "$$$$ldflags" \ -v \ $$$${pkg_gcflags:+-gcflags "$$$$pkg_gcflags"} \ diff --git a/lang/golang/golang-values.mk b/lang/golang/golang-values.mk index 78ad1b3de..a52dcc92d 100644 --- a/lang/golang/golang-values.mk +++ b/lang/golang/golang-values.mk @@ -27,6 +27,7 @@ unexport \ CC_FOR_TARGET CXX_FOR_TARGET GO_DISTFLAGS GO_GCFLAGS GO_LDFLAGS GOBUILDTIMELOGFILE GOROOT_BOOTSTRAP \ BOOT_GO_GCFLAGS GOEXPERIMENT GOBOOTSTRAP_TOOLEXEC # there are more magic environment variables to track down, but ain't nobody got time for that + # deliberately left untouched: GOPROXY GONOPROXY GOSUMDB GONOSUMDB GOPRIVATE go_arch=$(subst \ aarch64,arm64,$(subst \ -- cgit v1.2.3