
Hi All,
On Tue, Sep 9, 2014 at 12:22 PM, Chris Packham judge.packham@gmail.com wrote:
When the got2 pointers were adjusted after relocation the last entry was missed. For most builds was something innocuous and there was no observable problem but at least for the P2041RDB board this ended up being NetArpWaitTimerStart which caused the ARP packets to timeout immediately.
On Mon, Sep 8, 2014 at 9:04 PM, Joakim Tjernlund joakim.tjernlund@transmode.se wrote:
The relevant code that uses __got2_entries is in start.S:
in_ram:
/* * Relocation Function, r12 point to got2+0x8000 * * Adjust got2 pointers, no need to check for 0, this code * already puts a few entries in the table. */ li r0,__got2_entries@sectoff@l la r3,GOT(_GOT2_TABLE_) lwz r11,GOT(_GOT2_TABLE_) mtctr r0 sub r11,r3,r11 addi r3,r3,-4
1: lwzu r0,4(r3) cmpwi r0,0 beq- 2f add r0,r0,r11 stw r0,0(r3) 2: bdnz 1b
bdnz does decrement then test for zero so __got2_entries should hold the number of entries to relocate.
But __got2_entries is 1 less than it should be. Fix this by removing the -1 from the __got2_entries calculation.
Cc: Joakim Tjernlund joakim.tjernlund@transmode.se Signed-off-by: Chris Packham judge.packham@gmail.com
So here's a patch that addresses the issue. I've tested it on a P2041RDB (mpc85xx/QorIq). I am aware that I'm touching a lot of platforms so I need some help testing.
I've deliberately left off the following board specific files which at a glance have the same off-by-one error:
Sorry for the noise but Jocke has pointed me in the direction of a better fix. I'll submit that as a new patch. This one can be abandoned.