public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] RTEMS configure.host patches
@ 2017-10-11 12:58 Joel Sherrill
  2017-10-11 12:58 ` [PATCH v2 2/2] newlib/.../getreent.c: Allow to be provided by host and do so for RTEMS Joel Sherrill
  2017-10-11 13:49 ` [PATCH v2 1/2] newlib/configure.host: Remove obsolete definition of _I386MACH_ALLOW_HW_INTERRUPTS Joel Sherrill
  0 siblings, 2 replies; 11+ messages in thread
From: Joel Sherrill @ 2017-10-11 12:58 UTC (permalink / raw)
  To: newlib; +Cc: Joel Sherrill

Hi

I am not sure what went wrong before. Hopefully these are better.

--joel

Joel Sherrill (2):
  newlib/configure.host: Remove obsolete definition of
    _I386MACH_ALLOW_HW_INTERRUPTS
  newlib/.../getreent.c: Allow to be provided by host and do so for
    RTEMS

 newlib/configure.host        | 4 +---
 newlib/libc/reent/getreent.c | 8 ++++++++
 2 files changed, 9 insertions(+), 3 deletions(-)

-- 
1.8.3.1

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

* [PATCH v2 2/2] newlib/.../getreent.c: Allow to be provided by host and do so for RTEMS
  2017-10-11 12:58 [PATCH v2 0/2] RTEMS configure.host patches Joel Sherrill
@ 2017-10-11 12:58 ` Joel Sherrill
  2017-10-11 13:54   ` Corinna Vinschen
  2017-10-17 11:40   ` Sebastian Huber
  2017-10-11 13:49 ` [PATCH v2 1/2] newlib/configure.host: Remove obsolete definition of _I386MACH_ALLOW_HW_INTERRUPTS Joel Sherrill
  1 sibling, 2 replies; 11+ messages in thread
From: Joel Sherrill @ 2017-10-11 12:58 UTC (permalink / raw)
  To: newlib; +Cc: Joel Sherrill

RTEMS provides the option to have a global or per-thread reentrancy
as part of application configuration. As part of this, RTEMS provides
the implementation of __getreent() as appropriate. Allow the target
to determine if this method is present in libc.a.
---
 newlib/configure.host        | 2 +-
 newlib/libc/reent/getreent.c | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/newlib/configure.host b/newlib/configure.host
index fb3362b..7f397dd 100644
--- a/newlib/configure.host
+++ b/newlib/configure.host
@@ -605,7 +605,7 @@ case "${host}" in
 	default_newlib_io_long_long="yes"
 	default_newlib_io_c99_formats="yes"
 	newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB"
-	newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
+newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DGETREENT_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
         # turn off unsupported items in posix directory 
 	newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN -D_NO_POSIX_SPAWN"
 	;;
diff --git a/newlib/libc/reent/getreent.c b/newlib/libc/reent/getreent.c
index 60ae6fb..124abce 100644
--- a/newlib/libc/reent/getreent.c
+++ b/newlib/libc/reent/getreent.c
@@ -1,5 +1,11 @@
 /* default reentrant pointer when multithread enabled */
 
+#ifdef GETREENT_PROVIDED
+
+int _dummy_getreent;
+
+#else
+
 #include <_ansi.h>
 #include <reent.h>
 
@@ -12,3 +18,5 @@ _DEFUN_VOID(__getreent)
 {
   return _impure_ptr;
 }
+
+#endif
-- 
1.8.3.1

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

* [PATCH v2 1/2] newlib/configure.host: Remove obsolete definition of _I386MACH_ALLOW_HW_INTERRUPTS
  2017-10-11 12:58 [PATCH v2 0/2] RTEMS configure.host patches Joel Sherrill
  2017-10-11 12:58 ` [PATCH v2 2/2] newlib/.../getreent.c: Allow to be provided by host and do so for RTEMS Joel Sherrill
@ 2017-10-11 13:49 ` Joel Sherrill
  1 sibling, 0 replies; 11+ messages in thread
From: Joel Sherrill @ 2017-10-11 13:49 UTC (permalink / raw)
  To: newlib; +Cc: Joel Sherrill

The *-*-rtems* targets defined this even though the conditional
was no longer present in i386/setjmp.S.
---
 newlib/configure.host | 2 --
 1 file changed, 2 deletions(-)

diff --git a/newlib/configure.host b/newlib/configure.host
index ba2d8c6..fb3362b 100644
--- a/newlib/configure.host
+++ b/newlib/configure.host
@@ -608,8 +608,6 @@ case "${host}" in
 	newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
         # turn off unsupported items in posix directory 
 	newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN -D_NO_POSIX_SPAWN"
-        # turn off using cli/sti in i386 setjmp/longjmp
-	newlib_cflags="${newlib_cflags} -D_I386MACH_ALLOW_HW_INTERRUPTS"
 	;;
 # VxWorks supplies its own version of malloc, and the newlib one
 # doesn't work because VxWorks does not have sbrk.
-- 
1.8.3.1

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

* Re: [PATCH v2 2/2] newlib/.../getreent.c: Allow to be provided by host and do so for RTEMS
  2017-10-11 12:58 ` [PATCH v2 2/2] newlib/.../getreent.c: Allow to be provided by host and do so for RTEMS Joel Sherrill
@ 2017-10-11 13:54   ` Corinna Vinschen
  2017-10-11 16:28     ` Joel Sherrill
  2017-10-17 11:40   ` Sebastian Huber
  1 sibling, 1 reply; 11+ messages in thread
From: Corinna Vinschen @ 2017-10-11 13:54 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 2091 bytes --]

Hi Joel,

On Oct 11 07:57, Joel Sherrill wrote:
> RTEMS provides the option to have a global or per-thread reentrancy
> as part of application configuration. As part of this, RTEMS provides
> the implementation of __getreent() as appropriate. Allow the target
> to determine if this method is present in libc.a.
> ---
>  newlib/configure.host        | 2 +-
>  newlib/libc/reent/getreent.c | 8 ++++++++
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/newlib/configure.host b/newlib/configure.host
> index fb3362b..7f397dd 100644
> --- a/newlib/configure.host
> +++ b/newlib/configure.host
> @@ -605,7 +605,7 @@ case "${host}" in
>  	default_newlib_io_long_long="yes"
>  	default_newlib_io_c99_formats="yes"
>  	newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB"
> -	newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
> +newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DGETREENT_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
>          # turn off unsupported items in posix directory 
>  	newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN -D_NO_POSIX_SPAWN"
>  	;;
> diff --git a/newlib/libc/reent/getreent.c b/newlib/libc/reent/getreent.c
> index 60ae6fb..124abce 100644
> --- a/newlib/libc/reent/getreent.c
> +++ b/newlib/libc/reent/getreent.c
> @@ -1,5 +1,11 @@
>  /* default reentrant pointer when multithread enabled */
>  
> +#ifdef GETREENT_PROVIDED
> +
> +int _dummy_getreent;
> +

So, why do you need this?  If you implement your own __getreent, there's
no reason for this _dummy_getreent to exist, no?

Btw., Cygwin implements its own __getreent(), too, without having to
change newlib/libc/reent/getreent.c at all...


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH v2 2/2] newlib/.../getreent.c: Allow to be provided by host and do so for RTEMS
  2017-10-11 13:54   ` Corinna Vinschen
@ 2017-10-11 16:28     ` Joel Sherrill
  2017-10-13  6:09       ` Joel Sherrill
  0 siblings, 1 reply; 11+ messages in thread
From: Joel Sherrill @ 2017-10-11 16:28 UTC (permalink / raw)
  To: newlib


Sorry to top post but replying from my phone on a plane.

Some of our tests are managing to get duplicate symbol errors when linking.

I put the dummy symbol in to follow the pattern in the file I patterned this after. I would have to look at the source again to see what file that was


On Oct 11, 2017, 9:49 AM, at 9:49 AM, Corinna Vinschen <vinschen@redhat.com> wrote:
Hi Joel,

On Oct 11 07:57, Joel Sherrill wrote:
 RTEMS provides the option to have a global or per-thread reentrancy
 as part of application configuration. As part of this, RTEMS provides
 the implementation of __getreent() as appropriate. Allow the target
 to determine if this method is present in libc.a.
 ---
  newlib/configure.host<http://configure.host>        | 2 +-
  newlib/libc/reent/getreent.c | 8 ++++++++
  2 files changed, 9 insertions(+), 1 deletion(-)

 diff --git a/newlib/configure.host<http://configure.host> b/newlib/configure.host<http://configure.host>
 index fb3362b..7f397dd 100644
 --- a/newlib/configure.host<http://configure.host>
 +++ b/newlib/configure.host<http://configure.host>
 @@ -605,7 +605,7 @@ case "${host}" in
        default_newlib_io_long_long="yes"
        default_newlib_io_c99_formats="yes"
        newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB"
 -      newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED
-DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED
-DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
 +newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED
-DEXIT_PROVIDED -DSIGNAL_PROVIDED -DGETREENT_PROVIDED
-DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE
-DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
          # turn off unsupported items in posix directory
        newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT
-D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN
-D_NO_POSIX_SPAWN"
        ;;
 diff --git a/newlib/libc/reent/getreent.c
b/newlib/libc/reent/getreent.c
 index 60ae6fb..124abce 100644
 --- a/newlib/libc/reent/getreent.c
 +++ b/newlib/libc/reent/getreent.c
 @@ -1,5 +1,11 @@
  /* default reentrant pointer when multithread enabled */

 +#ifdef GETREENT_PROVIDED
 +
 +int _dummy_getreent;
 +

So, why do you need this?  If you implement your own __getreent,
there's
no reason for this _dummy_getreent to exist, no?

Btw., Cygwin implements its own __getreent(), too, without having to
change newlib/libc/reent/getreent.c at all...


Corinna

--
Corinna Vinschen
Cygwin Maintainer
Red Hat

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

* Re: [PATCH v2 2/2] newlib/.../getreent.c: Allow to be provided by host and do so for RTEMS
  2017-10-11 16:28     ` Joel Sherrill
@ 2017-10-13  6:09       ` Joel Sherrill
  2017-10-13  9:16         ` Corinna Vinschen
  0 siblings, 1 reply; 11+ messages in thread
From: Joel Sherrill @ 2017-10-13  6:09 UTC (permalink / raw)
  To: newlib

Is it OK to push these patches?

On 10/11/2017 8:54 AM, Joel Sherrill wrote:
> 
> Sorry to top post but replying from my phone on a plane.
> 
> Some of our tests are managing to get duplicate symbol errors when linking.
> 
> I put the dummy symbol in to follow the pattern in the file I patterned this after. I would have to look at the source again to see what file that was
> 
> 
> On Oct 11, 2017, 9:49 AM, at 9:49 AM, Corinna Vinschen <vinschen@redhat.com> wrote:
> Hi Joel,
> 
> On Oct 11 07:57, Joel Sherrill wrote:
>   RTEMS provides the option to have a global or per-thread reentrancy
>   as part of application configuration. As part of this, RTEMS provides
>   the implementation of __getreent() as appropriate. Allow the target
>   to determine if this method is present in libc.a.
>   ---
>    newlib/configure.host<http://configure.host>        | 2 +-
>    newlib/libc/reent/getreent.c | 8 ++++++++
>    2 files changed, 9 insertions(+), 1 deletion(-)
> 
>   diff --git a/newlib/configure.host<http://configure.host> b/newlib/configure.host<http://configure.host>
>   index fb3362b..7f397dd 100644
>   --- a/newlib/configure.host<http://configure.host>
>   +++ b/newlib/configure.host<http://configure.host>
>   @@ -605,7 +605,7 @@ case "${host}" in
>          default_newlib_io_long_long="yes"
>          default_newlib_io_c99_formats="yes"
>          newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB"
>   -      newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED
> -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED
> -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
>   +newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED
> -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DGETREENT_PROVIDED
> -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE
> -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
>            # turn off unsupported items in posix directory
>          newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT
> -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN
> -D_NO_POSIX_SPAWN"
>          ;;
>   diff --git a/newlib/libc/reent/getreent.c
> b/newlib/libc/reent/getreent.c
>   index 60ae6fb..124abce 100644
>   --- a/newlib/libc/reent/getreent.c
>   +++ b/newlib/libc/reent/getreent.c
>   @@ -1,5 +1,11 @@
>    /* default reentrant pointer when multithread enabled */
> 
>   +#ifdef GETREENT_PROVIDED
>   +
>   +int _dummy_getreent;
>   +
> 
> So, why do you need this?  If you implement your own __getreent,
> there's
> no reason for this _dummy_getreent to exist, no?
> 
> Btw., Cygwin implements its own __getreent(), too, without having to
> change newlib/libc/reent/getreent.c at all...
> 
> 
> Corinna
> 
> --
> Corinna Vinschen
> Cygwin Maintainer
> Red Hat
> 

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel.sherrill@OARcorp.com        On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35806
Support Available                (256) 722-9985

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

* Re: [PATCH v2 2/2] newlib/.../getreent.c: Allow to be provided by host and do so for RTEMS
  2017-10-13  6:09       ` Joel Sherrill
@ 2017-10-13  9:16         ` Corinna Vinschen
  2017-11-13  9:59           ` Joel Sherrill
  0 siblings, 1 reply; 11+ messages in thread
From: Corinna Vinschen @ 2017-10-13  9:16 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 3087 bytes --]

On Oct 12 20:31, Joel Sherrill wrote:
> On 10/11/2017 8:54 AM, Joel Sherrill wrote:
> > 
> > Sorry to top post but replying from my phone on a plane.
> > 
> > Some of our tests are managing to get duplicate symbol errors when linking.
> > 
> > I put the dummy symbol in to follow the pattern in the file I patterned this after. I would have to look at the source again to see what file that was
> > 
> > 
> > On Oct 11, 2017, 9:49 AM, at 9:49 AM, Corinna Vinschen <vinschen@redhat.com> wrote:
> > Hi Joel,
> > 
> > On Oct 11 07:57, Joel Sherrill wrote:
> >   RTEMS provides the option to have a global or per-thread reentrancy
> >   as part of application configuration. As part of this, RTEMS provides
> >   the implementation of __getreent() as appropriate. Allow the target
> >   to determine if this method is present in libc.a.
> >   ---
> >    newlib/configure.host<http://configure.host>        | 2 +-
> >    newlib/libc/reent/getreent.c | 8 ++++++++
> >    2 files changed, 9 insertions(+), 1 deletion(-)
> > 
> >   diff --git a/newlib/configure.host<http://configure.host> b/newlib/configure.host<http://configure.host>
> >   index fb3362b..7f397dd 100644
> >   --- a/newlib/configure.host<http://configure.host>
> >   +++ b/newlib/configure.host<http://configure.host>
> >   @@ -605,7 +605,7 @@ case "${host}" in
> >          default_newlib_io_long_long="yes"
> >          default_newlib_io_c99_formats="yes"
> >          newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB"
> >   -      newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED
> > -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED
> > -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
> >   +newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED
> > -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DGETREENT_PROVIDED
> > -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE
> > -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
> >            # turn off unsupported items in posix directory
> >          newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT
> > -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN
> > -D_NO_POSIX_SPAWN"
> >          ;;
> >   diff --git a/newlib/libc/reent/getreent.c
> > b/newlib/libc/reent/getreent.c
> >   index 60ae6fb..124abce 100644
> >   --- a/newlib/libc/reent/getreent.c
> >   +++ b/newlib/libc/reent/getreent.c
> >   @@ -1,5 +1,11 @@
> >    /* default reentrant pointer when multithread enabled */
> > 
> >   +#ifdef GETREENT_PROVIDED
> >   +
> >   +int _dummy_getreent;
> >   +
> > 
> > So, why do you need this?  If you implement your own __getreent,
> > there's
> > no reason for this _dummy_getreent to exist, no?
> > 
> > Btw., Cygwin implements its own __getreent(), too, without having to
> > change newlib/libc/reent/getreent.c at all...
> 
> Is it OK to push these patches?

I still need an explanation for _dummy_getreent.  It's kind of ugly.
Why exaclty is it required?


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH v2 2/2] newlib/.../getreent.c: Allow to be provided by host and do so for RTEMS
  2017-10-11 12:58 ` [PATCH v2 2/2] newlib/.../getreent.c: Allow to be provided by host and do so for RTEMS Joel Sherrill
  2017-10-11 13:54   ` Corinna Vinschen
@ 2017-10-17 11:40   ` Sebastian Huber
  1 sibling, 0 replies; 11+ messages in thread
From: Sebastian Huber @ 2017-10-17 11:40 UTC (permalink / raw)
  To: Joel Sherrill, newlib

On 11/10/17 14:57, Joel Sherrill wrote:
> diff --git a/newlib/libc/reent/getreent.c b/newlib/libc/reent/getreent.c
> index 60ae6fb..124abce 100644
> --- a/newlib/libc/reent/getreent.c
> +++ b/newlib/libc/reent/getreent.c
> @@ -1,5 +1,11 @@
>   /* default reentrant pointer when multithread enabled */
>   
> +#ifdef GETREENT_PROVIDED
> +
> +int _dummy_getreent;

Why do we need this file at all?

The __getreent() is only used if __DYNAMIC_REENT__ is defined, and then 
the platform must provide it.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

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

* Re: [PATCH v2 2/2] newlib/.../getreent.c: Allow to be provided by host and do so for RTEMS
  2017-10-13  9:16         ` Corinna Vinschen
@ 2017-11-13  9:59           ` Joel Sherrill
  2017-11-13 15:46             ` Corinna Vinschen
  0 siblings, 1 reply; 11+ messages in thread
From: Joel Sherrill @ 2017-11-13  9:59 UTC (permalink / raw)
  To: newlib



On 10/13/2017 4:15 AM, Corinna Vinschen wrote:
> On Oct 12 20:31, Joel Sherrill wrote:
>> On 10/11/2017 8:54 AM, Joel Sherrill wrote:
>>>
>>> Sorry to top post but replying from my phone on a plane.
>>>
>>> Some of our tests are managing to get duplicate symbol errors when linking.
>>>
>>> I put the dummy symbol in to follow the pattern in the file I patterned this after. I would have to look at the source again to see what file that was
>>>
>>>
>>> On Oct 11, 2017, 9:49 AM, at 9:49 AM, Corinna Vinschen <vinschen@redhat.com> wrote:
>>> Hi Joel,
>>>
>>> On Oct 11 07:57, Joel Sherrill wrote:
>>>    RTEMS provides the option to have a global or per-thread reentrancy
>>>    as part of application configuration. As part of this, RTEMS provides
>>>    the implementation of __getreent() as appropriate. Allow the target
>>>    to determine if this method is present in libc.a.
>>>    ---
>>>     newlib/configure.host<http://configure.host>        | 2 +-
>>>     newlib/libc/reent/getreent.c | 8 ++++++++
>>>     2 files changed, 9 insertions(+), 1 deletion(-)
>>>
>>>    diff --git a/newlib/configure.host<http://configure.host> b/newlib/configure.host<http://configure.host>
>>>    index fb3362b..7f397dd 100644
>>>    --- a/newlib/configure.host<http://configure.host>
>>>    +++ b/newlib/configure.host<http://configure.host>
>>>    @@ -605,7 +605,7 @@ case "${host}" in
>>>           default_newlib_io_long_long="yes"
>>>           default_newlib_io_c99_formats="yes"
>>>           newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB"
>>>    -      newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED
>>> -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED
>>> -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
>>>    +newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED
>>> -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DGETREENT_PROVIDED
>>> -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE
>>> -DHAVE_FCNTL -DHAVE_ASSERT_FUNC"
>>>             # turn off unsupported items in posix directory
>>>           newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT
>>> -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN
>>> -D_NO_POSIX_SPAWN"
>>>           ;;
>>>    diff --git a/newlib/libc/reent/getreent.c
>>> b/newlib/libc/reent/getreent.c
>>>    index 60ae6fb..124abce 100644
>>>    --- a/newlib/libc/reent/getreent.c
>>>    +++ b/newlib/libc/reent/getreent.c
>>>    @@ -1,5 +1,11 @@
>>>     /* default reentrant pointer when multithread enabled */
>>>
>>>    +#ifdef GETREENT_PROVIDED
>>>    +
>>>    +int _dummy_getreent;
>>>    +
>>>
>>> So, why do you need this?  If you implement your own __getreent,
>>> there's
>>> no reason for this _dummy_getreent to exist, no?
>>>
>>> Btw., Cygwin implements its own __getreent(), too, without having to
>>> change newlib/libc/reent/getreent.c at all...

That means there are two ways in which the symbol __getreent() can
be satisfied. One which is correct and one which isn't correct.
For RTEMS, we have tried to have only the one correct version
available across all the libraries.

For some reason, one example program managed to pull in the
incorrect one. This wouldn't happen if it wasn't there.

>> Is it OK to push these patches?
> 
> I still need an explanation for _dummy_getreent.  It's kind of ugly.
> Why exaclty is it required?

I modeled this on other files in libc/ including reent/,
stdlib/ and time/. They have a "_dummy_XXX" variable. I vaguely
recall something about this avoids having an object
with no symbols in a library. Do "grep -r _dummy_ ." from
the top of libc and you will see more than 20 examples.

They appear to be for a variety of conditionals like
ABORT_PROVIDED, REENTRANT_SYSCALLS_PROVIDED, NO_EXEC,
SIGNAL_PROVIDED, etc.

--joel


> 
> 
> Corinna
> 

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

* Re: [PATCH v2 2/2] newlib/.../getreent.c: Allow to be provided by host and do so for RTEMS
  2017-11-13  9:59           ` Joel Sherrill
@ 2017-11-13 15:46             ` Corinna Vinschen
  2017-11-14  8:01               ` Florian Schmidt
  0 siblings, 1 reply; 11+ messages in thread
From: Corinna Vinschen @ 2017-11-13 15:46 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 1032 bytes --]

On Nov 10 12:06, Joel Sherrill wrote:
> On 10/13/2017 4:15 AM, Corinna Vinschen wrote:
> > I still need an explanation for _dummy_getreent.  It's kind of ugly.
> > Why exaclty is it required?
> 
> I modeled this on other files in libc/ including reent/,
> stdlib/ and time/. They have a "_dummy_XXX" variable. I vaguely
> recall something about this avoids having an object
> with no symbols in a library. Do "grep -r _dummy_ ." from
> the top of libc and you will see more than 20 examples.
> 
> They appear to be for a variety of conditionals like
> ABORT_PROVIDED, REENTRANT_SYSCALLS_PROVIDED, NO_EXEC,
> SIGNAL_PROVIDED, etc.

I never actively noticed this dummy var stuff.  I still think this is
really ugly.  What should have happened is that the source file is
simply not built in these cases, rather than to include a dummy var.
But it's apparently historic and given that this is common practice in
newlib, I pushed your patch.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH v2 2/2] newlib/.../getreent.c: Allow to be provided by host and do so for RTEMS
  2017-11-13 15:46             ` Corinna Vinschen
@ 2017-11-14  8:01               ` Florian Schmidt
  0 siblings, 0 replies; 11+ messages in thread
From: Florian Schmidt @ 2017-11-14  8:01 UTC (permalink / raw)
  To: newlib

On 11/13/2017 10:59 AM, Corinna Vinschen wrote:
> I never actively noticed this dummy var stuff.  I still think this is
> really ugly.  What should have happened is that the source file is
> simply not built in these cases, rather than to include a dummy var.
> But it's apparently historic and given that this is common practice in
> newlib, I pushed your patch.

Speaking of which: I was also a bit confused as to what these dummy 
variables are supposed to do. However, that reminds me of something I 
noticed the other day when we experimented with newlib code: realloc.c 
contains a dummy variable name that looks wrong, and in fact clashes 
with the one from calloc.c. I'll send a patch for discussion.

Florian

-- 
Dr. Florian Schmidt
フローリアン・シュミット
Research Scientist,
Networked Systems and Data Analytics Group
NEC Laboratories Europe, Network Research Division
Kurfürsten-Anlage 36, D-69115 Heidelberg
Tel.     +49 (0)6221 4342-265
Fax:     +49 (0)6221 4342-155
e-mail:  florian.schmidt@neclab.eu
============================================================
NEC Europe Ltd | Registered Office: Athene, Odyssey
Business Park, West End Road, London, HA4 6QE, GB
Registered in England 2832014

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

end of thread, other threads:[~2017-11-14  7:56 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-11 12:58 [PATCH v2 0/2] RTEMS configure.host patches Joel Sherrill
2017-10-11 12:58 ` [PATCH v2 2/2] newlib/.../getreent.c: Allow to be provided by host and do so for RTEMS Joel Sherrill
2017-10-11 13:54   ` Corinna Vinschen
2017-10-11 16:28     ` Joel Sherrill
2017-10-13  6:09       ` Joel Sherrill
2017-10-13  9:16         ` Corinna Vinschen
2017-11-13  9:59           ` Joel Sherrill
2017-11-13 15:46             ` Corinna Vinschen
2017-11-14  8:01               ` Florian Schmidt
2017-10-17 11:40   ` Sebastian Huber
2017-10-11 13:49 ` [PATCH v2 1/2] newlib/configure.host: Remove obsolete definition of _I386MACH_ALLOW_HW_INTERRUPTS Joel Sherrill

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