Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1595608

Re: [PATCH resent] uapi libc compat: allow non-glibc to opt out of uapi definitions

From Szabolcs Nagy <nsz@port70.net>
Newsgroups linux.kernel
Subject Re: [PATCH resent] uapi libc compat: allow non-glibc to opt out of uapi definitions
Date 2017-03-09 01:50 +0100
Message-ID <tiUrf-5Np-15@gated-at.bofh.it> (permalink)
References <sCiYi-4ee-21@gated-at.bofh.it> <tiMk2-uK-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


* Carlos O'Donell <carlos@redhat.com> [2017-03-08 10:53:00 -0500]:
> On 11/11/2016 07:08 AM, Felix Janda wrote:
> > fixes the following compiler errors when <linux/in6.h> is included
> > after musl <netinet/in.h>:
> > 
> > ./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)

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH resent] uapi libc compat: allow non-glibc to opt out of  uapi definitions Carlos O'Donell <carlos@redhat.com> - 2017-03-08 17:10 +0100
  Re: [musl] Re: [PATCH resent] uapi libc compat: allow non-glibc to  opt out of uapi definitions Rich Felker <dalias@aerifal.cx> - 2017-03-08 17:50 +0100
    Re: [musl] Re: [PATCH resent] uapi libc compat: allow non-glibc to  opt out of uapi definitions Carlos O'Donell <carlos@redhat.com> - 2017-03-08 19:40 +0100
  Re: [PATCH resent] uapi libc compat: allow non-glibc to opt out of  uapi definitions Szabolcs Nagy <nsz@port70.net> - 2017-03-09 01:50 +0100
    Re: [PATCH resent] uapi libc compat: allow non-glibc to opt out of  uapi definitions Carlos O'Donell <carlos@redhat.com> - 2017-03-09 02:10 +0100
      Re: [musl] Re: [PATCH resent] uapi libc compat: allow non-glibc to  opt out of uapi definitions Rich Felker <dalias@aerifal.cx> - 2017-03-09 04:10 +0100

csiph-web