Re: [PATCH] LoongArch: Fix build errors for CONFIG_RANDSTRUCT

From: Huacai Chen
Date: Wed Nov 26 2025 - 02:09:22 EST


On Tue, Nov 25, 2025 at 9:49 PM Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx> wrote:
>
>
>
> On Tue, 25 Nov 2025, at 4:25 PM, Huacai Chen wrote:
> > When CONFIG_RANDSTRUCT enabled, members of task_struct are randomized.
> > There is a chance that TASK_STACK_CANARY be out of 12bit immediate's
> > range and causes build errors. TASK_STACK_CANARY is naturally aligned,
> > so fix it by replacing ld.d/st.d with ldptr.d/stptr.d which have 14bit
> > immediates.
>
> Hi Huacai,
>
> What about 32bit build in this case?
Use the same solution as other registers, please see:
https://lore.kernel.org/loongarch/20251122043634.3447854-7-chenhuacai@xxxxxxxxxxx/T/#u

Huacai

>
> Thanks
> Jiaxun
>
> >