Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Mar 2023 16:49:18 -0700
From:      Warner Losh <imp@bsdimp.com>
To:        Jessica Clarke <jrtc27@freebsd.org>
Cc:        Warner Losh <imp@freebsd.org>,  "src-committers@freebsd.org" <src-committers@freebsd.org>,  "dev-commits-src-all@freebsd.org" <dev-commits-src-all@freebsd.org>,  "dev-commits-src-main@freebsd.org" <dev-commits-src-main@freebsd.org>
Subject:   Re: git: 320e7e0003db - main - Revert "Fix cross-build support for Ubuntu 16.04"
Message-ID:  <CANCZdfosibmuyGoXXEy7e4r4=v5QLXbtC5RZGQmdi3HqEhy-1Q@mail.gmail.com>
In-Reply-To: <B9243E0B-D840-41F9-A800-714E2E1AC2B7@freebsd.org>
References:  <202303072311.327NBUfu043070@gitrepo.freebsd.org> <B9243E0B-D840-41F9-A800-714E2E1AC2B7@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000ff521605f6580f97
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Tue, Mar 7, 2023 at 4:13=E2=80=AFPM Jessica Clarke <jrtc27@freebsd.org> =
wrote:

> On 7 Mar 2023, at 23:11, Warner Losh <imp@FreeBSD.org> wrote:
> >
> > The branch main has been updated by imp:
> >
> > URL:
> https://cgit.FreeBSD.org/src/commit/?id=3D320e7e0003dbc14ed3fc01b95532924=
cd3fbda7b
> >
> > commit 320e7e0003dbc14ed3fc01b95532924cd3fbda7b
> > Author:     Jose Luis Duran <jlduran@gmail.com>
> > AuthorDate: 2023-03-02 15:31:31 +0000
> > Commit:     Warner Losh <imp@FreeBSD.org>
> > CommitDate: 2023-03-07 23:11:11 +0000
> >
> >    Revert "Fix cross-build support for Ubuntu 16.04"
> >
> >    This reverts commit d6327ae8c11b73765f100981baca49166b558b70.
> >
> >    Before version 2.25, glibc's unistd.h would define the POSIX subset =
of
> >    getopt.h by defining __need_getopt, including getopt.h (which would
> >    disable the header guard) and then undefining it so later including
> >    getopt.h explicitly would define the extensions. However, we wrap
> >    getopt, and so the wrapper's #pragma once breaks that. Thus getopt.h
> was
> >    included before the real unistd.h to ensure we get all the extension=
s.
> >
> >    However, with clang 12 that causes problems where we get a function
> >    mismatch (since getopt can throw exceptions). If we include it after
> >    unistd.h, it will get the full definitions since glibc no longer doe=
s
> >    the subsetting thing. This will result in matching definitions and f=
ix
> >    clang 12.
>
> This is the bit I still don=E2=80=99t understand and hoped the author wou=
ld
> explain=E2=80=A6
>

I'll look into it a bit more.

Warner


> Jess
>
> >    Reviewed by: imp, jrtc27 (OK'd on irc)
> >    Pull Request: https://github.com/freebsd/freebsd-src/pull/668
> > ---
> > tools/build/cross-build/include/linux/unistd.h | 10 +---------
> > 1 file changed, 1 insertion(+), 9 deletions(-)
> >
> > diff --git a/tools/build/cross-build/include/linux/unistd.h
> b/tools/build/cross-build/include/linux/unistd.h
> > index f518df2ac9ae..cd0b28ba39ed 100644
> > --- a/tools/build/cross-build/include/linux/unistd.h
> > +++ b/tools/build/cross-build/include/linux/unistd.h
> > @@ -41,17 +41,9 @@
> > /* Ensure that unistd.h pulls in getopt */
> > #define __USE_POSIX2
> > #endif
> > -/*
> > - * Before version 2.25, glibc's unistd.h would define the POSIX subset
> of
> > - * getopt.h by defining __need_getopt,  including getopt.h (which woul=
d
> > - * disable the header guard) and then undefining it so later including
> > - * getopt.h explicitly would define the extensions. However, we wrap
> getopt,
> > - * and so the wrapper's #pragma once breaks that. Thus getopt.h must b=
e
> > - * included before the real unistd.h to ensure we get all the
> extensions.
> > - */
> > -#include <getopt.h>
> > #include_next <unistd.h>
> > #include <fcntl.h>
> > +#include <getopt.h>
> > #include <stdlib.h>
> > #include <string.h>
> > #include <sys/syscall.h>
>
>

--000000000000ff521605f6580f97
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Tue, Mar 7, 2023 at 4:13=E2=80=AFP=
M Jessica Clarke &lt;<a href=3D"mailto:jrtc27@freebsd.org">jrtc27@freebsd.o=
rg</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margi=
n:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex=
">On 7 Mar 2023, at 23:11, Warner Losh &lt;imp@FreeBSD.org&gt; wrote:<br>
&gt; <br>
&gt; The branch main has been updated by imp:<br>
&gt; <br>
&gt; URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3D320e7e0003db=
c14ed3fc01b95532924cd3fbda7b" rel=3D"noreferrer" target=3D"_blank">https://=
cgit.FreeBSD.org/src/commit/?id=3D320e7e0003dbc14ed3fc01b95532924cd3fbda7b<=
/a><br>
&gt; <br>
&gt; commit 320e7e0003dbc14ed3fc01b95532924cd3fbda7b<br>
&gt; Author:=C2=A0 =C2=A0 =C2=A0Jose Luis Duran &lt;<a href=3D"mailto:jldur=
an@gmail.com" target=3D"_blank">jlduran@gmail.com</a>&gt;<br>
&gt; AuthorDate: 2023-03-02 15:31:31 +0000<br>
&gt; Commit:=C2=A0 =C2=A0 =C2=A0Warner Losh &lt;imp@FreeBSD.org&gt;<br>
&gt; CommitDate: 2023-03-07 23:11:11 +0000<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 Revert &quot;Fix cross-build support for Ubuntu 16.04&quo=
t;<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 This reverts commit d6327ae8c11b73765f100981baca49166b558=
b70.<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 Before version 2.25, glibc&#39;s unistd.h would define th=
e POSIX subset of<br>
&gt;=C2=A0 =C2=A0 getopt.h by defining __need_getopt, including getopt.h (w=
hich would<br>
&gt;=C2=A0 =C2=A0 disable the header guard) and then undefining it so later=
 including<br>
&gt;=C2=A0 =C2=A0 getopt.h explicitly would define the extensions. However,=
 we wrap<br>
&gt;=C2=A0 =C2=A0 getopt, and so the wrapper&#39;s #pragma once breaks that=
. Thus getopt.h was<br>
&gt;=C2=A0 =C2=A0 included before the real unistd.h to ensure we get all th=
e extensions.<br>
&gt; <br>
&gt;=C2=A0 =C2=A0 However, with clang 12 that causes problems where we get =
a function<br>
&gt;=C2=A0 =C2=A0 mismatch (since getopt can throw exceptions). If we inclu=
de it after<br>
&gt;=C2=A0 =C2=A0 unistd.h, it will get the full definitions since glibc no=
 longer does<br>
&gt;=C2=A0 =C2=A0 the subsetting thing. This will result in matching defini=
tions and fix<br>
&gt;=C2=A0 =C2=A0 clang 12.<br>
<br>
This is the bit I still don=E2=80=99t understand and hoped the author would=
 explain=E2=80=A6<br></blockquote><div><br></div><div>I&#39;ll look into it=
 a bit more.</div><div><br></div><div>Warner</div><div>=C2=A0</div><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px=
 solid rgb(204,204,204);padding-left:1ex">
Jess<br>
<br>
&gt;=C2=A0 =C2=A0 Reviewed by: imp, jrtc27 (OK&#39;d on irc)<br>
&gt;=C2=A0 =C2=A0 Pull Request: <a href=3D"https://github.com/freebsd/freeb=
sd-src/pull/668" rel=3D"noreferrer" target=3D"_blank">https://github.com/fr=
eebsd/freebsd-src/pull/668</a><br>
&gt; ---<br>
&gt; tools/build/cross-build/include/linux/unistd.h | 10 +---------<br>
&gt; 1 file changed, 1 insertion(+), 9 deletions(-)<br>
&gt; <br>
&gt; diff --git a/tools/build/cross-build/include/linux/unistd.h b/tools/bu=
ild/cross-build/include/linux/unistd.h<br>
&gt; index f518df2ac9ae..cd0b28ba39ed 100644<br>
&gt; --- a/tools/build/cross-build/include/linux/unistd.h<br>
&gt; +++ b/tools/build/cross-build/include/linux/unistd.h<br>
&gt; @@ -41,17 +41,9 @@<br>
&gt; /* Ensure that unistd.h pulls in getopt */<br>
&gt; #define __USE_POSIX2<br>
&gt; #endif<br>
&gt; -/*<br>
&gt; - * Before version 2.25, glibc&#39;s unistd.h would define the POSIX s=
ubset of<br>
&gt; - * getopt.h by defining __need_getopt,=C2=A0 including getopt.h (whic=
h would<br>
&gt; - * disable the header guard) and then undefining it so later includin=
g<br>
&gt; - * getopt.h explicitly would define the extensions. However, we wrap =
getopt,<br>
&gt; - * and so the wrapper&#39;s #pragma once breaks that. Thus getopt.h m=
ust be<br>
&gt; - * included before the real unistd.h to ensure we get all the extensi=
ons.<br>
&gt; - */<br>
&gt; -#include &lt;getopt.h&gt;<br>
&gt; #include_next &lt;unistd.h&gt;<br>
&gt; #include &lt;fcntl.h&gt;<br>
&gt; +#include &lt;getopt.h&gt;<br>
&gt; #include &lt;stdlib.h&gt;<br>
&gt; #include &lt;string.h&gt;<br>
&gt; #include &lt;sys/syscall.h&gt;<br>
<br>
</blockquote></div></div>

--000000000000ff521605f6580f97--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfosibmuyGoXXEy7e4r4=v5QLXbtC5RZGQmdi3HqEhy-1Q>