PowerPC: Add relocation support for -fpic
[oweals/u-boot.git] / arch / powerpc / cpu / mpc85xx / u-boot.lds
index 85042c5254b3fca805ba199f55ae9d5bfee4b7c5..67d7763eaad8180d80b9a8e19f813e848c883236 100644 (file)
@@ -54,13 +54,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    :