From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?Andr=c3=a9_Przywara?= Date: Sun, 6 Sep 2020 23:16:17 +0100 Subject: [PATCH v2 1/3] arm64: Mention 4K aligned load addresses in the PIE Kconfig help In-Reply-To: <04b3f313-6bf9-a6b0-0c1f-74c110b18000@wwwdotorg.org> References: <20200904090749.4067768-1-edgar.iglesias@gmail.com> <20200904090749.4067768-2-edgar.iglesias@gmail.com> <04b3f313-6bf9-a6b0-0c1f-74c110b18000@wwwdotorg.org> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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.