public inbox for gentoo-musl@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-musl] [GSoC] _GNU_SOURCE in C++
@ 2016-06-14  7:44 Lei Zhang
  2016-06-14  8:10 ` Felix Janda
       [not found] ` <20160615033804.GA2473@gmail.com>
  0 siblings, 2 replies; 19+ messages in thread
From: Lei Zhang @ 2016-06-14  7:44 UTC (permalink / raw
  To: Luca Barbato, gentoo-musl

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


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2016-06-22 14:02 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-14  7:44 [gentoo-musl] [GSoC] _GNU_SOURCE in C++ Lei Zhang
2016-06-14  8:10 ` Felix Janda
2016-06-14  8:28   ` Lei Zhang
     [not found]     ` <4228046b-02f1-1b65-f56d-6e79347e4390@gentoo.org>
2016-06-14  9:17       ` Lei Zhang
     [not found]         ` <20302d1d-92ff-1c4b-8939-08894c3589ca@gentoo.org>
2016-06-14  9:35           ` Lei Zhang
     [not found]             ` <8e7cafd9-97c7-6ca1-ad3f-95bdb0060ce0@gentoo.org>
2016-06-14 11:48               ` Lei Zhang
     [not found]                 ` <e1f362ee-7755-9a54-78e3-19e0733ebd3b@gentoo.org>
2016-06-15  1:45                   ` Lei Zhang
     [not found]                     ` <19f9f66f-5dd4-786a-3b29-0a57c407548e@gentoo.org>
2016-06-16  3:36                       ` Lei Zhang
     [not found]                         ` <1c93fa87-e2c3-2737-1222-ae93003e21ad@gentoo.org>
2016-06-16 12:47                           ` Lei Zhang
     [not found]                             ` <7d6fa9d6-1134-1d2a-1d06-33029b82429d@gentoo.org>
2016-06-16 13:42                               ` Lei Zhang
2016-06-17 11:12                                 ` Lei Zhang
2016-06-17 11:13                                   ` Lei Zhang
     [not found]                                   ` <37117cc0-2af1-306d-6ec5-d8d37d8c588c@gentoo.org>
2016-06-17 12:44                                     ` Lei Zhang
2016-06-21  4:54                                       ` Lei Zhang
2016-06-22 13:21                                         ` Lei Zhang
2016-06-22 13:54                                         ` Lei Zhang
2016-06-22 14:02                                           ` Lei Zhang
2016-06-14  9:55     ` Felix Janda
     [not found] ` <20160615033804.GA2473@gmail.com>
2016-06-15  3:55   ` Lei Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox