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 7C1BD1382AD for ; Tue, 14 Jun 2016 07:44:05 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BA1E6E04C7; Tue, 14 Jun 2016 07:44:02 +0000 (UTC) Received: from mail-oi0-f43.google.com (mail-oi0-f43.google.com [209.85.218.43]) (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 2CEAEE04C7 for ; Tue, 14 Jun 2016 07:44:02 +0000 (UTC) Received: by mail-oi0-f43.google.com with SMTP id d132so140556958oig.1 for ; Tue, 14 Jun 2016 00:44:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=8fjGnM8N0tQd7jOVJN98ZlbahGRLH5jZWR6kuG8ryiw=; b=PqPAXgw1GzdJ0JVKnpIqCebPgtYpAA5KXC9EG9EvV4gprXv9Z8vtEOEx9wF+ZlaKCk QoL3BGZvL/1TGcq2fcpgO+dp+keItTvL7qtFSLaQSrQSbi4+ylt+QHZkLI8zUXa4hAc8 4jySG6BVYKSg9pmDFhIgLYBODmzMJ5Y1BHkQ354UenhZi+pW9wrklaTnDJxvOs7xL0oN WsI8tnKwUaRIy/mVl4vvR1HPrFVmhLBaRv/nmKI0pcvIivPJsoebI2EzS3Zd2rzOdXMx pW/nL8UhDHJL9KRy6Jn5fVD/q0rMFLyeDbE1tU+eyk8m/Pvgdc64I9zU6JsB1UiMUKGB DVrA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=8fjGnM8N0tQd7jOVJN98ZlbahGRLH5jZWR6kuG8ryiw=; b=gtFpFbuoJq1BGSuZ3fgvsehPjXAzJzIuMqW6Z+/PIxHNaW+oHa92YvbvQTZDKeB0s2 BtttcwrT6TdjQ3DpyJ6zi5RzDM18jPk/5+XQ8ubE2mMNwdxtEt4WoIDKNlYHNLzJy4mF oXo04edbVBg7czZz66sQp/ss6ADEazlGqwieKNnRmNH7PFMr5V4pXBUhxbOlTx5f5DM2 6vrcTOD7epwXMh9DGyZMffKu40XWepZRUvY2r8re0i/O6eMEJ04yQ3e0nigw4W7ameO9 PJx7Ck/znonzNrfSjT2HWQejc/3k8vn8LAYBPd7C/T8K61rLWPNL/QAiY5tmBiSrb4wM IjKA== X-Gm-Message-State: ALyK8tLII+ZviBSrNi7te4eFaOMwa3h6jeTVZmL2J4E8Ki+J5HWJRsvcFxK9uG3S2MeozJVJ3u/CJlwAZmJIEA== X-Received: by 10.202.241.67 with SMTP id p64mr8102352oih.197.1465890241311; Tue, 14 Jun 2016 00:44:01 -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; Tue, 14 Jun 2016 00:44:00 -0700 (PDT) From: Lei Zhang Date: Tue, 14 Jun 2016 15:44:00 +0800 Message-ID: Subject: [gentoo-musl] [GSoC] _GNU_SOURCE in C++ To: Luca Barbato , gentoo-musl@lists.gentoo.org Content-Type: text/plain; charset=UTF-8 X-Archives-Salt: a074a2f4-eb98-4386-88c3-ad835494d454 X-Archives-Hash: c68b41360b54f9d173b91d7adf9191a1 Hi, So far the toughest issue with building LLVM against musl is that, LLVM redefines a bunch of non-POSIX symbols, including fopen64, stat64, etc, inside a C++ namespace. The namespace prevents them from clashing with glibc's definitions; but unfortunately, musl defines these symbols as macros, and macros don't respect C++ namespace, thus the clash. Here's how it looks in musl: #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE) #define tmpfile64 tmpfile #define fopen64 fopen ... #endif Actually these definitions are protected by _GNU_SOURCE, and LLVM *only* define this macro when glibc is present. So theoretically LLVM should play nice with musl. But an unfortunate truth is that, _GNU_SOURCE is unconditionally defined by g++ and clang++ when compiling any C++ code on Linux, rendering this protection useless. I did some googling, and it turns out that libstdc++ heavily relies on _GNU_SOURCE, so g++ always enable this macro for libstdc++ to function correctly. I guess clang++ does the same thing just for compatibility with g++. I think the incompatibility between LLVM and musl is probably neither side's fault, but the compiler's. Anyway, at least one of the three should be fixed. Thoughts? Lei