glibc/locale
Stefan Liebler 5fa268239b 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.
2016-06-28 12:28:53 +02:00
..
bits Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
programs localedef: drop unused --old-style 2016-06-11 01:37:04 -04:00
broken_cur_max.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
C_name.c
C-address.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
C-collate.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
C-ctype.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
C-identification.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
C-measurement.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
C-messages.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
C-monetary.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
C-name.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
C-numeric.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
C-paper.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
C-telephone.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
C-time.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
C-translit.h Regenerate locale/C-translit.h. 2015-12-09 22:24:26 -05:00
C-translit.h.in Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
categories.def Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
coll-lookup.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
coll-lookup.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
duplocale.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
elem-hash.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
findlocale.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
freelocale.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
gen-translit.pl Make shebang interpreter directives consistent 2016-01-07 04:03:21 -05:00
global-locale.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
hashval.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
indigits.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
indigitswc.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
iso-639.def localedata: sgs_LT: new locale [BZ #12450] 2016-05-01 15:18:04 -04:00
iso-3166.def Fix typos in 3166.def. 2013-10-04 18:51:42 -04:00
iso-4217.def localedata: CLDRv29: update LC_MONETARY int_curr_symbol & currency_symbol 2016-04-15 13:42:29 -04:00
langinfo.h Fix langinfo.h nl_langinfo_l namespace (bug 19996). 2016-04-26 15:02:26 +00:00
lc-address.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
lc-collate.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
lc-ctype.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
lc-identification.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
lc-measurement.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
lc-messages.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
lc-monetary.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
lc-name.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
lc-numeric.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
lc-paper.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
lc-telephone.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
lc-time.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
loadarchive.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
loadlocale.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
locale.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
localeconv.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
localeinfo.h S390: Fix relocation of _nl_current_LC_CATETORY_used in static build. [BZ #19860] 2016-06-28 12:28:53 +02:00
localename.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
locarchive.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Makefile Enable --localedir to set message catalog directory (Bug 14259) 2016-02-24 20:06:04 -05:00
mb_cur_max.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
newlocale.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nl_langinfo_l.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
nl_langinfo.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
outdigits.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
outdigitswc.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
setlocale.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
strlen-hash.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
SYS_libc.c
tst-C-locale.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
tst-duplocale.c Add missing test files. 2009-11-17 16:23:57 -08:00
tst-locname.c Add missing test files. 2009-11-17 16:23:57 -08:00
uselocale.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
Versions
weight.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
weightwc.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
xlocale.c Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00
xlocale.h Update copyright dates with scripts/update-copyrights. 2016-01-04 16:05:18 +00:00