mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH 1/2] fix risc64 conflict with kernel headers
@ 2019-08-06  5:51 Baruch Siach
  2019-08-06  5:51 ` [PATCH 2/2] fix risc64 user_regs_struct conflict with kernel header Baruch Siach
  2019-08-06 16:31 ` [PATCH 1/2] fix risc64 conflict with kernel headers Rich Felker
  0 siblings, 2 replies; 8+ messages in thread
From: Baruch Siach @ 2019-08-06  5:51 UTC (permalink / raw)
  To: Rich Felker; +Cc: musl, Baruch Siach

Rename user registers struct definitions to avoid conflict with the
asm/ptrace.h kernel header that defines the same structs. Use the
__riscv_mc prefix as glibc does.
---
 arch/riscv64/bits/signal.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/riscv64/bits/signal.h b/arch/riscv64/bits/signal.h
index 4c94a8f02edc..76d7ad80c8cd 100644
--- a/arch/riscv64/bits/signal.h
+++ b/arch/riscv64/bits/signal.h
@@ -12,29 +12,29 @@
 typedef unsigned long greg_t;
 typedef unsigned long gregset_t[32];
 
-struct __riscv_f_ext_state {
+struct __riscv_mc_f_ext_state {
 	unsigned int f[32];
 	unsigned int fcsr;
 };
 
-struct __riscv_d_ext_state {
+struct __riscv_mc_d_ext_state {
 	unsigned long long f[32];
 	unsigned int fcsr;
 };
 
-struct __riscv_q_ext_state {
+struct __riscv_mc_q_ext_state {
 	unsigned long long f[64] __attribute__((aligned(16)));
 	unsigned int fcsr;
 	unsigned int reserved[3];
 };
 
-union __riscv_fp_state {
-	struct __riscv_f_ext_state f;
-	struct __riscv_d_ext_state d;
-	struct __riscv_q_ext_state q;
+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;
 };
 
-typedef union __riscv_fp_state fpregset_t;
+typedef union __riscv_mc_fp_state fpregset_t;
 
 typedef struct sigcontext {
 	gregset_t gregs;
-- 
2.20.1



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

* [PATCH 2/2] fix risc64 user_regs_struct conflict with kernel header
  2019-08-06  5:51 [PATCH 1/2] fix risc64 conflict with kernel headers Baruch Siach
@ 2019-08-06  5:51 ` Baruch Siach
  2019-08-06 12:10   ` Rich Felker
  2019-08-06 16:31 ` [PATCH 1/2] fix risc64 conflict with kernel headers Rich Felker
  1 sibling, 1 reply; 8+ messages in thread
From: Baruch Siach @ 2019-08-06  5:51 UTC (permalink / raw)
  To: Rich Felker; +Cc: musl, Baruch Siach

Rename user_regs_struct following the example of s390 to avoid conflict
with the kernel asm/ptrace.h header.
---
 arch/riscv64/bits/user.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv64/bits/user.h b/arch/riscv64/bits/user.h
index bd0f0fc7027f..097c7ad6ce18 100644
--- a/arch/riscv64/bits/user.h
+++ b/arch/riscv64/bits/user.h
@@ -1,4 +1,4 @@
-struct user_regs_struct {
+struct _user_regs_struct {
 	unsigned long pc;
 	unsigned long ra;
 	unsigned long sp;
-- 
2.20.1



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

* Re: [PATCH 2/2] fix risc64 user_regs_struct conflict with kernel header
  2019-08-06  5:51 ` [PATCH 2/2] fix risc64 user_regs_struct conflict with kernel header Baruch Siach
@ 2019-08-06 12:10   ` Rich Felker
  2019-08-06 12:15     ` Baruch Siach
  0 siblings, 1 reply; 8+ messages in thread
From: Rich Felker @ 2019-08-06 12:10 UTC (permalink / raw)
  To: musl

On Tue, Aug 06, 2019 at 08:51:14AM +0300, Baruch Siach wrote:
> Rename user_regs_struct following the example of s390 to avoid conflict
> with the kernel asm/ptrace.h header.
> ---
>  arch/riscv64/bits/user.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/riscv64/bits/user.h b/arch/riscv64/bits/user.h
> index bd0f0fc7027f..097c7ad6ce18 100644
> --- a/arch/riscv64/bits/user.h
> +++ b/arch/riscv64/bits/user.h
> @@ -1,4 +1,4 @@
> -struct user_regs_struct {
> +struct _user_regs_struct {
>  	unsigned long pc;
>  	unsigned long ra;
>  	unsigned long sp;
> -- 
> 2.20.1

Does this agree with glibc naming?

Rich


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

* Re: [PATCH 2/2] fix risc64 user_regs_struct conflict with kernel header
  2019-08-06 12:10   ` Rich Felker
@ 2019-08-06 12:15     ` Baruch Siach
  2019-08-06 13:01       ` Rich Felker
  0 siblings, 1 reply; 8+ messages in thread
From: Baruch Siach @ 2019-08-06 12:15 UTC (permalink / raw)
  To: musl

Hi Rick,

On Tue, Aug 06 2019, Rich Felker wrote:
> On Tue, Aug 06, 2019 at 08:51:14AM +0300, Baruch Siach wrote:
>> Rename user_regs_struct following the example of s390 to avoid conflict
>> with the kernel asm/ptrace.h header.
>> ---
>>  arch/riscv64/bits/user.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/arch/riscv64/bits/user.h b/arch/riscv64/bits/user.h
>> index bd0f0fc7027f..097c7ad6ce18 100644
>> --- a/arch/riscv64/bits/user.h
>> +++ b/arch/riscv64/bits/user.h
>> @@ -1,4 +1,4 @@
>> -struct user_regs_struct {
>> +struct _user_regs_struct {
>>  	unsigned long pc;
>>  	unsigned long ra;
>>  	unsigned long sp;
>
> Does this agree with glibc naming?

glibc riscv headers do not define user_regs_struct.

baruch

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -


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

* Re: [PATCH 2/2] fix risc64 user_regs_struct conflict with kernel header
  2019-08-06 12:15     ` Baruch Siach
@ 2019-08-06 13:01       ` Rich Felker
  2019-08-06 13:16         ` Szabolcs Nagy
  0 siblings, 1 reply; 8+ messages in thread
From: Rich Felker @ 2019-08-06 13:01 UTC (permalink / raw)
  To: musl

On Tue, Aug 06, 2019 at 03:15:47PM +0300, Baruch Siach wrote:
> Hi Rick,
> 
> On Tue, Aug 06 2019, Rich Felker wrote:
> > On Tue, Aug 06, 2019 at 08:51:14AM +0300, Baruch Siach wrote:
> >> Rename user_regs_struct following the example of s390 to avoid conflict
> >> with the kernel asm/ptrace.h header.
> >> ---
> >>  arch/riscv64/bits/user.h | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >> 
> >> diff --git a/arch/riscv64/bits/user.h b/arch/riscv64/bits/user.h
> >> index bd0f0fc7027f..097c7ad6ce18 100644
> >> --- a/arch/riscv64/bits/user.h
> >> +++ b/arch/riscv64/bits/user.h
> >> @@ -1,4 +1,4 @@
> >> -struct user_regs_struct {
> >> +struct _user_regs_struct {
> >>  	unsigned long pc;
> >>  	unsigned long ra;
> >>  	unsigned long sp;
> >
> > Does this agree with glibc naming?
> 
> glibc riscv headers do not define user_regs_struct.

Not even by including a kernel header that defines it? If so, then the
public type must be the same as the type in the kernel header. This is
a known issue in user.h and related headers on several archs, and it's
hard to solve in any reasonable and consistent way short of doing the
same thing (including the kernel header). Renaming the type in a way
that makes the API incompatible is not the right solution.

Rich


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

* Re: [PATCH 2/2] fix risc64 user_regs_struct conflict with kernel header
  2019-08-06 13:01       ` Rich Felker
@ 2019-08-06 13:16         ` Szabolcs Nagy
  2019-08-06 14:04           ` Rich Felker
  0 siblings, 1 reply; 8+ messages in thread
From: Szabolcs Nagy @ 2019-08-06 13:16 UTC (permalink / raw)
  To: musl

* Rich Felker <dalias@libc.org> [2019-08-06 09:01:29 -0400]:
> On Tue, Aug 06, 2019 at 03:15:47PM +0300, Baruch Siach wrote:
> > On Tue, Aug 06 2019, Rich Felker wrote:
> > > On Tue, Aug 06, 2019 at 08:51:14AM +0300, Baruch Siach wrote:
> > >> -struct user_regs_struct {
> > >> +struct _user_regs_struct {
> > >
> > > Does this agree with glibc naming?
> > 
> > glibc riscv headers do not define user_regs_struct.
> 
> Not even by including a kernel header that defines it? If so, then the

the glibc sys/user.h is empty on riscv.

user_regs_struct is declared in asm/ptrace.h in linux
but that's not included into libc headers on riscv.

i think musl's user.h should be empty too.


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

* Re: [PATCH 2/2] fix risc64 user_regs_struct conflict with kernel header
  2019-08-06 13:16         ` Szabolcs Nagy
@ 2019-08-06 14:04           ` Rich Felker
  0 siblings, 0 replies; 8+ messages in thread
From: Rich Felker @ 2019-08-06 14:04 UTC (permalink / raw)
  To: musl

On Tue, Aug 06, 2019 at 03:16:03PM +0200, Szabolcs Nagy wrote:
> * Rich Felker <dalias@libc.org> [2019-08-06 09:01:29 -0400]:
> > On Tue, Aug 06, 2019 at 03:15:47PM +0300, Baruch Siach wrote:
> > > On Tue, Aug 06 2019, Rich Felker wrote:
> > > > On Tue, Aug 06, 2019 at 08:51:14AM +0300, Baruch Siach wrote:
> > > >> -struct user_regs_struct {
> > > >> +struct _user_regs_struct {
> > > >
> > > > Does this agree with glibc naming?
> > > 
> > > glibc riscv headers do not define user_regs_struct.
> > 
> > Not even by including a kernel header that defines it? If so, then the
> 
> the glibc sys/user.h is empty on riscv.
> 
> user_regs_struct is declared in asm/ptrace.h in linux
> but that's not included into libc headers on riscv.
> 
> i think musl's user.h should be empty too.

Good news for once! That's even better.

Rich


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

* Re: [PATCH 1/2] fix risc64 conflict with kernel headers
  2019-08-06  5:51 [PATCH 1/2] fix risc64 conflict with kernel headers Baruch Siach
  2019-08-06  5:51 ` [PATCH 2/2] fix risc64 user_regs_struct conflict with kernel header Baruch Siach
@ 2019-08-06 16:31 ` Rich Felker
  1 sibling, 0 replies; 8+ messages in thread
From: Rich Felker @ 2019-08-06 16:31 UTC (permalink / raw)
  To: musl

On Tue, Aug 06, 2019 at 08:51:13AM +0300, Baruch Siach wrote:
> Rename user registers struct definitions to avoid conflict with the
> asm/ptrace.h kernel header that defines the same structs. Use the
> __riscv_mc prefix as glibc does.
> ---
>  arch/riscv64/bits/signal.h | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/riscv64/bits/signal.h b/arch/riscv64/bits/signal.h
> index 4c94a8f02edc..76d7ad80c8cd 100644
> --- a/arch/riscv64/bits/signal.h
> +++ b/arch/riscv64/bits/signal.h
> @@ -12,29 +12,29 @@
>  typedef unsigned long greg_t;
>  typedef unsigned long gregset_t[32];
>  
> -struct __riscv_f_ext_state {
> +struct __riscv_mc_f_ext_state {
>  	unsigned int f[32];
>  	unsigned int fcsr;
>  };
>  
> -struct __riscv_d_ext_state {
> +struct __riscv_mc_d_ext_state {
>  	unsigned long long f[32];
>  	unsigned int fcsr;
>  };
>  
> -struct __riscv_q_ext_state {
> +struct __riscv_mc_q_ext_state {
>  	unsigned long long f[64] __attribute__((aligned(16)));
>  	unsigned int fcsr;
>  	unsigned int reserved[3];
>  };
>  
> -union __riscv_fp_state {
> -	struct __riscv_f_ext_state f;
> -	struct __riscv_d_ext_state d;
> -	struct __riscv_q_ext_state q;
> +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;
>  };
>  
> -typedef union __riscv_fp_state fpregset_t;
> +typedef union __riscv_mc_fp_state fpregset_t;
>  
>  typedef struct sigcontext {
>  	gregset_t gregs;
> -- 
> 2.20.1

I confirmed this matches glibc. Applying.

Rich


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

end of thread, other threads:[~2019-08-06 16:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-06  5:51 [PATCH 1/2] fix risc64 conflict with kernel headers Baruch Siach
2019-08-06  5:51 ` [PATCH 2/2] fix risc64 user_regs_struct conflict with kernel header Baruch Siach
2019-08-06 12:10   ` Rich Felker
2019-08-06 12:15     ` Baruch Siach
2019-08-06 13:01       ` Rich Felker
2019-08-06 13:16         ` Szabolcs Nagy
2019-08-06 14:04           ` Rich Felker
2019-08-06 16:31 ` [PATCH 1/2] fix risc64 conflict with kernel headers Rich Felker

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