Skip to content

Commit

Permalink
Merge pull request #3080 from zeldin/ppc64
Browse files Browse the repository at this point in the history
Add ppc64 to list of arches
  • Loading branch information
AkihiroSuda authored Sep 7, 2022
2 parents c9a0f4d + c48cd2c commit 7b34166
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 1 deletion.
1 change: 1 addition & 0 deletions client/llb/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ var (
LinuxArmel = Platform(ocispecs.Platform{OS: "linux", Architecture: "arm", Variant: "v6"})
LinuxArm64 = Platform(ocispecs.Platform{OS: "linux", Architecture: "arm64"})
LinuxS390x = Platform(ocispecs.Platform{OS: "linux", Architecture: "s390x"})
LinuxPpc64 = Platform(ocispecs.Platform{OS: "linux", Architecture: "ppc64"})
LinuxPpc64le = Platform(ocispecs.Platform{OS: "linux", Architecture: "ppc64le"})
Darwin = Platform(ocispecs.Platform{OS: "darwin", Architecture: "amd64"})
Windows = Platform(ocispecs.Platform{OS: "windows", Architecture: "amd64"})
Expand Down
1 change: 1 addition & 0 deletions solver/llbsolver/ops/exec_binfmt.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var qemuArchMap = map[string]string{
"riscv64": "riscv64",
"arm": "arm",
"s390x": "s390x",
"ppc64": "ppc64",
"ppc64le": "ppc64le",
"386": "i386",
}
Expand Down
7 changes: 6 additions & 1 deletion util/archutil/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ FROM base AS exit-s390x
COPY fixtures/exit.s390x.s .
RUN s390x-linux-gnu-as --noexecstack -o exit.o exit.s390x.s && s390x-linux-gnu-ld -o exit -s exit.o

FROM base AS exit-ppc64
COPY fixtures/exit.ppc64.s .
RUN powerpc64le-linux-gnu-as -mbig --noexecstack -o exit.o exit.ppc64.s && powerpc64le-linux-gnu-ld -EB -o exit -s exit.o

FROM base AS exit-ppc64le
COPY fixtures/exit.ppc64le.s .
RUN powerpc64le-linux-gnu-as --noexecstack -o exit.o exit.ppc64le.s && powerpc64le-linux-gnu-ld -o exit -s exit.o
Expand All @@ -56,12 +60,13 @@ COPY --from=exit-arm64 /src/exit arm64
COPY --from=exit-arm /src/exit arm
COPY --from=exit-riscv64 /src/exit riscv64
COPY --from=exit-s390x /src/exit s390x
COPY --from=exit-ppc64 /src/exit ppc64
COPY --from=exit-ppc64le /src/exit ppc64le
COPY --from=exit-mips64le /src/exit mips64le
COPY --from=exit-mips64 /src/exit mips64
COPY generate.go .

RUN go run generate.go amd64 386 arm64 arm riscv64 s390x ppc64le mips64le mips64 && ls -l
RUN go run generate.go amd64 386 arm64 arm riscv64 s390x ppc64 ppc64le mips64le mips64 && ls -l


FROM scratch
Expand Down
10 changes: 10 additions & 0 deletions util/archutil/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ func SupportedPlatforms(noCache bool) []ocispecs.Platform {
arr = append(arr, linux(p))
}
}
if p := "ppc64"; def.Architecture != p {
if _, err := ppc64Supported(); err == nil {
arr = append(arr, linux(p))
}
}
if p := "ppc64le"; def.Architecture != p {
if _, err := ppc64leSupported(); err == nil {
arr = append(arr, linux(p))
Expand Down Expand Up @@ -109,6 +114,11 @@ func WarnIfUnsupported(pfs []ocispecs.Platform) {
printPlatformWarning(p, err)
}
}
if p.Architecture == "ppc64" {
if _, err := ppc64Supported(); err != nil {
printPlatformWarning(p, err)
}
}
if p.Architecture == "ppc64le" {
if _, err := ppc64leSupported(); err != nil {
printPlatformWarning(p, err)
Expand Down
10 changes: 10 additions & 0 deletions util/archutil/fixtures/exit.ppc64.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.global _start
.section ".opd","aw"
_start:
.quad .L.start,.TOC.@tocbase,0
.text
.abiversion 1
.L.start:
li %r0, 1
li %r3, 0
sc
9 changes: 9 additions & 0 deletions util/archutil/ppc64_binary.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//go:build !ppc64
// +build !ppc64

package archutil

// This file is generated by running make inside the archutil package.
// Do not edit manually.

const Binaryppc64 = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x02\xff\xec\xd0\xb1\x8a\x13\x51\x14\x06\xe0\xff\x8e\xd9\x45\xd0\x62\x2c\x84\x05\x9b\x3c\x40\x98\x7a\xcb\x14\x6a\x65\xa3\x2f\xa0\x2b\x89\x6c\x23\xca\xee\x14\x76\xfb\xb4\x81\xbc\x45\x24\x93\xc9\x64\x12\x89\xa4\xb0\x92\xef\x83\xdc\x73\x72\x66\x7e\xce\x65\x9e\xde\x7d\x78\x5f\x55\x25\x83\x2a\xaf\x93\x74\x83\xba\x6c\xd6\xfd\x74\xde\x9d\x25\xd3\xee\x9c\xe7\x36\x93\xcc\x73\x95\x49\xff\xee\x55\x46\xea\x93\x9a\x94\xd9\x51\x2d\xc3\x79\xbd\x9b\xef\xf6\xec\xf7\x8d\xf6\xde\x1c\xd5\x92\x2c\xda\xd5\xc7\x43\xee\x62\xf5\xa2\x5d\x7d\x4a\xba\xfb\x5e\xbe\x2f\x29\xb7\xdb\xdf\x97\xe4\xed\xf6\xcb\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfc\x27\xea\x94\x69\x57\xab\xa7\xc3\xb0\x79\xbc\x7f\x6c\x1f\xda\xbb\xaf\x69\xda\xe5\xaf\x36\xcd\xf2\xfe\xf3\xb7\x87\xbb\xef\xcb\x34\x3f\x7e\x2e\xfe\xc5\xda\x17\x49\x4a\xdf\x5f\x8f\xef\x91\xa1\xe6\xe5\x49\xe6\xf9\xa8\x7f\x35\xca\x57\x7d\x7e\xd6\xe7\x67\x67\x76\x4e\x46\xfd\x9b\x51\xfe\x59\x97\x2f\x9b\xf5\xee\xef\xbe\xe6\xe6\x2f\xfb\xcb\x3e\xf7\x87\x32\x74\xd3\x73\x4f\x7e\x07\x00\x00\xff\xff\x5e\xe4\x1d\xbd\x60\x01\x01\x00"
8 changes: 8 additions & 0 deletions util/archutil/ppc64_check.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build !ppc64
// +build !ppc64

package archutil

func ppc64Supported() (string, error) {
return check("ppc64", Binaryppc64)
}
8 changes: 8 additions & 0 deletions util/archutil/ppc64_check_ppc64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build ppc64
// +build ppc64

package archutil

func ppc64Supported() (string, error) {
return "", nil
}

0 comments on commit 7b34166

Please sign in to comment.