diff mbox

[U-Boot,2/2] mpc83xx: Add relocation support for -fpic

Message ID 1290413598-6081-2-git-send-email-Joakim.Tjernlund@transmode.se
State Superseded, archived
Headers show

Commit Message

Joakim Tjernlund Nov. 22, 2010, 8:13 a.m. UTC
By rearranging the linker script we get support for
relocation of -fpic for free.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
---
 arch/powerpc/cpu/mpc83xx/u-boot.lds             |    5 +++--
 nand_spl/board/freescale/mpc8313erdb/u-boot.lds |    4 +++-
 nand_spl/board/freescale/mpc8315erdb/u-boot.lds |    4 +++-
 3 files changed, 9 insertions(+), 4 deletions(-)

Comments

Joakim Tjernlund Nov. 22, 2010, 3:16 p.m. UTC | #1
>
> By rearranging the linker script we get support for
> relocation of -fpic for free.
>
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> ---
>  arch/powerpc/cpu/mpc83xx/u-boot.lds             |    5 +++--
>  nand_spl/board/freescale/mpc8313erdb/u-boot.lds |    4 +++-
>  nand_spl/board/freescale/mpc8315erdb/u-boot.lds |    4 +++-
>  3 files changed, 9 insertions(+), 4 deletions(-)

Forgot to mention that NAND SPL for these two boards should be able
to replace -fPIC -mrelocatable with -fpic with this patch.
That should save you some space.

    Jocke
diff mbox

Patch

diff --git a/arch/powerpc/cpu/mpc83xx/u-boot.lds b/arch/powerpc/cpu/mpc83xx/u-boot.lds
index 0b74a13..877f298 100644
--- a/arch/powerpc/cpu/mpc83xx/u-boot.lds
+++ b/arch/powerpc/cpu/mpc83xx/u-boot.lds
@@ -67,13 +67,14 @@  SECTIONS
   PROVIDE (erotext = .);
   .reloc   :
   {
-    *(.got)
     _GOT2_TABLE_ = .;
     *(.got2)
+    *(.got)
+    PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
     _FIXUP_TABLE_ = .;
     *(.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/nand_spl/board/freescale/mpc8313erdb/u-boot.lds b/nand_spl/board/freescale/mpc8313erdb/u-boot.lds
index 853b2de..7c5a40f 100644
--- a/nand_spl/board/freescale/mpc8313erdb/u-boot.lds
+++ b/nand_spl/board/freescale/mpc8313erdb/u-boot.lds
@@ -40,8 +40,10 @@  SECTIONS
 		*(.sdata*)
 		_GOT2_TABLE_ = .;
 		*(.got2)
+		*(.got)
+		PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
 	}
-	__got2_entries = (. - _GOT2_TABLE_) >> 2;
+	__got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
 
 	. = ALIGN(8);
 	__bss_start = .;
diff --git a/nand_spl/board/freescale/mpc8315erdb/u-boot.lds b/nand_spl/board/freescale/mpc8315erdb/u-boot.lds
index 853b2de..7c5a40f 100644
--- a/nand_spl/board/freescale/mpc8315erdb/u-boot.lds
+++ b/nand_spl/board/freescale/mpc8315erdb/u-boot.lds
@@ -40,8 +40,10 @@  SECTIONS
 		*(.sdata*)
 		_GOT2_TABLE_ = .;
 		*(.got2)
+		*(.got)
+		PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
 	}
-	__got2_entries = (. - _GOT2_TABLE_) >> 2;
+	__got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
 
 	. = ALIGN(8);
 	__bss_start = .;