Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754714AbdCIAmj (ORCPT ); Wed, 8 Mar 2017 19:42:39 -0500 Received: from port70.net ([81.7.13.123]:55807 "EHLO port70.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751262AbdCIAme (ORCPT ); Wed, 8 Mar 2017 19:42:34 -0500 X-Greylist: delayed 940 seconds by postgrey-1.27 at vger.kernel.org; Wed, 08 Mar 2017 19:41:18 EST Date: Thu, 9 Mar 2017 01:14:35 +0100 From: Szabolcs Nagy To: "Carlos O'Donell" Cc: linux-kernel@vger.kernel.org, "David S. Miller" , linux-api@vger.kernel.org, musl@lists.openwall.com, Rich Felker Subject: Re: [PATCH resent] uapi libc compat: allow non-glibc to opt out of uapi definitions Message-ID: <20170309001435.GJ2082@port70.net> Mail-Followup-To: Carlos O'Donell , linux-kernel@vger.kernel.org, "David S. Miller" , linux-api@vger.kernel.org, musl@lists.openwall.com, Rich Felker References: <20161111120820.GA435@nyan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0 (2016-04-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1457 Lines: 32 * 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)