Gentoo Archives: gentoo-musl

From: Lei Zhang <zhanglei.april@×××××.com>
To: Luca Barbato <lu_zero@g.o>
Cc: gentoo-musl@l.g.o
Subject: Re: [gentoo-musl] [GSoC] _GNU_SOURCE in C++
Date: Fri, 17 Jun 2016 11:13:54
Message-Id: CAOYuCc2wNubtTN7Va_RD+GXhMuRvRa=Ujf2tUObdLztZik8Vqg@mail.gmail.com
In Reply to: Re: [gentoo-musl] [GSoC] _GNU_SOURCE in C++ by Lei Zhang
1 2016-06-17 19:12 GMT+08:00 Lei Zhang <zhanglei.april@×××××.com>:
2 > 2016-06-16 21:42 GMT+08:00 Lei Zhang <zhanglei.april@×××××.com>:
3 >> 2016-06-16 21:13 GMT+08:00 Luca Barbato <lu_zero@g.o>:
4 >>> On 16/06/16 14:47, Lei Zhang wrote:
5 >>>> 2016-06-16 17:43 GMT+08:00 Luca Barbato <lu_zero@g.o>:
6 >>>>> On 16/06/16 05:36, Lei Zhang wrote:
7 >>>>>> Attached is what I've got so far.
8 >>>>>>
9 >>>>>> Some of them are not documented in man pages, so I checked their
10 >>>>>> declarations in musl's headers. Functions strtold_l, strtoll_l and
11 >>>>>> strtoull_l are not available in musl, but libc++ is smart enough to
12 >>>>>> not use them when linked against musl.
13 >>>>
14 >>>> I made a mistake. Actually strtold_l *is* available in musl, but
15 >>>> hidden by _GNU_SOURCE.
16 >>>
17 >>> Not hidden by _BSD_SOURCE as well?
18 >>
19 >> No, only by _GNU_SOURCE.
20 >>
21 >>>>> beside vasprintf, the rest is covered by _XOPEN_SOURCE 700
22 >>>>>
23 >>>>> Might be worth trying to do -U_GNU_SOURCES -D_XOPEN_SOURCE=700 and see
24 >>>>> how it goes.
25 >>>>
26 >>>> So far vasprintf and strtold_l are not covered. vasprintf can be
27 >>>> covered with -D_BSD_SOURCE. But _BSD_SOURCE is deprecated since glibc
28 >>>> 2.20; I don't know if this has any impact on musl.
29 >>>
30 >>> It should not and -D_BSD_SOURCE should be fine for musl.
31 >>
32 >> I just found that vasprintf is only protected by _GNU_SOURCE in glibc,
33 >> which means in this case _BSD_SOURCE only works for musl.
34 >>
35 >>>>> How vasprintf is used?
36 >>>>
37 >>>> It's used by <locale>. The code is kinda hard to read; I can't tell
38 >>>> exactly what it's doing...
39 >>>
40 >>> same for the _l variants I guess.
41 >>
42 >> So what now? So far strtold_l still needs _GNU_SOURCE in musl;
43 >> strtold_l, strtoll_l, strtoull_l and vasprintf all need _GNU_SOURCE in
44 >> glibc.
45 >
46 > To sum it up:
47 >
48 > * As for musl, "-U_GNU_SOURCES -U_GNU_SOURCES=700 -D_BSD_SOURCE"
49 > covers every symbol needed by libc++ except for strtold_l.
50
51 Sorry, it should be "-U_GNU_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE"
52
53 Lei