[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wj2rjFNc33JPFWfOQ0b-6J812L3Qrrv8yir4Z1pf-cwLA@mail.gmail.com>
Date: Sat, 3 Aug 2024 08:35:45 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: build failure caused by RUNTIME_CONST()
On Sat, 3 Aug 2024 at 05:01, Oleg Nesterov <oleg@...hat.com> wrote:
>
> it seems that all other section do
>
> . = ALIGN(x); name : ...
>
> was this change intentional?
It was intentional, but you're right, I should probably just do the
ugly ". = ALIGN(8)" syntax to match everything else.
The ALIGN in the section definition aligns the output section, not the
input section. But I think that's redundant, with the "AT()" thing
specifying where in the output it goes. I should have used SUBALIGN()
to align the input sections.
And the ". = ALIGN()" at the head should be unnecessary too, since the
alignment should come from the input section itself, and we should
probably not specify that in the linker script, but in the section
definition.
Honestly, our linker scripts are basically voodoo, and the ALIGN
pattern we use is part of that voodoo. Part of it is that linker
script syntax is just horrendous, and part of it is that writing
linker scripts is so rare that people just mostly do it with the
"monkey see, monkey do" model of programming, ie cutting and pasting
things that they don't understand and modifying them so that it
"works".
IOW, the right thing to do is really to not have any ALIGN directive
at all, and have the alignment come from the input sections by
specifying it in the source when the section is built.
Except we don't do that either, unless it sometimes happens almost by
accident (ie when we tell the compiler to use specific section names
and alignment, then the compiler will actually do it for us).
I'll update my fix to be the minimal "don't rock the boat" fix. And
we'll continue with the nasty linker script voodoo approach.
Oh well.
Linus
Powered by blists - more mailing lists