Skip to contentSkip to conversation

powerpc/85xx: fix NAND boot linker scripts for -fpic

PATCH New Scott Wood 3 participants 4 messages May 1, 2012 – May 18, 2012 PowerPC

lore
Share & tools
lore

Scott Wood

author
#0 lore raw

PATCH 1/1 powerpc/85xx: fix NAND boot linker scripts for -fpic

GOT is now handled the way the main u-boot.lds does it. Without this, the boot hangs when built with newer GCC (since 4.6). Older toolchains hid the issue by converting -fpic to -fPIC.

---
 arch/powerpc/cpu/mpc85xx/u-boot-nand.lds     |    5 +++--
 arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds |    4 +++-
 2 files changed, 6 insertions(+), 3 deletions(-)
arch/powerpc/cpu/mpc85xx/u-boot-nand.lds +3 -2
index b1a1dac..8ba9399 100644
@@ -51,13 +51,14 @@ SECTIONS
   PROVIDE (erotext = .);
   .reloc   :
   {
-    KEEP(*(.got))
     _GOT2_TABLE_ = .;
     KEEP(*(.got2))
+    KEEP(*(.got))
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     KEEP(*(.fixup))
   }
-  __got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
+  __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
   __fixup_entries = (. - _FIXUP_TABLE_) >> 2;
 
   .data    :
arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds +3 -1
index 852f9aa..668158f 100644
@@ -37,10 +37,12 @@ SECTIONS
 	.reloc : {
 		_GOT2_TABLE_ = .;
 		KEEP(*(.got2))
+		KEEP(*(.got))
+		PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
 		_FIXUP_TABLE_ = .;
 		KEEP(*(.fixup))
 	}
-	__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >> 2;
+	__got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
 	__fixup_entries = (. - _FIXUP_TABLE_) >> 2;
 
 	. = ALIGN(8);
Signature · 1 line
1.7.7.rc3.4.g8d714
author
#3 lore raw

PATCH 1/1 powerpc/85xx: fix NAND boot linker scripts for -fpic

In reply to Scott Wood
Quoted 9 lines · Scott Wood

GOT is now handled the way the main u-boot.lds does it. Without this, the boot hangs when built with newer GCC (since 4.6). Older toolchains hid the issue by converting -fpic to -fPIC.

---
 arch/powerpc/cpu/mpc85xx/u-boot-nand.lds     |    5 +++--
 arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds |    4 +++-
 2 files changed, 6 insertions(+), 3 deletions(-)

Applied to u-boot-nand-flash

-Scott