mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Hongliang Wang <wanghongliang@loongson.cn>
To: musl@lists.openwall.com
Subject: [musl] LoongArch:add user_regs_struct and user_fp_struct.
Date: Mon, 26 Feb 2024 16:04:26 +0800	[thread overview]
Message-ID: <86f46f83-feb0-f6b8-c5bf-9740d908632d@loongson.cn> (raw)

Hi,

elfutils 0.190 references user_regs_struct and user_fp_struct, which
are defined in glibc, but not in musl. So there is a compile error when
compile ruby 3.3.0 in musl. I add these struct in musl loongarch, I also
adjust the ELF_NFPREG according the size of user_fp_struct, and 
elf_fpreg_t and elf_fpregset_t definition, which is consistent with glibc.

---
  arch/loongarch64/bits/user.h | 23 +++++++++++++++++++++--
  1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/arch/loongarch64/bits/user.h b/arch/loongarch64/bits/user.h
index 5a71d132..fd9b7b22 100644
--- a/arch/loongarch64/bits/user.h
+++ b/arch/loongarch64/bits/user.h
@@ -1,5 +1,24 @@
  #define ELF_NGREG    45
-#define ELF_NFPREG   33
+#define ELF_NFPREG   34
+
+struct user_regs_struct {
+	unsigned long regs[32];
+	unsigned long orig_a0;
+	unsigned long csr_era;
+	unsigned long csr_badv;
+	unsigned long reserved[10];
+};
+
+struct user_fp_struct {
+	unsigned long fpr[32];
+	unsigned long fcc;
+	unsigned int fcsr;
+};

  typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
-typedef double elf_fpreg_t, elf_fpregset_t[ELF_NFPREG];
+
+typedef union {
+	double d;
+	float f;
+} elf_fpreg_t;
+typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
-- 
2.37.1


Regards,
Hongliang Wang


                 reply	other threads:[~2024-02-26  8:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86f46f83-feb0-f6b8-c5bf-9740d908632d@loongson.cn \
    --to=wanghongliang@loongson.cn \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).