mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] LoongArch:add user_regs_struct and user_fp_struct.
@ 2024-02-26  8:04 Hongliang Wang
  0 siblings, 0 replies; only message in thread
From: Hongliang Wang @ 2024-02-26  8:04 UTC (permalink / raw)
  To: musl

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-26  8:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-26  8:04 [musl] LoongArch:add user_regs_struct and user_fp_struct Hongliang Wang

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).