[PATCH] Fix static-binary lazy FPU context allocation
Maciej W. Rozycki
macro@codesourcery.com
Thu Aug 22 22:36:00 GMT 2013
On Thu, 22 Aug 2013, Rich Felker wrote:
> > We have an issue with FPU control word initialization in static binaries.
> > We do it unconditionally, defeating any lazy FPU context allocation the OS
> > may implement.
>
> Could you elaborate on why this initialization needs to take place at
> all? Under what conditions would the kernel give an incorrect initial
> control word?
There's no "incorrect" control word. There's one kernel default for each
particular target (and possibly ABI variation on that target). Our
default value of __fpu_control is meant to match the kernel default so if
we use it -- fine.
The symbol can however be overridden by a program wishing to use a
non-default FPU execution mode. In that case we respect that value and
install it in hardware explicitly (allocating the FPU context right away
as a side effect) as the kernel won't do that for us. We need to do this
early on so that static initialisers see the right FPU execution mode.
That's at least my understanding how this variable works.
Maciej
More information about the Libc-alpha
mailing list