mirror of https://lore.kernel.org/lkml/
 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 0/2] sparc/build: Rework CFLAGS for clang compatibility
Date: Wed, 17 Jul 2024 23:10:14 +0700	[thread overview]
Message-ID: <20240717-sparc-cflags-v2-0-259407e6eb5f@protonmail.com> (raw)

Hello~

This changes the CFLAGS for building the SPARC kernel so that it can be
built with clang, as a follow up from the discussion in this thread:

https://lore.kernel.org/lkml/JAYB7uS-EdLABTR4iWZdtFOVa5MvlKosIrD_cKTzgeozCOGRM7lhxeLigFB1g3exX445I_W5VKB-tAzl2_G1zCVJRQjp67ODfsSqiZWOZ9o=@protonmail.com/T/#u

The changes are removal of various `-fcall-used-*` flags, and adding
clang target flags for SPARC:

- `-fcall-used-*` flags is removed as it is not supported in clang.
  Those should be safe to remove; the compiler will stop using the
  registers specified as temporaries, but it is a safe change wrt.
  the ABI. Assembly code can still use those registers as needed.
  A cursory look at the assembly generated by GCC 13.2 shows that
  the compiler was able to reallocate uses of those registers into
  other temporary registers without adding extra spills, so there
  should be no change in performance.

- More trivial is to add CLANG_TARGET_FLAGS for SPARC target.

Building with these changes still result in a working kernel,
at least for Sun T5120, Oracle T4-1, and qemu virtual machines.

On the LLVM side, the effort for building Linux/SPARC is tracked here:
https://github.com/llvm/llvm-project/issues/40792

Signed-off-by: Koakuma <koachan@protonmail.com>
---
Changes in v2:
- Remove the -mv8plus change; it will be handled on clang side:
  https://github.com/llvm/llvm-project/pull/98713
- Add CLANG_TARGET_FLAGS as suggested in v1 review.
- Link to v1: https://lore.kernel.org/r/20240620-sparc-cflags-v1-1-bba7d0ff7d42@protonmail.com

---
Koakuma (2):
      sparc/build: Remove all usage of -fcall-used* flags
      sparc/build: Add SPARC target flags for compiling with clang

 arch/sparc/Makefile      | 4 ++--
 arch/sparc/vdso/Makefile | 2 +-
 scripts/Makefile.clang   | 1 +
 3 files changed, 4 insertions(+), 3 deletions(-)
---
base-commit: 4d145e3f830ba2c2745b42bfba5c2f8fcb8d078a
change-id: 20240620-sparc-cflags-e7f2dbbd4b9d

Best regards,
-- 
Koakuma <koachan@protonmail.com>



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

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-17 16:10 Koakuma via B4 Relay [this message]
2024-07-17 16:10 ` [PATCH v2 1/2] sparc/build: Remove all usage of -fcall-used* flags Koakuma via B4 Relay
2024-08-02 23:04   ` 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

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-0-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

all inboxes | Powered by JetHome®