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

Joakim Tjernlund Joakim.Tjernlund at transmode.se
Mon Nov 22 09:13:18 CET 2010


By rearranging the linker script we get support for
relocation of -fpic for free.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund at 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(-)

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 = .;
-- 
1.7.2.2



More information about the U-Boot mailing list