Skip to content

Commit

Permalink
cmd/link: enable -buildmode=c-shared for ppc64le
Browse files Browse the repository at this point in the history
This enables -buildmode=c-shared on ppc64le.
It is described in golang issue golang#20756
  • Loading branch information
laboger committed Feb 2, 2018
1 parent 62a63a7 commit 81cb08d
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/cmd/dist/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ func (t *tester) supportedBuildmode(mode string) bool {
return false
case "c-shared":
switch pair {
case "linux-386", "linux-amd64", "linux-arm", "linux-arm64",
case "linux-386", "linux-amd64", "linux-arm", "linux-arm64", "linux-ppc64le",
"darwin-amd64", "darwin-386",
"android-arm", "android-arm64", "android-386":
return true
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/go/internal/work/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ func BuildModeInit() {
codegenArg = "-fPIC"
} else {
switch platform {
case "linux/amd64", "linux/arm", "linux/arm64", "linux/386",
case "linux/amd64", "linux/arm", "linux/arm64", "linux/386", "linux/ppc64le",
"android/amd64", "android/arm", "android/arm64", "android/386":
codegenArg = "-shared"
case "darwin/amd64", "darwin/386":
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/link/internal/ld/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (mode *BuildMode) Set(s string) error {
*mode = BuildmodeCArchive
case "c-shared":
switch objabi.GOARCH {
case "386", "amd64", "arm", "arm64":
case "386", "amd64", "arm", "arm64", "ppc64le":
default:
return badmode()
}
Expand Down
2 changes: 0 additions & 2 deletions src/runtime/rt0_linux_ppc64le.s
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ TEXT _rt0_ppc64le_linux_lib(SB),NOSPLIT,$-8
MOVD R0, 16(R1) // Save LR in caller's frame.
MOVW CR, R0 // Save CR in caller's frame
MOVD R0, 8(R1)
MOVD R2, 24(R1) // Save TOC in caller's frame.
MOVDU R1, -320(R1) // Allocate frame.

// Preserve callee-save registers.
Expand Down Expand Up @@ -121,7 +120,6 @@ done:
FMOVD 304(R1), F31

ADD $320, R1
MOVD 24(R1), R2
MOVD 8(R1), R0
MOVFL R0, $0xff
MOVD 16(R1), R0
Expand Down

0 comments on commit 81cb08d

Please sign in to comment.