
Hi Jocke
On Wed, Sep 10, 2014 at 1:20 AM, Joakim Tjernlund joakim.tjernlund@transmode.se wrote:
Joakim Tjernlund/Transmode wrote on 2014/09/09 14:30:13:
From: Joakim Tjernlund/Transmode To: Cc: Chris Packham judge.packham@gmail.com, u-boot
Date: 2014/09/09 14:30 Subject: Re: [U-Boot] relocation problem on powerpc
Here's some more info from a build without any of my modifications.
$ git describe v2014.10-rc2-12-g0b703db
$ powerpc-e500-linux-gnu-gcc --version powerpc-e500-linux-gnu-gcc (Gentoo 4.6.3-r1 p1.9, pie-0.5.2) 4.6.3
$ grep '_GOT2_TABLE_|_GLOBAL_OFFSET_TABLE_|__got2_entries'
u-boot.map
0x00000000effb5100 _GOT2_TABLE_ = . 0x00000000effb7d38 _GLOBAL_OFFSET_TABLE_ 0x00000000effb7d48 PROVIDE (_GLOBAL_OFFSET_TABLE_,
(. + 0x4))
0x0000000000000b0d __got2_entries = (((_GLOBAL_OFFSET_TABLE_ - _GOT2_TABLE_) >> 0x2) - 0x1)
$ gdb-multiarch u-boot (gdb) disassemble /r 0xeffb5100,0xeffb7d48 Dump of assembler code from 0xeffb5100 to 0xeffb7d48: 0xeffb5100 <_GOT2_TABLE_+0>: ef fb 51 00 .long 0xeffb5100 0xeffb5104 <_GOT2_TABLE_+4>: ef fb 7d 44 dtstsf cr7,f27,f15 0xeffb5108 <_GOT2_TABLE_+8>: ef f4 00 00 .long 0xeff40000 0xeffb510c <_GOT2_TABLE_+12>: ef f4 01 00 .long
0xeff40100
<snip> 0xeffb7d30 <_GOT2_TABLE_+11312>: ef f6 6e 74 .long
0xeff66e74
0xeffb7d34 <_GOT2_TABLE_+11316>: f0 00 00 d0 psq_st
f0,208(r0),0,0
0xeffb7d38 <_GLOBAL_OFFSET_TABLE_+0>: 00 00 00 00 .long
0x0
0xeffb7d3c <_GLOBAL_OFFSET_TABLE_+4>: 00 00 00 00 .long
0x0
0xeffb7d40 <_GLOBAL_OFFSET_TABLE_+8>: 00 00 00 00 .long
0x0
0xeffb7d44 <_FIXUP_TABLE_+0>: ef fb 99 d4 .long
0xeffb99d4
So no there is no brlr at the end of the table.
There should be, see
http://www.freescale.com/files/32bit/doc/ref_manual/E500ABIUG.pdf, chap 4.3.2
Yep that's pretty unambiguous "The word at _GLOBAL_OFFSET_TABLE_[-1] shall contain a blrl instruction". No "should", "may" or "can" in sight.
So I did a quick test too with my copy of u-boot: (gdb) disass /r 0x00000000effa0a48,0x00000000effa0a68 Dump of assembler code from 0xeffa0a48 to 0xeffa0a68: 0xeffa0a48 <_GOT2_TABLE_+9800>: f0 00 00 dc .long 0xf00000dc 0xeffa0a4c <_GOT2_TABLE_+9804>: ef f6 29 48 .long 0xeff62948 0xeffa0a50 <_GOT2_TABLE_+9808>: f0 00 00 e0 .long 0xf00000e0 0xeffa0a54 <_GOT2_TABLE_+9812>: 4e 80 00 21 blrl ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 0xeffa0a58 <_GLOBAL_OFFSET_TABLE_+0>: 00 00 00 00 .long 0x0 0xeffa0a5c <_GLOBAL_OFFSET_TABLE_+4>: 00 00 00 00 .long 0x0 0xeffa0a60 <_GLOBAL_OFFSET_TABLE_+8>: 00 00 00 00 .long 0x0 0xeffa0a64 <_FIXUP_TABLE_+0>: ef fa 23 1c .long 0xeffa231c
$ powerpc-softfloat_4.5.3-linux-gnu-ld --version GNU ld (GNU Binutils) 2.21.1
I don't know it this is tool(ld) problem or if something in u-boot's
build env. Try dropping
--gc-sections, see if that changes anything, or add --bss-plt or similar
--bss-plt seems to be the answer: http://lists.denx.de/pipermail/u-boot/2014-February/173134.html
Jocke
Same question as that original thread '--bss-plt' or '-mbss-plt'? The former works (I'll send a patch through) but I can only find documentation for the latter.