diff mbox

[U-Boot] ARMv8: add GOT sections to the list of sections copied

Message ID 1490378935-35315-1-git-send-email-philipp.tomsich@theobroma-systems.com
State Accepted
Commit 4b0d506ed3b4f77649346d45b349169a60a2b233
Delegated to: Tom Rini
Headers show

Commit Message

Philipp Tomsich March 24, 2017, 6:08 p.m. UTC
Recent Linux distributions (e.g. Debian 9) include cross-compilers for
AArch64, but only for the aarch64-linux-gnu triplet only. It can thus
be expected that users will attempt to use the system cross-compiler
(instead of an aarch64-elf variant) to compile U-Boot for their ARMv8
target systems.

One key differences between an aarch64-linux-gnu and an aarch64-elf
compiler are the default settings regarding position-independent: with
the aarch64-linux-gnu compiler, the default will create and use the
global offset table.

This change-set adjusts the list of sections copied on ARMv8 to include
the GOT sections. With this added, the list matches the previous setup
for AArch32 closely.

Note that this is not an 'academic' issue, but was in fact encountered
by our QA during testing of the RK3399-Q7 BSP and resulted in an
early failure of the SPL stage during FDT setup.

Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>

---

 arch/arm/config.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Simon Glass March 26, 2017, 3:48 a.m. UTC | #1
On 24 March 2017 at 12:08, Philipp Tomsich
<philipp.tomsich@theobroma-systems.com> wrote:
> Recent Linux distributions (e.g. Debian 9) include cross-compilers for
> AArch64, but only for the aarch64-linux-gnu triplet only. It can thus
> be expected that users will attempt to use the system cross-compiler
> (instead of an aarch64-elf variant) to compile U-Boot for their ARMv8
> target systems.
>
> One key differences between an aarch64-linux-gnu and an aarch64-elf
> compiler are the default settings regarding position-independent: with
> the aarch64-linux-gnu compiler, the default will create and use the
> global offset table.
>
> This change-set adjusts the list of sections copied on ARMv8 to include
> the GOT sections. With this added, the list matches the previous setup
> for AArch32 closely.
>
> Note that this is not an 'academic' issue, but was in fact encountered
> by our QA during testing of the RK3399-Q7 BSP and resulted in an
> early failure of the SPL stage during FDT setup.
>
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
>
> ---
>
>  arch/arm/config.mk | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Simon Glass <sjg@chromium.org>
Tom Rini April 4, 2017, 2:51 p.m. UTC | #2
On Fri, Mar 24, 2017 at 07:08:55PM +0100, Philipp Tomsich wrote:

> Recent Linux distributions (e.g. Debian 9) include cross-compilers for
> AArch64, but only for the aarch64-linux-gnu triplet only. It can thus
> be expected that users will attempt to use the system cross-compiler
> (instead of an aarch64-elf variant) to compile U-Boot for their ARMv8
> target systems.
> 
> One key differences between an aarch64-linux-gnu and an aarch64-elf
> compiler are the default settings regarding position-independent: with
> the aarch64-linux-gnu compiler, the default will create and use the
> global offset table.
> 
> This change-set adjusts the list of sections copied on ARMv8 to include
> the GOT sections. With this added, the list matches the previous setup
> for AArch32 closely.
> 
> Note that this is not an 'academic' issue, but was in fact encountered
> by our QA during testing of the RK3399-Q7 BSP and resulted in an
> early failure of the SPL stage during FDT setup.
> 
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
> 

Reviewed-by: Tom Rini <trini@konsulko.com>
Tom Rini April 9, 2017, 1:14 a.m. UTC | #3
On Fri, Mar 24, 2017 at 07:08:55PM +0100, Philipp Tomsich wrote:

> Recent Linux distributions (e.g. Debian 9) include cross-compilers for
> AArch64, but only for the aarch64-linux-gnu triplet only. It can thus
> be expected that users will attempt to use the system cross-compiler
> (instead of an aarch64-elf variant) to compile U-Boot for their ARMv8
> target systems.
> 
> One key differences between an aarch64-linux-gnu and an aarch64-elf
> compiler are the default settings regarding position-independent: with
> the aarch64-linux-gnu compiler, the default will create and use the
> global offset table.
> 
> This change-set adjusts the list of sections copied on ARMv8 to include
> the GOT sections. With this added, the list matches the previous setup
> for AArch32 closely.
> 
> Note that this is not an 'academic' issue, but was in fact encountered
> by our QA during testing of the RK3399-Q7 BSP and resulted in an
> early failure of the SPL stage during FDT setup.
> 
> Signed-off-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Tested-by: Klaus Goger <klaus.goger@theobroma-systems.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Reviewed-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/arch/arm/config.mk b/arch/arm/config.mk
index 08d7d1b..907c693 100644
--- a/arch/arm/config.mk
+++ b/arch/arm/config.mk
@@ -120,7 +120,7 @@  endif
 # limit ourselves to the sections we want in the .bin.
 ifdef CONFIG_ARM64
 OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .data \
-		-j .u_boot_list -j .rela.dyn
+		-j .u_boot_list -j .rela.dyn -j .got -j .got.plt
 else
 OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .hash \
 		-j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn