From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11127 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general,gmane.linux.kernel,gmane.linux.kernel.api Subject: Re: Re: [PATCH resent] uapi libc compat: allow non-glibc to opt out of uapi definitions Date: Wed, 8 Mar 2017 21:01:10 -0500 Message-ID: <20170309020110.GC1520@brightrain.aerifal.cx> References: <20161111120820.GA435@nyan> <20170309001435.GJ2082@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1489024965 7055 195.159.176.226 (9 Mar 2017 02:02:45 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 9 Mar 2017 02:02:45 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) Cc: linux-kernel@vger.kernel.org, "David S. Miller" , linux-api@vger.kernel.org, musl@lists.openwall.com To: Carlos O'Donell Original-X-From: musl-return-11142-gllmg-musl=m.gmane.org@lists.openwall.com Thu Mar 09 03:02:40 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1clnPZ-0000ti-DI for gllmg-musl@m.gmane.org; Thu, 09 Mar 2017 03:02:37 +0100 Original-Received: (qmail 7702 invoked by uid 550); 9 Mar 2017 02:02:42 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 7684 invoked from network); 9 Mar 2017 02:02:41 -0000 Content-Disposition: inline In-Reply-To: Xref: news.gmane.org gmane.linux.lib.musl.general:11127 gmane.linux.kernel:2426794 gmane.linux.kernel.api:22442 Archived-At: On Wed, Mar 08, 2017 at 07:51:29PM -0500, Carlos O'Donell wrote: > On 03/08/2017 07:14 PM, Szabolcs Nagy wrote: > > * Carlos O'Donell [2017-03-08 10:53:00 -0500]: > >> On 11/11/2016 07:08 AM, Felix Janda wrote: > >>> fixes the following compiler errors when is included > >>> after musl : > >>> > >>> ./linux/in6.h:32:8: error: redefinition of 'struct in6_addr' > >>> ./linux/in6.h:49:8: error: redefinition of 'struct sockaddr_in6' > >>> ./linux/in6.h:59:8: error: redefinition of 'struct ipv6_mreq' > >> > >> Do you have plans for fixing the error when the inclusion order is the other way? > > > > the other way (linux header included first) is > > problematic because linux headers don't follow > > all the standards the libc follows, they violate > > namespace rules in their struct definitions, so > > the libc definitions are necessarily incompatible > > with them and thus different translation units can > > end up refering to the same object through > > incompatible types which is undefined. > > (even if the abi matches and thus works across > > the syscall interface, a sufficiently smart > > toolchain can break such code at link time, > > and since the libc itself uses its own definitons > > that's what user code should use too). > > > > there should be a way to include standard conform > > libc headers and linux headers into the same tu, > > at least the case when all conflicting definitions > > come from the libc should work and i think that > > should be the scope of these libc-compat.h changes. > > (of course if glibc tries to support arbitrary > > interleavings then the changes should not break that) > > You can get non-standard defines even when including the > linux headers _after_ libc headers because linux headers > should rightly continue to define things that are required > for linux-specific applications. > > IMO the fact that the UAPI headers may cause problems with > standards conformance is orthogonal to the discussion of > _how_ we fix inclusion order issues. > > Some of the network headers can be used in relative safety > and need to be used for some applications. It is those cases > where I'd like to see an inclusion guard design that works > for both inclusion orders. The issue has been discussed on our side (musl) and our position so far is that we don't want to try to support the case of including the kernel headers before the libc headers, at least not at this time. It's a big rabbit hole of stuff that could go wrong. This doesn't preclude the kernel folks trying to make things so that it _can_ be supported more smoothly. Rich