Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Mar 2023 23:13:28 +0000
From:      Jessica Clarke <jrtc27@freebsd.org>
To:        Warner Losh <imp@FreeBSD.org>
Cc:        "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:  <B9243E0B-D840-41F9-A800-714E2E1AC2B7@freebsd.org>
In-Reply-To: <202303072311.327NBUfu043070@gitrepo.freebsd.org>
References:  <202303072311.327NBUfu043070@gitrepo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 7 Mar 2023, at 23:11, Warner Losh <imp@FreeBSD.org> wrote:
>=20
> The branch main has been updated by imp:
>=20
> URL: =
https://cgit.FreeBSD.org/src/commit/?id=3D320e7e0003dbc14ed3fc01b95532924c=
d3fbda7b
>=20
> 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
>=20
>    Revert "Fix cross-build support for Ubuntu 16.04"
>=20
>    This reverts commit d6327ae8c11b73765f100981baca49166b558b70.
>=20
>    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 =
extensions.
>=20
>    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 =
does
>    the subsetting thing. This will result in matching definitions and =
fix
>    clang 12.

This is the bit I still don=E2=80=99t understand and hoped the author =
would explain=E2=80=A6

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(-)
>=20
> 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 =
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 must =
be
> - * 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>




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B9243E0B-D840-41F9-A800-714E2E1AC2B7>