tools/nolibc: fix missing includes causing build issues at -O0
authorWilly Tarreau <w@1wt.eu>
Mon, 9 Jan 2023 07:54:40 +0000 (08:54 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Feb 2023 07:34:31 +0000 (08:34 +0100)
commitf3b7893078ca1e6b17a0b2501544ed4f8d9f8ef8
treee6af5bc393665d4e44c1501d406cff7bb2628b1b
parent338ec07a14cd82d9962b9d5f8b7d599864747ccd
tools/nolibc: fix missing includes causing build issues at -O0

[ Upstream commit 55abdd1f5e1e07418bf4a46c233a92f83cb5ae97 ]

After the nolibc includes were split to facilitate portability from
standard libcs, programs that include only what they need may miss
some symbols which are needed by libgcc. This is the case for raise()
which is needed by the divide by zero code in some architectures for
example.

Regardless, being able to include only the apparently needed files is
convenient.

Instead of trying to move all exported definitions to a single file,
since this can change over time, this patch takes another approach
consisting in including the nolibc header at the end of all standard
include files. This way their types and functions are already known
at the moment of inclusion, and including any single one of them is
sufficient to bring all the required ones.

Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/include/nolibc/ctype.h
tools/include/nolibc/errno.h
tools/include/nolibc/signal.h
tools/include/nolibc/stdio.h
tools/include/nolibc/stdlib.h
tools/include/nolibc/string.h
tools/include/nolibc/sys.h
tools/include/nolibc/time.h
tools/include/nolibc/types.h
tools/include/nolibc/unistd.h