diff mbox

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

Message ID 1291393838-19683-2-git-send-email-Joakim.Tjernlund@transmode.se
State Accepted
Commit ee0270dff748213bd009fad566c913110fbd89f9
Delegated to: Wolfgang Denk
Headers show

Commit Message

Joakim Tjernlund Dec. 3, 2010, 4:30 p.m. UTC
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>
---
 nand_spl/board/freescale/mpc8313erdb/u-boot.lds |    4 +++-
 nand_spl/board/freescale/mpc8315erdb/u-boot.lds |    4 +++-
 nand_spl/board/sheldon/simpc8313/u-boot.lds     |    4 +++-
 3 files changed, 9 insertions(+), 3 deletions(-)

Comments

Joakim Tjernlund Dec. 9, 2010, 6:30 p.m. UTC | #1
>
> 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>

Ping?
Scott Wood Dec. 9, 2010, 7:02 p.m. UTC | #2
On Fri, 3 Dec 2010 10:30:38 -0600
"Joakim Tjernlund" <Joakim.Tjernlund@transmode.se> wrote:

> 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>
> ---
>  nand_spl/board/freescale/mpc8313erdb/u-boot.lds |    4 +++-
>  nand_spl/board/freescale/mpc8315erdb/u-boot.lds |    4 +++-
>  nand_spl/board/sheldon/simpc8313/u-boot.lds     |    4 +++-
>  3 files changed, 9 insertions(+), 3 deletions(-)
> 


Were you able to boot test it on at least one of the boards?

If so:
Acked-by: Scott Wood <scottwood@freescale.com>
if Kim wants to take both of them.

If not, is there anything special I need to test it (specific
toolchain?) besides these two patches?

-Scott
Joakim Tjernlund Dec. 9, 2010, 8:26 p.m. UTC | #3
>
> On Fri, 3 Dec 2010 10:30:38 -0600
> "Joakim Tjernlund" <Joakim.Tjernlund@transmode.se> wrote:
>
> > 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>
> > ---
> >  nand_spl/board/freescale/mpc8313erdb/u-boot.lds |    4 +++-
> >  nand_spl/board/freescale/mpc8315erdb/u-boot.lds |    4 +++-
> >  nand_spl/board/sheldon/simpc8313/u-boot.lds     |    4 +++-
> >  3 files changed, 9 insertions(+), 3 deletions(-)
> >
>
>
> Were you able to boot test it on at least one of the boards?

nope, I don't have any of them. Just my own 8321 board.

>
> If so:
> Acked-by: Scott Wood <scottwood@freescale.com>
> if Kim wants to take both of them.
>
> If not, is there anything special I need to test it (specific
> toolchain?) besides these two patches?

No, not yet. The real benefit comes in later patches. Just
makes sure it works as before.

 Jocke
Joakim Tjernlund Dec. 9, 2010, 8:30 p.m. UTC | #4
>
>
> >
> > On Fri, 3 Dec 2010 10:30:38 -0600
> > "Joakim Tjernlund" <Joakim.Tjernlund@transmode.se> wrote:
> >
> > > 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>
> > > ---
> > >  nand_spl/board/freescale/mpc8313erdb/u-boot.lds |    4 +++-
> > >  nand_spl/board/freescale/mpc8315erdb/u-boot.lds |    4 +++-
> > >  nand_spl/board/sheldon/simpc8313/u-boot.lds     |    4 +++-
> > >  3 files changed, 9 insertions(+), 3 deletions(-)
> > >
> >
> >
> > Were you able to boot test it on at least one of the boards?
>
> nope, I don't have any of them. Just my own 8321 board.
>
> >
> > If so:
> > Acked-by: Scott Wood <scottwood@freescale.com>
> > if Kim wants to take both of them.
> >
> > If not, is there anything special I need to test it (specific
> > toolchain?) besides these two patches?
>
> No, not yet. The real benefit comes in later patches. Just
> makes sure it works as before.

Well, one thing should work now. nand_spl does not use fixups
so you should be able to remove -mrelocatable and just use -fpic.
Scott Wood Dec. 10, 2010, 8:34 p.m. UTC | #5
On Thu, 9 Dec 2010 21:30:16 +0100
Joakim Tjernlund <joakim.tjernlund@transmode.se> wrote:

> > > If not, is there anything special I need to test it (specific
> > > toolchain?) besides these two patches?
> >
> > No, not yet. The real benefit comes in later patches. Just
> > makes sure it works as before.

I applied those two patches on top of next, and it boots OK.

I added -fpic to PLATFORM_RELFLAGS, still boots OK.

> Well, one thing should work now. nand_spl does not use fixups
> so you should be able to remove -mrelocatable and just use -fpic.

If I remove -mrelocatable (with or without -fpic in place) I get
ERROR: Your compiler doesn't generate .fixup sections!
       Upgrade to a recent toolchain.

I see this with GCC 4.3.2 and GCC 4.5.1.

-Scott
Joakim Tjernlund Dec. 11, 2010, 9:08 a.m. UTC | #6
Scott Wood <scottwood@freescale.com> wrote on 2010/12/10 21:34:59:
>
> On Thu, 9 Dec 2010 21:30:16 +0100
> Joakim Tjernlund <joakim.tjernlund@transmode.se> wrote:
>
> > > > If not, is there anything special I need to test it (specific
> > > > toolchain?) besides these two patches?
> > >
> > > No, not yet. The real benefit comes in later patches. Just
> > > makes sure it works as before.
>
> I applied those two patches on top of next, and it boots OK.
>
> I added -fpic to PLATFORM_RELFLAGS, still boots OK.
>
> > Well, one thing should work now. nand_spl does not use fixups
> > so you should be able to remove -mrelocatable and just use -fpic.
>
> If I remove -mrelocatable (with or without -fpic in place) I get
> ERROR: Your compiler doesn't generate .fixup sections!
>        Upgrade to a recent toolchain.

Seems like nand_spl borrows the Makefile under arch/powerpc/ which won't work
as the normal powerpc boards needs .fixups and has a test for that.
In addition the test is a bit flawed, it checks the object files for .fixups
instead of checking the toolchain.
Obviously this will have to be fixed before one can remove -mrelocatable just for nand_spl.
On the other hand, removing -mrelocatable won't be needed when you use my gcc patches which
will be in gcc 4.6
Kim Phillips Dec. 13, 2010, 11:05 p.m. UTC | #7
On Thu, 9 Dec 2010 13:02:58 -0600
Scott Wood <scottwood@freescale.com> wrote:

> On Fri, 3 Dec 2010 10:30:38 -0600
> "Joakim Tjernlund" <Joakim.Tjernlund@transmode.se> wrote:
> 
> > 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>
> > ---
> >  nand_spl/board/freescale/mpc8313erdb/u-boot.lds |    4 +++-
> >  nand_spl/board/freescale/mpc8315erdb/u-boot.lds |    4 +++-
> >  nand_spl/board/sheldon/simpc8313/u-boot.lds     |    4 +++-
> >  3 files changed, 9 insertions(+), 3 deletions(-)
> 
> Were you able to boot test it on at least one of the boards?
> 
> If so:
> Acked-by: Scott Wood <scottwood@freescale.com>
> if Kim wants to take both of them.

patch 1 out of 2 goes outside the 83xx domain; defaulting to Wolfgang
to pick up both, with my:

Acked-by: Kim Phillips <kim.phillips@freescale.com>

Thanks,

Kim
Joakim Tjernlund Dec. 14, 2010, 12:49 a.m. UTC | #8
Kim Phillips <kim.phillips@freescale.com> wrote on 2010/12/14 00:05:11:
> On Thu, 9 Dec 2010 13:02:58 -0600
> Scott Wood <scottwood@freescale.com> wrote:
>
> > On Fri, 3 Dec 2010 10:30:38 -0600
> > "Joakim Tjernlund" <Joakim.Tjernlund@transmode.se> wrote:
> >
> > > 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>
> > > ---
> > >  nand_spl/board/freescale/mpc8313erdb/u-boot.lds |    4 +++-
> > >  nand_spl/board/freescale/mpc8315erdb/u-boot.lds |    4 +++-
> > >  nand_spl/board/sheldon/simpc8313/u-boot.lds     |    4 +++-
> > >  3 files changed, 9 insertions(+), 3 deletions(-)
> >
> > Were you able to boot test it on at least one of the boards?
> >
> > If so:
> > Acked-by: Scott Wood <scottwood@freescale.com>
> > if Kim wants to take both of them.
>
> patch 1 out of 2 goes outside the 83xx domain; defaulting to Wolfgang
> to pick up both, with my:
>
> Acked-by: Kim Phillips <kim.phillips@freescale.com>

Great! then we got:
[PATCH] PowerPC: Move -fPIC flag to common place
[PATCH] PowerPC: Add support for -msingle-pic-base
Joakim Tjernlund Dec. 17, 2010, 3:54 p.m. UTC | #9
>
> Kim Phillips <kim.phillips@freescale.com> wrote on 2010/12/14 00:05:11:
> > On Thu, 9 Dec 2010 13:02:58 -0600
> > Scott Wood <scottwood@freescale.com> wrote:
> >
> > > On Fri, 3 Dec 2010 10:30:38 -0600
> > > "Joakim Tjernlund" <Joakim.Tjernlund@transmode.se> wrote:
> > >
> > > > 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>
> > > > ---
> > > >  nand_spl/board/freescale/mpc8313erdb/u-boot.lds |    4 +++-
> > > >  nand_spl/board/freescale/mpc8315erdb/u-boot.lds |    4 +++-
> > > >  nand_spl/board/sheldon/simpc8313/u-boot.lds     |    4 +++-
> > > >  3 files changed, 9 insertions(+), 3 deletions(-)
> > >
> > > Were you able to boot test it on at least one of the boards?
> > >
> > > If so:
> > > Acked-by: Scott Wood <scottwood@freescale.com>
> > > if Kim wants to take both of them.
> >
> > patch 1 out of 2 goes outside the 83xx domain; defaulting to Wolfgang
> > to pick up both, with my:
> >
> > Acked-by: Kim Phillips <kim.phillips@freescale.com>

These seems forgotten?

>
> Great! then we got:
> [PATCH] PowerPC: Move -fPIC flag to common place
> [PATCH] PowerPC: Add support for -msingle-pic-base

How about the above 2 patches?

   Jocke
Wolfgang Denk Dec. 17, 2010, 4:13 p.m. UTC | #10
Dear Joakim Tjernlund,

In message <OF3301F88E.E61F6369-ONC12577FC.00573EBC-C12577FC.00576AF2@transmode.se> you wrote:
>
> > Great! then we got:
> > [PATCH] PowerPC: Move -fPIC flag to common place
> > [PATCH] PowerPC: Add support for -msingle-pic-base
> 
> How about the above 2 patches?

I think I have them on my list for "next", but I got other things to
do first.

This will definitely not go into v2010.12.

Best regards,

Wolfgang Denk
Joakim Tjernlund Dec. 17, 2010, 4:39 p.m. UTC | #11
Wolfgang Denk <wd@denx.de> wrote on 2010/12/17 17:13:47:
>
> Dear Joakim Tjernlund,
>
> In message <OF3301F88E.E61F6369-ONC12577FC.00573EBC-C12577FC.00576AF2@transmode.se> you wrote:
> >
> > > Great! then we got:
> > > [PATCH] PowerPC: Move -fPIC flag to common place
> > > [PATCH] PowerPC: Add support for -msingle-pic-base
> >
> > How about the above 2 patches?
>
> I think I have them on my list for "next", but I got other things to
> do first.

OK, not forgotten then. Good.

>
> This will definitely not go into v2010.12.

Sure, that was not my intention either.

        Jocke
Wolfgang Denk Dec. 17, 2010, 7:40 p.m. UTC | #12
Dear Joakim Tjernlund,

In message <1291393838-19683-2-git-send-email-Joakim.Tjernlund@transmode.se> you wrote:
> 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>
> ---
>  nand_spl/board/freescale/mpc8313erdb/u-boot.lds |    4 +++-
>  nand_spl/board/freescale/mpc8315erdb/u-boot.lds |    4 +++-
>  nand_spl/board/sheldon/simpc8313/u-boot.lds     |    4 +++-
>  3 files changed, 9 insertions(+), 3 deletions(-)

Applied to "next", thanks.

Best regards,

Wolfgang Denk
Joakim Tjernlund Jan. 12, 2011, 4:16 p.m. UTC | #13
> Wolfgang Denk <wd@denx.de> wrote on 2010/12/17 17:13:47:
> >
> > Dear Joakim Tjernlund,
> >
> > In message <OF3301F88E.E61F6369-ONC12577FC.00573EBC-C12577FC.00576AF2@transmode.se> you wrote:
> > >
> > > > Great! then we got:
> > > > [PATCH] PowerPC: Move -fPIC flag to common place
> > > > [PATCH] PowerPC: Add support for -msingle-pic-base
> > >
> > > How about the above 2 patches?
> >
> > I think I have them on my list for "next", but I got other things to
> > do first.
>
> OK, not forgotten then. Good.
>
> >
> > This will definitely not go into v2010.12.
>
> Sure, that was not my intention either.

hmm, no word on the above two patches yet.

     Jocke
diff mbox

Patch

diff --git a/nand_spl/board/freescale/mpc8313erdb/u-boot.lds b/nand_spl/board/freescale/mpc8313erdb/u-boot.lds
index 138e427..f1649f8 100644
--- a/nand_spl/board/freescale/mpc8313erdb/u-boot.lds
+++ b/nand_spl/board/freescale/mpc8313erdb/u-boot.lds
@@ -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 = .;
diff --git a/nand_spl/board/freescale/mpc8315erdb/u-boot.lds b/nand_spl/board/freescale/mpc8315erdb/u-boot.lds
index 138e427..f1649f8 100644
--- a/nand_spl/board/freescale/mpc8315erdb/u-boot.lds
+++ b/nand_spl/board/freescale/mpc8315erdb/u-boot.lds
@@ -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 = .;
diff --git a/nand_spl/board/sheldon/simpc8313/u-boot.lds b/nand_spl/board/sheldon/simpc8313/u-boot.lds
index ad82589..1da4287 100644
--- a/nand_spl/board/sheldon/simpc8313/u-boot.lds
+++ b/nand_spl/board/sheldon/simpc8313/u-boot.lds
@@ -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 = .;