Skip to content

Commit

Permalink
community/go: force external link mode for ppc64le again
Browse files Browse the repository at this point in the history
This re-enables 866f2e1. While Go
1.18.1 fixed the initial linking error we encountered with Go 1.18
on ppc64le it seems there are two more regressions with -buildmode=pie
and CGO_CFLAGS=-Os. See:

* golang/go#52336
* golang/go#52337

Forcing external link mode seems to be a workaround for now.

Fixes #13692
  • Loading branch information
nmeum committed Apr 13, 2022
1 parent de8d161 commit c0e69ba
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
11 changes: 10 additions & 1 deletion community/go/APKBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
pkgname=go
# go binaries are statically linked, security updates require rebuilds
pkgver=1.18.1
pkgrel=0
pkgrel=1
pkgdesc="Go programming language compiler"
url="https://go.dev/"
arch="all"
Expand All @@ -15,6 +15,7 @@ checkdepends="binutils-gold"
subpackages="$pkgname-doc"
source="https://go.dev/dl/go$pkgver.src.tar.gz
allow-unshare-to-return-enosys.patch
force-external-link-on-ppc64le.patch
"
case "$CARCH" in
arm*|aarch64) depends="binutils-gold";;
Expand Down Expand Up @@ -122,6 +123,13 @@ case "$CARCH" in
x86_64|s390x|aarch64) export GO_LDFLAGS=-buildmode=pie ;;
esac

# Disable tests on ppc64 for now since they fail due to the
# force-external-link-on-ppc64le.patch we employ currently.
# See the patch description for details.
case "$CARCH" in
ppc64le) options="!check" ;;
esac

prepare() {
default_prepare

Expand Down Expand Up @@ -202,4 +210,5 @@ package() {
sha512sums="
baa053e2d713b235b9285c946b4f0842085a5224d1f4cbe92a446fbf97ed9f7289c8d4ba212fb31dd2e4eac39bb4c015f478543a1856594c2d1fc331c946f571 go1.18.1.src.tar.gz
6017caacf77c2911e9e882878fdaa2ed066b76b7e97b2ad776bc33d96b21cabc802966473946642c86a8f985c69adcc5e7ea61684f6d0dbacd468a6aad687229 allow-unshare-to-return-enosys.patch
9e1d052cb030281093fc3f6862986b9d81a15ca344cb8be90eddd7a97e0ab74f8b022e79f6beefad81a53b041878c4644e8143ef7eeca4fc1757df97c73ff15b force-external-link-on-ppc64le.patch
"
17 changes: 17 additions & 0 deletions community/go/force-external-link-on-ppc64le.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
See https://github.com/golang/go/issues/51787#issuecomment-1072700785

Re-Enabled for Go 1.18.1, see:

https://gitlab.alpinelinux.org/alpine/aports/-/issues/13692

--- go.orig/src/cmd/link/internal/ld/config.go
+++ go/src/cmd/link/internal/ld/config.go
@@ -212,7 +212,7 @@
// windows/arm64 internal linking is not implemented.
return true, buildcfg.GOOS + "/" + buildcfg.GOARCH + " does not support internal cgo"
}
- if iscgo && ctxt.Arch == sys.ArchPPC64 {
+ if iscgo && (ctxt.Arch == sys.ArchPPC64 || ctxt.Arch == sys.ArchPPC64LE) {
// Big Endian PPC64 cgo internal linking is not implemented for aix or linux.
return true, buildcfg.GOOS + " does not support internal cgo"
}

0 comments on commit c0e69ba

Please sign in to comment.