Skip to content

runtime/cgo: fix calls from C to go on linux/ppc64 #58976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/cmd/link/internal/ld/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,5 @@ func determineLinkMode(ctxt *Link) {
if extNeeded {
Exitf("internal linking requested %sbut external linking required: %s", via, extReason)
}
case LinkExternal:
switch {
case buildcfg.GOARCH == "ppc64" && buildcfg.GOOS != "aix":
Exitf("external linking not supported for %s/ppc64", buildcfg.GOOS)
}
}
}
5 changes: 3 additions & 2 deletions src/runtime/cgo/asm_ppc64x.s
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ TEXT crosscall2(SB),NOSPLIT|NOFRAME,$0
BL runtime·reginit(SB)
BL runtime·load_g(SB)

#ifdef GOARCH_ppc64
#ifdef GOOS_aix
// ppc64 use elf ABI v1. we must get the real entry address from
// first slot of the function descriptor before call.
// Same for AIX.
// This applies only for AIX; on Linux go functions are represented
// by a raw pointer regardless of elf ABI version
MOVD 8(R3), R2
MOVD (R3), R3
#endif
Expand Down