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).
This commit is contained in:
Richard W.M. Jones
2016-11-09 11:42:54 +00:00
parent 6d805f3b33
commit c08788ef1b
6 changed files with 26 additions and 0 deletions

View File

@@ -797,6 +797,8 @@ to specify the QEMU interface emulation to use at run time." };
[["file_architecture"; "/bin-ppc64le-dynamic"]], "ppc64le"), [];
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 (
@@ -817,6 +819,8 @@ to specify the QEMU interface emulation to use at run time." };
[["file_architecture"; "/lib-ppc64le.so"]], "ppc64le"), [];
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 (
@@ -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.

View File

@@ -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;

View File

@@ -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 \

View File

@@ -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 \

Binary file not shown.

BIN
test-data/binaries/lib-s390x.so Executable file

Binary file not shown.