Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19630987rwd; Wed, 28 Jun 2023 11:53:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5MKe1RaTwxogJSz0m0UtUTh6fM1TWX+BWkwwFk+phqLkfqqX1Cl67VkqY9+RHKz9mg4iS8 X-Received: by 2002:a05:6a20:914d:b0:122:e62d:dd0a with SMTP id x13-20020a056a20914d00b00122e62ddd0amr28688309pzc.26.1687978412773; Wed, 28 Jun 2023 11:53:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687978412; cv=none; d=google.com; s=arc-20160816; b=g0WyZby2pzg/6lcglnp+FErmp9fOF7tyFtd+3zjZ/Yobpj3iI1KBINihwsJBGqmoil 3Bk2XeIyMtifcp8OTpARjHWjqPzB8UgGXgBMN9jYbCnW+mfwepMgEwfFH18aCJxXvfUq vxY8irpbi/4KVrMJVQgNGwxvveenOPFCy7CH0q5PVP5ECBXBEVZJuJMUgg8Fa0himVk1 WgOH00y8PvSS2KLIq61onoSGQcTF6XQVL3RP6HeQdzDB31DqlVkVeZrUq80kMYxXJk5w q04lp0ROn7b0Wo/THyxZ8w+cQxwOHXCctbnD8RWac+5NaAgBVgrcd8+Xfn25Kbs4ZhoZ lSyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:feedback-id:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=XLIeu9cRGUvJNev42xpK1gnazsR0VcA7NgKljJ2RNyk=; fh=jGpRxxGHkcGZyN2ZnaDwhUy8S6joixew3DGGT1L/CuQ=; b=ZBCMI5X2ce0iNXLZAcULuB1w2zIlE0ioSDbf6WA0KKTHAwGfUo+m0L8YcUIrSTWq2P LBX66AkbmNeNaRYcgYYO1eF/G4PaBMRumapWbxzwEa/799YkWOH7A1CGBTb+sroyqn8J aKLPnBfWoJEFfpxgIyMgWObTL33QqWk5+rdiUyiMYuecNg/QBNuDgKj8cPCHerkMwj44 FPbqO/qvL8pJcl0Q5NDYSjlLv5xGI9RqunTKpz+uCVxXO8pZelF9Lx6XeZ5YHePmkb+x MDNxAFtLaAwVXU34HyEKjWdWXalmU5AYZRveKscKEW4ujc4fKJBYDyXn3KBB58ikrXvb kYeg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j64-20020a638b43000000b005487b44705asi10007765pge.93.2023.06.28.11.53.19; Wed, 28 Jun 2023 11:53:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232172AbjF1SvT (ORCPT + 99 others); Wed, 28 Jun 2023 14:51:19 -0400 Received: from bg4.exmail.qq.com ([43.154.54.12]:56757 "EHLO bg4.exmail.qq.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231974AbjF1SvA (ORCPT ); Wed, 28 Jun 2023 14:51:00 -0400 X-QQ-mid: bizesmtp76t1687978248tvmfh55f Received: from linux-lab-host.localdomain ( [116.30.129.193]) by bizesmtp.qq.com (ESMTP) with id ; Thu, 29 Jun 2023 02:50:47 +0800 (CST) X-QQ-SSF: 01200000000000D0W000000A0000000 X-QQ-FEAT: kNiroXLcbYfrJCsBI1sa5E6qtqNyNUUSAPAKfE1it5MbxZO/BaVe/duwUGXKF Sm9d/SAmlvYOT+pgc5igmBpIt9S2G4iKsnTlVXEvkaFaHcDNqBQzv2bSp41ULt8iIrDCCnw tdsdjVq+IbEYYN7LM3/MDZ3DnO9T5rDy+lL/Yyim/NFIp/+GQWL01mQEGU0Q3mRYtZNu00W BmFVKFq2OsmovkZ2/TLDlFljGX9E2juXwgQaKyXF/LfN8W1bXuZJYedEeHDWhOt5FMXxMwz 2SLVCGCFSefiq1H6yfNBBnHM0QEHRC068sGkE+J52h9ZMmARwFYG5Hn4/VSAttMSijYP9eS YlV97yWdOyNmZvtepGpyk/g7CsQIA== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 12319157307414105420 From: Zhangjin Wu 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 Message-Id: X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrsz:qybglogicsvrsz3a-3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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-.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