I don't think so. The musl version of duplocale.c ( https://github.com/cloudius-systems/musl/blob/master/src/locale/duplocale.c) defines __duplocale and its alias duplocale using weak_alias macro. On other hand, musl setlocale.c defines setlocale only that is why we have to add alias to aliases.ld.
On Sat, Aug 15, 2020 at 03:13 Nadav Har'El <[email protected]> wrote: > Don't you also need to add the alias __duplocale? > > On Sat, Aug 15, 2020, 07:27 Waldemar Kozaczuk <[email protected]> > wrote: > >> Signed-off-by: Waldemar Kozaczuk <[email protected]> >> >> >> --- >> >> >> Makefile | 4 ++-- >> >> >> libc/aliases.ld | 1 + >> >> >> libc/locale/duplocale.c | 15 --------------- >> >> >> libc/locale/setlocale.c | 13 ------------- >> >> >> 4 files changed, 3 insertions(+), 30 deletions(-) >> >> >> delete mode 100644 libc/locale/duplocale.c >> >> >> delete mode 100644 libc/locale/setlocale.c >> >> >> >> >> >> diff --git a/Makefile b/Makefile >> >> >> index a4cdcf55..0abbd196 100644 >> >> >> --- a/Makefile >> >> >> +++ b/Makefile >> >> >> @@ -1009,7 +1009,7 @@ libc += errno/strerror.o >> >> >> musl += locale/catclose.o >> >> >> musl += locale/catgets.o >> >> >> musl += locale/catopen.o >> >> >> -libc += locale/duplocale.o >> >> >> +musl += locale/duplocale.o >> >> >> libc += locale/freelocale.o >> >> >> musl += locale/iconv.o >> >> >> musl += locale/intl.o >> >> >> @@ -1041,7 +1041,7 @@ musl += locale/isxdigit_l.o >> >> >> libc += locale/langinfo.o >> >> >> musl += locale/localeconv.o >> >> >> libc += locale/nl_langinfo_l.o >> >> >> -libc += locale/setlocale.o >> >> >> +musl += locale/setlocale.o >> >> >> musl += locale/strcasecmp_l.o >> >> >> libc += locale/strcoll.o >> >> >> libc += locale/strcoll_l.o >> >> >> diff --git a/libc/aliases.ld b/libc/aliases.ld >> >> >> index 23f208b1..c1ad406a 100644 >> >> >> --- a/libc/aliases.ld >> >> >> +++ b/libc/aliases.ld >> >> >> @@ -26,6 +26,7 @@ __finitel = finitel; >> >> >> >> >> >> /* locale */ >> >> >> __toupper_l = toupper_l; >> >> >> +__setlocale = setlocale; >> >> >> >> >> >> /* multibyte */ >> >> >> __mbrlen = mbrlen; >> >> >> diff --git a/libc/locale/duplocale.c b/libc/locale/duplocale.c >> >> >> deleted file mode 100644 >> >> >> index 695a06f1..00000000 >> >> >> --- a/libc/locale/duplocale.c >> >> >> +++ /dev/null >> >> >> @@ -1,15 +0,0 @@ >> >> >> -#include <stdlib.h> >> >> >> -#include <string.h> >> >> >> -#include "locale_impl.h" >> >> >> -#include "libc.h" >> >> >> - >> >> >> -locale_t __duplocale(locale_t old) >> >> >> -{ >> >> >> - locale_t new; >> >> >> - new = calloc(1, sizeof *new); >> >> >> - if (new && old != LC_GLOBAL_LOCALE) memcpy(new, old, sizeof *new); >> >> >> - return new; >> >> >> -} >> >> >> - >> >> >> -/* OSv local: a libstdc++ build against glibc wants the __ version */ >> >> >> -weak_alias(__duplocale, duplocale); >> >> >> diff --git a/libc/locale/setlocale.c b/libc/locale/setlocale.c >> >> >> deleted file mode 100644 >> >> >> index b311f28b..00000000 >> >> >> --- a/libc/locale/setlocale.c >> >> >> +++ /dev/null >> >> >> @@ -1,13 +0,0 @@ >> >> >> -#include <locale.h> >> >> >> -#include "libc.h" >> >> >> - >> >> >> -char *__setlocale(int category, const char *locale) >> >> >> -{ >> >> >> - /* Note: plain "C" would be better, but puts some broken >> >> >> - * software into legacy 8-bit-codepage mode, ignoring >> >> >> - * the standard library's multibyte encoding */ >> >> >> - return "C.UTF-8"; >> >> >> -} >> >> >> - >> >> >> -/* OSv local: a libstdc++ build against glibc wants the __ version */ >> >> >> -weak_alias(__setlocale, setlocale); >> >> >> -- >> >> >> 2.26.2 >> >> >> >> >> >> -- >> >> >> You received this message because you are subscribed to the Google Groups >> "OSv Development" group. >> >> >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> >> >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/osv-dev/20200815042719.51117-4-jwkozaczuk%40gmail.com >> . >> >> >> > > > > > > > > -- > > > You received this message because you are subscribed to the Google Groups > "OSv Development" group. > > > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > > > To view this discussion on the web visit > https://groups.google.com/d/msgid/osv-dev/CANEVyjtPAZ%3DePmdRZ6SCrvHDP8mpGYxnQxiCJjDtgOnX8J5Z1w%40mail.gmail.com > <https://groups.google.com/d/msgid/osv-dev/CANEVyjtPAZ%3DePmdRZ6SCrvHDP8mpGYxnQxiCJjDtgOnX8J5Z1w%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > > -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/osv-dev/CAL9cFfNxypgRgxzez0fOxQCkrMVLmM%2BWQ47UxnTC7%3DqMH20k9Q%40mail.gmail.com.
