public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix missing err declaration in __pthread_initialize_minimal_internal
@ 2015-05-22 17:18 Steve Ellcey
  2015-05-24 15:07 ` Carlos O'Donell
  0 siblings, 1 reply; 5+ messages in thread
From: Steve Ellcey @ 2015-05-22 17:18 UTC (permalink / raw)
  To: GNU C Library; +Cc: Roland McGrath

Roland's patch (https://sourceware.org/ml/libc-alpha/2015-05/msg00464.html)
to set tid field to a unique value removed the declaration of err
[INTERNAL_SYSCALL_DECL (err);] from __pthread_initialize_minimal_internal,
but there are other uses of err in other INTERNAL_SYSCALL's in
__pthread_initialize_minimal_internal so this broke the build glibc build
for MIPS (and presumably other platforms).

Here is a patch to put the declaration back.  I think the only question
is exactly where this declaration should go.   I initially put it right
in front of the first INTERNAL_SYSCALL call but I noticed that that is inside
of an ifdef and there are other INTERNAL_SYSCALL uses (with err) that
are in different ifdef's so I moved the declaration outside of any ifdef's.
This fixed my build problem.  OK to checkin?

Steve Ellcey
sellcey@imgtec.com



2015-05-22  Steve Ellcey  <sellcey@imgtec.com>

	* nptl/nptl-init.c (__pthread_initialize_minimal_internal):
	Add declaration of err that was removed in earlier patch.



diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
index 5b8d931..3bfb478 100644
--- a/nptl/nptl-init.c
+++ b/nptl/nptl-init.c
@@ -326,6 +326,7 @@ __pthread_initialize_minimal_internal (void)
   pd->robust_prev = &pd->robust_head;
 #endif
   pd->robust_head.list = &pd->robust_head;
+  INTERNAL_SYSCALL_DECL (err);
 #ifdef __NR_set_robust_list
   pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock)
 				  - offsetof (pthread_mutex_t,


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

* Re: [PATCH] Fix missing err declaration in __pthread_initialize_minimal_internal
  2015-05-22 17:18 [PATCH] Fix missing err declaration in __pthread_initialize_minimal_internal Steve Ellcey
@ 2015-05-24 15:07 ` Carlos O'Donell
  2015-05-25 11:46   ` Khem Raj
  2015-05-26 17:18   ` Steve Ellcey
  0 siblings, 2 replies; 5+ messages in thread
From: Carlos O'Donell @ 2015-05-24 15:07 UTC (permalink / raw)
  To: sellcey, GNU C Library, Khem Raj; +Cc: Roland McGrath

On 05/22/2015 12:42 PM, Steve Ellcey wrote:
> Roland's patch (https://sourceware.org/ml/libc-alpha/2015-05/msg00464.html)
> to set tid field to a unique value removed the declaration of err
> [INTERNAL_SYSCALL_DECL (err);] from __pthread_initialize_minimal_internal,
> but there are other uses of err in other INTERNAL_SYSCALL's in
> __pthread_initialize_minimal_internal so this broke the build glibc build
> for MIPS (and presumably other platforms).
> 
> Here is a patch to put the declaration back.  I think the only question
> is exactly where this declaration should go.   I initially put it right
> in front of the first INTERNAL_SYSCALL call but I noticed that that is inside
> of an ifdef and there are other INTERNAL_SYSCALL uses (with err) that
> are in different ifdef's so I moved the declaration outside of any ifdef's.
> This fixed my build problem.  OK to checkin?
> 
> Steve Ellcey
> sellcey@imgtec.com
> 
> 
> 
> 2015-05-22  Steve Ellcey  <sellcey@imgtec.com>
> 
> 	* nptl/nptl-init.c (__pthread_initialize_minimal_internal):
> 	Add declaration of err that was removed in earlier patch.
> 
> 
> 
> diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
> index 5b8d931..3bfb478 100644
> --- a/nptl/nptl-init.c
> +++ b/nptl/nptl-init.c
> @@ -326,6 +326,7 @@ __pthread_initialize_minimal_internal (void)
>    pd->robust_prev = &pd->robust_head;
>  #endif
>    pd->robust_head.list = &pd->robust_head;
> +  INTERNAL_SYSCALL_DECL (err);

Why isn't this inside the inner ifdef?

>  #ifdef __NR_set_robust_list
>    pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock)
>  				  - offsetof (pthread_mutex_t,

As Florian mentioned to Raj, the definition of the err decl should
be in the same scope as the syscall that uses it.

Did I miss something?

Cheers,
Carlos.

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

* Re: [PATCH] Fix missing err declaration in __pthread_initialize_minimal_internal
  2015-05-24 15:07 ` Carlos O'Donell
@ 2015-05-25 11:46   ` Khem Raj
  2015-05-26 17:18   ` Steve Ellcey
  1 sibling, 0 replies; 5+ messages in thread
From: Khem Raj @ 2015-05-25 11:46 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: sellcey, GNU C Library, Roland McGrath

On Sat, May 23, 2015 at 8:04 PM, Carlos O'Donell <carlos@redhat.com> wrote:
> On 05/22/2015 12:42 PM, Steve Ellcey wrote:
>> Roland's patch (https://sourceware.org/ml/libc-alpha/2015-05/msg00464.html)
>> to set tid field to a unique value removed the declaration of err
>> [INTERNAL_SYSCALL_DECL (err);] from __pthread_initialize_minimal_internal,
>> but there are other uses of err in other INTERNAL_SYSCALL's in
>> __pthread_initialize_minimal_internal so this broke the build glibc build
>> for MIPS (and presumably other platforms).
>>
>> Here is a patch to put the declaration back.  I think the only question
>> is exactly where this declaration should go.   I initially put it right
>> in front of the first INTERNAL_SYSCALL call but I noticed that that is inside
>> of an ifdef and there are other INTERNAL_SYSCALL uses (with err) that
>> are in different ifdef's so I moved the declaration outside of any ifdef's.
>> This fixed my build problem.  OK to checkin?
>>
>> Steve Ellcey
>> sellcey@imgtec.com
>>
>>
>>
>> 2015-05-22  Steve Ellcey  <sellcey@imgtec.com>
>>
>>       * nptl/nptl-init.c (__pthread_initialize_minimal_internal):
>>       Add declaration of err that was removed in earlier patch.
>>
>>
>>
>> diff --git a/nptl/nptl-init.c b/nptl/nptl-init.c
>> index 5b8d931..3bfb478 100644
>> --- a/nptl/nptl-init.c
>> +++ b/nptl/nptl-init.c
>> @@ -326,6 +326,7 @@ __pthread_initialize_minimal_internal (void)
>>    pd->robust_prev = &pd->robust_head;
>>  #endif
>>    pd->robust_head.list = &pd->robust_head;
>> +  INTERNAL_SYSCALL_DECL (err);
>
> Why isn't this inside the inner ifdef?
>
>>  #ifdef __NR_set_robust_list
>>    pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock)
>>                                 - offsetof (pthread_mutex_t,
>
> As Florian mentioned to Raj, the definition of the err decl should
> be in the same scope as the syscall that uses it.
>
> Did I miss something?

I think Roland posted another patch which should already fix this issue.

>
> Cheers,
> Carlos.
>

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

* Re: [PATCH] Fix missing err declaration in __pthread_initialize_minimal_internal
  2015-05-24 15:07 ` Carlos O'Donell
  2015-05-25 11:46   ` Khem Raj
@ 2015-05-26 17:18   ` Steve Ellcey
  2015-05-26 18:25     ` Carlos O'Donell
  1 sibling, 1 reply; 5+ messages in thread
From: Steve Ellcey @ 2015-05-26 17:18 UTC (permalink / raw)
  To: Carlos O'Donell; +Cc: GNU C Library, Khem Raj, Roland McGrath

On Sat, 2015-05-23 at 23:04 -0400, Carlos O'Donell wrote:

> Why isn't this inside the inner ifdef?
> 
> >  #ifdef __NR_set_robust_list
> >    pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock)
> >  				  - offsetof (pthread_mutex_t,
> 
> As Florian mentioned to Raj, the definition of the err decl should
> be in the same scope as the syscall that uses it.
> 
> Did I miss something?
> 
> Cheers,
> Carlos.

This patch is no longer needed due to Roland's patch but the reason I
didn't put INTERNAL_SYSCALL_DECL in the same scope as INTERNAL_SYSCALL
was because there was multiple INTERNAL_SYSCALL calls in
__pthread_initialize_minimal_internal and I wanted one
INTERNAL_SYSCALL_DECL to cover them all.  That was basically what we had
before.  I guess the right way (and what Roland checked in) is to have
one INTERNAL_SYSCALL_DECL for each scope with an INTERNAL_SYSCALL and if
you have two INTERNAL_SYSCALL's in different ifdefs but in the same C
scope then use brackets to make different scopes so you can have a
INTERNAL_SYSCALL_DECL with each INTERNAL_SYSCALL.

I.e. do not do this:

INTERNAL_SYSCALL_DECL
#if A
INTERNAL_SYSCALL()
#endif
#if B
INTERNAL_SYSCALL()
#endif


but instead do this:


#if A
{
  INTERNAL_SYSCALL_DECL
  INTERNAL_SYSCALL()
}
#endif
#if B
{
  INTERNAL_SYSCALL_DECL
  INTERNAL_SYSCALL()
}
#endif


Steve Ellcey
sellcey@imgtec.com
  

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

* Re: [PATCH] Fix missing err declaration in __pthread_initialize_minimal_internal
  2015-05-26 17:18   ` Steve Ellcey
@ 2015-05-26 18:25     ` Carlos O'Donell
  0 siblings, 0 replies; 5+ messages in thread
From: Carlos O'Donell @ 2015-05-26 18:25 UTC (permalink / raw)
  To: sellcey; +Cc: GNU C Library, Khem Raj, Roland McGrath

On 05/26/2015 12:42 PM, Steve Ellcey wrote:
> On Sat, 2015-05-23 at 23:04 -0400, Carlos O'Donell wrote:
> 
>> Why isn't this inside the inner ifdef?
>>
>>>  #ifdef __NR_set_robust_list
>>>    pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock)
>>>  				  - offsetof (pthread_mutex_t,
>>
>> As Florian mentioned to Raj, the definition of the err decl should
>> be in the same scope as the syscall that uses it.
>>
>> Did I miss something?
>>
>> Cheers,
>> Carlos.
> 
> This patch is no longer needed due to Roland's patch but the reason I
> didn't put INTERNAL_SYSCALL_DECL in the same scope as INTERNAL_SYSCALL
> was because there was multiple INTERNAL_SYSCALL calls in
> __pthread_initialize_minimal_internal and I wanted one
> INTERNAL_SYSCALL_DECL to cover them all.  That was basically what we had
> before.  I guess the right way (and what Roland checked in) is to have
> one INTERNAL_SYSCALL_DECL for each scope with an INTERNAL_SYSCALL and if
> you have two INTERNAL_SYSCALL's in different ifdefs but in the same C
> scope then use brackets to make different scopes so you can have a
> INTERNAL_SYSCALL_DECL with each INTERNAL_SYSCALL.
> 
> I.e. do not do this:
> 
> INTERNAL_SYSCALL_DECL
> #if A
> INTERNAL_SYSCALL()
> #endif
> #if B
> INTERNAL_SYSCALL()
> #endif
> 
> 
> but instead do this:
> 
> 
> #if A
> {
>   INTERNAL_SYSCALL_DECL
>   INTERNAL_SYSCALL()
> }
> #endif
> #if B
> {
>   INTERNAL_SYSCALL_DECL
>   INTERNAL_SYSCALL()
> }
> #endif

Agreed. I did see later that Roland checked in a solution.

Cheers,
Carlos.

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

end of thread, other threads:[~2015-05-26 17:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-22 17:18 [PATCH] Fix missing err declaration in __pthread_initialize_minimal_internal Steve Ellcey
2015-05-24 15:07 ` Carlos O'Donell
2015-05-25 11:46   ` Khem Raj
2015-05-26 17:18   ` Steve Ellcey
2015-05-26 18:25     ` Carlos O'Donell

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 read-only IMAP folder(s) and NNTP newsgroup(s).