Re: Bug#1034756: dpkg: please add support for riscv32
Hi!
On Sun, 2023-04-23 at 23:20:01 +0800, Bo YU wrote:
> Package: dpkg
> Version: 1.21.21
> Severity: wishlist
> Tags: patch
> User: debian-riscv@lists.debian.org
> Usertags: riscv32
> Currently riscv32 has been supported upstream for a while[0] and people
> can setup a riscv32 qemu with yocto[1], but it is time consuming.
> There is no distro to support riscv32 AFAIK until now however I think
> this will benefits users who want to setup riscv32 rootfs quickly if we
> support this.
Is your intention to create such port (unofficially or officially in
Debian)?
> I thought the riscv32 has met the request[2] also.
I assume the ABI is set in stone and well defined.
> Please let me know if there is any issue.
I think at the time when we added riscv64 we didn't also add riscv32
because it was not clear whether there was then interest or demand,
and I don't recall whether there were concerns about what ISA baseline
to choose? (But I guess this would use the default baseline specified
currently by the compiler.)
> [0]: https://github.com/riscv-collab/riscv-gnu-toolchain#installation-linux
> [1]: https://github.com/riscv/meta-riscv
> [2]: https://wiki.debian.org/Teams/Dpkg/FAQ#Q._Can_we_add_support_for_new_dpkg_architectures.3F
Thanks for the patch, I've adapted it slightly for the test suite (now
it passes «make authorcheck», and added the missing ABI tracking support,
but I think I'll split that into its own commit as that is affecting
riscv64 too.
(I'm in the process of preparing another upload to sid, ideally before
the release, and if this looks all good, I'd be inclined to include
part of this (probably not the ABI tracking bits) into that release,
to make adding such port possible in the near future.)
Thanks,
Guillem
From d71a98c23c43a06650e90480e864c0e3da344437 Mon Sep 17 00:00:00 2001
From: Bo YU <tsu.yubo@gmail.com>
Date: Tue, 25 Apr 2023 03:50:43 +0200
Subject: [PATCH] arch: Add support for riscv32 CPU
[guillem@debian.org:
- Adapt the test suite.
- Add ABI checking support. ]
Closes: #1034756
Signed-off-by: Guillem Jover <guillem@debian.org>
---
data/cputable | 1 +
scripts/Dpkg/Shlibs/Objdump.pm | 9 +++++++++
scripts/t/Dpkg_Arch.t | 4 ++--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/data/cputable b/data/cputable
index 7b1ee2c58..7c2c1c1c8 100644
--- a/data/cputable
+++ b/data/cputable
@@ -45,6 +45,7 @@ powerpc powerpc (powerpc|ppc) 32 big
powerpcel powerpcle powerpcle 32 little
ppc64 powerpc64 (powerpc|ppc)64 64 big
ppc64el powerpc64le powerpc64le 64 little
+riscv32 riscv32 riscv32 32 little
riscv64 riscv64 riscv64 64 little
s390 s390 s390 32 big
s390x s390x s390x 64 big
diff --git a/scripts/Dpkg/Shlibs/Objdump.pm b/scripts/Dpkg/Shlibs/Objdump.pm
index 5e27ec7f2..e30921b68 100644
--- a/scripts/Dpkg/Shlibs/Objdump.pm
+++ b/scripts/Dpkg/Shlibs/Objdump.pm
@@ -118,6 +118,7 @@ use constant {
EM_XTENSA => 94,
EM_MICROBLAZE => 189,
EM_ARCV2 => 195,
+ EM_RISCV => 243,
EM_LOONGARCH => 258,
EM_AVR_OLD => 0x1057,
EM_OR1K_OLD => 0x8472,
@@ -143,6 +144,13 @@ use constant {
EF_IA64_ABI64 => 0x00000010,
+ EF_RISCV_FLOAT_ABI_SOFT => 0x0000,
+ EF_RISCV_FLOAT_ABI_SINGLE => 0x0002,
+ EF_RISCV_FLOAT_ABI_DOUBLE => 0x0004,
+ EF_RISCV_FLOAT_ABI_QUAD => 0x0006,
+ EF_RISCV_FLOAT_ABI_MASK => 0x0006,
+ EF_RISCV_RVE => 0x0008,
+
EF_LOONGARCH_SOFT_FLOAT => 0x00000001,
EF_LOONGARCH_SINGLE_FLOAT => 0x00000002,
EF_LOONGARCH_DOUBLE_FLOAT => 0x00000003,
@@ -184,6 +192,7 @@ my %elf_flags_mask = (
EM_LOONGARCH() => EF_LOONGARCH_ABI_MASK,
EM_MIPS() => EF_MIPS_ABI_MASK | EF_MIPS_ABI2,
EM_PPC64() => EF_PPC64_ABI64,
+ EM_RISCV() => EF_RISCV_FLOAT_ABI_MASK | EF_RISCV_RVE,
);
sub get_format {
diff --git a/scripts/t/Dpkg_Arch.t b/scripts/t/Dpkg_Arch.t
index 95e6adf52..d2018593d 100644
--- a/scripts/t/Dpkg_Arch.t
+++ b/scripts/t/Dpkg_Arch.t
@@ -16,7 +16,7 @@
use strict;
use warnings;
-use Test::More tests => 18900;
+use Test::More tests => 19393;
use_ok('Dpkg::Arch', qw(debarch_to_debtuple debarch_to_multiarch
debarch_eq debarch_is debarch_is_wildcard
@@ -28,7 +28,7 @@ use_ok('Dpkg::Arch', qw(debarch_to_debtuple debarch_to_multiarch
get_host_gnu_type
get_valid_arches));
-my $KNOWN_ARCHES_TOTAL = 569;
+my $KNOWN_ARCHES_TOTAL = 584;
my @valid_arches = get_valid_arches();
sub get_valid_wildcards
--
2.40.0
Reply to: