linux/tools/include/nolibc
Willy Tarreau 556fb7131e tools/nolibc: avoid undesired casts in the __sysret() macro
Having __sysret() as an inline function has the unfortunate effect of
adding casts and large constants comparisons after the syscall returns
that significantly inflate some light code that's otherwise syscall-
heavy. Even nolibc-test grew by ~1%.

Let's switch back to a macro for this, and use it only with signed
arguments. Note that it is also possible to design a slightly more
complex macro covering unsigned and pointers but we only have 3 such
syscalls so it is pointless, and these were just addressed not to use
this macro anymore. Now for the argument (the local variable containing
the syscall return value), any negative value is an error, that results
in -1 being returned and errno to be assigned the opposite value.

This may be revisited again in the future if really needed but for now
let's get back to something sane.

Fixes: 428905da6e ("tools/nolibc: sys.h: add a syscall return helper")
Link: https://lore.kernel.org/lkml/20230806095846.GB10627@1wt.eu/
Link: https://lore.kernel.org/lkml/ZNKOJY+g66nkIyvv@1wt.eu/
Cc: Zhangjin Wu <falcon@tinylab.org>
Cc: David Laight <David.Laight@ACULAB.COM>
Cc: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Willy Tarreau <w@1wt.eu>
2023-08-23 05:17:07 +02:00
..
.gitignore tools/nolibc: Add gitignore to avoid git complaints about sysroot 2023-03-20 08:45:21 -07:00
arch-aarch64.h tools/nolibc: aarch64: shrink _start with _start_c 2023-08-23 04:40:22 +02:00
arch-arm.h tools/nolibc: arm: shrink _start with _start_c 2023-08-23 04:40:22 +02:00
arch-i386.h tools/nolibc: i386: shrink _start with _start_c 2023-08-23 04:40:22 +02:00
arch-loongarch.h tools/nolibc: loongarch: shrink _start with _start_c 2023-08-23 04:40:22 +02:00
arch-mips.h tools/nolibc: mips: shrink _start with _start_c 2023-08-23 04:40:22 +02:00
arch-powerpc.h tools/nolibc: silence ppc64 compile warnings 2023-08-23 05:17:07 +02:00
arch-riscv.h tools/nolibc: riscv: shrink _start with _start_c 2023-08-23 04:40:22 +02:00
arch-s390.h tools/nolibc: s390: shrink _start with _start_c 2023-08-23 04:40:22 +02:00
arch-x86_64.h tools/nolibc: x86_64: shrink _start with _start_c 2023-08-23 04:40:22 +02:00
arch.h tools/nolibc: add support for powerpc 2023-08-23 05:17:07 +02:00
compiler.h tools/nolibc: fix segfaults on compilers without attribute no_stack_protector 2023-06-09 11:46:08 -07:00
crt.h tools/nolibc: stackprotector.h: make __stack_chk_init static 2023-08-23 05:17:07 +02:00
ctype.h tools/nolibc: fix missing includes causing build issues at -O0 2023-01-09 09:36:05 -08:00
errno.h tools/nolibc: make errno a weak symbol instead of a static one 2023-01-10 13:33:55 -08:00
Makefile tools/nolibc: add new crt.h with _start_c 2023-08-23 04:40:22 +02:00
nolibc.h tools/nolibc: add missing my_syscall6() for mips 2023-08-23 04:38:02 +02:00
signal.h tools/nolibc: fix missing includes causing build issues at -O0 2023-01-09 09:36:05 -08:00
stackprotector.h tools/nolibc: stackprotector.h: make __stack_chk_init static 2023-08-23 05:17:07 +02:00
std.h tools/nolibc: add stdint.h 2023-03-20 08:45:21 -07:00
stdint.h tools/nolibc: stdint: use __SIZE_TYPE__ for size_t 2023-08-23 05:17:07 +02:00
stdio.h tools/nolibc: setvbuf: avoid unused parameter warnings 2023-08-23 05:17:07 +02:00
stdlib.h tools/nolibc: completely remove optional environ support 2023-08-23 04:40:22 +02:00
string.h tools/nolibc: use standard __asm__ statements 2023-06-09 11:46:07 -07:00
sys.h tools/nolibc: avoid undesired casts in the __sysret() macro 2023-08-23 05:17:07 +02:00
time.h tools/nolibc: fix missing includes causing build issues at -O0 2023-01-09 09:36:05 -08:00
types.h tools/nolibc: remove the old sys_stat support 2023-08-23 04:40:22 +02:00
unistd.h tools/nolibc: unistd.h: reorder the syscall macros 2023-08-06 12:27:53 +02:00