Hi, Willy
This is v2 of the "tools/nolibc: shrink arch support" [1].
This v2 has no core code logic change, but applies some suggestions from Willy and Thomas, one is using post-whitespaces instead of post-tab, another is restructuring the arch support directory and files [2].
Like musl, this v2 creates <ARCH> directory for every arch and splits the old arch-<ARCH>.h to <ARCH>/{crt.h, sys.h} and at the same time, splits the old arch.h to crt_arch.h and sys_arch.h. at last, only need to include crt_arch.h in crt.h and sys_arch.h in sys.h respectively, and no longer need to include arch.h in the other common headers:
crt.h <-- crt_arch.h <-- <ARCH>/crt.h sys.h <-- sys_arch.h <-- <ARCH>/sys.h
It is based on the 20230705-nolibc-series2 branch of nolibc repo [3]. It should be applied after the v6 __sysret helper series [4] and the v4 min config support series [5].
Here is the test report for all of the supported architectures:
arch/board | result ------------|------------ arm/vexpress-a9 | 142 test(s) passed, 1 skipped, 0 failed. arm/virt | 142 test(s) passed, 1 skipped, 0 failed. aarch64/virt | 142 test(s) passed, 1 skipped, 0 failed. ppc/g3beige | not supported ppc/ppce500 | not supported i386/pc | 142 test(s) passed, 1 skipped, 0 failed. x86_64/pc | 142 test(s) passed, 1 skipped, 0 failed. mipsel/malta | 142 test(s) passed, 1 skipped, 0 failed. loongarch64/virt | 142 test(s) passed, 1 skipped, 0 failed. riscv64/virt | 142 test(s) passed, 1 skipped, 0 failed. riscv32/virt | 0 test(s) passed, 0 skipped, 0 failed. s390x/s390-ccw-virtio | 142 test(s) passed, 1 skipped, 0 failed.
Changes from v1 --> v2:
* tools/nolibc: rename arch-<ARCH>.h to <ARCH>/arch.h tools/nolibc: split arch.h to crt.h and sys.h
Restruct the arch support directory and files.
Fix up the errors reported by scripts/checkpatch.pl.
* tools/nolibc: sys.h: remove the old sys_stat support
Rebase on the new arch support directory and files.
* tools/nolibc: crt.h: add _start_c
Move #include "compiler.h" in the common crt.h too.
* tools/nolibc: arm/crt.h: shrink _start with _start_c tools/nolibc: aarch64/crt.h: shrink _start with _start_c tools/nolibc: i386/crt.h: shrink _start with _start_c tools/nolibc: x86_64/crt.h: shrink _start with _start_c tools/nolibc: mips/crt.h: shrink _start with _start_c tools/nolibc: loongarch/crt.h: shrink _start with _start_c tools/nolibc: riscv/crt.h: shrink _start with _start_c tools/nolibc: s390/crt.h: shrink _start with _start_c
Rebase on the new arch support directory and files.
Use post-whitespaces instead of post-tab.
Best regards, Zhangjin --- [1]: https://lore.kernel.org/lkml/cover.1687976753.git.falcon@tinylab.org/ [2]: https://lore.kernel.org/lkml/20230703145500.500460-1-falcon@tinylab.org/ [3]: https://git.kernel.org/pub/scm/linux/kernel/git/wtarreau/nolibc.git [4]: https://lore.kernel.org/lkml/cover.1688739492.git.falcon@tinylab.org/ [5]: https://lore.kernel.org/lkml/cover.1688750763.git.falcon@tinylab.org/
Zhangjin Wu (12): tools/nolibc: rename arch-<ARCH>.h to <ARCH>/arch.h tools/nolibc: split arch.h to crt.h and sys.h tools/nolibc: sys.h: remove the old sys_stat support tools/nolibc: crt.h: add _start_c tools/nolibc: arm/crt.h: shrink _start with _start_c tools/nolibc: aarch64/crt.h: shrink _start with _start_c tools/nolibc: i386/crt.h: shrink _start with _start_c tools/nolibc: x86_64/crt.h: shrink _start with _start_c tools/nolibc: mips/crt.h: shrink _start with _start_c tools/nolibc: loongarch/crt.h: shrink _start with _start_c tools/nolibc: riscv/crt.h: shrink _start with _start_c tools/nolibc: s390/crt.h: shrink _start with _start_c
tools/include/nolibc/Makefile | 36 ++++--- tools/include/nolibc/aarch64/crt.h | 24 +++++ .../nolibc/{arch-aarch64.h => aarch64/sys.h} | 68 +------------ tools/include/nolibc/arch.h | 36 ------- tools/include/nolibc/arm/crt.h | 25 +++++ .../include/nolibc/{arch-arm.h => arm/sys.h} | 96 +------------------ tools/include/nolibc/crt.h | 60 ++++++++++++ tools/include/nolibc/crt_arch.h | 32 +++++++ tools/include/nolibc/i386/crt.h | 33 +++++++ .../nolibc/{arch-i386.h => i386/sys.h} | 77 +-------------- tools/include/nolibc/loongarch/crt.h | 30 ++++++ .../{arch-loongarch.h => loongarch/sys.h} | 64 +------------ tools/include/nolibc/mips/crt.h | 32 +++++++ .../nolibc/{arch-mips.h => mips/sys.h} | 87 +---------------- tools/include/nolibc/nolibc.h | 2 +- tools/include/nolibc/riscv/crt.h | 28 ++++++ .../nolibc/{arch-riscv.h => riscv/sys.h} | 83 +--------------- tools/include/nolibc/s390/crt.h | 21 ++++ .../nolibc/{arch-s390.h => s390/sys.h} | 74 +------------- tools/include/nolibc/signal.h | 1 - tools/include/nolibc/stdio.h | 1 - tools/include/nolibc/stdlib.h | 2 +- tools/include/nolibc/sys.h | 65 +++---------- tools/include/nolibc/sys_arch.h | 32 +++++++ tools/include/nolibc/time.h | 1 - tools/include/nolibc/types.h | 4 +- tools/include/nolibc/unistd.h | 1 - tools/include/nolibc/x86_64/crt.h | 33 +++++++ .../nolibc/{arch-x86_64.h => x86_64/sys.h} | 74 +------------- 29 files changed, 421 insertions(+), 701 deletions(-) create mode 100644 tools/include/nolibc/aarch64/crt.h rename tools/include/nolibc/{arch-aarch64.h => aarch64/sys.h} (76%) delete mode 100644 tools/include/nolibc/arch.h create mode 100644 tools/include/nolibc/arm/crt.h rename tools/include/nolibc/{arch-arm.h => arm/sys.h} (74%) create mode 100644 tools/include/nolibc/crt.h create mode 100644 tools/include/nolibc/crt_arch.h create mode 100644 tools/include/nolibc/i386/crt.h rename tools/include/nolibc/{arch-i386.h => i386/sys.h} (73%) create mode 100644 tools/include/nolibc/loongarch/crt.h rename tools/include/nolibc/{arch-loongarch.h => loongarch/sys.h} (73%) create mode 100644 tools/include/nolibc/mips/crt.h rename tools/include/nolibc/{arch-mips.h => mips/sys.h} (74%) create mode 100644 tools/include/nolibc/riscv/crt.h rename tools/include/nolibc/{arch-riscv.h => riscv/sys.h} (70%) create mode 100644 tools/include/nolibc/s390/crt.h rename tools/include/nolibc/{arch-s390.h => s390/sys.h} (68%) create mode 100644 tools/include/nolibc/sys_arch.h create mode 100644 tools/include/nolibc/x86_64/crt.h rename tools/include/nolibc/{arch-x86_64.h => x86_64/sys.h} (76%)