Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp12479918rwd; Fri, 23 Jun 2023 06:46:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6smoTnvmxHu0rqbaMLmQsNMGeaNxqgLmeYmIJt53ZXKuqGIi3avT2g/58YOKOspgDAiP3J X-Received: by 2002:a05:6a00:21c2:b0:65a:710a:7855 with SMTP id t2-20020a056a0021c200b0065a710a7855mr16126562pfj.26.1687527964999; Fri, 23 Jun 2023 06:46:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687527964; cv=none; d=google.com; s=arc-20160816; b=Y7MBZ87zW53KkXqgKfVYNK6Vuh32WXMqziQu4ewDdNtspdN9+eQKrzjlldNaQ36TzN rXEKvMQwSIzunPjLhYViOORcL2TrCe2wrwL2Y1qFUsGY70v/WbAW33Skd4EFZaWcwtxl aIJCdo+7eA7IjMRpsKJao4lzkm1wrjCHCHhR7JEYNkOYOvVkfPxRgG7EAwbKRC9t35ah U9L5sjb9flOOZM2UeBDUb8ydzycCY3H5bAE1BSgsLNzBj7c/GO0K+p+dO6flqDhYGe1B bD1yanHtL42E69s3i/HAcliRUP45e1eXiZ60+gMZy6Juc56BJsErCcq0GQOJDOy7VNTz p6zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=E14kPitc75ZoxdxF+x3JQlQRCkESoB1w8owhLtYh2i0=; b=uaPEHi7MmftRuBrsYbZ1Un0OQlp8PN8It36MDY56Lm4EUWYJqFxdwHOovcIXdGc8sl MaVwaJ6TJ3T7XsUCnkRGKB9ynWYUqoqbHEUH/1l6aWr953TQQUK0OvBpV+CVXrlJFJ29 TbhqIMoEBm4iwJipeYr9gjhyn15vnaOjJlQBUucFO+z/jyyBucJ8kDQNLqON3OAAGc4U oQlJFAGZoulTfy8FjKDS+/J8koPkVDWsPf15fo13uwQ96w1vcd1AhzPbxWvWvcwCA3Cl GbLq74LW0XT8vgxfPEK50tboWO+8xvPiyz6GuSidY3ecyF9aqkhGI+fFNACUPibCN/Vc cN4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@xen0n.name header.s=mail header.b=a50DuS08; 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 k4-20020aa79984000000b00660b5630927si8937768pfh.133.2023.06.23.06.45.52; Fri, 23 Jun 2023 06:46:04 -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; dkim=pass header.i=@xen0n.name header.s=mail header.b=a50DuS08; 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 S229775AbjFWNoM (ORCPT + 99 others); Fri, 23 Jun 2023 09:44:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229647AbjFWNoK (ORCPT ); Fri, 23 Jun 2023 09:44:10 -0400 Received: from mailbox.box.xen0n.name (mail.xen0n.name [115.28.160.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0962D2100; Fri, 23 Jun 2023 06:44:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=xen0n.name; s=mail; t=1687527844; bh=XjMJYVClVBZoq59JRA/g/JtKw+4iNV+idqP9kd8lKmU=; h=From:To:Cc:Subject:Date:From; b=a50DuS080AUdkqLrk8Gl9D/KDlR7Zjw9FOr0hJGpUO+wusB8EUalv4A0FebLE+24S BR6SBWemSRsIMUo5cFUBuHHbCzuaKCEJBsTNNTldJ30JrDNjoIi/Yqe8KOJIjbZpub AY+knOb8/4LlrKVU/+AGFL/ZEKFm7xMgLODHFmbY= Received: from ld50.lan (unknown [101.88.25.181]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailbox.box.xen0n.name (Postfix) with ESMTPSA id C13C160106; Fri, 23 Jun 2023 21:44:02 +0800 (CST) From: WANG Xuerui To: Huacai Chen Cc: WANG Rui , Xi Ruoyao , loongarch@lists.linux.dev, linux-kbuild@vger.kernel.org, llvm@lists.linux.dev, linux-kernel@vger.kernel.org, WANG Xuerui Subject: [PATCH 0/9] LoongArch: Preliminary ClangBuiltLinux enablement Date: Fri, 23 Jun 2023 21:43:42 +0800 Message-Id: <20230623134351.1898379-1-kernel@xen0n.name> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 From: WANG Xuerui Hi, It's been a long time since the LoongArch port was upstreamed to LLVM, and there seems to be evidence that Linux was successfully built with Clang inside Loongson roughly around that time; however, a lot has changed since then, and the Linux/LoongArch codebase now makes use of more novel features that necessitate further work. (The enablement work is tracked at [1].) With this patch series and a patched LLVM/LLD ([2] for llvm-objcopy, and [3] for LLD), a working kernel can be built with `make LLVM=1`; although currently support for CONFIG_RELOCATABLE and CONFIG_MODULE is still TODO, we've decided to post the series early to hopefully reduce the rebase burden. The series contains several useful cleanups anyway. Regarding how to merge this: because only Patch 8 is outside arch/loongarch, I'd prefer the series to get merged through Huacai's tree. The series applies cleanly on top of next-20230622. Thanks go to the ClangBuiltLinux team, and LoongArch toolchain maintainers from Loongson and the community alike; without your help this would come much later, if at all (my free time has been steadily dwindling this year already). Your comments are welcome! [1]: https://github.com/ClangBuiltLinux/linux/issues/1787 [2]: https://reviews.llvm.org/D153609 [3]: https://reviews.llvm.org/D138135 WANG Rui (2): LoongArch: Calculate various sizes in the linker script LoongArch: extable: Also recognize ABI names of registers WANG Xuerui (7): LoongArch: Prepare for assemblers with proper FCSR bank support LoongArch: Make {read,write}_fcsr compatible with LLVM/Clang LoongArch: Make the CPUCFG and CSR ops simple aliases of compiler built-ins LoongArch: Simplify the invtlb wrappers LoongArch: Tweak CFLAGS for Clang compatibility Makefile: Add loongarch target flag for Clang compilation LoongArch: Mark Clang LTO as working arch/loongarch/Kconfig | 5 ++ arch/loongarch/Makefile | 14 ++++- arch/loongarch/include/asm/fpregdef.h | 7 +++ arch/loongarch/include/asm/gpr-num.h | 30 ++++++++++ arch/loongarch/include/asm/loongarch.h | 82 ++++++++------------------ arch/loongarch/include/asm/tlb.h | 45 +++++--------- arch/loongarch/kernel/efi-header.S | 6 +- arch/loongarch/kernel/head.S | 8 +-- arch/loongarch/kernel/traps.c | 2 +- arch/loongarch/kernel/vmlinux.lds.S | 7 +++ arch/loongarch/lib/dump_tlb.c | 6 +- arch/loongarch/mm/tlb.c | 10 ++-- arch/loongarch/vdso/Makefile | 6 +- scripts/Makefile.clang | 1 + 14 files changed, 122 insertions(+), 107 deletions(-) -- 2.40.0