From patchwork Fri Aug 11 20:28:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 712995 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2DEAC001B0 for ; Fri, 11 Aug 2023 20:28:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235141AbjHKU2T (ORCPT ); Fri, 11 Aug 2023 16:28:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233761AbjHKU2S (ORCPT ); Fri, 11 Aug 2023 16:28:18 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C76718E; Fri, 11 Aug 2023 13:28:17 -0700 (PDT) X-QQ-mid: bizesmtp75t1691785691t4yqicvr Received: from linux-lab-host.localdomain ( [116.30.128.116]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 12 Aug 2023 04:28:10 +0800 (CST) X-QQ-SSF: 01200000000000E0X000000A0000000 X-QQ-FEAT: znfcQSa1hKbJ9heHmmVzurJmSlJJLoeDwqs0FEaF3zhu869c7ogKiel1aVx+X Kv+pwbFmZDvH0FSS9ijtxRM7IAWCdtyurnTuBb3lN033Z3QL4VtR0tqXqIclwSM0fX/3w9a N0t3GxnssBOW0NugqPIo+KahA8ePl/ObcHMx9ZmrS4annemGnwR1xFeOJrigsBEn3EuD+J/ dKW/i7CFRP+lNxzRfpODQhLnRe2pRUBQn62JrIufoGtGeqX+2ee/8zcQ8ELY+IhizaouPRP DmplbYpZ4Bh6I7pSABB3oQGuTa6nfJ0itfpigF+w2qHZzm1IOBUjfhr5wg4EVM+XA1Z8gTT VlQNQPbriL6c4ZA7YU1Dct30ciRce0GYcZOIE4km3Q7xMfFUxD0T8aLVBl69g== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 2177922128315101133 From: Zhangjin Wu To: falcon@tinylab.org, w@1wt.eu Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, tanyuan@tinylab.org, thomas@t-8ch.de Subject: [PATCH v2 1/7] selftests/nolibc: allow use x86_64 toolchain for i386 Date: Sat, 12 Aug 2023 04:28:09 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This allows to share the same x86_64 toolchain for i386 architecture. Pass '-m32' CFLAGS to tell x86_64 toolchains to generate i386 executable. Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 76c387a20811..98d0a619d49d 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -125,6 +125,7 @@ else Q=@ endif +CFLAGS_i386 = -m32 CFLAGS_ppc = -m32 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) CFLAGS_ppc64 = -m64 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) CFLAGS_ppc64le = -m64 -mlittle-endian -mno-vsx $(call cc-option,-mabi=elfv2) From patchwork Fri Aug 11 20:29:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 713686 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EBEBC001B0 for ; Fri, 11 Aug 2023 20:29:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233761AbjHKU31 (ORCPT ); Fri, 11 Aug 2023 16:29:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229610AbjHKU30 (ORCPT ); Fri, 11 Aug 2023 16:29:26 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BA66E4D; Fri, 11 Aug 2023 13:29:25 -0700 (PDT) X-QQ-mid: bizesmtp68t1691785759term9hyb Received: from linux-lab-host.localdomain ( [116.30.128.116]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 12 Aug 2023 04:29:18 +0800 (CST) X-QQ-SSF: 01200000000000E0X000000A0000000 X-QQ-FEAT: vrqOr+ppv0uBaIpwqqkyD2NSGBPtX6bqJ79M3tA90otUDH674hIAw+1qNu3L9 vlKc5wwueXdseNPhnpq/8OoJ0cA0Ny4Am8Bg6FJKDLNvkuw1GKGOwYe69FXvUG9Iu9vKiA0 PLY0Q3mjrBixGAkNsF6l0p49hRIgsamlJJaMt/Sn06SHuLvOxDVzbHoBfrA4KrG9jXZB4sS k5JqKi3YxbulBI0lEchTPI+bUziiuvxoRWwOw5LoEZwk9rvNEnCW/LegnmNEkXGlcKnIq3C UyqcKppdJw7fdoYxMuuxDOA6wBQBSV14Wk6+vBbmTccIyhkEch8p53V3jhTrog2zTIVdgFA jUudS9rNKYCNLQF0DWgzMvyCLIujgVrqg6Luy+dvgETDpmLhmui39X8p0pPEQ== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 9388448604258754597 From: Zhangjin Wu To: falcon@tinylab.org, w@1wt.eu Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, tanyuan@tinylab.org, thomas@t-8ch.de Subject: [PATCH v2 2/7] selftests/nolibc: allow use mips64 toolchain for mips Date: Sat, 12 Aug 2023 04:29:17 +0800 Message-Id: <954c9c14ddd37f8612db256ccde0efc26a300a2e.1691783604.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This allows to share the same mips64 toolchain for mips architecture. Pass '-mabi=32' CFLAGS to tell mips64 toolchains to generate 32-bit mips executable. Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 98d0a619d49d..d1012f006405 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -130,7 +130,7 @@ CFLAGS_ppc = -m32 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) CFLAGS_ppc64 = -m64 -mbig-endian -mno-vsx $(call cc-option,-mmultiple) CFLAGS_ppc64le = -m64 -mlittle-endian -mno-vsx $(call cc-option,-mabi=elfv2) CFLAGS_s390 = -m64 -CFLAGS_mips = -EL +CFLAGS_mips = -mabi=32 -EL CFLAGS_STACKPROTECTOR ?= $(call cc-option,-mstack-protector-guard=global $(call cc-option,-fstack-protector-all)) CFLAGS ?= -Os -fno-ident -fno-asynchronous-unwind-tables -std=c89 -W -Wall -Wextra \ $(call cc-option,-fno-stack-protector) \ From patchwork Fri Aug 11 20:30:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 712994 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEA8AC04A6A for ; Fri, 11 Aug 2023 20:30:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236346AbjHKUai (ORCPT ); Fri, 11 Aug 2023 16:30:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236268AbjHKUaf (ORCPT ); Fri, 11 Aug 2023 16:30:35 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 117F01AA; Fri, 11 Aug 2023 13:30:33 -0700 (PDT) X-QQ-mid: bizesmtp78t1691785827tsemri9j Received: from linux-lab-host.localdomain ( [116.30.128.116]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 12 Aug 2023 04:30:26 +0800 (CST) X-QQ-SSF: 01200000000000E0X000000A0000000 X-QQ-FEAT: wF64VgvUy+WoAQlv2m9G5Y88uxGUDDprvJilB8SvHjHKHiNt14cjKGDU5kCYV Ym1rdr5hCQVUIfi6gwz6mHVBIBtL2sQ65qAPzNYfwYZfkGcteIDXT4zYCXl9GXdvTOI7yKX zdiHiyKcn7rIhEeaVc3qz0iI3EdEtQYneR0OvElD4ZYImgCRrN3JsDyu+xbDE6lFTQMKrA8 /Opn5U6Hu8/tx8i3RhHKhUlgLTZ1m9JEHJYcWND1pCqQ2m8OGewOa18BQpgUoWf6Cgky+la y/hOc11BW9TKhhM1qgTIjeH+Bre0ZtXnPJuRR9tbcZVwMu/ye95is1TdhQhZCRNuLone5Nm dB4kBXmoDFcqsgZqwXUTWMi3SZbBEc3EPMtqGmtz7a/IHjZpPV189EJpUj8GQ== X-QQ-GoodBg: 0 X-BIZMAIL-ID: 950217989988851933 From: Zhangjin Wu To: falcon@tinylab.org, w@1wt.eu Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, tanyuan@tinylab.org, thomas@t-8ch.de Subject: [PATCH v2 3/7] selftests/nolibc: libc-test: use HOSTCC instead of CC Date: Sat, 12 Aug 2023 04:30:25 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org libc-test is mainly added to compare the behavior of nolibc to the system libc, it is meaningless and error-prone with cross compiling. Let's use HOSTCC instead of CC to avoid wrongly use cross compiler when CROSS_COMPILE is passed or customized. Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index d1012f006405..91ccfc27780f 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -191,7 +191,7 @@ nolibc-test: nolibc-test.c endif libc-test: nolibc-test.c - $(QUIET_CC)$(CC) -o $@ $< + $(QUIET_CC)$(HOSTCC) -o $@ $< # local libc-test run-libc-test: libc-test From patchwork Fri Aug 11 20:31:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 713685 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DA81C001B0 for ; Fri, 11 Aug 2023 20:31:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236442AbjHKUbn (ORCPT ); Fri, 11 Aug 2023 16:31:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236268AbjHKUbm (ORCPT ); Fri, 11 Aug 2023 16:31:42 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BBCE1AE; Fri, 11 Aug 2023 13:31:40 -0700 (PDT) X-QQ-mid: bizesmtp67t1691785895tgum3qxa Received: from linux-lab-host.localdomain ( [116.30.128.116]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 12 Aug 2023 04:31:34 +0800 (CST) X-QQ-SSF: 01200000002000E0X000B00A0000000 X-QQ-FEAT: lO87fmWkX3EYb0Z7DGgry/wBfLkTIiP63iqaOMGbl7n0jyIq9h0d3cq/ertgc MeIquG7TCOysshgbb7okgSY+I4eDb/L3IAFJfDNtB4nw+Sd4msegnZ52pFUcuEl26bSjI/k qO7LEfawsjRxaUHQsyEqK3tiDLQtQkb0/ITp7Hal1qOplMe+8blEjU0ba4cHzl9pI8XnIJN VYWTwBBDJ8UqZ1cHPJXYxB/+VJDc+r5wGpTHYeewjLk+weEJK+CY9TcKQp90AKIOrxxTcOo XM8oj3KBvlLdSv9b+9GcBL3i8saH5/eWxO6l67GXIkugSvVPTLDKpiy8AlbVZr8UqaOQovz syhlvGLM+GetFKNUyPVX+N/12H2wOPvpt7T5hZA39S055CVQii1oNoEop91X5G16hPmgCzG X-QQ-GoodBg: 0 X-BIZMAIL-ID: 18124793566430197416 From: Zhangjin Wu To: falcon@tinylab.org, w@1wt.eu Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, tanyuan@tinylab.org, thomas@t-8ch.de Subject: [PATCH v2 4/7] selftests/nolibc: allow customize CROSS_COMPILE by architecture Date: Sat, 12 Aug 2023 04:31:33 +0800 Message-Id: <3526b34a6ba674c978015a0e3a106e47dd524930.1691783604.git.falcon@tinylab.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Some cross compilers are not just prefixed with XARCH, customize them by architecture may simplify the test a lot, especially, when iterate with XARCH. After customizing this for every architecture or its variant, the minimal test argument will be architecture or variant itself, no CROSS_COMPILE required to be passed. If the prefix of installed cross compiler is not the same as the one customized, we can also pass CROSS_COMPILE as before or even pass CROSS_COMPILE_$(XARCH) and CC from command line. Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 91ccfc27780f..5aff60d31d72 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for nolibc tests -include ../../../scripts/Makefile.include # We need this for the "cc-option" macro. include ../../../build/Build.include @@ -55,6 +54,12 @@ IMAGE_loongarch = arch/loongarch/boot/vmlinuz.efi IMAGE = $(IMAGE_$(XARCH)) IMAGE_NAME = $(notdir $(IMAGE)) +# CROSS_COMPILE: cross toolchain prefix by architecture +CROSS_COMPILE ?= $(CROSS_COMPILE_$(XARCH)) + +# Make CC is always prefixed with $(CROSS_COMPILE) +include ../../../scripts/Makefile.include + # default kernel configurations that appear to be usable DEFCONFIG_i386 = defconfig DEFCONFIG_x86_64 = defconfig From patchwork Fri Aug 11 20:32:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 712993 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD9EAC001B0 for ; Fri, 11 Aug 2023 20:32:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230423AbjHKUcu (ORCPT ); Fri, 11 Aug 2023 16:32:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234601AbjHKUct (ORCPT ); Fri, 11 Aug 2023 16:32:49 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.155.65.254]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60B6518E; Fri, 11 Aug 2023 13:32:48 -0700 (PDT) X-QQ-mid: bizesmtp74t1691785963tp54ggzl Received: from linux-lab-host.localdomain ( [116.30.128.116]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 12 Aug 2023 04:32:42 +0800 (CST) X-QQ-SSF: 01200000002000E0X000B00A0000000 X-QQ-FEAT: +ynUkgUhZJmk+CmCBh8hIWz7kAw/TgBO6SK/g3i3wf3qZL1DjYMFDwQpLi61w QrkXy+r9OW+Wp8HSnO76LSPbMqIxJjDmNxbqur9WbAzA3u7JISFeDOMqkoP3lHEJ5IP2KxM Du26jloWTDgWRPDhYE9/4HWirH0fMkbvCfL6EZ4wPf1cb1JvrsIes1wxcxn+68Xbnmu9pBm JBvPHO54FvcVguAcMFURVp9vMhRE+3Sup3pat94nDCP8/cuAjBJyVjiUf4sdc1e0jTUU72q ZHXX5VNPFOTFwHQFW0QQSWlDlbAtn7Fs9uuxyDN6eN+WKgB8Cc9BC04muM4DpmI77vTSL51 X36+B3RYg6jr9B7+XZHLHVdQVUpSRMk/2cCM/Vxow6BufaIvYaRRIrp0jrcH82VKkxt6/yf X-QQ-GoodBg: 0 X-BIZMAIL-ID: 10532850792558521576 From: Zhangjin Wu To: falcon@tinylab.org, w@1wt.eu Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, tanyuan@tinylab.org, thomas@t-8ch.de Subject: [PATCH v2 5/7] selftests/nolibc: customize CROSS_COMPILE for all architectures Date: Sat, 12 Aug 2023 04:32:41 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This simplifies the 'make' commands for nolibc supported architectures, only requires the XARCH option now. As suggested by Willy, the small, newest and obtainable cross toolchains from [1] are customized by default, users must download, decompress and configure the bin/ path to the PATH environment variable manually. If still want to use a cross toolchain from local software repositories, we can also pass CROSS_COMPILE, CROSS_COMPILE_$(XARCH) or even CC from command line. After carefully install and configure $(CROSS_COMPILE_$(XARCH)), qemu-system-$(XARCH) and qemu-$(XARCH), it is able to run tests for the architectures or their variants like this: $ ARCHS="i386 x86_64 arm64 arm mips ppc ppc64 ppc64le riscv s390 loongarch" $ for arch in ${ARCHS[@]}; do printf "%9s: " $arch; make run-user XARCH=$arch | grep status; done $ for arch in ${ARCHS[@]}; do printf "%9s: " $arch; make defconfig run XARCH=$arch | grep status; done [1]: https://mirrors.edge.kernel.org/pub/tools/crosstool/ Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 5aff60d31d72..9a787fdf9842 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -55,6 +55,27 @@ IMAGE = $(IMAGE_$(XARCH)) IMAGE_NAME = $(notdir $(IMAGE)) # CROSS_COMPILE: cross toolchain prefix by architecture +# +# Notes, +# - The small, newest and obtainable cross toolchains from [1] are recommended, +# Please download, decompress and add the bin/ path to 'PATH' env variable +# - To use another cross compiler, pass 'CROSS_COMPLE', 'CROSS_COMPILE_$(XARCH)' +# by variant or even 'CC' from command line +# +# [1]: https://mirrors.edge.kernel.org/pub/tools/crosstool/ + +CROSS_COMPILE_i386 ?= x86_64-linux- +CROSS_COMPILE_x86_64 ?= x86_64-linux- +CROSS_COMPILE_x86 ?= x86_64-linux- +CROSS_COMPILE_arm64 ?= aarch64-linux- +CROSS_COMPILE_arm ?= arm-linux-gnueabi- +CROSS_COMPILE_mips ?= mips64-linux- +CROSS_COMPILE_ppc ?= powerpc64-linux- +CROSS_COMPILE_ppc64 ?= powerpc64-linux- +CROSS_COMPILE_ppc64le ?= powerpc64-linux- +CROSS_COMPILE_riscv ?= riscv64-linux- +CROSS_COMPILE_s390 ?= s390-linux- +CROSS_COMPILE_loongarch ?= loongarch64-linux- CROSS_COMPILE ?= $(CROSS_COMPILE_$(XARCH)) # Make CC is always prefixed with $(CROSS_COMPILE) From patchwork Fri Aug 11 20:33:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 713684 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 377E7C001B0 for ; Fri, 11 Aug 2023 20:33:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233523AbjHKUd5 (ORCPT ); Fri, 11 Aug 2023 16:33:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230153AbjHKUd5 (ORCPT ); Fri, 11 Aug 2023 16:33:57 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B747618B; Fri, 11 Aug 2023 13:33:55 -0700 (PDT) X-QQ-mid: bizesmtp88t1691786030ts4c8dvh Received: from linux-lab-host.localdomain ( [116.30.128.116]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 12 Aug 2023 04:33:49 +0800 (CST) X-QQ-SSF: 01200000002000E0X000B00A0000000 X-QQ-FEAT: +ynUkgUhZJl3WY6C5uvcvVVodeorT98CN4gBSPLs8ljQvf3SUgVweUZ5odeml jBoWGtzPGyigtk2lzzaV7dxp7YDXE01eLeKimDced/7TqZeA5MPIXnVYtl7X7Yc70WHEHT9 oiSr6ElMCxKbjQupSBxnAp0jY7+jQL64ADS4h8g7YttibF5eRAxDTxOjNZ03RheQ4nQMqR8 iR+6GG/xBozmKozu0CMuk7+4aKKhj0kESIDRfcuAJvIj9N1bs/IAwLvaW4MgfaEK9A4Ouw1 4wVjmg/GcO2mePQLGWdPVuVl5m7ZWm40EqkqpNtpDUN4gxHz1aic0MilaOmfiMI6zIAPYaw Ulfngh8zC1LMBSK6aVyEIiEPKyJOzYI8ugrt/qxlFQdSQXIgydbsCeo5vnZ/I9Q+HVqUkUV X-QQ-GoodBg: 0 X-BIZMAIL-ID: 17079127722739655232 From: Zhangjin Wu To: falcon@tinylab.org, w@1wt.eu Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, tanyuan@tinylab.org, thomas@t-8ch.de Subject: [PATCH v2 6/7] selftests/nolibc: import cc-cross-prefix macro Date: Sat, 12 Aug 2023 04:33:48 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org cc-cross-prefix is required to return first where a gcc is found in PATH, this allows to customize more than one cross compiler. Since scripts/Makefile.compiler provides cc-option too, let's use it instead of tools/build/Build.include. Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 9a787fdf9842..7687988c780b 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 # Makefile for nolibc tests -# We need this for the "cc-option" macro. -include ../../../build/Build.include +# We need this for the "cc-option" and "cc-cross-prefix" macros. +include ../../../../scripts/Makefile.compiler # we're in ".../tools/testing/selftests/nolibc" ifeq ($(srctree),) From patchwork Fri Aug 11 20:34:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangjin Wu X-Patchwork-Id: 712992 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A19BBC001B0 for ; Fri, 11 Aug 2023 20:35:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236199AbjHKUfE (ORCPT ); Fri, 11 Aug 2023 16:35:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230153AbjHKUfE (ORCPT ); Fri, 11 Aug 2023 16:35:04 -0400 Received: from bg4.exmail.qq.com (bg4.exmail.qq.com [43.154.54.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 531C51AA; Fri, 11 Aug 2023 13:35:03 -0700 (PDT) X-QQ-mid: bizesmtp75t1691786097t68neb4h Received: from linux-lab-host.localdomain ( [116.30.128.116]) by bizesmtp.qq.com (ESMTP) with id ; Sat, 12 Aug 2023 04:34:56 +0800 (CST) X-QQ-SSF: 01200000002000E0X000B00A0000000 X-QQ-FEAT: X8eDqSQ5BkoKQePf2zVu8YMMFfNFjgBgxrLs2bAsPeoLTEUbzreCZd+1mSd20 7U3TEs36Uo9gkL4FqLIEZtzmKcjTET+hKQVgGRen90EEjks1kEZ2RdYJHJ1K60hBz0ekXsq EwXwQaUkkaWjEQ4/xwiAcD4sJvBPi62L6Xt0+/7eZgk2y5ce5xWUfnAWqTvsrWBuO+hsPvh Y0z7i6GriAoG00RsA3sB2j1wNDC2I8o71hN2UdMxANB5rFiESNUYMZ/TjksRcXH0HVuOJiJ Zil6yT8ZDR7IGL5eEb0DLZ9z4yr1ziQS6AH8YcVZLVzTVw/Oekri+azHmh87U2b8mZR/dLp 7Zq35cw61OiwR9RAEyzQq7vw06R9hH//KTJUlbFHGiHhhcr4R+2DsEczjk/zuqG2BtqLzYB X-QQ-GoodBg: 0 X-BIZMAIL-ID: 10952256110585604528 From: Zhangjin Wu To: falcon@tinylab.org, w@1wt.eu Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, tanyuan@tinylab.org, thomas@t-8ch.de Subject: [PATCH v2 7/7] selftests/nolibc: allow use cross toolchains from software repository Date: Sat, 12 Aug 2023 04:34:55 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:tinylab.org:qybglogicsvrgz:qybglogicsvrgz5a-1 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org This allows users to install and use cross toolchains from local software repositories. The prefixes of local cross toolchains are appended to the CROSS_COMPILE_$(XARCH) list, cc-cross-prefix is called to search this list and return the first where a gcc is found in PATH. Since different distributions have different prefixes, here only adds the frequently used ones. To use more prefixes not listed in Makefile, please put the lines as following in your script and load it with a 'source' command: export CROSS_COMPILE_i386="x86_64-linux-" export CROSS_COMPILE_x86_64="x86_64-linux-" export CROSS_COMPILE_x86="x86_64-linux-" export CROSS_COMPILE_arm64="aarch64-linux-" export CROSS_COMPILE_arm="arm-linux-gnueabi-" export CROSS_COMPILE_mips="mips64-linux-" export CROSS_COMPILE_ppc="powerpc64-linux-" export CROSS_COMPILE_ppc64="powerpc64-linux-" export CROSS_COMPILE_ppc64le="powerpc64-linux-" export CROSS_COMPILE_riscv="riscv64-linux-" export CROSS_COMPILE_s390="s390-linux-" export CROSS_COMPILE_loongarch="loongarch64-linux-" Signed-off-by: Zhangjin Wu --- tools/testing/selftests/nolibc/Makefile | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selftests/nolibc/Makefile index 7687988c780b..ef2507f12e24 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -59,24 +59,25 @@ IMAGE_NAME = $(notdir $(IMAGE)) # Notes, # - The small, newest and obtainable cross toolchains from [1] are recommended, # Please download, decompress and add the bin/ path to 'PATH' env variable +# - The frequently used prefixes are added for local cross toolchains # - To use another cross compiler, pass 'CROSS_COMPLE', 'CROSS_COMPILE_$(XARCH)' # by variant or even 'CC' from command line # # [1]: https://mirrors.edge.kernel.org/pub/tools/crosstool/ -CROSS_COMPILE_i386 ?= x86_64-linux- -CROSS_COMPILE_x86_64 ?= x86_64-linux- -CROSS_COMPILE_x86 ?= x86_64-linux- -CROSS_COMPILE_arm64 ?= aarch64-linux- -CROSS_COMPILE_arm ?= arm-linux-gnueabi- -CROSS_COMPILE_mips ?= mips64-linux- -CROSS_COMPILE_ppc ?= powerpc64-linux- -CROSS_COMPILE_ppc64 ?= powerpc64-linux- -CROSS_COMPILE_ppc64le ?= powerpc64-linux- -CROSS_COMPILE_riscv ?= riscv64-linux- -CROSS_COMPILE_s390 ?= s390-linux- +CROSS_COMPILE_i386 ?= x86_64-linux- x86_64-linux-gnu- +CROSS_COMPILE_x86_64 ?= x86_64-linux- x86_64-linux-gnu- +CROSS_COMPILE_x86 ?= x86_64-linux- x86_64-linux-gnu- +CROSS_COMPILE_arm64 ?= aarch64-linux- aarch64-linux-gnu- +CROSS_COMPILE_arm ?= arm-linux-gnueabi- arm-none-eabi- +CROSS_COMPILE_mips ?= mips64-linux- mips64el-linux-gnuabi64- +CROSS_COMPILE_ppc ?= powerpc64-linux- powerpc-linux-gnu- +CROSS_COMPILE_ppc64 ?= powerpc64-linux- powerpc64le-linux-gnu- +CROSS_COMPILE_ppc64le ?= powerpc64-linux- powerpc64le-linux-gnu- +CROSS_COMPILE_riscv ?= riscv64-linux- riscv64-linux-gnu- +CROSS_COMPILE_s390 ?= s390-linux- s390x-linux-gnu- CROSS_COMPILE_loongarch ?= loongarch64-linux- -CROSS_COMPILE ?= $(CROSS_COMPILE_$(XARCH)) +CROSS_COMPILE ?= $(call cc-cross-prefix,$(CROSS_COMPILE_$(XARCH))) # Make CC is always prefixed with $(CROSS_COMPILE) include ../../../scripts/Makefile.include