From patchwork Wed Jul 17 16:10:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koakuma via B4 Relay X-Patchwork-Id: 13735599 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 26003181B9A; Wed, 17 Jul 2024 16:12:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721232729; cv=none; b=YDDQLhvYV6xK0hx7fN2GCG7cbHPJE2yo5XunprWs58eQrWJlBFFACmGl8E3kSZ9UP31DRvXkZuYTITdDfmbA1E8jRhKx3I+7BFkv4qHmKpL8WIv84W/DBo2Jra8eSlpMMdCxEmtINR4J3H4nKjJXAKbNDRydZ8t5+LOruhhC/zg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721232729; c=relaxed/simple; bh=RAy/ksV3bI+jYpZMEbAnaO3B61n/1HcPTXV7BHINhDU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ZrpVRd0jLwt4v5v79TUj2fMO3wJwvzT0yJMrhKO+tYlwgOw/63O4eQwi78wq01El7wJDPZO2NOPsYD9aHt+za8KDB/po7YcVMkR/P1y0UWXsYyCJ96QZh/WFeH4xk5+82vDmAki5W0ZxRlpqkzrmVqRUMtV5BkM0LzbfjOb+83g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=shbXjLPJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="shbXjLPJ" Received: by smtp.kernel.org (Postfix) with ESMTPS id C5132C4AF0B; Wed, 17 Jul 2024 16:12:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721232728; bh=RAy/ksV3bI+jYpZMEbAnaO3B61n/1HcPTXV7BHINhDU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=shbXjLPJXdRB1tVuUt0uLxZSsuyUDn5AMTlsJxjNvye+zdF07wlNebxOI3d7Qcm73 EA0tE0PAnr4MtBgVPn5NrDa+gQOKkLuaVPiaQLyheI3gV3gfDG/bK3wTJqrCdk+OPR KeVhHVfpkivSAxT0vlD9sKhMYMrqdCkOIJuousO8DaY22Wvko5Pzh39D2xNousN4H+ Z2AApmNlwYnUNayL7Bz4BoJVCPN+3BXPeruNC2JFtczLyFrU4QQlUdAwetSauJjkyg TqIWU4IpdyWH7aVirsZnzAs6bG2Cu4z1ZnnxPwiwohZnuBZUonEdPL2M4GnzDkh4E9 9x1uwC++Z0mZg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEDECC3DA61; Wed, 17 Jul 2024 16:12:08 +0000 (UTC) From: Koakuma via B4 Relay Date: Wed, 17 Jul 2024 23:10:15 +0700 Subject: [PATCH v2 1/2] sparc/build: Remove all usage of -fcall-used* flags Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240717-sparc-cflags-v2-1-259407e6eb5f@protonmail.com> References: <20240717-sparc-cflags-v2-0-259407e6eb5f@protonmail.com> In-Reply-To: <20240717-sparc-cflags-v2-0-259407e6eb5f@protonmail.com> To: "David S. Miller" , Andreas Larsson , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , glaubitz@physik.fu-berlin.de, Masahiro Yamada , Nicolas Schier Cc: sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-kbuild@vger.kernel.org, Koakuma X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1721232727; l=2404; i=koachan@protonmail.com; s=20240620; h=from:subject:message-id; bh=BmBOSeK5N1Oy/bbdHrIC4l2mSYFoxSF/u0TXtn+HPh4=; b=MDVSlMcoYXgsyyvNQtnK9WTRCXYuPfjMAj3GvKKG5BXguIwLI3+64HoWlTSXoJtvYHolxIPZQ VI+Ux/+2ko0C0mb15ccb41nEUfBNAcPw2n5uAA2Dd+rz808U+R8Z+yE X-Developer-Key: i=koachan@protonmail.com; a=ed25519; pk=UA59FS3yiAA1cnAAUZ1rehTmr6skh95PgkNRBLcoKCg= X-Endpoint-Received: by B4 Relay for koachan@protonmail.com/20240620 with auth_id=174 X-Original-From: Koakuma Reply-To: koachan@protonmail.com From: Koakuma Remove all usage of -fcall-used* flags so that all flags used are portable between GCC and clang. The reasoning is as follows: In the (normal) 32-bit ABI, %g5 and %g7 is normally reserved, and in the 64-bit ABI, %g7 is the reserved one. Linux turns them into volatile registers by the way of -fcall-used-*, but on the other hand, omitting the flags shouldn't be harmful; compilers will now simply refuse to touch them, and any assembly code that happens to touch them would still work like usual (because Linux' conventions already treats them as volatile anyway). Signed-off-by: Koakuma Tested-by: Nathan Chancellor --- arch/sparc/Makefile | 4 ++-- arch/sparc/vdso/Makefile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile index 757451c3ea1d..7318a8b452c3 100644 --- a/arch/sparc/Makefile +++ b/arch/sparc/Makefile @@ -29,7 +29,7 @@ UTS_MACHINE := sparc # versions of gcc. Some gcc versions won't pass -Av8 to binutils when you # give -mcpu=v8. This silently worked with older bintutils versions but # does not any more. -KBUILD_CFLAGS += -m32 -mcpu=v8 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7 +KBUILD_CFLAGS += -m32 -mcpu=v8 -pipe -mno-fpu KBUILD_CFLAGS += -Wa,-Av8 KBUILD_AFLAGS += -m32 -Wa,-Av8 @@ -45,7 +45,7 @@ export BITS := 64 UTS_MACHINE := sparc64 KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow -KBUILD_CFLAGS += -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare +KBUILD_CFLAGS += -ffixed-g4 -ffixed-g5 -Wno-sign-compare KBUILD_CFLAGS += -Wa,--undeclared-regs KBUILD_CFLAGS += $(call cc-option,-mtune=ultrasparc3) KBUILD_AFLAGS += -m64 -mcpu=ultrasparc -Wa,--undeclared-regs diff --git a/arch/sparc/vdso/Makefile b/arch/sparc/vdso/Makefile index 243dbfc4609d..e009443145af 100644 --- a/arch/sparc/vdso/Makefile +++ b/arch/sparc/vdso/Makefile @@ -46,7 +46,7 @@ CFL := $(PROFILING) -mcmodel=medlow -fPIC -O2 -fasynchronous-unwind-tables -m64 -fno-omit-frame-pointer -foptimize-sibling-calls \ -DDISABLE_BRANCH_PROFILING -DBUILD_VDSO -SPARC_REG_CFLAGS = -ffixed-g4 -ffixed-g5 -fcall-used-g5 -fcall-used-g7 +SPARC_REG_CFLAGS = -ffixed-g4 -ffixed-g5 $(vobjs): KBUILD_CFLAGS := $(filter-out $(RANDSTRUCT_CFLAGS) $(GCC_PLUGINS_CFLAGS) $(SPARC_REG_CFLAGS),$(KBUILD_CFLAGS)) $(CFL) From patchwork Wed Jul 17 16:10:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Koakuma via B4 Relay X-Patchwork-Id: 13735601 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4265D1822CA; Wed, 17 Jul 2024 16:12:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721232731; cv=none; b=YeWjhLbjJzFSJuXSNFKKo94Hovw0WaagpZej0gLrLfwZfj3bcR2x3rpt6Hw4VdEPboU1zL2F4TkE68TdWHk9lWa2WnyilNB/OWnel2sJP/YlQNZ0XMESwzdvF1gAJOYXvQno2UAlUrqPARvyBoO+gYYi87vRpvqKzcg2/guTi70= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721232731; c=relaxed/simple; bh=V0CKkAQdRN3WbHfKZmvbfid5D/WhcFJk+hpVN1F1yt0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A62i9vbwzw5pmXapvQp9NeDDvtzkud4uub9mLJtTC35VU7ABda2aDlXPotIXkR5YR5WbUMxmxaCnKLebq4lUBVdAXi6qf6Tiw69VHfsHv81BAxzwebEixEh5xSuu2Xc8jzqzUzkiVGRg766brID6C5rHE1rHErrIWzNGeYXvplo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uPh7sqh7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uPh7sqh7" Received: by smtp.kernel.org (Postfix) with ESMTPS id D6905C32782; Wed, 17 Jul 2024 16:12:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721232728; bh=V0CKkAQdRN3WbHfKZmvbfid5D/WhcFJk+hpVN1F1yt0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=uPh7sqh7SibxE8K1uzJj+ZdSz6qUady772KQwyQ3F5x9HU42HcwN/LvJqtsAmxvpn qx4wAQcO7HvEi8ojn8SUPFboEtK/+5TTIAVkt7CauGhddm4ScrYFbJ5m24iT+UQ6Ef K643+vZ1nNakOtofv5X+1S+7udl46K2PCsMEnekpBOd3PjBHHVuJuHHbMuDPLhIe/3 nJKlbp1bUb0sONPUpij5jw/N52dHH50Fv+d2qUVU6Tw8mnSTYcd51kgjhT8ktXYLpf QvJG+RedhIucu9MFMCgYfyEO+A88eNRTeTlfRX9wEFZut/HGCIAYzLgKhFzPpdfXyx eKO6q0UF+q5CA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE748C3DA42; Wed, 17 Jul 2024 16:12:08 +0000 (UTC) From: Koakuma via B4 Relay Date: Wed, 17 Jul 2024 23:10:16 +0700 Subject: [PATCH v2 2/2] sparc/build: Add SPARC target flags for compiling with clang Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240717-sparc-cflags-v2-2-259407e6eb5f@protonmail.com> References: <20240717-sparc-cflags-v2-0-259407e6eb5f@protonmail.com> In-Reply-To: <20240717-sparc-cflags-v2-0-259407e6eb5f@protonmail.com> To: "David S. Miller" , Andreas Larsson , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , glaubitz@physik.fu-berlin.de, Masahiro Yamada , Nicolas Schier Cc: sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-kbuild@vger.kernel.org, Koakuma X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=ed25519-sha256; t=1721232727; l=1022; i=koachan@protonmail.com; s=20240620; h=from:subject:message-id; bh=Sa5MwKGuBYGAJmb585d/SZ5+q8ysIBSVFXuit392tK0=; b=kc0NkRwgjz1/ds7jqN4e7rwUpz8AF62xmINjqcnMb3N+eAaVm2/tzRDrmnOX7R9bxEFmwd8U2 hzvjHSf7w3NBj9gygcQtKkXfc5LHmQrJTNV53JIKetVnY9QYTXzIIj9 X-Developer-Key: i=koachan@protonmail.com; a=ed25519; pk=UA59FS3yiAA1cnAAUZ1rehTmr6skh95PgkNRBLcoKCg= X-Endpoint-Received: by B4 Relay for koachan@protonmail.com/20240620 with auth_id=174 X-Original-From: Koakuma Reply-To: koachan@protonmail.com From: Koakuma clang only supports building 64-bit kernel, so we use the sparc64-linux-gnu target. See also: https://lore.kernel.org/lkml/e26PTXUXEz8OYXmaeKn4Mpuejr4IOlFfFwdB5vpsluXlYiqDdlyQTYcDtdAny_o4gO4SfPeQCCN2qpyT6e0nog5EaP3xk2SeUPTrF54p1gM=@protonmail.com/T/#m068e010dcf8b99d3510a90d7532bcdb70e2e2c6b Signed-off-by: Koakuma Reviewed-by: Nathan Chancellor Acked-by: Masahiro Yamada --- scripts/Makefile.clang | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/Makefile.clang b/scripts/Makefile.clang index 6c23c6af797f..2435efae67f5 100644 --- a/scripts/Makefile.clang +++ b/scripts/Makefile.clang @@ -10,6 +10,7 @@ CLANG_TARGET_FLAGS_mips := mipsel-linux-gnu CLANG_TARGET_FLAGS_powerpc := powerpc64le-linux-gnu CLANG_TARGET_FLAGS_riscv := riscv64-linux-gnu CLANG_TARGET_FLAGS_s390 := s390x-linux-gnu +CLANG_TARGET_FLAGS_sparc := sparc64-linux-gnu CLANG_TARGET_FLAGS_x86 := x86_64-linux-gnu CLANG_TARGET_FLAGS_um := $(CLANG_TARGET_FLAGS_$(SUBARCH)) CLANG_TARGET_FLAGS := $(CLANG_TARGET_FLAGS_$(SRCARCH))