linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Zhangjin Wu <falcon@tinylab.org>
To: thomas@t-8ch.de, w@1wt.eu
Cc: falcon@tinylab.org, arnd@arndb.de, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, linux-riscv@lists.infradead.org
Subject: [PATCH v1 00/11] tools/nolibc: shrink arch support
Date: Thu, 29 Jun 2023 02:50:41 +0800	[thread overview]
Message-ID: <cover.1687976753.git.falcon@tinylab.org> (raw)

Hi,

This patchset further improves porting of nolibc to new architectures,
it is based on our previous v5 sysret helper series [1].

It mainly shrinks the assembly _start by moving most of its operations
to a C version of _start_c() function. and also, it removes the old
sys_stat() support by using the sys_statx() instead and therefore,
removes all of the arch specific sys_stat_struct.

Tested 'run' on all of the supported architectures:

               arch/board | result
              ------------|------------
          arm/vexpress-a9 | 141 test(s) passed, 1 skipped, 0 failed. See all results in /labs/linux-lab/logging/nolibc/arm-vexpress-a9-nolibc-test.log
                 arm/virt | 141 test(s) passed, 1 skipped, 0 failed. See all results in /labs/linux-lab/logging/nolibc/arm-virt-nolibc-test.log
             aarch64/virt | 141 test(s) passed, 1 skipped, 0 failed. See all results in /labs/linux-lab/logging/nolibc/aarch64-virt-nolibc-test.log
              ppc/g3beige | not supported
              ppc/ppce500 | not supported
                  i386/pc | 141 test(s) passed, 1 skipped, 0 failed. See all results in /labs/linux-lab/logging/nolibc/i386-pc-nolibc-test.log
                x86_64/pc | 141 test(s) passed, 1 skipped, 0 failed. See all results in /labs/linux-lab/logging/nolibc/x86_64-pc-nolibc-test.log
             mipsel/malta | 141 test(s) passed, 1 skipped, 0 failed. See all results in /labs/linux-lab/logging/nolibc/mipsel-malta-nolibc-test.log
         loongarch64/virt | 141 test(s) passed, 1 skipped, 0 failed. See all results in /labs/linux-lab/logging/nolibc/loongarch64-virt-nolibc-test.log
             riscv64/virt | 141 test(s) passed, 1 skipped, 0 failed. See all results in /labs/linux-lab/logging/nolibc/riscv64-virt-nolibc-test.log
             riscv32/virt | 119 test(s) passed, 1 skipped, 22 failed. See all results in /labs/linux-lab/logging/nolibc/riscv32-virt-nolibc-test.log
    s390x/s390-ccw-virtio | 141 test(s) passed, 1 skipped, 0 failed. See all results in /labs/linux-lab/logging/nolibc/s390x-s390-ccw-virtio-nolibc-test.log

  Notes:
  - ppc support are ready locally, will be sent out later.
  - full riscv32/virt support are ready locally, will be sent out later.

Changes:

* tools/nolibc: remove old arch specific stat support

    Just like the __NR_statx we used in nolibc-test.c, Let's only
    reserve sys_statx() and use it to implement the stat() function.

    Remove the old sys_stat() and sys_stat_struct completely.

* tools/nolibc: add new crt.h with _start_c

    A new C version of _start_c() is added to only require a 'sp' argument
    and find the others (argc, argv, envp/environ, auxv) for us in C.

* tools/nolibc: include crt.h before arch.h

    Include crt.h before arch.h to let _start() be able to call the new
    added _start_c() in arch-<ARCH>.h.

* tools/nolibc: arm: shrink _start with _start_c
  tools/nolibc: aarch64: shrink _start with _start_c
  tools/nolibc: i386: shrink _start with _start_c
  tools/nolibc: x86_64: shrink _start with _start_c
  tools/nolibc: mips: shrink _start with _start_c
  tools/nolibc: loongarch: shrink _start with _start_c
  tools/nolibc: riscv: shrink _start with _start_c
  tools/nolibc: s390: shrink _start with _start_c

    Move most of the operations from the assembly _start() to the C
    _start_c(), only require to do minimal operations in assembly _start
    now.

With this patchset, porting nolibc to a new architecture become easier,
the powerpc porting will be added later.

Best regards,
Zhangjin
---
[1]: https://lore.kernel.org/lkml/cover.1687957589.git.falcon@tinylab.org/

Zhangjin Wu (11):
  tools/nolibc: remove old arch specific stat support
  tools/nolibc: add new crt.h with _start_c
  tools/nolibc: include crt.h before arch.h
  tools/nolibc: arm: shrink _start with _start_c
  tools/nolibc: aarch64: shrink _start with _start_c
  tools/nolibc: i386: shrink _start with _start_c
  tools/nolibc: x86_64: shrink _start with _start_c
  tools/nolibc: mips: shrink _start with _start_c
  tools/nolibc: loongarch: shrink _start with _start_c
  tools/nolibc: riscv: shrink _start with _start_c
  tools/nolibc: s390: shrink _start with _start_c

 tools/include/nolibc/Makefile         |  1 +
 tools/include/nolibc/arch-aarch64.h   | 53 ++----------------
 tools/include/nolibc/arch-arm.h       | 79 ++-------------------------
 tools/include/nolibc/arch-i386.h      | 58 +++-----------------
 tools/include/nolibc/arch-loongarch.h | 42 ++------------
 tools/include/nolibc/arch-mips.h      | 73 +++----------------------
 tools/include/nolibc/arch-riscv.h     | 65 ++--------------------
 tools/include/nolibc/arch-s390.h      | 60 ++------------------
 tools/include/nolibc/arch-x86_64.h    | 54 ++----------------
 tools/include/nolibc/crt.h            | 57 +++++++++++++++++++
 tools/include/nolibc/nolibc.h         |  1 +
 tools/include/nolibc/signal.h         |  1 +
 tools/include/nolibc/stdio.h          |  1 +
 tools/include/nolibc/stdlib.h         |  1 +
 tools/include/nolibc/sys.h            | 64 ++++------------------
 tools/include/nolibc/time.h           |  1 +
 tools/include/nolibc/types.h          |  4 +-
 tools/include/nolibc/unistd.h         |  1 +
 18 files changed, 122 insertions(+), 494 deletions(-)
 create mode 100644 tools/include/nolibc/crt.h

-- 
2.25.1


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

             reply	other threads:[~2023-06-28 18:51 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-28 18:50 Zhangjin Wu [this message]
2023-06-28 18:51 ` [PATCH v1 01/11] tools/nolibc: remove old arch specific stat support Zhangjin Wu
2023-06-28 18:53 ` [PATCH v1 02/11] tools/nolibc: add new crt.h with _start_c Zhangjin Wu
2023-06-28 18:54 ` [PATCH v1 03/11] tools/nolibc: include crt.h before arch.h Zhangjin Wu
2023-07-02 18:57   ` Thomas Weißschuh
2023-07-03  9:58     ` Zhangjin Wu
2023-07-03 10:11       ` Thomas Weißschuh
2023-07-03 14:55         ` Zhangjin Wu
2023-06-28 18:55 ` [PATCH v1 04/11] tools/nolibc: arm: shrink _start with _start_c Zhangjin Wu
2023-06-28 18:57 ` [PATCH v1 05/11] tools/nolibc: aarch64: " Zhangjin Wu
2023-06-28 18:58 ` [PATCH v1 06/11] tools/nolibc: i386: " Zhangjin Wu
2023-06-28 18:59 ` [PATCH v1 07/11] tools/nolibc: x86_64: " Zhangjin Wu
2023-06-28 19:01 ` [PATCH v1 08/11] tools/nolibc: mips: " Zhangjin Wu
2023-06-28 19:02 ` [PATCH v1 09/11] tools/nolibc: loongarch: " Zhangjin Wu
2023-06-28 19:04 ` [PATCH v1 10/11] tools/nolibc: riscv: " Zhangjin Wu
2023-06-28 19:06 ` [PATCH v1 11/11] tools/nolibc: s390: " Zhangjin Wu

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=cover.1687976753.git.falcon@tinylab.org \
    --to=falcon@tinylab.org \
    --cc=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=thomas@t-8ch.de \
    --cc=w@1wt.eu \
    /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;
as well as URLs for NNTP newsgroup(s).