Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5311907rwb; Mon, 31 Jul 2023 23:49:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlEO6K33r+rHfWw/oJxIdJkvmSnY+AgWY2JGVDurDiycOVUAyhabyiX5k+vdWaoAqOgcYpvi X-Received: by 2002:a17:902:ef89:b0:1b8:2dca:fa19 with SMTP id iz9-20020a170902ef8900b001b82dcafa19mr10035183plb.28.1690872540707; Mon, 31 Jul 2023 23:49:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690872540; cv=none; d=google.com; s=arc-20160816; b=CrBC8Ofrwqq67URgGmWj9APA7Z3YkzA8Fp0UvSZKwfBBASEOTuaWxFIQAmJ1qkmJc3 VDCi3Onv1IZ1bszFwctyc6P2MQk0/3P17XIEMwLasXOMVVtteygnfdhQTgKNZ8fpMk2J Kk4QxZ2/2UlErPBUi241dhEshGKesjvBP10ttPa7ZzEe5UBW0/qBg5Y+B+e4q6UlXiGK ebb2iHcn3RFy8aEZU7VpAaV/DcxbjB+eO9DSa7jx8jMI0cgLevTodiFeyf957ykY952Q Z6e/LHoNvumj99H49f4End4jnRUt69XcfaNlHL08yNvAO9zFJ//FkHF3dFdwHn5U5O+h ii/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=aLqOzMib/ozgsb++3jP9BFe1fjKfw2zjdVD2p3c84iU=; fh=xB22ndQROENE71QtbezY23JLk4nP1Mmqtf4j5Ck7NkM=; b=ksbUYUAGmZm/Q2G6Z73VapqGBHSiZnu9PUCKUlDWyshGUaYryYwcpAvS5biC7ByHBj BqLH8OSj3tdTv/9vqkXpXZI9OMtcn69j3mxt0Z3Q+yuUFNK1SDuDofVLp3zz792iSOMW VeZg5sCoMOW7nU5IkHU7z2B4Sg+8ibPR48eZIOLu9LnmCSc0fHSu2UgjFjQ3scwLq+4X 2a1MI2JLSlv6AtCv/6QnHTQ/sDnmq3UW0Y5SOR24iB/3EeE+zBmrVbSOYt795p8QTT7L AmnxbqZdfHjNdg1Ezu0VWgXm1QKXBRk1JTrmYU2bfzz3YstaYAUFntlpCGMwQxqWbCAi Au6A== 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 a6-20020a170902ecc600b001bc13e00c4fsi2819665plh.501.2023.07.31.23.48.48; Mon, 31 Jul 2023 23:49:00 -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 S230222AbjHAGa7 (ORCPT + 99 others); Tue, 1 Aug 2023 02:30:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbjHAGa5 (ORCPT ); Tue, 1 Aug 2023 02:30:57 -0400 Received: from mail.loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0D1C4DB for ; Mon, 31 Jul 2023 23:30:55 -0700 (PDT) Received: from loongson.cn (unknown [113.200.148.30]) by gateway (Coremail) with SMTP id _____8DxRvGdpshk6uUNAA--.32938S3; Tue, 01 Aug 2023 14:30:53 +0800 (CST) Received: from linux.localdomain (unknown [113.200.148.30]) by localhost.localdomain (Coremail) with SMTP id AQAAf8DxPCOcpshk8pVDAA--.26385S2; Tue, 01 Aug 2023 14:30:52 +0800 (CST) From: Tiezhu Yang To: Huacai Chen , Nathan Chancellor , Nick Desaulniers Cc: loongarch@lists.linux.dev, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, loongson-kernel@lists.loongnix.cn Subject: [PATCH] LoongArch: Error out if clang version is less than 17.0.0 Date: Tue, 1 Aug 2023 14:30:46 +0800 Message-Id: <1690871446-23713-1-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 X-CM-TRANSID: AQAAf8DxPCOcpshk8pVDAA--.26385S2 X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Coremail-Antispam: 1Uk129KBj93XoW7AFykXFW8JryfCr47CFWrtFc_yoW8Cr4fpr 1rZw1DKr4kXryFvrZ7J34DWryY9F97JryIgFyUJryUWry2qws5WrW8KrWagFZrZws7Zay0 gryxG3WS9FyUA3gCm3ZEXasCq-sJn29KB7ZKAUJUUUUr529EdanIXcx71UUUUU7KY7ZEXa sCq-sGcSsGvfJ3Ic02F40EFcxC0VAKzVAqx4xG6I80ebIjqfuFe4nvWSU5nxnvy29KBjDU 0xBIdaVrnRJUUU9Yb4IE77IF4wAFF20E14v26r1j6r4UM7CY07I20VC2zVCF04k26cxKx2 IYs7xG6rWj6s0DM7CIcVAFz4kK6r1Y6r17M28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48v e4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI 0_Gr0_Cr1l84ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AK xVW8Jr0_Cr1UM2kKe7AKxVWUXVWUAwAS0I0E0xvYzxvE52x082IY62kv0487Mc804VCY07 AIYIkI8VC2zVCFFI0UMc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWU AVWUtwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7V AKI48JMxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMxCIbckI1I0E14v2 6r1Y6r17MI8I3I0E5I8CrVAFwI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17 CEb7AF67AKxVWUAVWUtwCIc40Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1j6r1xMIIF 0xvE2Ix0cI8IcVCY1x0267AKxVWUJVW8JwCI42IY6xAIw20EY4v20xvaj40_Jr0_JF4lIx AIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCTnIWIev Ja73UjIFyTuYvjxUc0eHDUUUU X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On my test machine, the clang version is 16.0.4, when build kernel with clang: make CC=clang loongson3_defconfig make CC=clang there exist many errors such as: clang-16: error: argument unused during compilation: '-mabi=lp64s' error: unknown register name 'a0' in asm error: unknown register name 't0' in asm the above issues have been fixed in the upstream llvm project recently, it works well when update clang version to 17.0.0: make CC=clang loongson3_defconfig make CC=clang menuconfig (set CONFIG_MODULES=n and CONFIG_RELOCATABLE=n) make CC=clang thus 17.0.0 is the minimal clang version to build kernel on LoongArch, it is better to error out if clang version is less than 17.0.0, then we can do the right thing to update clang version and avoid wasting time to analysis kernel errors. By the way, the clang 17.0.0 still have some issues to build kernel on LoongArch, you need to unset CONFIG_MODULES and CONFIG_RELOCATABLE to avoid build errors. Additionally, if you want a workable kernel, some modules should be set as y instead of m if CONFIG_MODULES=n. Link: https://github.com/ClangBuiltLinux/linux/issues/1787 Signed-off-by: Tiezhu Yang --- arch/loongarch/Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile index b1e5db5..f07f62a 100644 --- a/arch/loongarch/Makefile +++ b/arch/loongarch/Makefile @@ -10,6 +10,12 @@ KBUILD_DEFCONFIG := loongson3_defconfig image-name-y := vmlinux image-name-$(CONFIG_EFI_ZBOOT) := vmlinuz +ifdef CONFIG_CC_IS_CLANG + ifneq ($(call clang-min-version, 170000),y) + $(error Sorry, you need a newer clang version >= 17.0.0) + endif +endif + ifndef CONFIG_EFI_STUB KBUILD_IMAGE := $(boot)/vmlinux.elf else -- 2.1.0