[U-Boot] [PATCH] relocation: Do not relocate NULL pointers.

NULL is an absolute value and should not be relocated. After this correction code like: void weak_fun(void) __attribute__((weak)); printf("weak_fun:%p\n", weak_fun); will still print null after relocation.
Signed-off-by: Joakim Tjernlund Joakim.Tjernlund@transmode.se ---
v2 - add ppc4xx v3 - add 74xx_7xx
cpu/74xx_7xx/start.S | 6 ++++-- cpu/mpc512x/start.S | 6 ++++-- cpu/mpc5xx/start.S | 6 ++++-- cpu/mpc5xxx/start.S | 6 ++++-- cpu/mpc8220/start.S | 6 ++++-- cpu/mpc824x/start.S | 6 ++++-- cpu/mpc8260/start.S | 6 ++++-- cpu/mpc83xx/start.S | 6 ++++-- cpu/mpc85xx/start.S | 6 ++++-- cpu/mpc86xx/start.S | 6 ++++-- cpu/mpc8xx/start.S | 6 ++++-- cpu/ppc4xx/start.S | 6 ++++-- 12 files changed, 48 insertions(+), 24 deletions(-)
diff --git a/cpu/74xx_7xx/start.S b/cpu/74xx_7xx/start.S index 792cd30..23381a3 100644 --- a/cpu/74xx_7xx/start.S +++ b/cpu/74xx_7xx/start.S @@ -716,15 +716,17 @@ in_ram: 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) - bdnz 1b +2: bdnz 1b
/* * Now adjust the fixups and the pointers to the fixups * in case we need to move ourselves again. */ -2: li r0,__fixup_entries@sectoff@l + li r0,__fixup_entries@sectoff@l lwz r3,GOT(_FIXUP_TABLE_) cmpwi r0,0 mtctr r0 diff --git a/cpu/mpc512x/start.S b/cpu/mpc512x/start.S index 360682d..a00e045 100644 --- a/cpu/mpc512x/start.S +++ b/cpu/mpc512x/start.S @@ -609,15 +609,17 @@ in_ram: 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) - bdnz 1b +2: bdnz 1b
/* * Now adjust the fixups and the pointers to the fixups * in case we need to move ourselves again. */ -2: li r0,__fixup_entries@sectoff@l + li r0,__fixup_entries@sectoff@l lwz r3,GOT(_FIXUP_TABLE_) cmpwi r0,0 mtctr r0 diff --git a/cpu/mpc5xx/start.S b/cpu/mpc5xx/start.S index 106935c..85ea7a8 100644 --- a/cpu/mpc5xx/start.S +++ b/cpu/mpc5xx/start.S @@ -458,15 +458,17 @@ in_ram: 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) - bdnz 1b +2: bdnz 1b
/* * Now adjust the fixups and the pointers to the fixups * in case we need to move ourselves again. */ -2: li r0,__fixup_entries@sectoff@l + li r0,__fixup_entries@sectoff@l lwz r3,GOT(_FIXUP_TABLE_) cmpwi r0,0 mtctr r0 diff --git a/cpu/mpc5xxx/start.S b/cpu/mpc5xxx/start.S index 6b1162a..eb42939 100644 --- a/cpu/mpc5xxx/start.S +++ b/cpu/mpc5xxx/start.S @@ -684,15 +684,17 @@ in_ram: 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) - bdnz 1b +2: bdnz 1b
/* * Now adjust the fixups and the pointers to the fixups * in case we need to move ourselves again. */ -2: li r0,__fixup_entries@sectoff@l + li r0,__fixup_entries@sectoff@l lwz r3,GOT(_FIXUP_TABLE_) cmpwi r0,0 mtctr r0 diff --git a/cpu/mpc8220/start.S b/cpu/mpc8220/start.S index 3abc619..af9472d 100644 --- a/cpu/mpc8220/start.S +++ b/cpu/mpc8220/start.S @@ -649,15 +649,17 @@ in_ram: 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) - bdnz 1b +2: bdnz 1b
/* * Now adjust the fixups and the pointers to the fixups * in case we need to move ourselves again. */ -2: li r0,__fixup_entries@sectoff@l + li r0,__fixup_entries@sectoff@l lwz r3,GOT(_FIXUP_TABLE_) cmpwi r0,0 mtctr r0 diff --git a/cpu/mpc824x/start.S b/cpu/mpc824x/start.S index 39325cd..750457b 100644 --- a/cpu/mpc824x/start.S +++ b/cpu/mpc824x/start.S @@ -589,15 +589,17 @@ in_ram: 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) - bdnz 1b +2: bdnz 1b
/* * Now adjust the fixups and the pointers to the fixups * in case we need to move ourselves again. */ -2: li r0,__fixup_entries@sectoff@l + li r0,__fixup_entries@sectoff@l lwz r3,GOT(_FIXUP_TABLE_) cmpwi r0,0 mtctr r0 diff --git a/cpu/mpc8260/start.S b/cpu/mpc8260/start.S index 379f2fb..edb95e6 100644 --- a/cpu/mpc8260/start.S +++ b/cpu/mpc8260/start.S @@ -909,15 +909,17 @@ in_ram: 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) - bdnz 1b +2: bdnz 1b
/* * Now adjust the fixups and the pointers to the fixups * in case we need to move ourselves again. */ -2: li r0,__fixup_entries@sectoff@l + li r0,__fixup_entries@sectoff@l lwz r3,GOT(_FIXUP_TABLE_) cmpwi r0,0 mtctr r0 diff --git a/cpu/mpc83xx/start.S b/cpu/mpc83xx/start.S index 26e3106..ee4b862 100644 --- a/cpu/mpc83xx/start.S +++ b/cpu/mpc83xx/start.S @@ -957,16 +957,18 @@ in_ram: 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) - bdnz 1b +2: bdnz 1b
#ifndef CONFIG_NAND_SPL /* * Now adjust the fixups and the pointers to the fixups * in case we need to move ourselves again. */ -2: li r0,__fixup_entries@sectoff@l + li r0,__fixup_entries@sectoff@l lwz r3,GOT(_FIXUP_TABLE_) cmpwi r0,0 mtctr r0 diff --git a/cpu/mpc85xx/start.S b/cpu/mpc85xx/start.S index 4f7236f..d56003b 100644 --- a/cpu/mpc85xx/start.S +++ b/cpu/mpc85xx/start.S @@ -932,15 +932,17 @@ in_ram: 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) - bdnz 1b +2: bdnz 1b
/* * Now adjust the fixups and the pointers to the fixups * in case we need to move ourselves again. */ -2: li r0,__fixup_entries@sectoff@l + li r0,__fixup_entries@sectoff@l lwz r3,GOT(_FIXUP_TABLE_) cmpwi r0,0 mtctr r0 diff --git a/cpu/mpc86xx/start.S b/cpu/mpc86xx/start.S index 63cc8db..e65f1c0 100644 --- a/cpu/mpc86xx/start.S +++ b/cpu/mpc86xx/start.S @@ -733,15 +733,17 @@ in_ram: 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) - bdnz 1b +2: bdnz 1b
/* * Now adjust the fixups and the pointers to the fixups * in case we need to move ourselves again. */ -2: li r0,__fixup_entries@sectoff@l + li r0,__fixup_entries@sectoff@l lwz r3,GOT(_FIXUP_TABLE_) cmpwi r0,0 mtctr r0 diff --git a/cpu/mpc8xx/start.S b/cpu/mpc8xx/start.S index 8864c37..e84326e 100644 --- a/cpu/mpc8xx/start.S +++ b/cpu/mpc8xx/start.S @@ -589,15 +589,17 @@ in_ram: 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) - bdnz 1b +2: bdnz 1b
/* * Now adjust the fixups and the pointers to the fixups * in case we need to move ourselves again. */ -2: li r0,__fixup_entries@sectoff@l + li r0,__fixup_entries@sectoff@l lwz r3,GOT(_FIXUP_TABLE_) cmpwi r0,0 mtctr r0 diff --git a/cpu/ppc4xx/start.S b/cpu/ppc4xx/start.S index f2b8908..c3cf2ba 100644 --- a/cpu/ppc4xx/start.S +++ b/cpu/ppc4xx/start.S @@ -1568,15 +1568,17 @@ in_ram: 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) - bdnz 1b +2: bdnz 1b
/* * Now adjust the fixups and the pointers to the fixups * in case we need to move ourselves again. */ -2: li r0,__fixup_entries@sectoff@l + li r0,__fixup_entries@sectoff@l lwz r3,GOT(_FIXUP_TABLE_) cmpwi r0,0 mtctr r0

Dear Joakim Tjernlund,
In message 1254960231-11441-1-git-send-email-Joakim.Tjernlund@transmode.se you wrote:
NULL is an absolute value and should not be relocated. After this correction code like: void weak_fun(void) __attribute__((weak)); printf("weak_fun:%p\n", weak_fun); will still print null after relocation.
Signed-off-by: Joakim Tjernlund Joakim.Tjernlund@transmode.se
v2 - add ppc4xx v3 - add 74xx_7xx
Could you next time _please_ add this "v3" information to the Subject:, say as "[PATCH v3] relocation: ..." ?
Thanks!
cpu/74xx_7xx/start.S | 6 ++++-- cpu/mpc512x/start.S | 6 ++++-- cpu/mpc5xx/start.S | 6 ++++-- cpu/mpc5xxx/start.S | 6 ++++-- cpu/mpc8220/start.S | 6 ++++-- cpu/mpc824x/start.S | 6 ++++-- cpu/mpc8260/start.S | 6 ++++-- cpu/mpc83xx/start.S | 6 ++++-- cpu/mpc85xx/start.S | 6 ++++-- cpu/mpc86xx/start.S | 6 ++++-- cpu/mpc8xx/start.S | 6 ++++-- cpu/ppc4xx/start.S | 6 ++++-- 12 files changed, 48 insertions(+), 24 deletions(-)
I really wonder why we have that many copis of that code :-(
Applied to reloc branch.
Jocke, Peter: am I understanding correctly that we now have everything in the "reloc" branch that we want to include with this upcoming release, i. e. that we can do the "final" testing now before I merge that branch into master?
Best regards,
Wolfgang Denk

Dear Joakim Tjernlund,
In message 1254960231-11441-1-git-send-email-Joakim.Tjernlund@transmode.se you wrote:
NULL is an absolute value and should not be relocated. After this correction code like: void weak_fun(void) __attribute__((weak)); printf("weak_fun:%p\n", weak_fun); will still print null after relocation.
Signed-off-by: Joakim Tjernlund Joakim.Tjernlund@transmode.se
v2 - add ppc4xx v3 - add 74xx_7xx
Could you next time _please_ add this "v3" information to the Subject:, say as "[PATCH v3] relocation: ..." ?
You sure are hard to please :)
Thanks!
cpu/74xx_7xx/start.S | 6 ++++-- cpu/mpc512x/start.S | 6 ++++-- cpu/mpc5xx/start.S | 6 ++++-- cpu/mpc5xxx/start.S | 6 ++++-- cpu/mpc8220/start.S | 6 ++++-- cpu/mpc824x/start.S | 6 ++++-- cpu/mpc8260/start.S | 6 ++++-- cpu/mpc83xx/start.S | 6 ++++-- cpu/mpc85xx/start.S | 6 ++++-- cpu/mpc86xx/start.S | 6 ++++-- cpu/mpc8xx/start.S | 6 ++++-- cpu/ppc4xx/start.S | 6 ++++-- 12 files changed, 48 insertions(+), 24 deletions(-)
I really wonder why we have that many copis of that code :-(
Applied to reloc branch.
Jocke, Peter: am I understanding correctly that we now have everything in the "reloc" branch that we want to include with this upcoming release, i. e. that we can do the "final" testing now before I merge that branch into master?
Yes, I have nothing more ready and I believe everything is in place.

Dear Joakim Tjernlund,
In message OF5F1602B1.C165074D-ONC1257649.0030F813-C1257649.00311F2C@transmode.se you wrote:
Could you next time _please_ add this "v3" information to the Subject:, say as "[PATCH v3] relocation: ..." ?
You sure are hard to please :)
Not really. I consider this a basic requirement to patch submission. In your case, I received two patches with identical subjets within a very short interval. In such cases it is impossible to say which was sent first, i.e. I have to rely on (often non-working) threading and/or to open the messages and try to figure out from content which is what. This is just a waste of time.
Jocke, Peter: am I understanding correctly that we now have everything in the "reloc" branch that we want to include with this upcoming release, i. e. that we can do the "final" testing now before I merge that branch into master?
Yes, I have nothing more ready and I believe everything is in place.
Good.
Thanks.
Best regards,
Wolfgang Denk

Wolfgang Denk wd@denx.de wrote on 08/10/2009 14:44:07:
Dear Joakim Tjernlund,
In message <OF5F1602B1.C165074D-ONC1257649.0030F813-C1257649. 00311F2C@transmode.se> you wrote:
Could you next time _please_ add this "v3" information to the Subject:, say as "[PATCH v3] relocation: ..." ?
You sure are hard to please :)
Not really. I consider this a basic requirement to patch submission. In your case, I received two patches with identical subjets within a very short interval. In such cases it is impossible to say which was sent first, i.e. I have to rely on (often non-working) threading and/or to open the messages and try to figure out from content which is what. This is just a waste of time.
That was not seriously meant, hence the :) Sorry for the confusion.
Jocke

Jocke, Peter: am I understanding correctly that we now have everything in the "reloc" branch that we want to include with this upcoming release, i. e. that we can do the "final" testing now before I merge that branch into master?
Yes, I have nothing more ready and I believe everything is in place.
Same here, should be good to go.
Peter

Dear Peter Tyser,
In message 1255009252.9100.1019.camel@localhost.localdomain you wrote:
Jocke, Peter: am I understanding correctly that we now have everything in the "reloc" branch that we want to include with this upcoming release, i. e. that we can do the "final" testing now before I merge that branch into master?
Yes, I have nothing more ready and I believe everything is in place.
Same here, should be good to go.
I tested the "reloc" branch on a few boards, and didn't see any problems. So I decided to go ahead and merged it into "master".
It's in mainline now :-)
Best regards,
Wolfgang Denk
participants (4)
-
Joakim Tjernlund
-
Joakim Tjernlund
-
Peter Tyser
-
Wolfgang Denk