From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id C90041382BD for ; Fri, 17 Jun 2016 12:44:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B78E0E0AA9; Fri, 17 Jun 2016 12:44:05 +0000 (UTC) Received: from mail-oi0-f65.google.com (mail-oi0-f65.google.com [209.85.218.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 48BA1E0AA9 for ; Fri, 17 Jun 2016 12:44:05 +0000 (UTC) Received: by mail-oi0-f65.google.com with SMTP id a64so13510463oii.1 for ; Fri, 17 Jun 2016 05:44:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=mQLP2PPDRqJc8J5rhI2hpQ+AxNrv8/mloZLZ4rACorI=; b=BZSXy8O9B6HXNCM/Uqgx0J31V3+pw63JUIB/2xpVgeaXDnGJDU2kNLMI1qPI+z6lzu NKl18sOjfbwCD2sFj/7Ial3ZgKhOkTcvXjHz+rkmsFd7kpvQiBy4l/HzqW4RSsCDCNld B57FNUIQSitoYt4bsCbtdhq3GFvwU9UIgaPNFmDlPcOZz13282QWEgpvO3AKrci9Pu8p sGGskZt4tiHaozWVcRTlj6v4XNm3gHI2qWuZHZrkFDeHgNSZ6JJKmuUCTCVzxnDh6Y18 K+oWLLzdGFWVv+h51QQrPHjke0qlIdED0oMP9kibcefAD8Ue0r8WgTKRcLpP3skPlRiH PtMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=mQLP2PPDRqJc8J5rhI2hpQ+AxNrv8/mloZLZ4rACorI=; b=mvaQAs8Gwz7A1QX9hV/o+4Zu4YvDOUvM/C1LiFlCnhrdE2clVjN3dA6WHutUzHwaxe ydMw30BSwhcTkEdFi2LcHfo9PrJDesDrvQ9w9yKbIk/Hiv2RkyTiZpwL0aUbQ2aFh8rj ShKc7zv4dyjSn15/j/rfZuqcCbfTZIQgaePoiw8/BkbUnLqb7AMLnus5oYttz+40KXui 8faquYBo1EeKq566wbwbZLKMOiw/KPbLPiMisZpVMobOIK2rJokHPQXGk8+W0T1UPMR+ 5Lkn94LwPspVtTL6/P0cWhO4eVUx/bx9xaHRX1kdEqi1CVwzCJ8RYfj4lgN/AArmfVvw 90Vg== X-Gm-Message-State: ALyK8tKnyUTYKsFcBrhPsrFYRgbHvLfmwVVucdH9Mu4BrXidwTAsG7ds2X7maYZog+Yrnu/urGS9AozFJcBZ0Q== X-Received: by 10.202.241.67 with SMTP id p64mr949440oih.197.1466167444557; Fri, 17 Jun 2016 05:44:04 -0700 (PDT) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo musl list X-BeenThere: gentoo-musl@gentoo.org X-BeenThere: gentoo-musl@lists.gentoo.org MIME-Version: 1.0 Received: by 10.202.63.212 with HTTP; Fri, 17 Jun 2016 05:44:03 -0700 (PDT) In-Reply-To: <37117cc0-2af1-306d-6ec5-d8d37d8c588c@gentoo.org> References: <4228046b-02f1-1b65-f56d-6e79347e4390@gentoo.org> <20302d1d-92ff-1c4b-8939-08894c3589ca@gentoo.org> <8e7cafd9-97c7-6ca1-ad3f-95bdb0060ce0@gentoo.org> <19f9f66f-5dd4-786a-3b29-0a57c407548e@gentoo.org> <1c93fa87-e2c3-2737-1222-ae93003e21ad@gentoo.org> <7d6fa9d6-1134-1d2a-1d06-33029b82429d@gentoo.org> <37117cc0-2af1-306d-6ec5-d8d37d8c588c@gentoo.org> From: Lei Zhang Date: Fri, 17 Jun 2016 20:44:03 +0800 Message-ID: Subject: Re: [gentoo-musl] [GSoC] _GNU_SOURCE in C++ To: Luca Barbato Cc: gentoo-musl@lists.gentoo.org Content-Type: text/plain; charset=UTF-8 X-Archives-Salt: 4031921a-c992-4a63-b831-6f9a70d6beb4 X-Archives-Hash: 848899842f40941840e25a3f339bc722 2016-06-17 19:25 GMT+08:00 Luca Barbato : > On 17/06/16 13:12, Lei Zhang wrote: >> 2016-06-16 21:42 GMT+08:00 Lei Zhang : >>> 2016-06-16 21:13 GMT+08:00 Luca Barbato : >>>> On 16/06/16 14:47, Lei Zhang wrote: >>>>> 2016-06-16 17:43 GMT+08:00 Luca Barbato : >>>>>> On 16/06/16 05:36, Lei Zhang wrote: >>>>>>> Attached is what I've got so far. >>>>>>> >>>>>>> Some of them are not documented in man pages, so I checked their >>>>>>> declarations in musl's headers. Functions strtold_l, strtoll_l and >>>>>>> strtoull_l are not available in musl, but libc++ is smart enough to >>>>>>> not use them when linked against musl. >>>>> >>>>> I made a mistake. Actually strtold_l *is* available in musl, but >>>>> hidden by _GNU_SOURCE. >>>> >>>> Not hidden by _BSD_SOURCE as well? >>> >>> No, only by _GNU_SOURCE. >>> >>>>>> beside vasprintf, the rest is covered by _XOPEN_SOURCE 700 >>>>>> >>>>>> Might be worth trying to do -U_GNU_SOURCES -D_XOPEN_SOURCE=700 and see >>>>>> how it goes. >>>>> >>>>> So far vasprintf and strtold_l are not covered. vasprintf can be >>>>> covered with -D_BSD_SOURCE. But _BSD_SOURCE is deprecated since glibc >>>>> 2.20; I don't know if this has any impact on musl. >>>> >>>> It should not and -D_BSD_SOURCE should be fine for musl. >>> >>> I just found that vasprintf is only protected by _GNU_SOURCE in glibc, >>> which means in this case _BSD_SOURCE only works for musl. >>> >>>>>> How vasprintf is used? >>>>> >>>>> It's used by . The code is kinda hard to read; I can't tell >>>>> exactly what it's doing... >>>> >>>> same for the _l variants I guess. >>> >>> So what now? So far strtold_l still needs _GNU_SOURCE in musl; >>> strtold_l, strtoll_l, strtoull_l and vasprintf all need _GNU_SOURCE in >>> glibc. >> >> To sum it up: >> >> * As for musl, "-U_GNU_SOURCES -U_GNU_SOURCES=700 -D_BSD_SOURCE" >> covers every symbol needed by libc++ except for strtold_l. >> >> * As for glibc, "-U_GNU_SOURCE -D_ISOC11_SOURCE -D_DEFAULT_SOURCE" >> covers everything except for strtold_l, strtoll_l, strtoull_l and >> vasprintf. > > > Sounds almost good, now some configure/cmake patches to put that in and > some #define _GNU_SOURCES /#undef in selected places might get it > working completely... After putting about eight "#define _GNU_SOURCE"s in various *.cpp files, it seems to work now :) I'll see if I can reduce the number of "#define"s needed. Lei