community/go: backport ppc64le fix for _main

_main has an early check to verify if a binary is statically or dynamically
linked that depends on R0 being zero. R0 is not guaranteed to be zero at that
point and this can break Go on ppc64le.
This commit is contained in:
Roberto Oliveira 2017-09-12 23:34:06 +00:00
parent a26ff41439
commit fdb4bb35e3
2 changed files with 36 additions and 2 deletions

View File

@ -4,7 +4,7 @@ pkgname=go
pkgver=1.9
# This should be the latest commit on the corresponding release branch
_toolsver="5d2fd3ccab986d52112bf301d47a819783339d0e"
pkgrel=0
pkgrel=1
pkgdesc="Go programming language compiler"
url="http://www.golang.org/"
arch="all"
@ -20,6 +20,7 @@ source="http://golang.org/dl/go${pkgver/_/}.src.tar.gz
go-tools-${pkgver/_/}.tar.gz::https://github.com/golang/tools/archive/${_toolsver}.tar.gz
default-buildmode-pie.patch
set-external-linker.patch
make-sure-R0-is-zero-before-main-on-ppc64le.patch
"
# NOTE: building go for x86 with grsec kernel requires:
@ -167,4 +168,5 @@ _crosspkg() {
sha512sums="70c4b892b6883fb21fc1a547a2b8d174df8c7aca282a3906e3816b4442b16c5da578b69c19443122a4a45e66fc95d170528d826b70932af09f4afd2a46615d74 go1.9.src.tar.gz
d679873082dbac6a47b7c43ac74c47cb19616fb053a4faa3e6ee78004ece86aa5c432fba3d24c030d47396089d7ec7c6357af5648bd767341056396066ff9a04 go-tools-1.9.tar.gz
ef9da66d76e4698314eaf2aa88cf40a8430a15f8f6cb9ad17ee9d72498ec049b60e63e1ff5acf13a916c5ea365f9d9a282b6f2b06e28de9e3484eb9a3d7dd98e default-buildmode-pie.patch
6b36f3780ab10e5c4902473a8ab5c0417220ece584b537517e9e60979bdc5a548ed14dd2546605392c89ec5ea6691769d337d34e2e19b92eba5bbca1898f4ada set-external-linker.patch"
6b36f3780ab10e5c4902473a8ab5c0417220ece584b537517e9e60979bdc5a548ed14dd2546605392c89ec5ea6691769d337d34e2e19b92eba5bbca1898f4ada set-external-linker.patch
451ca02dea91d74d8e3216c7a48d963bbfc040b43d15868087d6339a1815c4996817c5ace265a20abcdb9d1da4e9ff58e373397d98df773b729876f4623b1cc8 make-sure-R0-is-zero-before-main-on-ppc64le.patch"

View File

@ -0,0 +1,32 @@
From 9aea0e89b6df032c29d0add8d69ba2c95f1106d9 Mon Sep 17 00:00:00 2001
From: Carlos Eduardo Seo <cseo@linux.vnet.ibm.com>
Date: Thu, 10 Aug 2017 14:48:36 -0300
Subject: [PATCH] runtime: make sure R0 is zero before _main on ppc64le
_main has an early check to verify if a binary is statically or dynamically
linked that depends on R0 being zero. R0 is not guaranteed to be zero at that
point and this was breaking Go on Alpine for ppc64le.
Change-Id: I4a1059ff7fd3db6fc489e7dcfe631c1814dd965b
Reviewed-on: https://go-review.googlesource.com/54730
Run-TryBot: Lynn Boger <laboger@linux.vnet.ibm.com>
Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com>
---
src/runtime/rt0_linux_ppc64le.s | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/runtime/rt0_linux_ppc64le.s b/src/runtime/rt0_linux_ppc64le.s
index 134858bff8..73b9ae392d 100644
--- a/src/runtime/rt0_linux_ppc64le.s
+++ b/src/runtime/rt0_linux_ppc64le.s
@@ -2,6 +2,7 @@
#include "textflag.h"
TEXT _rt0_ppc64le_linux(SB),NOSPLIT,$0
+ XOR R0, R0 // Make sure R0 is zero before _main
BR _main<>(SB)
TEXT _rt0_ppc64le_linux_lib(SB),NOSPLIT,$-8
--
2.14.1