Skip to content

Commit

Permalink
Merge pull request #1959 from wanghuaiqing2010/master
Browse files Browse the repository at this point in the history
add support for mips64el and mips64
  • Loading branch information
tonistiigi authored Feb 2, 2021
2 parents 6b9ea0c + 7cd6a5f commit 91e19ef
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 2 deletions.
17 changes: 15 additions & 2 deletions util/archutil/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
FROM debian:buster-slim AS base
RUN echo "deb http://os.loongnix.org/mirrors/debian/debian/ buster main" > /etc/apt/sources.list
RUN apt-get update && apt-get --no-install-recommends install -y \
binutils-arm-linux-gnueabihf \
binutils-aarch64-linux-gnu \
binutils-x86-64-linux-gnu \
binutils-i686-linux-gnu \
binutils-riscv64-linux-gnu \
binutils-s390x-linux-gnu \
binutils-powerpc64le-linux-gnu
binutils-powerpc64le-linux-gnu \
binutils-mips64el-linux-gnuabi64 \
binutils-mips64-linux-gnuabi64
WORKDIR /src


Expand Down Expand Up @@ -38,6 +41,14 @@ 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

FROM base AS exit-mips64le
COPY fixtures/exit.mips64le.s .
RUN mips64el-linux-gnuabi64-as --noexecstack -o exit.o exit.mips64le.s && mips64el-linux-gnuabi64-ld -o exit -s exit.o

FROM base AS exit-mips64
COPY fixtures/exit.mips64.s .
RUN mips64-linux-gnuabi64-as --noexecstack -o exit.o exit.mips64.s && mips64-linux-gnuabi64-ld -o exit -s exit.o

FROM golang:1.13-alpine AS generate
WORKDIR /src
COPY --from=exit-amd64 /src/exit amd64
Expand All @@ -47,9 +58,11 @@ COPY --from=exit-arm /src/exit arm
COPY --from=exit-riscv64 /src/exit riscv64
COPY --from=exit-s390x /src/exit s390x
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 && ls -l
RUN go run generate.go amd64 386 arm64 arm riscv64 s390x ppc64le mips64le mips64 && ls -l


FROM scratch
Expand Down
22 changes: 22 additions & 0 deletions util/archutil/detect.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ func SupportedPlatforms(noCache bool) []string {
if p := "linux/386"; def != p && i386Supported() == nil {
arr = append(arr, p)
}
if p := "linux/mips64le"; def != p && mips64leSupported() == nil {
arr = append(arr, p)
}
if p := "linux/mips64"; def != p && mips64Supported() == nil {
arr = append(arr, p)
}
if !strings.HasPrefix(def, "linux/arm/") && armSupported() == nil {
arr = append(arr, "linux/arm/v7", "linux/arm/v6")
} else if def == "linux/arm/v7" {
Expand Down Expand Up @@ -66,6 +72,12 @@ func Check(pp specs.Platform) bool {
if p == "linux/386" && i386Supported() == nil {
return true
}
if p == "linux/mips64le" && mips64leSupported() == nil {
return true
}
if p == "linux/mips64" && mips64Supported() == nil {
return true
}
if !strings.HasPrefix(p, "linux/arm/") && armSupported() == nil {
return true
}
Expand Down Expand Up @@ -110,6 +122,16 @@ func WarnIfUnsupported(pfs []string) {
printPlatformWarning(p, err)
}
}
if p == "linux/mips64le" {
if err := mips64leSupported(); err != nil {
printPlatformWarning(p, err)
}
}
if p == "linux/mips64" {
if err := mips64Supported(); err != nil {
printPlatformWarning(p, err)
}
}
if strings.HasPrefix(p, "linux/arm/v6") || strings.HasPrefix(p, "linux/arm/v7") {
if err := armSupported(); err != nil {
printPlatformWarning(p, err)
Expand Down
6 changes: 6 additions & 0 deletions util/archutil/fixtures/exit.mips64.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.global _start
.text
_start:
li $a0,0
li $v0,5058
syscall
6 changes: 6 additions & 0 deletions util/archutil/fixtures/exit.mips64le.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.global _start
.text
_start:
li $a0,0
li $v0,5058
syscall
8 changes: 8 additions & 0 deletions util/archutil/mips64_binary.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// +build !mips64

package archutil

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

const Binarymips64 = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x02\xff\xac\x92\xb1\x4a\xf4\x40\x14\x85\xbf\x99\xcd\xe6\xff\x41\xc5\x05\x2d\xc4\x2a\xc5\x16\x8b\xc5\x60\x69\x25\xb1\x50\x10\x14\x56\x7c\x82\x04\xd7\x18\x90\x24\x6c\x26\x60\x27\xbe\x81\xcf\xe4\xbb\x08\xbe\x80\xf5\xca\x24\x93\x98\x44\xa6\x10\x3c\x45\xce\xdc\x93\x7b\x72\xc3\x9c\xfb\x7c\x7e\x75\x21\xa5\xa0\x83\xe4\x3f\x60\x04\x11\x20\x8e\xad\x1a\x36\x24\x5e\x83\xa6\x3a\x61\x42\x88\xcf\xb4\x80\x09\xe0\xd9\xbe\x8f\xc6\x37\x60\x83\x83\x11\xb7\x33\xa6\xdf\x83\xeb\xfe\x3e\x9b\x63\x38\x60\x01\x77\xfa\xfd\x06\xf0\xf9\x1d\x66\xe6\x37\xa5\x44\xf4\xe7\xd5\x8f\x45\x57\xef\x3b\xbc\x22\x10\x2f\xed\x3d\x30\xf7\x60\x2e\xf7\xde\x80\x6d\x53\x9f\x01\xbb\x49\x56\xd5\x5f\xfb\xe7\x09\x54\xf9\x50\xea\xb5\x8e\x62\xd4\xf5\xe5\xf2\x56\x45\x71\x7a\xff\x18\x25\xa5\x2d\xf3\x42\xa7\x79\x56\xa2\xf4\xea\x49\xa3\x92\xac\x52\x91\xd6\xeb\x34\xae\xf4\xaa\xe4\x4f\xb0\x55\xc0\x51\x97\xe6\x30\x87\x71\x1e\xf4\xf2\x68\xf5\xc3\x02\x76\xac\x68\xfd\xa2\x7f\x65\x06\x0b\x87\x5f\xd8\x77\x6d\xa3\x3f\xdc\xa3\x6e\x9f\x66\x3f\xf3\xe9\xa0\xf2\xcd\xe6\xd3\x11\x45\xe8\xf0\x8f\x73\x9d\x38\xfc\x4b\x7b\x38\x75\xf9\xbf\x02\x00\x00\xff\xff\x61\x89\x8d\x22\x10\x03\x00\x00"
7 changes: 7 additions & 0 deletions util/archutil/mips64_check.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build !mips64

package archutil

func mips64Supported() error {
return check(Binarymips64)
}
7 changes: 7 additions & 0 deletions util/archutil/mips64_check_mips64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build mips64

package archutil

func mips64Supported() error {
return nil
}
8 changes: 8 additions & 0 deletions util/archutil/mips64le_binary.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// +build !mips64le

package archutil

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

const Binarymips64le = "\x1f\x8b\x08\x00\x00\x00\x00\x00\x02\xff\xa4\x92\xb1\x4a\xf4\x40\x14\x85\xbf\x99\xec\xee\xbf\xf0\x2b\x0a\x5a\x88\x55\x8a\x2d\x82\xc5\x90\xd2\x4a\xc6\x42\x41\x50\x58\xf1\x09\x12\x5c\x63\x40\x92\xb0\x99\x80\x9d\xf8\x06\x3e\x93\xef\x22\xec\x0b\x58\xaf\x84\xcc\xac\x26\x26\x28\x78\x9b\x73\xcf\xbd\x73\x12\xe6\x9c\x79\x3a\xbb\x3c\x97\x42\xe0\x4a\x32\xa5\x66\xa1\xc0\xaf\x51\xdb\xf9\xcb\xe7\x11\x5f\x73\x8c\x87\x66\xc2\x18\x0f\x8a\x11\xb0\xb2\xcb\x15\x8d\xce\xe1\x81\x9d\x3b\x9c\x5a\xac\x77\x63\x5a\xe5\x8b\x2f\xa8\x2d\xd1\x9b\xff\x36\xcd\xf5\x9b\xb9\x9d\xf0\xfb\xda\xdd\x74\x1e\x52\xd2\xf9\x1a\x88\xa0\xc1\xfd\x01\x7d\xf8\x2c\x7c\xd1\x9a\x8c\x66\xaf\x7b\x72\xb6\x65\xd9\xe9\x0e\x90\x64\x15\xe2\x5f\xbd\x13\xa8\xf2\xbe\x34\x4b\x13\xc5\xa8\xab\x8b\xf9\x8d\x8a\xe2\xf4\xee\x21\x4a\x4a\x4b\xf3\xc2\xa4\x79\x56\xa2\xcc\xe2\xd1\xa0\x92\xac\x52\x91\x31\xcb\x34\xae\xcc\xa2\xe4\xef\xf5\x1f\x38\x82\x42\x7e\xcf\xa3\x95\x03\x9d\x3c\xdc\xfc\x10\xd8\x6e\xf4\x53\x6b\x54\x73\x7f\x6b\x42\x30\xa0\x77\x1e\x05\xb6\x77\x19\xb9\x77\x14\x8a\x6e\x1e\xfd\x5c\x01\xef\xeb\x75\xde\xbd\x97\x1e\xd0\x8b\x1e\xee\xf5\xf8\x32\xb7\x07\x4f\x7e\xd0\x7f\x04\x00\x00\xff\xff\xd1\x67\xf7\xcd\x10\x03\x00\x00"
7 changes: 7 additions & 0 deletions util/archutil/mips64le_check.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build !mips64le

package archutil

func mips64leSupported() error {
return check(Binarymips64le)
}
7 changes: 7 additions & 0 deletions util/archutil/mips64le_check_mips64le.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build mips64le

package archutil

func mips64leSupported() error {
return nil
}

0 comments on commit 91e19ef

Please sign in to comment.