diff mbox

[U-Boot] powerpc/85xx: fix NAND boot linker scripts for -fpic

Message ID 20120501214551.GA12049@schlenkerla.am.freescale.net
State Accepted
Commit d2a97daf629a49a416ed405b8c7c2a1e77b99148
Delegated to: Scott Wood
Headers show

Commit Message

Scott Wood May 1, 2012, 9:45 p.m. UTC
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.

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
 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(-)

Comments

Joakim Tjernlund May 2, 2012, 8:06 a.m. UTC | #1
Scott Wood <scottwood@freescale.com> wrote on 2012/05/01 23:45:51:
>
> 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.
>
> Signed-off-by: Scott Wood <scottwood@freescale.com>

Loks good

Acked-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Lan Chunhe-B25806 May 3, 2012, 3:09 a.m. UTC | #2
Scott Wood wrote:
> 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.
>
> Signed-off-by: Scott Wood <scottwood@freescale.com>
>   
Tested-by: Chunhe Lan <Chunhe.Lan@freescale.com>
Scott Wood May 18, 2012, 11 p.m. UTC | #3
On 05/01/2012 04:45 PM, Scott Wood wrote:
> 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.
> 
> Signed-off-by: Scott Wood <scottwood@freescale.com>
> ---
>  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
diff mbox

Patch

diff --git a/arch/powerpc/cpu/mpc85xx/u-boot-nand.lds b/arch/powerpc/cpu/mpc85xx/u-boot-nand.lds
index b1a1dac..8ba9399 100644
--- a/arch/powerpc/cpu/mpc85xx/u-boot-nand.lds
+++ b/arch/powerpc/cpu/mpc85xx/u-boot-nand.lds
@@ -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    :
diff --git a/arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds b/arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds
index 852f9aa..668158f 100644
--- a/arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds
+++ b/arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds
@@ -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);