Re: Why all glibc2 programs are FPU programs

Ulrich Drepper (drepper@cygnus.com)
27 May 1998 11:47:33 -0700


"Adam J. Richter" <adam@yggdrasil.com> writes:

> So, can we settle on this solution? To implement this change, no
> work is necessary beyond deleteing that line that line in
> glibc/sysdeps/unix/sysv/linux/init-first.c that says
> "setfpucw(__fpu_control);". Okay?

No, you miss the point. There are cases when the initialization is
necessary (try running the SPECS suite with the default setup). Even
when using the personality is used this would require the if and
*hardcoding* the default value for each architecture and each kernel
version (i.e., when the kernel changed this).

The code must look in general like this:

kvalue = <somehow get the default value the kernel uses>;

lvalue = <the value libc would use to initialize>;

if (kvalue != lvalue)
setfpucw (lvalue);

The <lvalue> is a variable, it cannot be a constant. The question is
how to get the <kvalue>. Your approach would require that for each
architecture there is code like this:

switch (<personality to use>)
{
case NNN:
kvalue = foo;
break;
default:
kvalue = bar;
break;
}

which explicitly hardcodes the value foo and bar and there
relationship to the kernel versions. This is what I want to avoid.
Why introduce explicit dependencies? It's not necessary.

The alternative I presented yesterday is that the kernel passes up in
the auxiliary vector (remember, we get this almost for free!) the
value it will use. I.e., we have

- almost no extra code to determine <kvalue>

- always the correct value for the kernel beneath

- no dependencies between kernel and libc

And it is trivial to implement in the kernel (about 2 extra lines) and
in the libc as well.

-- Uli
---------------. drepper at gnu.org ,-. 1325 Chesapeake Terrace
Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com `------------------------

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu