loongarch.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: WANG Rui <wangrui@loongson.cn>
To: Huacai Chen <chenhuacai@loongson.cn>
Cc: Huacai Chen <chenhuacai@kernel.org>,
	loongarch@lists.linux.dev,  Xuefeng Li <lixuefeng@loongson.cn>,
	Guo Ren <guoren@kernel.org>,  Xuerui Wang <kernel@xen0n.name>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	 linux-kernel@vger.kernel.org, kernel test robot <lkp@intel.com>
Subject: Re: [PATCH] LoongArch: Specify -m32/-m64 explicitly for 32BIT/64BIT
Date: Tue, 28 Apr 2026 15:35:24 +0800	[thread overview]
Message-ID: <CAHirt9gdabrd=PY6aWJQmhueeea7NeeZijP_rP_egnQ+-LKnoQ@mail.gmail.com> (raw)
In-Reply-To: <20260428070658.1740856-1-chenhuacai@loongson.cn>

On Tue, Apr 28, 2026 at 3:07 PM Huacai Chen <chenhuacai@loongson.cn> wrote:
>
> Clang/LLVM build needs -m32/-m64 to switch triple variants (i.e. the
> --target=xxx parameter). Otherwise we get build errors for CONFIG_32BIT.
>
> GCC doesn't support -m32/-m64 now, but maybe support in future, so use
> cc-option to specify them.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202604232041.ESJDwVG4-lkp@intel.com/
> Suggested-by: Nathan Chancellor <nathan@kernel.org
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>

Tested-by: WANG Rui <wangrui@loongson.cn>

Both Clang 18 building loongarch64 and Clang 22 building loongarch32
work as expected.

Cheers,
Rui


> ---
>  arch/loongarch/Makefile      | 2 ++
>  arch/loongarch/vdso/Makefile | 2 ++
>  2 files changed, 4 insertions(+)
>
> diff --git a/arch/loongarch/Makefile b/arch/loongarch/Makefile
> index 47516aeea9d2..54fcfa1eac1f 100644
> --- a/arch/loongarch/Makefile
> +++ b/arch/loongarch/Makefile
> @@ -55,9 +55,11 @@ endif
>  ifdef CONFIG_32BIT
>  tool-archpref          = $(32bit-tool-archpref)
>  UTS_MACHINE            := loongarch32
> +cflags-y               += $(call cc-option,-m32)
>  else
>  tool-archpref          = $(64bit-tool-archpref)
>  UTS_MACHINE            := loongarch64
> +cflags-y               += $(call cc-option,-m64)
>  endif
>
>  ifneq ($(SUBARCH),$(ARCH))
> diff --git a/arch/loongarch/vdso/Makefile b/arch/loongarch/vdso/Makefile
> index 42aa96249828..9c9181bb4071 100644
> --- a/arch/loongarch/vdso/Makefile
> +++ b/arch/loongarch/vdso/Makefile
> @@ -12,6 +12,8 @@ obj-vdso-$(CONFIG_GENERIC_GETTIMEOFDAY) += vgettimeofday.o
>  ccflags-vdso := \
>         $(filter -I%,$(KBUILD_CFLAGS)) \
>         $(filter -E%,$(KBUILD_CFLAGS)) \
> +       $(filter -m32,$(KBUILD_CFLAGS)) \
> +       $(filter -m64,$(KBUILD_CFLAGS)) \
>         $(filter -march=%,$(KBUILD_CFLAGS)) \
>         $(filter -m%-float,$(KBUILD_CFLAGS)) \
>         $(CLANG_FLAGS) \
> --
> 2.52.0
>
>


      reply	other threads:[~2026-04-28  7:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28  7:06 [PATCH] LoongArch: Specify -m32/-m64 explicitly for 32BIT/64BIT Huacai Chen
2026-04-28  7:35 ` WANG Rui [this message]

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='CAHirt9gdabrd=PY6aWJQmhueeea7NeeZijP_rP_egnQ+-LKnoQ@mail.gmail.com' \
    --to=wangrui@loongson.cn \
    --cc=chenhuacai@kernel.org \
    --cc=chenhuacai@loongson.cn \
    --cc=guoren@kernel.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=kernel@xen0n.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lixuefeng@loongson.cn \
    --cc=lkp@intel.com \
    --cc=loongarch@lists.linux.dev \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).