Re: [PATCH v2 1/3] arm64: Mention 4K aligned load addresses in the PIE Kconfig help
On Sun, Sep 06, 2020 at 11:16:17PM +0100, André Przywara wrote: > On 04/09/2020 19:42, Stephen Warren wrote: > > On 9/4/20 3:07 AM, Edgar E. Iglesias wrote: > >> From: "Edgar E. Iglesias" > >> > >> Mention the requirement of 4K aligned load addresses in the > >> help section for the POSITION_INDEPENDENT option. > >> > >> Suggested-by: Michal Simek > >> Signed-off-by: Edgar E. Iglesias > >> --- > >> arch/arm/Kconfig | 3 +++ > >> 1 file changed, 3 insertions(+) > >> > >> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig > >> index f30c2639ec..c144c08612 100644 > >> --- a/arch/arm/Kconfig > >> +++ b/arch/arm/Kconfig > >> @@ -21,6 +21,9 @@ config POSITION_INDEPENDENT > >> information that is embedded in the binary to support U-Boot > >> relocating itself to the top-of-RAM later during execution. > >> > >> +When this option is enabled, U-Boot needs to be loaded at a > >> +4K aligned address. > > > > I don't believe this restriction should be documented as part of > > POSITION_INDEPENDENT; the restriction always exists at least for 64-bit > > ARM, since arch/arm/lib/relocate_64.S relocate_code uses the same > > assembly sequence that imposes this restriction, and IIUC that code is > > unconditionally used. > > While this is true, the difference is that without POSITION_INDEPENDENT > the alignment is easily determined by the hardcoded load address. So we > should actually have a build time check on this. > > With POSITION_INDEPENDENT, however, the load address is only known at > runtime (somewhat under the user's control, if you like). So a warning > or hint here might be useful. But maybe it should be noted as a general > restriction in the paragraph above: > " ... from almost any address" => "from almost any 4K aligned address" > That sounds good to me. Thanks, Edgar
Re: [PATCH v2 1/3] arm64: Mention 4K aligned load addresses in the PIE Kconfig help
On 04/09/2020 19:42, Stephen Warren wrote: > On 9/4/20 3:07 AM, Edgar E. Iglesias wrote: >> From: "Edgar E. Iglesias" >> >> Mention the requirement of 4K aligned load addresses in the >> help section for the POSITION_INDEPENDENT option. >> >> Suggested-by: Michal Simek >> Signed-off-by: Edgar E. Iglesias >> --- >> arch/arm/Kconfig | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig >> index f30c2639ec..c144c08612 100644 >> --- a/arch/arm/Kconfig >> +++ b/arch/arm/Kconfig >> @@ -21,6 +21,9 @@ config POSITION_INDEPENDENT >>information that is embedded in the binary to support U-Boot >>relocating itself to the top-of-RAM later during execution. >> >> + When this option is enabled, U-Boot needs to be loaded at a >> + 4K aligned address. > > I don't believe this restriction should be documented as part of > POSITION_INDEPENDENT; the restriction always exists at least for 64-bit > ARM, since arch/arm/lib/relocate_64.S relocate_code uses the same > assembly sequence that imposes this restriction, and IIUC that code is > unconditionally used. While this is true, the difference is that without POSITION_INDEPENDENT the alignment is easily determined by the hardcoded load address. So we should actually have a build time check on this. With POSITION_INDEPENDENT, however, the load address is only known at runtime (somewhat under the user's control, if you like). So a warning or hint here might be useful. But maybe it should be noted as a general restriction in the paragraph above: " ... from almost any address" => "from almost any 4K aligned address" Cheers, Andre.
Re: [PATCH v2 1/3] arm64: Mention 4K aligned load addresses in the PIE Kconfig help
On 9/4/20 3:07 AM, Edgar E. Iglesias wrote: > From: "Edgar E. Iglesias" > > Mention the requirement of 4K aligned load addresses in the > help section for the POSITION_INDEPENDENT option. > > Suggested-by: Michal Simek > Signed-off-by: Edgar E. Iglesias > --- > arch/arm/Kconfig | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig > index f30c2639ec..c144c08612 100644 > --- a/arch/arm/Kconfig > +++ b/arch/arm/Kconfig > @@ -21,6 +21,9 @@ config POSITION_INDEPENDENT > information that is embedded in the binary to support U-Boot > relocating itself to the top-of-RAM later during execution. > > + When this option is enabled, U-Boot needs to be loaded at a > + 4K aligned address. I don't believe this restriction should be documented as part of POSITION_INDEPENDENT; the restriction always exists at least for 64-bit ARM, since arch/arm/lib/relocate_64.S relocate_code uses the same assembly sequence that imposes this restriction, and IIUC that code is unconditionally used.
[PATCH v2 1/3] arm64: Mention 4K aligned load addresses in the PIE Kconfig help
From: "Edgar E. Iglesias" Mention the requirement of 4K aligned load addresses in the help section for the POSITION_INDEPENDENT option. Suggested-by: Michal Simek Signed-off-by: Edgar E. Iglesias --- arch/arm/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index f30c2639ec..c144c08612 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -21,6 +21,9 @@ config POSITION_INDEPENDENT information that is embedded in the binary to support U-Boot relocating itself to the top-of-RAM later during execution. + When this option is enabled, U-Boot needs to be loaded at a + 4K aligned address. + config INIT_SP_RELATIVE bool "Specify the early stack pointer relative to the .bss section" help -- 2.25.1