mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH] Change container for riscv floating-point state to __riscv_mc_fp_state
@ 2019-09-28 23:03 Khem Raj
  2019-09-28 23:24 ` Rich Felker
  0 siblings, 1 reply; 3+ messages in thread
From: Khem Raj @ 2019-09-28 23:03 UTC (permalink / raw)
  To: musl; +Cc: Khem Raj

Match the struct elements with glibc
glibc also uses __riscv_mc prefix, some packages like gdb uses that

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 arch/riscv64/bits/signal.h | 18 +++++++++---------
 arch/riscv64/bits/user.h   |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/riscv64/bits/signal.h b/arch/riscv64/bits/signal.h
index 76d7ad80..aba7ab00 100644
--- a/arch/riscv64/bits/signal.h
+++ b/arch/riscv64/bits/signal.h
@@ -13,25 +13,25 @@ typedef unsigned long greg_t;
 typedef unsigned long gregset_t[32];
 
 struct __riscv_mc_f_ext_state {
-	unsigned int f[32];
-	unsigned int fcsr;
+	unsigned int __f[32];
+	unsigned int __fcsr;
 };
 
 struct __riscv_mc_d_ext_state {
-	unsigned long long f[32];
-	unsigned int fcsr;
+	unsigned long long __f[32];
+	unsigned int __fcsr;
 };
 
 struct __riscv_mc_q_ext_state {
-	unsigned long long f[64] __attribute__((aligned(16)));
-	unsigned int fcsr;
+	unsigned long long __f[64] __attribute__((aligned(16)));
+	unsigned int __fcsr;
 	unsigned int reserved[3];
 };
 
 union __riscv_mc_fp_state {
-	struct __riscv_mc_f_ext_state f;
-	struct __riscv_mc_d_ext_state d;
-	struct __riscv_mc_q_ext_state q;
+	struct __riscv_mc_f_ext_state __f;
+	struct __riscv_mc_d_ext_state __d;
+	struct __riscv_mc_q_ext_state __q;
 };
 
 typedef union __riscv_mc_fp_state fpregset_t;
diff --git a/arch/riscv64/bits/user.h b/arch/riscv64/bits/user.h
index d2e383b2..9918a2fe 100644
--- a/arch/riscv64/bits/user.h
+++ b/arch/riscv64/bits/user.h
@@ -5,4 +5,4 @@ struct user_fpregs_struct {
 
 #define ELF_NGREG 32
 typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
-typedef struct user_fpregs_struct elf_fpregset_t;
+typedef union __riscv_mc_fp_state elf_fpregset_t;
-- 
2.23.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Change container for riscv floating-point state to __riscv_mc_fp_state
  2019-09-28 23:03 [PATCH] Change container for riscv floating-point state to __riscv_mc_fp_state Khem Raj
@ 2019-09-28 23:24 ` Rich Felker
  2019-09-28 23:39   ` Khem Raj
  0 siblings, 1 reply; 3+ messages in thread
From: Rich Felker @ 2019-09-28 23:24 UTC (permalink / raw)
  To: musl

On Sat, Sep 28, 2019 at 04:03:48PM -0700, Khem Raj wrote:
> Match the struct elements with glibc
> glibc also uses __riscv_mc prefix, some packages like gdb uses that
> 
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  arch/riscv64/bits/signal.h | 18 +++++++++---------
>  arch/riscv64/bits/user.h   |  2 +-
>  2 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/riscv64/bits/signal.h b/arch/riscv64/bits/signal.h
> index 76d7ad80..aba7ab00 100644
> --- a/arch/riscv64/bits/signal.h
> +++ b/arch/riscv64/bits/signal.h
> @@ -13,25 +13,25 @@ typedef unsigned long greg_t;
>  typedef unsigned long gregset_t[32];
>  
>  struct __riscv_mc_f_ext_state {
> -	unsigned int f[32];
> -	unsigned int fcsr;
> +	unsigned int __f[32];
> +	unsigned int __fcsr;
>  };
>  
>  struct __riscv_mc_d_ext_state {
> -	unsigned long long f[32];
> -	unsigned int fcsr;
> +	unsigned long long __f[32];
> +	unsigned int __fcsr;
>  };
>  
>  struct __riscv_mc_q_ext_state {
> -	unsigned long long f[64] __attribute__((aligned(16)));
> -	unsigned int fcsr;
> +	unsigned long long __f[64] __attribute__((aligned(16)));
> +	unsigned int __fcsr;
>  	unsigned int reserved[3];
>  };
>  
>  union __riscv_mc_fp_state {
> -	struct __riscv_mc_f_ext_state f;
> -	struct __riscv_mc_d_ext_state d;
> -	struct __riscv_mc_q_ext_state q;
> +	struct __riscv_mc_f_ext_state __f;
> +	struct __riscv_mc_d_ext_state __d;
> +	struct __riscv_mc_q_ext_state __q;
>  };

This looks like an improvement for another major reason too -- the
names f, d, q, are really bad namespace pollution to have in the
default profile.

There are actually more namespace problems in this file too, some of
them actually conformance issues.

> diff --git a/arch/riscv64/bits/user.h b/arch/riscv64/bits/user.h
> index d2e383b2..9918a2fe 100644
> --- a/arch/riscv64/bits/user.h
> +++ b/arch/riscv64/bits/user.h
> @@ -5,4 +5,4 @@ struct user_fpregs_struct {
>  
>  #define ELF_NGREG 32
>  typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
> -typedef struct user_fpregs_struct elf_fpregset_t;
> +typedef union __riscv_mc_fp_state elf_fpregset_t;
> -- 
> 2.23.0

This part unfortunately depends on signal.h, which sys/user.h does not
include. Since sys/user.h is a junk header it might be acceptable to
just make the rv64 bits include signal.h, or to make it always include
signal.h.

Rich


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Change container for riscv floating-point state to __riscv_mc_fp_state
  2019-09-28 23:24 ` Rich Felker
@ 2019-09-28 23:39   ` Khem Raj
  0 siblings, 0 replies; 3+ messages in thread
From: Khem Raj @ 2019-09-28 23:39 UTC (permalink / raw)
  To: musl, Rich Felker



On 9/28/19 4:24 PM, Rich Felker wrote:
> On Sat, Sep 28, 2019 at 04:03:48PM -0700, Khem Raj wrote:
>> Match the struct elements with glibc
>> glibc also uses __riscv_mc prefix, some packages like gdb uses that
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> ---
>>  arch/riscv64/bits/signal.h | 18 +++++++++---------
>>  arch/riscv64/bits/user.h   |  2 +-
>>  2 files changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/arch/riscv64/bits/signal.h b/arch/riscv64/bits/signal.h
>> index 76d7ad80..aba7ab00 100644
>> --- a/arch/riscv64/bits/signal.h
>> +++ b/arch/riscv64/bits/signal.h
>> @@ -13,25 +13,25 @@ typedef unsigned long greg_t;
>>  typedef unsigned long gregset_t[32];
>>  
>>  struct __riscv_mc_f_ext_state {
>> -	unsigned int f[32];
>> -	unsigned int fcsr;
>> +	unsigned int __f[32];
>> +	unsigned int __fcsr;
>>  };
>>  
>>  struct __riscv_mc_d_ext_state {
>> -	unsigned long long f[32];
>> -	unsigned int fcsr;
>> +	unsigned long long __f[32];
>> +	unsigned int __fcsr;
>>  };
>>  
>>  struct __riscv_mc_q_ext_state {
>> -	unsigned long long f[64] __attribute__((aligned(16)));
>> -	unsigned int fcsr;
>> +	unsigned long long __f[64] __attribute__((aligned(16)));
>> +	unsigned int __fcsr;
>>  	unsigned int reserved[3];
>>  };
>>  
>>  union __riscv_mc_fp_state {
>> -	struct __riscv_mc_f_ext_state f;
>> -	struct __riscv_mc_d_ext_state d;
>> -	struct __riscv_mc_q_ext_state q;
>> +	struct __riscv_mc_f_ext_state __f;
>> +	struct __riscv_mc_d_ext_state __d;
>> +	struct __riscv_mc_q_ext_state __q;
>>  };
> 
> This looks like an improvement for another major reason too -- the
> names f, d, q, are really bad namespace pollution to have in the
> default profile.
> 
> There are actually more namespace problems in this file too, some of
> them actually conformance issues.
> 
>> diff --git a/arch/riscv64/bits/user.h b/arch/riscv64/bits/user.h
>> index d2e383b2..9918a2fe 100644
>> --- a/arch/riscv64/bits/user.h
>> +++ b/arch/riscv64/bits/user.h
>> @@ -5,4 +5,4 @@ struct user_fpregs_struct {
>>  
>>  #define ELF_NGREG 32
>>  typedef unsigned long elf_greg_t, elf_gregset_t[ELF_NGREG];
>> -typedef struct user_fpregs_struct elf_fpregset_t;
>> +typedef union __riscv_mc_fp_state elf_fpregset_t;
>> -- 
>> 2.23.0
> 
> This part unfortunately depends on signal.h, which sys/user.h does not
> include. Since sys/user.h is a junk header it might be acceptable to
> just make the rv64 bits include signal.h, or to make it always include
> signal.h.

I think including bitss/signal.h in sys/user.h on rv64  is a good
compromise. Do you want a v2 with this change  ? or  I can send the
include  part as a separate patch on top

> 
> Rich
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-28 23:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-28 23:03 [PATCH] Change container for riscv floating-point state to __riscv_mc_fp_state Khem Raj
2019-09-28 23:24 ` Rich Felker
2019-09-28 23:39   ` Khem Raj

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