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 locale/18960] s390: _nl_locale_subfreeres uses larl opcode on misaligned symbol


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

--- Comment #4 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  5fa268239b46e127f941c3510ad200ce5ef8df45 (commit)
      from  0cdaef4dac5a885af9848e158e77cc347ee781bb (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=5fa268239b46e127f941c3510ad200ce5ef8df45

commit 5fa268239b46e127f941c3510ad200ce5ef8df45
Author: Stefan Liebler <stli@linux.vnet.ibm.com>
Date:   Tue Jun 28 12:23:35 2016 +0200

    S390: Fix relocation of _nl_current_LC_CATETORY_used in static build. [BZ
#19860]

    With shared libc, all locale categories are always loaded.
    For static libc they aren't, but there exist a weak
    _nl_current_LC_CATEGORY_used symbol for each category.
    If the category is used, the locale/lc-CATEGORY.o is linked in
    where _NL_CURRENT_DEFINE (LC_CATEGORY) defines and sets the
    _nl_current_LC_CATEGORY_used symbol to one.

    As reported by Marcin
    "Bug 18960 - s390: _nl_locale_subfreeres uses larl opcode on misaligned
symbol"
    (https://sourceware.org/bugzilla/show_bug.cgi?id=18960)
    In function _nl_locale_subfreeres (locale/setlocale.c) for each category
    a check - &_nl_current_LC_CATEGORY_used != 0 - decides whether the category
    is used or not.
    There is also a second usage with the same mechanism in function
__uselocale
    (locale/uselocale.c).

    On s390 a larl instruction with R_390_PC32DBL relocation is used to
    get the address of _nl_current_LC_CATEGORY_used symbols. As larl loads the
    address relative in halfwords and the code is always 2-byte aligned,
    larl can only load even addresses.
    At the end, the relocated address is always zero and never one.

    Marcins patch (see bugzilla) uses the following declaration in
locale/setlocale.c:
    extern char _nl_current_##category##_used __attribute__((__aligned__(1)));
    In function _nl_locale_subfreeres all categories are checked and therefore
gcc
    is now building an array of addresses in rodata section with an R_390_64
    relocation for every address. This array is loaded with larl instruction
and
    each address is accessed by index.
    This fixes only the usage in _nl_locale_subfreeres. Each user has to add
the
    alignment attribute.

    This patch set the _nl_current_LC_CATEGORY_used symbols to two instead of
one.
    This way gcc can use larl instruction and the check against zero works on
    every usage.

    ChangeLog:

        [BZ #19860]
        * locale/localeinfo.h (_NL_CURRENT_DEFINE):
        Set _nl_current_LC_CATEGORY_used to two instead of one.

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

Summary of changes:
 ChangeLog           |    6 ++++++
 locale/localeinfo.h |    7 +++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

-- 
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]