Skip to content

Commit ada74f3

Browse files
committed
Fix ppc64 for Alpine
Both 1.8 and 1.9 require this fix on Alpine Linux. Without it, go segfaults at the very start. For more details, see the commit message in the patch itself. Taken from Alpine (https://github.com/alpinelinux/aports/tree/master/community/go). Tested by me on ppc64le for 1.8/alpine-3.6, 1.9/alpine-3.6 (had to add ppc64le/ prefix to FROM line argument for it to work, as multiarch alpine is still WIP ATM). This patch is not required for Debian -- tested for 1.8/jessie, 1.8/stretch, and 1.9/stretch. Signed-off-by: Kir Kolyshkin <[email protected]>
1 parent f1240ba commit ada74f3

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
From 9aea0e89b6df032c29d0add8d69ba2c95f1106d9 Mon Sep 17 00:00:00 2001
2+
From: Carlos Eduardo Seo <[email protected]>
3+
Date: Thu, 10 Aug 2017 14:48:36 -0300
4+
Subject: [PATCH] runtime: make sure R0 is zero before _main on ppc64le
5+
6+
_main has an early check to verify if a binary is statically or dynamically
7+
linked that depends on R0 being zero. R0 is not guaranteed to be zero at that
8+
point and this was breaking Go on Alpine for ppc64le.
9+
10+
Change-Id: I4a1059ff7fd3db6fc489e7dcfe631c1814dd965b
11+
Reviewed-on: https://go-review.googlesource.com/54730
12+
Run-TryBot: Lynn Boger <[email protected]>
13+
Reviewed-by: Lynn Boger <[email protected]>
14+
---
15+
src/runtime/rt0_linux_ppc64le.s | 1 +
16+
1 file changed, 1 insertion(+)
17+
18+
diff --git a/src/runtime/rt0_linux_ppc64le.s b/src/runtime/rt0_linux_ppc64le.s
19+
index 134858bff8..73b9ae392d 100644
20+
--- a/src/runtime/rt0_linux_ppc64le.s
21+
+++ b/src/runtime/rt0_linux_ppc64le.s
22+
@@ -2,6 +2,7 @@
23+
#include "textflag.h"
24+
25+
TEXT _rt0_ppc64le_linux(SB),NOSPLIT,$0
26+
+ XOR R0, R0 // Make sure R0 is zero before _main
27+
BR _main<>(SB)
28+
29+
TEXT _rt0_ppc64le_linux_lib(SB),NOSPLIT,$-8
30+
--
31+
2.14.1
32+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
From 9aea0e89b6df032c29d0add8d69ba2c95f1106d9 Mon Sep 17 00:00:00 2001
2+
From: Carlos Eduardo Seo <[email protected]>
3+
Date: Thu, 10 Aug 2017 14:48:36 -0300
4+
Subject: [PATCH] runtime: make sure R0 is zero before _main on ppc64le
5+
6+
_main has an early check to verify if a binary is statically or dynamically
7+
linked that depends on R0 being zero. R0 is not guaranteed to be zero at that
8+
point and this was breaking Go on Alpine for ppc64le.
9+
10+
Change-Id: I4a1059ff7fd3db6fc489e7dcfe631c1814dd965b
11+
Reviewed-on: https://go-review.googlesource.com/54730
12+
Run-TryBot: Lynn Boger <[email protected]>
13+
Reviewed-by: Lynn Boger <[email protected]>
14+
---
15+
src/runtime/rt0_linux_ppc64le.s | 1 +
16+
1 file changed, 1 insertion(+)
17+
18+
diff --git a/src/runtime/rt0_linux_ppc64le.s b/src/runtime/rt0_linux_ppc64le.s
19+
index 134858bff8..73b9ae392d 100644
20+
--- a/src/runtime/rt0_linux_ppc64le.s
21+
+++ b/src/runtime/rt0_linux_ppc64le.s
22+
@@ -2,6 +2,7 @@
23+
#include "textflag.h"
24+
25+
TEXT _rt0_ppc64le_linux(SB),NOSPLIT,$0
26+
+ XOR R0, R0 // Make sure R0 is zero before _main
27+
BR _main<>(SB)
28+
29+
TEXT _rt0_ppc64le_linux_lib(SB),NOSPLIT,$-8
30+
--
31+
2.14.1
32+

0 commit comments

Comments
 (0)