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