Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: Zhangjin Wu <falcon@tinylab.org>
Cc: arnd@arndb.de, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, thomas@t-8ch.de
Subject: Re: [PATCH v4 00/18] tools/nolibc: shrink arch support
Date: Sun, 16 Jul 2023 06:50:15 +0200	[thread overview]
Message-ID: <20230716045015.GA28761@1wt.eu> (raw)
In-Reply-To: <20230716011744.499597-1-falcon@tinylab.org>

On Sun, Jul 16, 2023 at 09:17:44AM +0800, Zhangjin Wu wrote:
> > I finally found that it's due to the lack of -Isysroot/x86/include, so
> > it used to get linux includes from those provided by glibc and these ones
> > were missing statx since packaged for an older kernel.
> >
> 
> So, your local glibc may be older than 2.28 (The one we mentioned in the
> commit message who supports statx)? mine 2.31 glibc is ok:

Oh definitely! It's a 2.23, and on another machine I'm having a 2.27
on an ubuntu 18 but it was built against a more recent kernel so its
linux/stat.h has the required entries, and on another one I'm having
a 2.17 which was built against a 3.10 kernel.

> For older Linux systems without a newer libc may really require the
> installation of the linux sysroot (linux/uapi).

Yes. My point was that it wasn't very hard to already spot breakage
on existing code built on existing setups.

> > I knew that sooner or later I'd have to reinstall this machine but I
> > can't get out of my head that to date I have yet not been convinced by
> > the absolute necessity of this modification which is progressively adding
> > more burden :-/  Time will tell...
> >
> 
> This may also let us think about the removing of <linux/xxx.h> from our
> nolibc headers? just like musl does ;-)
> 
>     $ grep "include <linux" -ur ../../../include/nolibc/
>     ../../../include/nolibc/stdlib.h:#include <linux/auxvec.h>
>     ../../../include/nolibc/sys.h:#include <linux/fs.h>
>     ../../../include/nolibc/sys.h:#include <linux/loop.h>
>     ../../../include/nolibc/sys.h:#include <linux/time.h>
>     ../../../include/nolibc/sys.h:#include <linux/auxvec.h>
>     ../../../include/nolibc/sys.h:#include <linux/fcntl.h> /* for O_* and AT_* */
>     ../../../include/nolibc/sys.h:#include <linux/stat.h>  /* for statx() */
>     ../../../include/nolibc/sys.h:#include <linux/prctl.h>
>     ../../../include/nolibc/types.h:#include <linux/mman.h>
>     ../../../include/nolibc/types.h:#include <linux/reboot.h> /* for LINUX_REBOOT_* */
>     ../../../include/nolibc/types.h:#include <linux/stat.h>
>     ../../../include/nolibc/types.h:#include <linux/time.h>
> 
> If simply put all of them to types.h, it may be too much, a new "sys/"
> directory with almost the same Linux type files may be required, but as
> an in-kernel libc, this duplication may be a "big" issue too, so, adding
> minimal required macros and structs in types.h may be another choice.
(...)
> The required new macros and structs may be around 100-300 lines? but it may
> help to avoid the installation of sysroot completely and also avoid the cross
> including the linux-libc-dev package used by glibc?

No, really, that's what we used to do previously. If you remember we
recently removed lots of structs and defines from various files because
they used to regularly conflict with linux/foo.h (that we can't prevent
users from including), while not always being 100% up-to-date. It's
particularly annoying when there are typedefs for example because it's
difficult to detect them, and if you redefine them you end up with build
errors. We should only keep that for absolute necessity. In fact, maybe
we could have these few ones precisely for statx, right after including
linux/stat.h (which is supposed to provide them):

  #ifndef STATX_BASIC_STATS
    /* pre-4.10 linux uapi headers present, missing statx that we need */
    #define STATX_BASIC_STATS xxx
    struct statx {
        ...
    };
  #endif

I may give this a try to see if it's sufficient to fix the build on
these machines. But it's not critical anyway. I might try once I'm
bored of seeing build failures.

Cheers,
Willy

      reply	other threads:[~2023-07-16  4:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-15 18:16 [PATCH v4 00/18] tools/nolibc: shrink arch support Zhangjin Wu
2023-07-15 18:17 ` [PATCH v4 01/18] tools/nolibc: arch-*.h: add missing space after ',' Zhangjin Wu
2023-07-15 18:18 ` [PATCH v4 02/18] tools/nolibc: fix up startup failures for -O0 under gcc < 11.1.0 Zhangjin Wu
2023-07-15 18:20 ` [PATCH v4 03/18] tools/nolibc: remove the old sys_stat support Zhangjin Wu
2023-07-15 18:21 ` [PATCH v4 04/18] tools/nolibc: add new crt.h with _start_c Zhangjin Wu
2023-07-15 18:22 ` [PATCH v4 05/18] tools/nolibc: stackprotector.h: add empty __stack_chk_init for !_NOLIBC_STACKPROTECTOR Zhangjin Wu
2023-07-15 18:23 ` [PATCH v4 06/18] tools/nolibc: crt.h: initialize stack protector Zhangjin Wu
2023-07-15 18:24 ` [PATCH v4 07/18] tools/nolibc: arm: shrink _start with _start_c Zhangjin Wu
2023-07-15 18:25 ` [PATCH v4 08/18] tools/nolibc: aarch64: " Zhangjin Wu
2023-07-15 18:26 ` [PATCH v4 09/18] tools/nolibc: i386: " Zhangjin Wu
2023-07-15 18:27 ` [PATCH v4 10/18] tools/nolibc: x86_64: " Zhangjin Wu
2023-07-15 18:28 ` [PATCH v4 11/18] tools/nolibc: mips: " Zhangjin Wu
2023-07-15 18:30 ` [PATCH v4 12/18] tools/nolibc: loongarch: " Zhangjin Wu
2023-07-15 18:31 ` [PATCH v4 13/18] tools/nolibc: riscv: " Zhangjin Wu
2023-07-15 18:32 ` [PATCH v4 14/18] tools/nolibc: s390: " Zhangjin Wu
2023-07-15 18:33 ` [PATCH v4 15/18] selftests/nolibc: add EXPECT_PTRGE, EXPECT_PTRGT, EXPECT_PTRLE, EXPECT_PTRLT Zhangjin Wu
2023-07-15 18:34 ` [PATCH v4 16/18] selftests/nolibc: add testcases for startup code Zhangjin Wu
2023-07-15 18:35 ` [PATCH v4 17/18] selftests/nolibc: allow run nolibc-test locally Zhangjin Wu
2023-07-15 18:36 ` [PATCH v4 18/18] selftests/nolibc: allow test -include /path/to/nolibc.h Zhangjin Wu
2023-07-15 22:26 ` [PATCH v4 00/18] tools/nolibc: shrink arch support Willy Tarreau
2023-07-16  1:17   ` Zhangjin Wu
2023-07-16  4:50     ` Willy Tarreau [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230716045015.GA28761@1wt.eu \
    --to=w@1wt.eu \
    --cc=arnd@arndb.de \
    --cc=falcon@tinylab.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=thomas@t-8ch.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox