[Bug locale/23164] LC_MONETARY data incorrect with static linking
carlos at redhat dot com
sourceware-bugzilla@sourceware.org
Sat May 12 03:13:00 GMT 2018
https://sourceware.org/bugzilla/show_bug.cgi?id=23164
Carlos O'Donell <carlos at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |carlos at redhat dot com
--- Comment #1 from Carlos O'Donell <carlos at redhat dot com> ---
(In reply to Jonathan Wakely from comment #0)
> This program works when linked to libc.so but not when linked to libc.a
>
> #define _GNU_SOURCE
> #include <locale.h>
> #include <langinfo.h>
> #include <stdio.h>
>
> int main()
> {
> locale_t loc = newlocale(1 << LC_ALL, "en_US.UTF-8", 0);
> const char* ccurr = nl_langinfo_l(CURRENCY_SYMBOL, loc);
> printf("Currency symbol: %s\n", ccurr);
> return 0;
> }
>
> $ gcc loc.c
> $ ./a.out
> Currency symbol: $
> $ gcc loc.c -static
> $ ./a.out
> Currency symbol:
>
> The returned value is an empty string instead of "$"
>
> This was reduced from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85732
> which shows that all LC_MONETARY values are missing for all lcoales when the
> program is statically linked.
>
> I see this on several versions, 2.13, 2.25, 2.26, 2.27
This looks like bug 16915 has come back again.
It was fixed in 2.20, and a testcase covered this e.g. tst-langinfo compiled
static... oops, but there were no LC_MONETARY entries in the data input for
this test :-(
It looks like the static build is still optimizing out what it considers unused
categories. So the fix is incomplete.
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list