Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Jeff Johnson <quic_jjohnson@quicinc.com>
Cc: linux-mips@vger.kernel.org, llvm@lists.linux.dev
Subject: Re: mips allmodconfig build error with llvm-18.1.7-x86_64
Date: Mon, 17 Jun 2024 10:44:46 -0700	[thread overview]
Message-ID: <20240617174446.GA843124@thelio-3990X> (raw)
In-Reply-To: <a138bd58-80b3-4adb-8cbb-65e92a0d0b6e@quicinc.com>

Hi Jeff,

On Mon, Jun 17, 2024 at 08:50:00AM -0700, Jeff Johnson wrote:
> As part of my tree-wide cleanup of missing MODULE_DESCRIPTION() macros I'm
> trying to do allmodconfig builds for every architecture.
> 
> With:
> export ARCH=mips
> export LLVM=llvm-18.1.7-x86_64/bin/
> make distclean
> make allmodconfig
> make -j$(nproc)
> 
> I'm getting build errors like:
> Cannot find symbol for section 46: .text.free_initmem.
> init/main.o: failed
> 
> Cannot find symbol for section 6: .text.copy_from_kernel_nofault_allowed.
> mm/maccess.o: failed
> 
> Cannot find symbol for section 10: .text.arch_asym_cpu_priority.
> kernel/sched/fair.o: failed
> 
> Interestingly, if I make 'defconfig' instead of 'allmodconfig' I don't see
> this issue.
> 
> Any thoughts on how to have a successful mips allmodconfig build?

Hmmm, it looks like https://github.com/ClangBuiltLinux/linux/issues/1830
never got addressed, sorry about that :/

This is basically a poor interaction with Clang's integrated assembler,
-ffunction-sections, and recordmcount that nobody has really been able
to figure out how to deal with. It is not MIPS specific but the fact
that MIPS allows CONFIG_LD_DEAD_CODE_DATA_ELIMINATION to be selected
means that it is much easier to trigger.

My recommendation for this is to disable that configuration (and -Werror
configurations) when building, which you can easily do with the
KCONFIG_ALLCONFIG variable and bash's process substitution during the
allmodconfig step (keeping the rest of your commands the same):

  $ make KCONFIG_ALLCONFIG=<(printf 'CONFIG_%s=n\n' DRM_WERROR LD_DEAD_CODE_DATA_ELIMINATION WERROR) allmodconfig

Alternatively, you could use the 'allmod.config' file plus
KCONFIG_ALLCONFIG=1:

  $ printf 'CONFIG_%s=n\n' DRM_WERROR LD_DEAD_CODE_DATA_ELIMINATION WERROR >allmod.config

  $ make KCONFIG_ALLCONFIG=1 allmodconfig

I will try to send a version of that diff that I have in that linked
issue so that you don't have to jump through these hoops.

Even with that addressed though, I see another issue in an allmodconfig
when building arch/mips/kernel/cps-vec.S that I don't recall seeing
before:

  arch/mips/kernel/cps-vec.S:363:2: error: instruction requires a CPU feature not currently enabled
   jr.hb $9
   ^
  arch/mips/kernel/cps-vec.S:477:4: error: instruction requires a CPU feature not currently enabled
  1: jr.hb $8
     ^

I was able to workaround that by disabling CONFIG_MIPS_CPS in the same
manner as above and that build finished fine for me with that same
toolchain.

For what it's worth, MIPS is not very well supported in LLVM anymore, as
the main maintainer stepped down a couple of years ago. Another
maintainer has stepped up but a lot of these issues are long outstanding
problems, so I think the likelihood of them getting addressed at this
point is pretty low.

Cheers,
Nathan

  reply	other threads:[~2024-06-17 17:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-17 15:50 mips allmodconfig build error with llvm-18.1.7-x86_64 Jeff Johnson
2024-06-17 17:44 ` Nathan Chancellor [this message]
2024-06-18  9:28   ` Maciej W. Rozycki

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=20240617174446.GA843124@thelio-3990X \
    --to=nathan@kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=quic_jjohnson@quicinc.com \
    /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