diff mbox series

[U-Boot] mpc83xx: Add support for -msingle-pic-base

Message ID 20181128095955.8828-1-joakim.tjernlund@infinera.com
State Accepted
Commit 64d68dcdd7de3f8a20753a73a988835fafc3ce7c
Delegated to: Mario Six
Headers show
Series [U-Boot] mpc83xx: Add support for -msingle-pic-base | expand

Commit Message

Joakim Tjernlund Nov. 28, 2018, 9:59 a.m. UTC
-msingle-pic-base is a new gcc(from 4.6) option for ppc and
it reduces the size of my u-boot with about 4 KB.
While at it, add -fno-jump-tables too to save a
few more bytes.

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
---

 I think all PowerPC's can use this but I have only tested
 83xx so just enable for this cpu for now.

 arch/powerpc/cpu/mpc83xx/config.mk | 1 +
 arch/powerpc/cpu/mpc83xx/start.S   | 3 +++
 2 files changed, 4 insertions(+)

Comments

Mario Six Dec. 5, 2018, 11:56 a.m. UTC | #1
Hi Joakim,
On Wed, Dec 5, 2018 at 11:03 AM Joakim Tjernlund
<Joakim.Tjernlund@infinera.com> wrote:
>
> Ping ?
>
> On Thu, 2018-11-29 at 14:09 +0100, Joakim Tjernlund wrote:
> > OOPS, I forgot to include you in this patch so I do that now :)
> >
> >
> > ------- Forwarded Message --------
> > From: Joakim Tjernlund <joakim.tjernlund@infinera.com>
> > To: u-boot@lists.denx.de
> > Cc: Joakim Tjernlund <joakim.tjernlund@infinera.com>
> > Subject: [PATCH] mpc83xx: Add support for -msingle-pic-base
> > Date: Wed, 28 Nov 2018 10:59:55 +0100
> >
> > -msingle-pic-base is a new gcc(from 4.6) option for ppc and
> > it reduces the size of my u-boot with about 4 KB.
> > While at it, add -fno-jump-tables too to save a
> > few more bytes.
> >
> > Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
> > ---
> >
> >  I think all PowerPC's can use this but I have only tested
> >  83xx so just enable for this cpu for now.
> >
> >  arch/powerpc/cpu/mpc83xx/config.mk | 1 +
> >  arch/powerpc/cpu/mpc83xx/start.S   | 3 +++
> >  2 files changed, 4 insertions(+)
> >
> > diff --git a/arch/powerpc/cpu/mpc83xx/config.mk b/arch/powerpc/cpu/mpc83xx/config.mk
> > index 14870eec4d..a07df4d389 100644
> > --- a/arch/powerpc/cpu/mpc83xx/config.mk
> > +++ b/arch/powerpc/cpu/mpc83xx/config.mk
> > @@ -3,3 +3,4 @@
> >  # Copyright 2004 Freescale Semiconductor, Inc.
> >
> >  PLATFORM_CPPFLAGS += -DCONFIG_E300 -msoft-float
> > +PLATFORM_RELFLAGS += -msingle-pic-base -fno-jump-tables
> > diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S
> > index a3bacf138c..c00bb31363 100644
> > --- a/arch/powerpc/cpu/mpc83xx/start.S
> > +++ b/arch/powerpc/cpu/mpc83xx/start.S
> > @@ -288,6 +288,9 @@ in_flash:
> >       /*------------------------------------------------------*/
> >
> >       GET_GOT                 /* initialize GOT access        */
> > +     /* Needed for -msingle-pic-base */
> > +     bl      _GLOBAL_OFFSET_TABLE_@local-4
> > +     mflr    r30
> >
> >       /* r3: IMMR */
> >       lis     r3, CONFIG_SYS_IMMR@h
>
Don't worry, I was aware of the patch; just had to find some time for
testing :-)

Reviewed-by: Mario Six <mario.six@gdsys.cc>
Tested-by: Mario Six <mario.six@gdsys.cc> (on MPC8308)

Best regards,
Mario
Mario Six Dec. 11, 2018, 6:18 a.m. UTC | #2
On Wed, Dec 5, 2018 at 12:56 PM Mario Six <mario.six@gdsys.cc> wrote:
>
> Hi Joakim,
> On Wed, Dec 5, 2018 at 11:03 AM Joakim Tjernlund
> <Joakim.Tjernlund@infinera.com> wrote:
> >
> > Ping ?
> >
> > On Thu, 2018-11-29 at 14:09 +0100, Joakim Tjernlund wrote:
> > > OOPS, I forgot to include you in this patch so I do that now :)
> > >
> > >
> > > ------- Forwarded Message --------
> > > From: Joakim Tjernlund <joakim.tjernlund@infinera.com>
> > > To: u-boot@lists.denx.de
> > > Cc: Joakim Tjernlund <joakim.tjernlund@infinera.com>
> > > Subject: [PATCH] mpc83xx: Add support for -msingle-pic-base
> > > Date: Wed, 28 Nov 2018 10:59:55 +0100
> > >
> > > -msingle-pic-base is a new gcc(from 4.6) option for ppc and
> > > it reduces the size of my u-boot with about 4 KB.
> > > While at it, add -fno-jump-tables too to save a
> > > few more bytes.
> > >
> > > Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
> > > ---
> > >
> > >  I think all PowerPC's can use this but I have only tested
> > >  83xx so just enable for this cpu for now.
> > >
> > >  arch/powerpc/cpu/mpc83xx/config.mk | 1 +
> > >  arch/powerpc/cpu/mpc83xx/start.S   | 3 +++
> > >  2 files changed, 4 insertions(+)
> > >
> > > diff --git a/arch/powerpc/cpu/mpc83xx/config.mk b/arch/powerpc/cpu/mpc83xx/config.mk
> > > index 14870eec4d..a07df4d389 100644
> > > --- a/arch/powerpc/cpu/mpc83xx/config.mk
> > > +++ b/arch/powerpc/cpu/mpc83xx/config.mk
> > > @@ -3,3 +3,4 @@
> > >  # Copyright 2004 Freescale Semiconductor, Inc.
> > >
> > >  PLATFORM_CPPFLAGS += -DCONFIG_E300 -msoft-float
> > > +PLATFORM_RELFLAGS += -msingle-pic-base -fno-jump-tables
> > > diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S
> > > index a3bacf138c..c00bb31363 100644
> > > --- a/arch/powerpc/cpu/mpc83xx/start.S
> > > +++ b/arch/powerpc/cpu/mpc83xx/start.S
> > > @@ -288,6 +288,9 @@ in_flash:
> > >       /*------------------------------------------------------*/
> > >
> > >       GET_GOT                 /* initialize GOT access        */
> > > +     /* Needed for -msingle-pic-base */
> > > +     bl      _GLOBAL_OFFSET_TABLE_@local-4
> > > +     mflr    r30
> > >
> > >       /* r3: IMMR */
> > >       lis     r3, CONFIG_SYS_IMMR@h
> >
> Don't worry, I was aware of the patch; just had to find some time for
> testing :-)
>
> Reviewed-by: Mario Six <mario.six@gdsys.cc>
> Tested-by: Mario Six <mario.six@gdsys.cc> (on MPC8308)
>
> Best regards,
> Mario

Applied to u-boot-mpc83xx/master.
diff mbox series

Patch

diff --git a/arch/powerpc/cpu/mpc83xx/config.mk b/arch/powerpc/cpu/mpc83xx/config.mk
index 14870eec4d..a07df4d389 100644
--- a/arch/powerpc/cpu/mpc83xx/config.mk
+++ b/arch/powerpc/cpu/mpc83xx/config.mk
@@ -3,3 +3,4 @@ 
 # Copyright 2004 Freescale Semiconductor, Inc.
 
 PLATFORM_CPPFLAGS += -DCONFIG_E300 -msoft-float
+PLATFORM_RELFLAGS += -msingle-pic-base -fno-jump-tables
diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S
index a3bacf138c..c00bb31363 100644
--- a/arch/powerpc/cpu/mpc83xx/start.S
+++ b/arch/powerpc/cpu/mpc83xx/start.S
@@ -288,6 +288,9 @@  in_flash:
 	/*------------------------------------------------------*/
 
 	GET_GOT			/* initialize GOT access	*/
+	/* Needed for -msingle-pic-base */
+	bl	_GLOBAL_OFFSET_TABLE_@local-4
+	mflr	r30
 
 	/* r3: IMMR */
 	lis	r3, CONFIG_SYS_IMMR@h