public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* Placement of signgam in libc instead of libm
@ 2023-04-20 21:20 Joel Sherrill
  2023-04-24  8:52 ` Corinna Vinschen
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Sherrill @ 2023-04-20 21:20 UTC (permalink / raw)
  To: Newlib

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

Hi

While double some checking that all references used by the long double math
routines Jennifer are resolved when linking, we have found a small oddity.

The file libc/reent/signgam.c is implemented as follows:

int *
__signgam (void)
{
  return &_REENT_SIGNGAM(_REENT);
}

When TLS is enabled, the macro _REENT_SIGNGAM resolves to
_tls_gamma_signgam which is in the file libm/math/w_lgamma.c. This creates
the first reference from libc to libm that I have ever seen and requires
explicitly linking with -lm -lc when using lgamma().

Would anyone be opposed to moving this method to libm/math?

--joel

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

* Re: Placement of signgam in libc instead of libm
  2023-04-20 21:20 Placement of signgam in libc instead of libm Joel Sherrill
@ 2023-04-24  8:52 ` Corinna Vinschen
  2023-04-24 15:16   ` Jeff Johnston
  0 siblings, 1 reply; 3+ messages in thread
From: Corinna Vinschen @ 2023-04-24  8:52 UTC (permalink / raw)
  To: newlib

On Apr 20 16:20, Joel Sherrill wrote:
> Hi
> 
> While double some checking that all references used by the long double math
> routines Jennifer are resolved when linking, we have found a small oddity.
> 
> The file libc/reent/signgam.c is implemented as follows:
> 
> int *
> __signgam (void)
> {
>   return &_REENT_SIGNGAM(_REENT);
> }
> 
> When TLS is enabled, the macro _REENT_SIGNGAM resolves to
> _tls_gamma_signgam which is in the file libm/math/w_lgamma.c. This creates
> the first reference from libc to libm that I have ever seen and requires
> explicitly linking with -lm -lc when using lgamma().
> 
> Would anyone be opposed to moving this method to libm/math?

Not me, but Jeff added this to libc for a reason, I guess...?


Corinna


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

* Re: Placement of signgam in libc instead of libm
  2023-04-24  8:52 ` Corinna Vinschen
@ 2023-04-24 15:16   ` Jeff Johnston
  0 siblings, 0 replies; 3+ messages in thread
From: Jeff Johnston @ 2023-04-24 15:16 UTC (permalink / raw)
  To: newlib

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

I looked at this.  I think it would ok to move as the method requires
math.h and I would
assume any users would have -lm specified.

-- Jeff J.

On Mon, Apr 24, 2023 at 4:52 AM Corinna Vinschen <vinschen@redhat.com>
wrote:

> On Apr 20 16:20, Joel Sherrill wrote:
> > Hi
> >
> > While double some checking that all references used by the long double
> math
> > routines Jennifer are resolved when linking, we have found a small
> oddity.
> >
> > The file libc/reent/signgam.c is implemented as follows:
> >
> > int *
> > __signgam (void)
> > {
> >   return &_REENT_SIGNGAM(_REENT);
> > }
> >
> > When TLS is enabled, the macro _REENT_SIGNGAM resolves to
> > _tls_gamma_signgam which is in the file libm/math/w_lgamma.c. This
> creates
> > the first reference from libc to libm that I have ever seen and requires
> > explicitly linking with -lm -lc when using lgamma().
> >
> > Would anyone be opposed to moving this method to libm/math?
>
> Not me, but Jeff added this to libc for a reason, I guess...?
>
>
> Corinna
>
>

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

end of thread, other threads:[~2023-04-24 15:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-20 21:20 Placement of signgam in libc instead of libm Joel Sherrill
2023-04-24  8:52 ` Corinna Vinschen
2023-04-24 15:16   ` Jeff Johnston

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