From 474691f73ec27018c1c1feaab066086c812519b1 Mon Sep 17 00:00:00 2001 From: Adam Hughes Date: Tue, 8 Mar 2022 23:27:29 +0000 Subject: [PATCH] feat: add riscv64 architecture --- pkg/sif/arch.go | 5 ++++- pkg/siftool/add.go | 6 ++++-- pkg/siftool/testdata/TestAddCommands/Add/out.golden | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pkg/sif/arch.go b/pkg/sif/arch.go index d7acbb69..d6f66737 100644 --- a/pkg/sif/arch.go +++ b/pkg/sif/arch.go @@ -1,4 +1,4 @@ -// Copyright (c) 2021, Sylabs Inc. All rights reserved. +// Copyright (c) 2021-2022, Sylabs Inc. All rights reserved. // This software is licensed under a 3-clause BSD license. Please consult the // LICENSE file distributed with the sources of this project regarding your // rights to use or distribute this software. @@ -18,6 +18,7 @@ var ( hdrArchMIPS64 archType = [...]byte{'0', '9', '\x00'} hdrArchMIPS64le archType = [...]byte{'1', '0', '\x00'} hdrArchS390x archType = [...]byte{'1', '1', '\x00'} + hdrArchRISCV64 archType = [...]byte{'1', '2', '\x00'} ) type archType [3]byte @@ -36,6 +37,7 @@ func getSIFArch(arch string) archType { "mips64": hdrArchMIPS64, "mips64le": hdrArchMIPS64le, "s390x": hdrArchS390x, + "riscv64": hdrArchRISCV64, } t, ok := archMap[arch] @@ -59,6 +61,7 @@ func (t archType) GoArch() string { hdrArchMIPS64: "mips64", hdrArchMIPS64le: "mips64le", hdrArchS390x: "s390x", + hdrArchRISCV64: "riscv64", } arch, ok := archMap[t] diff --git a/pkg/siftool/add.go b/pkg/siftool/add.go index 941f9b0c..b4fc6793 100644 --- a/pkg/siftool/add.go +++ b/pkg/siftool/add.go @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2021, Sylabs Inc. All rights reserved. +// Copyright (c) 2019-2022, Sylabs Inc. All rights reserved. // Copyright (c) 2017, SingularityWare, LLC. All rights reserved. // Copyright (c) 2017, Yannick Cote All rights reserved. // This software is licensed under a 3-clause BSD license. Please consult the @@ -66,7 +66,7 @@ func addFlags(fs *pflag.FlagSet) { 1-386, 2-amd64, 3-arm, 4-arm64, 5-ppc64, 6-ppc64le, 7-mips, 8-mipsle, 9-mips64, - 10-mips64le, 11-s390x`) + 10-mips64le, 11-s390x, 12-riscv64`) signHash = fs.Int32("signhash", 0, `the signature hash used (with -datatype 5-Signature) [NEEDED, no default]: 1-SHA256, 2-SHA384, 3-SHA512, @@ -130,6 +130,8 @@ func getArch() string { return "mips64le" case 11: return "s390x" + case 12: + return "riscv64" default: return "unknown" } diff --git a/pkg/siftool/testdata/TestAddCommands/Add/out.golden b/pkg/siftool/testdata/TestAddCommands/Add/out.golden index 16c47e5d..6e1d0421 100644 --- a/pkg/siftool/testdata/TestAddCommands/Add/out.golden +++ b/pkg/siftool/testdata/TestAddCommands/Add/out.golden @@ -24,7 +24,7 @@ Flags: 1-386, 2-amd64, 3-arm, 4-arm64, 5-ppc64, 6-ppc64le, 7-mips, 8-mipsle, 9-mips64, - 10-mips64le, 11-s390x + 10-mips64le, 11-s390x, 12-riscv64 --partfs int32 the filesystem used (with -datatype 4-Partition) [NEEDED, no default]: 1-Squash, 2-Ext3, 3-ImmuObj,