aboutsummaryrefslogtreecommitdiffstats
path: root/community/go/default-buildmode-pie.patch
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2018-09-06 22:23:56 +0200
committerSören Tempel <soeren+git@soeren-tempel.net>2018-10-07 18:41:55 +0200
commit9686793792a2c40a872ebbb2b86fa537f22491ad (patch)
tree83752b6f0e6f2ca05a25373832722f0eb2e4f45f /community/go/default-buildmode-pie.patch
parent5f5f852407d176edf3596f5dcde0cd7aa21d446c (diff)
downloadaports-9686793792a2c40a872ebbb2b86fa537f22491ad.tar.bz2
aports-9686793792a2c40a872ebbb2b86fa537f22491ad.tar.xz
community/go: Fix the `cannot find runtime/cgo`-warning
This warning seems to be emitted since we build with `-shared` for PIE by default through our `default-buildmode-pie.patch`. Building with shared linkage requires depending on CGO. The patch, however, doesn't force a dependency on CGO. As with android we need to force external linkage in order to always depend on CGO thereby resolving this warning. I am unsure whether this is really the best way to fix the problem since I don't know enough about the internals of the go compiler. However, I am under the impression that the person who originally committed the patch isn't familiar with the compiler internals either. Thus it's probably ok to push this as is.
Diffstat (limited to 'community/go/default-buildmode-pie.patch')
-rw-r--r--community/go/default-buildmode-pie.patch21
1 files changed, 16 insertions, 5 deletions
diff --git a/community/go/default-buildmode-pie.patch b/community/go/default-buildmode-pie.patch
index 3cf4865a78..1924a483f2 100644
--- a/community/go/default-buildmode-pie.patch
+++ b/community/go/default-buildmode-pie.patch
@@ -1,8 +1,19 @@
-diff --git a/src/cmd/go/internal/work/init.go b/src/cmd/go/internal/work/init.go
-index 7f894f5..a37cbf3 100644
---- a/src/cmd/go/internal/work/init.go
-+++ b/src/cmd/go/internal/work/init.go
-@@ -111,7 +111,8 @@ func buildModeInit() {
+diff -upr go.orig/src/cmd/go/internal/load/pkg.go go/src/cmd/go/internal/load/pkg.go
+--- go.orig/src/cmd/go/internal/load/pkg.go 2018-08-24 22:38:35.000000000 +0200
++++ go/src/cmd/go/internal/load/pkg.go 2018-09-06 22:18:36.756408760 +0200
+@@ -1578,7 +1578,7 @@ func LinkerDeps(p *Package) []string {
+ func externalLinkingForced(p *Package) bool {
+ // Some targets must use external linking even inside GOROOT.
+ switch cfg.BuildContext.GOOS {
+- case "android":
++ case "android", "linux":
+ return true
+ case "darwin":
+ switch cfg.BuildContext.GOARCH {
+diff -upr go.orig/src/cmd/go/internal/work/init.go go/src/cmd/go/internal/work/init.go
+--- go.orig/src/cmd/go/internal/work/init.go 2018-08-24 22:38:35.000000000 +0200
++++ go/src/cmd/go/internal/work/init.go 2018-09-06 22:18:03.942821296 +0200
+@@ -123,7 +123,8 @@ func buildModeInit() {
ldBuildmode = "c-shared"
case "default":
switch platform {