diff mbox

[U-Boot,RFC,v1] powerpc: add --bss-plt to LDFLAGS

Message ID 1410321790-12914-1-git-send-email-judge.packham@gmail.com
State Accepted
Delegated to: York Sun
Headers show

Commit Message

Chris Packham Sept. 10, 2014, 4:03 a.m. UTC
With some versions of gcc (that we know of 4.6.3 and 4.8.2 are affected)
it is necessary to specify --bss-plt to get the final blrl in the
_GOT2_TABLE_. Without this the last symbol does not get it's address
relocated.  For the P2041RDB board this ended up being
NetArpWaitTimerStart which caused the ARP packets to timeout
immediately.

Helped-by: Joakim Tjernlund <joakim.tjernlund@transmode.se>
Signed-off-by: Chris Packham <judge.packham@gmail.com>
---
Technically this is v2 of
http://lists.denx.de/pipermail/u-boot/2014-September/188365.html but the
solution is so different that I'm treating it as a new patch series.

 arch/powerpc/config.mk |    1 +
 1 file changed, 1 insertion(+)

Comments

Joakim Tjernlund Sept. 10, 2014, 10:47 a.m. UTC | #1
Chris Packham <judge.packham@gmail.com> wrote on 2014/09/10 06:03:10:
> 
> With some versions of gcc (that we know of 4.6.3 and 4.8.2 are affected)
> it is necessary to specify --bss-plt to get the final blrl in the
> _GOT2_TABLE_. Without this the last symbol does not get it's address
> relocated.  For the P2041RDB board this ended up being
> NetArpWaitTimerStart which caused the ARP packets to timeout
> immediately.
> 
> Helped-by: Joakim Tjernlund <joakim.tjernlund@transmode.se>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>

The commit text is a bit misleading, it is binutils(ld) which has changed
default so now one have to specify --bss-plt to get what u-boot needs.
Works fine with binutils 2.21.1

Acked-by: Joakim Tjernlund <joakim.tjernlund@transmode.se>

One could possibly argue that --secure-plt should have a NULL word there 
like
the other 3 reserved words around _GLOBAL_OFFSET_TABLE_ to preserve 
compatibility.

PS.
     -mbss-plt is the gcc option while --bss-plt is the ld option. u-boot
     invokes ld directly so --bss-plt is appropriate
 
> ---
> Technically this is v2 of
> http://lists.denx.de/pipermail/u-boot/2014-September/188365.html but the
> solution is so different that I'm treating it as a new patch series.
> 
>  arch/powerpc/config.mk |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/powerpc/config.mk b/arch/powerpc/config.mk
> index 6329b6c..fec02f2 100644
> --- a/arch/powerpc/config.mk
> +++ b/arch/powerpc/config.mk
> @@ -11,6 +11,7 @@ endif
> 
>  CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000
>  LDFLAGS_FINAL += --gc-sections
> +LDFLAGS_FINAL += --bss-plt
>  PLATFORM_RELFLAGS += -fpic -mrelocatable -ffunction-sections 
-fdata-sections \
>                          -meabi
>  PLATFORM_CPPFLAGS += -D__powerpc__ -ffixed-r2
> -- 
> 1.7.9.5
>
York Sun Sept. 24, 2014, 10:14 p.m. UTC | #2
On 09/09/2014 09:03 PM, Chris Packham wrote:
> With some versions of gcc (that we know of 4.6.3 and 4.8.2 are affected)
> it is necessary to specify --bss-plt to get the final blrl in the
> _GOT2_TABLE_. Without this the last symbol does not get it's address
> relocated.  For the P2041RDB board this ended up being
> NetArpWaitTimerStart which caused the ARP packets to timeout
> immediately.
> 
> Helped-by: Joakim Tjernlund <joakim.tjernlund@transmode.se>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---

Dear Wolfgang,

I am trying to apply this patch. Shall I drop the "Helped-by:" line. I
understand Chris is giving credit to Joakim. But "Helped-by:" is not a standard
signature.

York
Joakim Tjernlund Sept. 25, 2014, 7:26 a.m. UTC | #3
> 
> On 09/09/2014 09:03 PM, Chris Packham wrote:
> > With some versions of gcc (that we know of 4.6.3 and 4.8.2 are 
affected)
> > it is necessary to specify --bss-plt to get the final blrl in the
> > _GOT2_TABLE_. Without this the last symbol does not get it's address
> > relocated.  For the P2041RDB board this ended up being
> > NetArpWaitTimerStart which caused the ARP packets to timeout
> > immediately.
> > 
> > Helped-by: Joakim Tjernlund <joakim.tjernlund@transmode.se>
> > Signed-off-by: Chris Packham <judge.packham@gmail.com>
> > ---
> 
> Dear Wolfgang,
> 
> I am trying to apply this patch. Shall I drop the "Helped-by:" line. I
> understand Chris is giving credit to Joakim. But "Helped-by:" is not a 
standard
> signature.

I am happy with Acked-by or Sign-off-by, you choose.

 Jocke
York Sun Sept. 25, 2014, 4:49 p.m. UTC | #4
On 09/09/2014 09:03 PM, Chris Packham wrote:
> With some versions of gcc (that we know of 4.6.3 and 4.8.2 are affected)
> it is necessary to specify --bss-plt to get the final blrl in the
> _GOT2_TABLE_. Without this the last symbol does not get it's address
> relocated.  For the P2041RDB board this ended up being
> NetArpWaitTimerStart which caused the ARP packets to timeout
> immediately.
> 
> Helped-by: Joakim Tjernlund <joakim.tjernlund@transmode.se>
> Signed-off-by: Chris Packham <judge.packham@gmail.com>
> ---

Applied to u-boot-mpc85xx, awaiting upstream.

York
diff mbox

Patch

diff --git a/arch/powerpc/config.mk b/arch/powerpc/config.mk
index 6329b6c..fec02f2 100644
--- a/arch/powerpc/config.mk
+++ b/arch/powerpc/config.mk
@@ -11,6 +11,7 @@  endif
 
 CONFIG_STANDALONE_LOAD_ADDR ?= 0x40000
 LDFLAGS_FINAL += --gc-sections
+LDFLAGS_FINAL += --bss-plt
 PLATFORM_RELFLAGS += -fpic -mrelocatable -ffunction-sections -fdata-sections \
 								-meabi
 PLATFORM_CPPFLAGS += -D__powerpc__ -ffixed-r2