This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/15421] lgamma wrongly sets signgam for ISO C


https://sourceware.org/bugzilla/show_bug.cgi?id=15421

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, master has been updated
       via  d709042a6e5ab3c360280faad6f9538a34dc8eea (commit)
      from  8c873bf0190740ac1102e13ff7aeb6c08048abfd (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=d709042a6e5ab3c360280faad6f9538a34dc8eea

commit d709042a6e5ab3c360280faad6f9538a34dc8eea
Author: Joseph Myers <joseph@codesourcery.com>
Date:   Fri Nov 20 22:49:59 2015 +0000

    Fix lgamma setting signgam for ISO C (bug 15421).

    The lgamma (and likewise lgammaf, lgammal) function wrongly sets the
    signgam variable even when building for strict ISO C conformance
    (-std=c99 / -std=c11), although the user may define such a variable
    and it's only in the implementation namespace for POSIX with XSI
    extensions enabled.

    Following discussions starting at
    <https://sourceware.org/ml/libc-alpha/2013-04/msg00767.html> and
    <https://sourceware.org/ml/libc-alpha/2015-10/msg00844.html>, it seems
    that the safest approach for fixing this particular issue is for
    signgam to become a weak alias for a newly exported symbol __signgam,
    with the library functions only setting __signgam, at which point
    static linker magic will preserve the alias for newly linked binaries
    that refer to the library's signgam rather than defining their own,
    while breaking the alias for programs that define their own signgam,
    with new symbol versions for lgamma functions and with compat symbols
    for existing binaries that set both signgam and __signgam.

    This patch implements that approach for the fix.  signgam is made into
    a weak alias.  The four symbols __signgam, lgamma, lgammaf, lgammal
    get new symbol versions at version GLIBC_2.23, with the existing
    versions of lgamma, lgammaf and lgammal becoming compat symbols.

    When the compat versions are built, gamma, gammaf and gammal are
    aliases for the compat versions (i.e. always set signgam); this is OK
    as they are not ISO C functions, and avoids adding new symbol versions
    for them unnecessarily.  When the compat versions are not built
    (i.e. for static linking and for future glibc ports), gamma, gammaf
    and gammal are aliases for the new versions that set __signgam.  The
    ldbl-opt versions are updated accordingly.

    The lgamma wrappers are adjusted so that the same source files,
    included from different files with different definitions of
    USE_AS_COMPAT, can build either the new versions or the compat
    versions.  Similar changes are made to the ia64 versions (untested).

    Tests are added that the lgamma functions do not interfere with a user
    variable called signgam for ISO C, with various choices for the size
    of that variable, whether it is initialized, and for static and
    dynamic linking.  The conformtest whitelist entry is removed as well.

    Tested for x86_64, x86, mips64 and powerpc, including looking at
    objdump --dynamic-syms output to make sure the expected sets of
    symbols were aliases.  Also spot-tested that a binary built with old
    glibc works properly (i.e. gets signgam set) when run with new glibc.

        [BZ #15421]
        * sysdeps/ieee754/s_signgam.c (signgam): Rename to __signgam,
        initialize with 0 and define as weak alias of __signgam.
        * include/math.h [!_ISOMAC] (__signgam): Declare.
        * math/Makefile (libm-calls): Add w_lgamma_compat.
        (tests): Add test-signgam-uchar, test-signgam-uchar-init,
        test-signgam-uint, test-signgam-uint-init, test-signgam-ullong and
        test-signgam-ullong-init.
        (tests-static): Add test-signgam-uchar-static,
        test-signgam-uchar-init-static, test-signgam-uint-static,
        test-signgam-uint-init-static, test-signgam-ullong-static and
        test-signgam-ullong-init-static.
        (CFLAGS-test-signgam-uchar.c): New variable.
        (CFLAGS-test-signgam-uchar-init.c): Likewise.
        (CFLAGS-test-signgam-uchar-static.c): Likewise.
        (CFLAGS-test-signgam-uchar-init-static.c): Likewise.
        (CFLAGS-test-signgam-uint.c): Likewise.
        (CFLAGS-test-signgam-uint-init.c): Likewise.
        (CFLAGS-test-signgam-uint-static.c): Likewise.
        (CFLAGS-test-signgam-uint-init-static.c): Likewise.
        (CFLAGS-test-signgam-ullong.c): Likewise.
        (CFLAGS-test-signgam-ullong-init.c): Likewise.
        (CFLAGS-test-signgam-ullong-static.c): Likewise.
        (CFLAGS-test-signgam-ullong-init-static.c): Likewise.
        * math/Versions (libm): Add GLIBC_2.23.
        * math/lgamma-compat.h: New file.
        * math/test-signgam-main.c: Likewise.
        * math/test-signgam-uchar-init-static.c: Likewise.
        * math/test-signgam-uchar-init.c: Likewise.
        * math/test-signgam-uchar-static.c: Likewise.
        * math/test-signgam-uchar.c: Likewise.
        * math/test-signgam-uint-init-static.c: Likewise.
        * math/test-signgam-uint-init.c: Likewise.
        * math/test-signgam-uint-static.c: Likewise.
        * math/test-signgam-uint.c: Likewise.
        * math/test-signgam-ullong-init-static.c: Likewise.
        * math/test-signgam-ullong-init.c: Likewise.
        * math/test-signgam-ullong-static.c: Likewise.
        * math/test-signgam-ullong.c: Likewise.
        * math/w_lgamma.c: Rename to w_lgamma_main.c and replace by
        wrapper of w_lgamma_main.c.
        * math/w_lgamma_compat.c: New file.
        * math/w_lgamma_compatf.c: Likewise.
        * math/w_lgamma_compatl.c: Likewise.
        * math/w_lgamma_main.c: New file.  Based on w_lgamma.c.  Include
        <lgamma-compat.h>.  Condition contents on [BUILD_LGAMMA].  Support
        defining compatibility symbols.
        (__lgamma): Change to LGFUNC (__lgamma).  Use CALL_LGAMMA.
        * math/w_lgammaf.c: Rename to w_lgammaf_main.c and replace by
        wrapper of w_lgammaf_main.c.
        * math/w_lgammaf_main.c: New file.  Based on w_lgammaf.c.  Include
        <lgamma-compat.h>.  Condition contents on [BUILD_LGAMMA].  Support
        defining compatibility symbols.
        (__lgammaf): Change to LGFUNC (__lgammaf).  Use CALL_LGAMMA.
        * math/w_lgammal.c: Rename to w_lgammal_main.c and replace by
        wrapper of w_lgammal_main.c.
        * math/w_lgammal_main.c: New file.  Based on w_lgammal.c.  Include
        <lgamma-compat.h>.  Condition contents on [BUILD_LGAMMA].  Support
        defining compatibility symbols.
        (__lgammal): Change to LGFUNC (__lgammal).  Use CALL_LGAMMA.
        * sysdeps/ia64/fpu/lgamma-compat.h: New file.
        * sysdeps/ia64/fpu/w_lgamma.c: Move to ....
        * sysdeps/ia64/fpu/w_lgamma_main.c: ...here.  Include
        <lgamma-compat.h>.
        (__ieee754_lgamma): Change to LGFUNC (lgamma).  Use CALL_LGAMMA.
        (__ieee754_gamma): Define as alias.
        * sysdeps/ia64/fpu/w_lgammaf.c: Move to ....
        * sysdeps/ia64/fpu/w_lgammaf_main.c: ...here.  Include
        <lgamma-compat.h>.
        (__ieee754_lgammaf): Change to LGFUNC (lgammaf).  Use CALL_LGAMMA.
        (__ieee754_gammaf): Define as alias.
        * sysdeps/ia64/fpu/w_lgammal.c: Move to ....
        * sysdeps/ia64/fpu/w_lgammal_main.c: ...here.  Include
        <lgamma-compat.h>.
        (__ieee754_lgammal): Change to LGFUNC (lgammal).  Use CALL_LGAMMA.
        (__ieee754_gammal): Define as alias.
        * sysdeps/ieee754/ldbl-opt/w_lgamma.c: Move to ....
        * sysdeps/ieee754/ldbl-opt/w_lgamma_compat.c: ...here.  Include
        <math/w_lgamma_compat.c>.
        [LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)] (__lgammal_dbl_compat):
        Define as alias of __lgamma_compat and use in defining lgammal.
        * sysdeps/ieee754/ldbl-opt/w_lgammal.c: Move to ....
        * sysdeps/ieee754/ldbl-opt/w_lgamma_compatl.c: ...here.  Include
        <math/lgamma-compat.h> and <math/w_lgamma_compatl.c>.
        (USE_AS_COMPAT): New macro.
        (LGAMMA_OLD_VER): Undefine and redefine.
        (lgammal): Do not define here.
        (gammal): Only define here if [GAMMA_ALIAS].
        * conform/linknamespace.pl (@whitelist): Remove signgam.
        * sysdeps/nacl/libm.abilist: Update.
        * sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
        Likewise.
        * sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
        * sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |  125 ++++++++++++++++++++
 NEWS                                               |    6 +
 conform/linknamespace.pl                           |    4 +-
 include/math.h                                     |    2 +
 math/Makefile                                      |   24 ++++-
 math/Versions                                      |    7 +
 math/lgamma-compat.h                               |   73 ++++++++++++
 math/test-signgam-main.c                           |   71 +++++++++++
 math/test-signgam-uchar-init-static.c              |    1 +
 math/test-signgam-uchar-init.c                     |    3 +
 math/test-signgam-uchar-static.c                   |    1 +
 math/test-signgam-uchar.c                          |    3 +
 math/test-signgam-uint-init-static.c               |    1 +
 math/test-signgam-uint-init.c                      |    3 +
 math/test-signgam-uint-static.c                    |    1 +
 math/test-signgam-uint.c                           |    3 +
 math/test-signgam-ullong-init-static.c             |    1 +
 math/test-signgam-ullong-init.c                    |    3 +
 math/test-signgam-ullong-static.c                  |    1 +
 math/test-signgam-ullong.c                         |    3 +
 math/w_lgamma.c                                    |   51 +--------
 math/w_lgamma_compat.c                             |    2 +
 math/w_lgamma_compatf.c                            |    2 +
 math/w_lgamma_compatl.c                            |    2 +
 math/w_lgamma_main.c                               |   59 +++++++++
 math/w_lgammaf.c                                   |   42 +------
 math/w_lgammaf_main.c                              |   44 +++++++
 math/w_lgammal.c                                   |   49 +--------
 math/w_lgammal_main.c                              |   51 ++++++++
 sysdeps/ia64/fpu/lgamma-compat.h                   |   42 +++++++
 sysdeps/ia64/fpu/w_lgamma.c                        |   80 -------------
 sysdeps/ia64/fpu/w_lgamma_main.c                   |   73 ++++++++++++
 sysdeps/ia64/fpu/w_lgammaf.c                       |   80 -------------
 sysdeps/ia64/fpu/w_lgammaf_main.c                  |   73 ++++++++++++
 sysdeps/ia64/fpu/w_lgammal.c                       |   79 ------------
 sysdeps/ia64/fpu/w_lgammal_main.c                  |   72 +++++++++++
 sysdeps/ieee754/ldbl-opt/w_lgamma.c                |    6 -
 sysdeps/ieee754/ldbl-opt/w_lgamma_compat.c         |    7 +
 sysdeps/ieee754/ldbl-opt/w_lgamma_compatl.c        |   11 ++
 sysdeps/ieee754/ldbl-opt/w_lgammal.c               |    6 -
 sysdeps/ieee754/s_signgam.c                        |    3 +-
 sysdeps/nacl/libm.abilist                          |    5 +
 sysdeps/unix/sysv/linux/aarch64/libm.abilist       |    5 +
 sysdeps/unix/sysv/linux/alpha/libm.abilist         |    5 +
 sysdeps/unix/sysv/linux/arm/libm.abilist           |    5 +
 sysdeps/unix/sysv/linux/hppa/libm.abilist          |    5 +
 sysdeps/unix/sysv/linux/i386/libm.abilist          |    5 +
 sysdeps/unix/sysv/linux/ia64/libm.abilist          |    5 +
 sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist |    5 +
 sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist   |    5 +
 sysdeps/unix/sysv/linux/microblaze/libm.abilist    |    5 +
 sysdeps/unix/sysv/linux/mips/mips32/libm.abilist   |    5 +
 sysdeps/unix/sysv/linux/mips/mips64/libm.abilist   |    5 +
 sysdeps/unix/sysv/linux/nios2/libm.abilist         |    5 +
 .../sysv/linux/powerpc/powerpc32/fpu/libm.abilist  |    5 +
 .../linux/powerpc/powerpc32/nofpu/libm.abilist     |    5 +
 .../sysv/linux/powerpc/powerpc64/libm-le.abilist   |    5 +
 .../unix/sysv/linux/powerpc/powerpc64/libm.abilist |    5 +
 sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist  |    5 +
 sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist  |    5 +
 sysdeps/unix/sysv/linux/sh/libm.abilist            |    5 +
 sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist |    5 +
 sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist |    5 +
 .../sysv/linux/tile/tilegx/tilegx32/libm.abilist   |    5 +
 .../sysv/linux/tile/tilegx/tilegx64/libm.abilist   |    5 +
 sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist  |    5 +
 sysdeps/unix/sysv/linux/x86_64/64/libm.abilist     |    5 +
 sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist    |    5 +
 68 files changed, 911 insertions(+), 394 deletions(-)
 create mode 100644 math/lgamma-compat.h
 create mode 100644 math/test-signgam-main.c
 create mode 100644 math/test-signgam-uchar-init-static.c
 create mode 100644 math/test-signgam-uchar-init.c
 create mode 100644 math/test-signgam-uchar-static.c
 create mode 100644 math/test-signgam-uchar.c
 create mode 100644 math/test-signgam-uint-init-static.c
 create mode 100644 math/test-signgam-uint-init.c
 create mode 100644 math/test-signgam-uint-static.c
 create mode 100644 math/test-signgam-uint.c
 create mode 100644 math/test-signgam-ullong-init-static.c
 create mode 100644 math/test-signgam-ullong-init.c
 create mode 100644 math/test-signgam-ullong-static.c
 create mode 100644 math/test-signgam-ullong.c
 create mode 100644 math/w_lgamma_compat.c
 create mode 100644 math/w_lgamma_compatf.c
 create mode 100644 math/w_lgamma_compatl.c
 create mode 100644 math/w_lgamma_main.c
 create mode 100644 math/w_lgammaf_main.c
 create mode 100644 math/w_lgammal_main.c
 create mode 100644 sysdeps/ia64/fpu/lgamma-compat.h
 delete mode 100644 sysdeps/ia64/fpu/w_lgamma.c
 create mode 100644 sysdeps/ia64/fpu/w_lgamma_main.c
 delete mode 100644 sysdeps/ia64/fpu/w_lgammaf.c
 create mode 100644 sysdeps/ia64/fpu/w_lgammaf_main.c
 delete mode 100644 sysdeps/ia64/fpu/w_lgammal.c
 create mode 100644 sysdeps/ia64/fpu/w_lgammal_main.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/w_lgamma.c
 create mode 100644 sysdeps/ieee754/ldbl-opt/w_lgamma_compat.c
 create mode 100644 sysdeps/ieee754/ldbl-opt/w_lgamma_compatl.c
 delete mode 100644 sysdeps/ieee754/ldbl-opt/w_lgammal.c

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]