sparclinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Koakuma via B4 Relay <devnull+koachan.protonmail.com@kernel.org>
To: "David S. Miller" <davem@davemloft.net>,
	 Andreas Larsson <andreas@gaisler.com>,
	 Nathan Chancellor <nathan@kernel.org>,
	 Nick Desaulniers <ndesaulniers@google.com>,
	 Bill Wendling <morbo@google.com>,
	Justin Stitt <justinstitt@google.com>,
	 glaubitz@physik.fu-berlin.de,
	Masahiro Yamada <masahiroy@kernel.org>,
	 Nicolas Schier <nicolas@fjasle.eu>
Cc: sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org,
	 llvm@lists.linux.dev, linux-kbuild@vger.kernel.org,
	 Koakuma <koachan@protonmail.com>
Subject: [PATCH v2 1/2] sparc/build: Remove all usage of -fcall-used* flags
Date: Wed, 17 Jul 2024 23:10:15 +0700	[thread overview]
Message-ID: <20240717-sparc-cflags-v2-1-259407e6eb5f@protonmail.com> (raw)
In-Reply-To: <20240717-sparc-cflags-v2-0-259407e6eb5f@protonmail.com>

From: Koakuma <koachan@protonmail.com>

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 <koachan@protonmail.com>
---
 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)
 

-- 
2.45.2



  reply	other threads:[~2024-07-17 16:12 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-17 16:10 [PATCH v2 0/2] sparc/build: Rework CFLAGS for clang compatibility Koakuma via B4 Relay
2024-07-17 16:10 ` Koakuma via B4 Relay [this message]
2024-08-02 23:04   ` [PATCH v2 1/2] sparc/build: Remove all usage of -fcall-used* flags Nathan Chancellor
2024-10-24 16:29   ` Andreas Larsson
2024-10-26 14:50     ` Koakuma
2024-07-17 16:10 ` [PATCH v2 2/2] sparc/build: Add SPARC target flags for compiling with clang Koakuma via B4 Relay
2024-08-02 22:42   ` Nathan Chancellor
2024-08-03  5:58   ` Masahiro Yamada
2024-10-21 20:16 ` [PATCH v2 0/2] sparc/build: Rework CFLAGS for clang compatibility Nathan Chancellor
2024-10-22 19:10   ` Masahiro Yamada
2024-10-22 20:07     ` Nathan Chancellor
2024-10-23  0:43       ` Koakuma
2024-10-23  3:38         ` Masahiro Yamada
2024-10-23 16:45           ` Nathan Chancellor
2024-10-26 14:52             ` Koakuma
2024-10-27 11:00               ` Masahiro Yamada
2024-10-27 18:34               ` Nathan Chancellor
2024-10-23  3:29       ` Masahiro Yamada
2024-10-23 16:35         ` Nathan Chancellor
2024-10-22 19:13   ` Masahiro Yamada
     [not found] <20240716-sparc-cflags-v2-0-40bdc4484d10@protonmail.com>
     [not found] ` <20240716-sparc-cflags-v2-1-40bdc4484d10@protonmail.com>
2024-10-21  6:55   ` [PATCH v2 1/2] sparc/build: Remove all usage of -fcall-used* flags Koakuma

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240717-sparc-cflags-v2-1-259407e6eb5f@protonmail.com \
    --to=devnull+koachan.protonmail.com@kernel.org \
    --cc=andreas@gaisler.com \
    --cc=davem@davemloft.net \
    --cc=glaubitz@physik.fu-berlin.de \
    --cc=justinstitt@google.com \
    --cc=koachan@protonmail.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=masahiroy@kernel.org \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nicolas@fjasle.eu \
    --cc=sparclinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).