[RFC PATCH 0/4] tools/nolibc: add stdint and more integer types

From: Willy Tarreau
Date: Sun Feb 19 2023 - 13:51:59 EST


Hi Vincent,

I could finally work out the various issues. In short, all of the
problems came from the dependency on __WORDSIZE and the fact that
when not defined, the tests would default to the 32-bit ones. The
reason why it seldom worked was that some cross-compilers configured
to build for the same build and target arch do still mistakenly
include files from /usr/include and inadvertently get some glibc
entries. I changed these locations to rely on __SIZEOF_LONG__ instead
that's provided by the compiler and which I've tested to work fine
since pretty old compilers. For the values I've switched to __LONG_MAX__
that is also defined by the compiler, and this allows us to get rid
of the ifdef and hard-coded values in stdint.h.

Now everything works fine on all supported architectures.

I'd like you to have a look at this patch set, it's yours with
these small changes that I've commented before my s-o-b when
relevant. I would appreciate it if you could recheck everything,
possibly change some stuff if you think it's needed, and also
adjust your commit messages where relevant to match the final
state, dropping my own temporary comments and s-o-b that are
not needed.

One important note, I've based the patch on Paul's latest branch
named "dev.2023.02.06a" here:

https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git/

It contains the pending patches that will soon be submitted to Linus,
and support for the s390x platform that I wanted to confirm does work
fine as well. If you need to change some code, please rebase on this
branch before testing.

Thanks!
Willy

--
Vincent Dagonneau (4):
tools/nolibc: add stdint.h
tools/nolibc: add integer types and integer limit macros
tools/nolibc: enlarge column width of tests
tools/nolibc: add tests for the integer limits in stdint.h

tools/include/nolibc/Makefile | 4 +-
tools/include/nolibc/std.h | 15 +-
tools/include/nolibc/stdint.h | 75 ++++++++++
tools/testing/selftests/nolibc/nolibc-test.c | 141 ++++++++++++-------
4 files changed, 170 insertions(+), 65 deletions(-)
create mode 100644 tools/include/nolibc/stdint.h

--
2.35.3