This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix static-binary lazy FPU context allocation
- From: "Carlos O'Donell" <carlos at redhat dot com>
- To: "Maciej W. Rozycki" <macro at codesourcery dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Tue, 03 Sep 2013 11:45:12 -0400
- Subject: Re: [PATCH] Fix static-binary lazy FPU context allocation
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot DEB dot 1 dot 10 dot 1308221904520 dot 8514 at tp dot orcam dot me dot uk>
On 08/22/2013 03:12 PM, Maciej W. Rozycki wrote:
> No regressions in mips-linux-gnu testing, o32, n64 and n32 ABIs. OK to
> apply?
What existing test case checks for this?
Could you please add a static test that verifies this is set correctly?
> 2013-08-22 Maciej W. Rozycki <macro@codesourcery.com>
>
> * csu/init-first.c (_init): Remove the !SHARED condition around
> FPU control word initialization.
> * elf/dl-support.c (_dl_fpu_control): New variable.
> (_dl_aux_init) <AT_FPUCW>: Initialize it.
>
> Maciej
>
> glibc-static-fpucw.diff
> Index: glibc-fsf-trunk-quilt/csu/init-first.c
> ===================================================================
> --- glibc-fsf-trunk-quilt.orig/csu/init-first.c 2013-05-07 22:59:41.000000000 +0100
> +++ glibc-fsf-trunk-quilt/csu/init-first.c 2013-08-22 19:46:48.168109470 +0100
> @@ -61,11 +61,8 @@ _init (int argc, char **argv, char **env
> if (!__libc_multiple_libcs)
> {
> /* Set the FPU control word to the proper default value if the
> - kernel would use a different value. (In a static program we
> - don't have this information.) */
> -#ifdef SHARED
> + kernel would use a different value. */
> if (__fpu_control != GLRO(dl_fpu_control))
> -#endif
> __setfpucw (__fpu_control);
> }
>
> Index: glibc-fsf-trunk-quilt/elf/dl-support.c
> ===================================================================
> --- glibc-fsf-trunk-quilt.orig/elf/dl-support.c 2013-08-20 15:18:10.000000000 +0100
> +++ glibc-fsf-trunk-quilt/elf/dl-support.c 2013-08-21 20:07:55.169669153 +0100
> @@ -167,6 +167,8 @@ size_t _dl_phnum;
> uint64_t _dl_hwcap __attribute__ ((nocommon));
> uint64_t _dl_hwcap2 __attribute__ ((nocommon));
>
This needs a detailed comment here explaining the behaviour of this
internal variable. I would also welcome an expounding of the semantics
of __fpu_control and the behaviour for static and dynamic applications.
> +fpu_control_t _dl_fpu_control = _FPU_DEFAULT;
> +
> /* This is not initialized to HWCAP_IMPORTANT, matching the definition
> of _dl_important_hwcaps, below, where no hwcap strings are ever
> used. This mask is still used to mediate the lookups in the cache
> @@ -253,6 +255,9 @@ _dl_aux_init (ElfW(auxv_t) *av)
> case AT_HWCAP2:
> GLRO(dl_hwcap2) = (unsigned long int) av->a_un.a_val;
> break;
> + case AT_FPUCW:
> + GLRO(dl_fpu_control) = av->a_un.a_val;
> + break;
> #ifdef NEED_DL_SYSINFO
> case AT_SYSINFO:
> GL(dl_sysinfo) = av->a_un.a_val;
>
In summary:
- Test case.
- Comment for _dl_fpu_control.
Cheers,
Carlos.