Richard W.M. Jones
2016-Nov-09 12:26 UTC
[Libguestfs] [PATCH] filearch: Add s390 and s390x detection and tests.
Unfortunately I was unable to build s390 binaries since multilib was dropped in Fedora 24 on s390x. Going from the source of the 'file' command it seems as if it prints "32-bit" (the architecture is really 31 bit). --- generator/actions.ml | 12 ++++++++++++ src/filearch.c | 10 ++++++++++ test-data/Makefile.am | 2 ++ test-data/binaries/Makefile.am | 2 ++ test-data/binaries/bin-s390x-dynamic | Bin 0 -> 8448 bytes test-data/binaries/lib-s390x.so | Bin 0 -> 7696 bytes 6 files changed, 26 insertions(+) create mode 100755 test-data/binaries/bin-s390x-dynamic create mode 100755 test-data/binaries/lib-s390x.so diff --git a/generator/actions.ml b/generator/actions.ml index 91a1819..43de38b 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -798,6 +798,8 @@ to specify the QEMU interface emulation to use at run time." }; InitISOFS, Always, TestResultString ( [["file_architecture"; "/bin-riscv64-dynamic"]], "riscv64"), []; InitISOFS, Always, TestResultString ( + [["file_architecture"; "/bin-s390x-dynamic"]], "s390x"), []; + InitISOFS, Always, TestResultString ( [["file_architecture"; "/bin-sparc-dynamic"]], "sparc"), []; InitISOFS, Always, TestResultString ( [["file_architecture"; "/bin-win32.exe"]], "i386"), []; @@ -818,6 +820,8 @@ to specify the QEMU interface emulation to use at run time." }; InitISOFS, Always, TestResultString ( [["file_architecture"; "/lib-riscv64.so"]], "riscv64"), []; InitISOFS, Always, TestResultString ( + [["file_architecture"; "/lib-s390x.so"]], "s390x"), []; + InitISOFS, Always, TestResultString ( [["file_architecture"; "/lib-sparc.so"]], "sparc"), []; InitISOFS, Always, TestResultString ( [["file_architecture"; "/lib-win32.dll"]], "i386"), []; @@ -880,6 +884,14 @@ Intel Itanium. RISC-V 32-, 64- or 128-bit variants. +=item \"s390\" + +31 bit IBM S/390. + +=item \"s390x\" + +64 bit IBM S/390. + =item \"sparc\" 32 bit SPARC. diff --git a/src/filearch.c b/src/filearch.c index 310038e..2c75425 100644 --- a/src/filearch.c +++ b/src/filearch.c @@ -102,6 +102,16 @@ canonical_elf_arch (guestfs_h *g, ret = safe_asprintf (g, "riscv%s", bits); goto no_strdup; } + else if (strstr (elf_arch, "IBM S/390")) { + if (STREQ (bits, "32")) + r = "s390"; + else if (STREQ (bits, "64")) + r = "s390x"; + else { + error (g, "file_architecture: unknown S/390 bit size: %s", bits); + return NULL; + } + } else r = elf_arch; diff --git a/test-data/Makefile.am b/test-data/Makefile.am index 86cd5a2..0ac7354 100644 --- a/test-data/Makefile.am +++ b/test-data/Makefile.am @@ -42,6 +42,7 @@ image_files = \ $(srcdir)/binaries/bin-ppc64-dynamic \ $(srcdir)/binaries/bin-ppc64le-dynamic \ $(srcdir)/binaries/bin-riscv64-dynamic \ + $(srcdir)/binaries/bin-s390x-dynamic \ $(srcdir)/binaries/bin-sparc-dynamic \ $(srcdir)/binaries/bin-win32.exe \ $(srcdir)/binaries/bin-win64.exe \ @@ -54,6 +55,7 @@ image_files = \ $(srcdir)/binaries/lib-ppc64.so \ $(srcdir)/binaries/lib-ppc64le.so \ $(srcdir)/binaries/lib-riscv64.so \ + $(srcdir)/binaries/lib-s390x.so \ $(srcdir)/binaries/lib-sparc.so \ $(srcdir)/binaries/lib-win32.dll \ $(srcdir)/binaries/lib-win64.dll \ diff --git a/test-data/binaries/Makefile.am b/test-data/binaries/Makefile.am index ccc7d00..05c1eb9 100644 --- a/test-data/binaries/Makefile.am +++ b/test-data/binaries/Makefile.am @@ -27,6 +27,7 @@ EXTRA_DIST = \ bin-ppc64-dynamic \ bin-ppc64le-dynamic \ bin-riscv64-dynamic \ + bin-s390x-dynamic \ bin-sparc-dynamic \ bin-win32.exe \ bin-win64.exe \ @@ -39,6 +40,7 @@ EXTRA_DIST = \ lib-ppc64le.so \ lib-mipsel.so \ lib-riscv64.so \ + lib-s390x.so \ lib-sparc.so \ lib-win32.dll \ lib-win64.dll \ diff --git a/test-data/binaries/bin-s390x-dynamic b/test-data/binaries/bin-s390x-dynam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AEP#HBw;8u1RM6FG$OrpTq?;&L1EE=j;e^EScuQmSXi{=6?~e z-#?~Iy>on9)m8S){6DSZe@y#pE}rxGoB2!7$#WC9-0;=+0rmex;HEvq8u>D0{`k-S zHW?wTEm^HSL1w(Gka_&<zf1YGYF=aS_x}?Bx$nT)U(a8w=5qbn#`LH4`3ssazfCqE zQcL1GSmyePucG<=wS9#B%=MxercCcJ98cHJ?>`Yf@0s>~|JwjKzaB4{5PAN*4-{Or zCqH_pka<~I<=cOz`}}=_Rh*Ax>dSr4$|{eXQT@iZ!Reb2kB7&*9T>e^uaSS-40NEt KA;rC`m;XPXE<-N> literal 0 HcmV?d00001 diff --git a/test-data/binaries/lib-s390x.so b/test-data/binaries/lib-s390x.so new file mode 100755 index 0000000000000000000000000000000000000000..387b56da990bd829acc7eb3a824361c2e5203a7e GIT binary patch literal 7696 zcmeHMUua}k89z6fWRh(Xr+;?a>Jl$)uvzF%X0sSmUph&eO;WPyn$5!cboWkXnvBk$ z?aWO{iduyrqPWz>q7QxOK1dKMY{iF$f*k}=q{yl$(ibgZeTlFWY(-Hz{=Rd*@6O5X zomJ2WA9BJy-}!#upL5Q4&Yk<6lNV<f&vkV<DlFaV1lkPr%rl-f^ub%2X4RzXRay0L zsN2JO9Z2ujj6i6LSn8wK;6tvV!x7pwYVfX%q1vtsZL!N5d^kd#hQWoZKJW>CK%AFY z9-(T);2}-qgWI10#{IGM-;)&VmZ3&{qI8;{^G7XKLUl~Y<^eq2b4!=hlXLI<<#%0w z`q8xu{jbzd?VtQa?#fq;jp_zX;?Z&J&nA@PHYm=7_2aqc&%d3W{=)UWH&0%E?)O6n z-`pL#^P7F(9Sa<i9ZKTohU$9x5sR^!CtZuNnobAY?|@Hsz+c2_->-CW=MB~Mb>I{q z6!(Imy8fz#+xn^d;^%b&_<*tRy&U@SytQ(*;?)Dc7I>cWij`uZyk|j_x3F^F%NJ^e zwPHOe)K<>Vl&Y1&ik~YLj4WQ_t#10{z%LbFfa257d&}%$rsUV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U e58-)?I24%=VU*K!=>Iqe(9!?1AVV%;|NjDizI)05 literal 0 HcmV?d00001 -- 2.7.4
Maybe Matching Threads
- [PATCH 12/27] daemon: Reimplement ‘file_architecture’ API in OCaml.
- [PATCH v5] inspector: recognize ppc64 and ppc64le archs (RHBZ#1211996)
- [PATCH 1/2] filearch: Add RISC-V architecture.
- [PATCH v4 0/2] inspector: recognize ppc64 and ppc64le archs (RHBZ#1211996)
- [PATCH v5] inspector: recognize ppc64 and ppc64le archs (RHBZ#1211996)