Re: [PATCH] arm: mediatek: fix secondary CPU boot on Thumb-2 kernels with Clang

Akari Tsuyukusa <[email protected]>
Newsgroups org.infradead.lists.linux-mediatek,dev.linux.lists.llvm,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <amWfjDyn0jrnIf63@buffalo-ssd>
On Thu, Jul 23, 2026 at 11:53:14AM +0200, Arnd Bergmann wrote:
> On Thu, Jul 23, 2026, at 11:15, Akari Tsuyukusa wrote:
> > Can you send your fix as PATCH?
> > I think your approach is better than mine.
> 
> I think we should wait for the llvm issue to be resolved first, to
> document whether this is considered a bug in the kernel or the
> assembler, and to see if any other kernel code may be affected
> by the same thing.
> 
> Looking around other .S files, I see the same
> pattern in stext(), cpu_resume_arm(), mcpm_entry_point(),
> all of which start in arm mode but end in thumb.

It's a LLVM bug.
The LLVM assembler source code explicitly mentions this limitation:

  ///
  /// FIXME: there is a corner case where the state is changed in between the
  /// label definition and the .type directive. This is not expected to occur
  /// in practice, and handling it would require the backend to track IsThumb
  /// for every label.
  ///

https://github.com/llvm/llvm-project/pull/211641/changes

However, it will take some time for an LLVM release with this fix to
become available. Since LLVM (>=15.0.0) is an officially supported
toolchain, leaving the kernel with bug(s?) on supported LLVM versions
isn't ideal.
I think we should apply a workaround in the kernel for now.

Best Regards,
Akari
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.