From: Stephen Warren Date: Thu, 24 Sep 2020 14:22:23 -0600 Subject: [PATCH 1/5] arm64: PIE: Skip fixups if distance is zero In-Reply-To: References: <20200924001715.30975-1-andre.przywara@arm.com> <20200924001715.30975-2-andre.przywara@arm.com> Message-ID: <92cdce75-b78d-325d-5a2f-59d89febb46d@wwwdotorg.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 9/24/20 8:45 AM, Andr? Przywara wrote: > On 24/09/2020 01:17, Andre Przywara wrote: >> When the actual offset between link and runtime address is zero, there >> is no need for patching up U-Boot early when running with >> CONFIG_POSITION_INDEPENDENT. > > That turns out to be not fully true. > Some toolchains (all Linaro cross compilers?) don't handle this well, > they keep the original locations in the binary uninitialised, and rely > on the reldyn fixup table to patch in the actual values. > Other compilers (GCC 9.2 vanilla, Ubuntu GCC 7.5.0, Arm website 9.2) > fill in the addresses both into the binary and the fixup, so this patch > works. > > It seems to be fixed by enabling CONFIG_STATIC_RELA? > I see it's disabled for CONFIG_POSITION_INDEPENDENT, what was the reason > behind that? I can't remember for sure. I tried re-enabling STATIC_RELA at both the upstream commit where POSITION_INDEPENDENT was first implemented and at top-of-tree, and ran test/py on Tegra, and it works fine. Perhaps I just figured there was no need to perform the static relocations since the code would always do it? I figure it's safe to re-enable it, i.e. decouple the two config options completely.