Re: [PATCH v2] parisc: Fix boot with kernel v5.14

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Sep 5, 2021 at 11:40 PM Helge Deller <deller@xxxxxx> wrote:
> On 9/2/21 10:41 PM, Arnd Bergmann wrote:
> >
> > The reason that the "output_len" access breaks is that gcc explicitly optimizes
> > the bytewise access  into word accesses because it assumes that global variables
> > are correctly declared, and that they are aligned according to the requirements
> > of the ABI.
> > This may be surprising and even unfortunate, but I can see why they did
> > this optimization, and that it helps in other cases as well.
>
> Arnd, you were absolutely correct and I was wrong.
>
> It seems to work nicely now after I changed the output_len variable to
> become an "extern char".

Ok, that's a relief, at least my patch wasn't the main cause then.

Changing the declaration to 'extern char' of course is still incorrect, so
this might cause other problems in the future, the same way that the
old declaration caused the problem by decaring the wrong alignment.

I think declaring it as an array of four characters, or a struct with reduced
alignment would be the safer choice here. Ideally however you would
change the linker script to insert a

    . = ALIGN(4);

before the output to make the variable properly aligned according to
the ABI. See 'git log arch/arm/kernel/vmlinux.lds.S' for a long history
of alignment changes we did there.

        Arnd



[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux