PowerPC, nand_spl: Add relocation support for -fpic
authorJoakim Tjernlund <Joakim.Tjernlund@transmode.se>
Fri, 3 Dec 2010 16:30:38 +0000 (17:30 +0100)
committerWolfgang Denk <wd@denx.de>
Fri, 17 Dec 2010 19:25:19 +0000 (20:25 +0100)
By rearranging the linker script we get support for
relocation of -fpic for free.
Move __got2_entries outside _GOT2_TABLE_ defining scope
matching the rest of PowerPC

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Acked-by: Scott Wood <scottwood@freescale.com>
Acked-by: Kim Phillips <kim.phillips@freescale.com>
nand_spl/board/freescale/mpc8313erdb/u-boot.lds
nand_spl/board/freescale/mpc8315erdb/u-boot.lds
nand_spl/board/sheldon/simpc8313/u-boot.lds

index 138e42765f1cd3da89381101e5a2f87feb82e242..f1649f84bd420946aaf6f3678bbff8efda47cec0 100644 (file)
@@ -39,8 +39,10 @@ SECTIONS
                *(.sdata*)
                _GOT2_TABLE_ = .;
                KEEP(*(.got2))
-               __got2_entries = (. - _GOT2_TABLE_) >> 2;
+               KEEP(*(.got))
+               PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
        }
+       __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
 
        . = ALIGN(8);
        __bss_start = .;
index 138e42765f1cd3da89381101e5a2f87feb82e242..f1649f84bd420946aaf6f3678bbff8efda47cec0 100644 (file)
@@ -39,8 +39,10 @@ SECTIONS
                *(.sdata*)
                _GOT2_TABLE_ = .;
                KEEP(*(.got2))
-               __got2_entries = (. - _GOT2_TABLE_) >> 2;
+               KEEP(*(.got))
+               PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
        }
+       __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
 
        . = ALIGN(8);
        __bss_start = .;
index ad8258957bb81a89c3e0d179415b413bab900494..1da4287673a96a8af70b0cef415af1f7abc9062e 100644 (file)
@@ -40,8 +40,10 @@ SECTIONS
                *(.sdata*)
                _GOT2_TABLE_ = .;
                *(.got2)
-               __got2_entries = (. - _GOT2_TABLE_) >> 2;
+               KEEP(*(.got))
+               PROVIDE(_GLOBAL_OFFSET_TABLE_ = . + 4);
        }
+       __got2_entries = ((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 2) - 1;
 
        . = ALIGN(8);
        __bss_start = .;