Linux MIPS Architecture development
 help / color / mirror / Atom feed
* mips allmodconfig build error with llvm-18.1.7-x86_64
@ 2024-06-17 15:50 Jeff Johnson
  2024-06-17 17:44 ` Nathan Chancellor
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Johnson @ 2024-06-17 15:50 UTC (permalink / raw)
  To: linux-mips, llvm

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?

/jeff


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mips allmodconfig build error with llvm-18.1.7-x86_64
  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
  2024-06-18  9:28   ` Maciej W. Rozycki
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2024-06-17 17:44 UTC (permalink / raw)
  To: Jeff Johnson; +Cc: linux-mips, llvm

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mips allmodconfig build error with llvm-18.1.7-x86_64
  2024-06-17 17:44 ` Nathan Chancellor
@ 2024-06-18  9:28   ` Maciej W. Rozycki
  0 siblings, 0 replies; 3+ messages in thread
From: Maciej W. Rozycki @ 2024-06-18  9:28 UTC (permalink / raw)
  To: Nathan Chancellor; +Cc: Jeff Johnson, linux-mips, llvm

On Mon, 17 Jun 2024, Nathan Chancellor wrote:

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

 JR.HB is supposed to be permitted for MIPSr1 as a backwards compatible 
ISA extension, even though coming from MIPSr2 and not originally a part of 
the MIPSr1 ISA (although there was an erratum in some MIPS 4Kc cores that 
caused an RI exception with this encoding).

 FWIW,

  Maciej

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-18  9:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2024-06-18  9:28   ` Maciej W. Rozycki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox