[PATCH] arm: mediatek: fix secondary CPU boot on Thumb-2 kernels with Clang
Akari Tsuyukusa
akkun11.open at gmail.com
Sat Jul 25 23:08:57 PDT 2026
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
More information about the Linux-mediatek
mailing list