Skip to content

Commit 2a9abfc

Browse files
committed
reserve at least 48 bytes in stack frame when calling C functions for ppc64
1 parent 89f2540 commit 2a9abfc

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

src/cmd/link/internal/ld/config.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -247,9 +247,6 @@ func determineLinkMode(ctxt *Link) {
247247
}
248248
ctxt.LinkMode = LinkInternal
249249
case "1":
250-
if objabi.GOARCH == "ppc64" && objabi.GOOS != "aix" {
251-
Exitf("external linking requested via GO_EXTLINK_ENABLED but not supported for %s/ppc64", objabi.GOOS)
252-
}
253250
ctxt.LinkMode = LinkExternal
254251
default:
255252
if needed, _ := mustLinkExternal(ctxt); needed {
@@ -261,17 +258,10 @@ func determineLinkMode(ctxt *Link) {
261258
} else {
262259
ctxt.LinkMode = LinkInternal
263260
}
264-
if objabi.GOARCH == "ppc64" && objabi.GOOS != "aix" && ctxt.LinkMode == LinkExternal {
265-
Exitf("external linking is not supported for %s/ppc64", objabi.GOOS)
266-
}
267261
}
268262
case LinkInternal:
269263
if needed, reason := mustLinkExternal(ctxt); needed {
270264
Exitf("internal linking requested but external linking required: %s", reason)
271265
}
272-
case LinkExternal:
273-
if objabi.GOARCH == "ppc64" && objabi.GOOS != "aix" {
274-
Exitf("external linking not supported for %s/ppc64", objabi.GOOS)
275-
}
276266
}
277267
}

src/runtime/asm_ppc64x.s

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "textflag.h"
1111
#include "asm_ppc64x.h"
1212

13-
#ifdef GOOS_aix
13+
#ifdef GOARCH_ppc64
1414
#define cgoCalleeStackSize 48
1515
#else
1616
#define cgoCalleeStackSize 32
@@ -562,7 +562,7 @@ TEXT gosave<>(SB),NOSPLIT|NOFRAME,$0
562562
BL runtime·badctxt(SB)
563563
RET
564564

565-
#ifdef GOOS_aix
565+
#ifdef GOARCH_ppc64
566566
#define asmcgocallSaveOffset cgoCalleeStackSize + 8
567567
#else
568568
#define asmcgocallSaveOffset cgoCalleeStackSize

src/runtime/rt0_linux_ppc64.s

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ TEXT _main<>(SB),NOSPLIT,$-8
1818
// There is no TLS base pointer.
1919
//
2020
// TODO(austin): Support ABI v1 dynamic linking entry point
21+
XOR R0, R0 // following functions assume R0 is zero
2122
MOVD $runtime·rt0_go(SB), R12
2223
MOVD R12, CTR
2324
MOVBZ runtime·iscgo(SB), R5

0 commit comments

Comments
 (0)