[PATCH] arm: mediatek: fix secondary CPU boot on Thumb-2 kernels with Clang
Arnd Bergmann
arnd at kernel.org
Sun Jul 26 13:00:35 PDT 2026
On Sun, Jul 26, 2026, at 08:08, Akari Tsuyukusa wrote:
> 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.
Working around it in the kernel is fine, but I'd prefer to wait for
the fix to first get merged into llvm so we can reference the
bugfix in the kernel commit.
A trivial workaround would be to have a dependency in
CONFIG_THUMB2_KERNEL for !AS_IS_LLVM||CLANG_VERSION>=24
(or whatever version), though fixing the .S code in all known
instances is probably better if we want to ever have a chance
to require IAS on all architectures.
Arnd
More information about the Linux-mediatek
mailing list