Skip to contentSkip to conversation

relocation: Do not relocate NULL pointers.

PATCH New Joakim Tjernlund 3 participants 7 messages Oct 8, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---

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(-)
cpu/74xx_7xx/start.S +4 -2
index 792cd30..23381a3 100644
@@ -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 at sectoff@l
+	li	r0,__fixup_entries at sectoff@l
 	lwz	r3,GOT(_FIXUP_TABLE_)
 	cmpwi	r0,0
 	mtctr	r0
cpu/mpc512x/start.S +4 -2
index 360682d..a00e045 100644
@@ -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 at sectoff@l
+	li	r0,__fixup_entries at sectoff@l
 	lwz	r3,GOT(_FIXUP_TABLE_)
 	cmpwi	r0,0
 	mtctr	r0
cpu/mpc5xx/start.S +4 -2
index 106935c..85ea7a8 100644
@@ -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 at sectoff@l
+	li	r0,__fixup_entries at sectoff@l
 	lwz	r3,GOT(_FIXUP_TABLE_)
 	cmpwi	r0,0
 	mtctr	r0
cpu/mpc5xxx/start.S +4 -2
index 6b1162a..eb42939 100644
@@ -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 at sectoff@l
+	li	r0,__fixup_entries at sectoff@l
 	lwz	r3,GOT(_FIXUP_TABLE_)
 	cmpwi	r0,0
 	mtctr	r0
cpu/mpc8220/start.S +4 -2
index 3abc619..af9472d 100644
@@ -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 at sectoff@l
+	li	r0,__fixup_entries at sectoff@l
 	lwz	r3,GOT(_FIXUP_TABLE_)
 	cmpwi	r0,0
 	mtctr	r0
cpu/mpc824x/start.S +4 -2
index 39325cd..750457b 100644
@@ -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 at sectoff@l
+	li	r0,__fixup_entries at sectoff@l
 	lwz	r3,GOT(_FIXUP_TABLE_)
 	cmpwi	r0,0
 	mtctr	r0
cpu/mpc8260/start.S +4 -2
index 379f2fb..edb95e6 100644
@@ -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 at sectoff@l
+	li	r0,__fixup_entries at sectoff@l
 	lwz	r3,GOT(_FIXUP_TABLE_)
 	cmpwi	r0,0
 	mtctr	r0
cpu/mpc83xx/start.S +4 -2
index 26e3106..ee4b862 100644
@@ -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 at sectoff@l
+	li	r0,__fixup_entries at sectoff@l
 	lwz	r3,GOT(_FIXUP_TABLE_)
 	cmpwi	r0,0
 	mtctr	r0
cpu/mpc85xx/start.S +4 -2
index 4f7236f..d56003b 100644
@@ -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 at sectoff@l
+	li	r0,__fixup_entries at sectoff@l
 	lwz	r3,GOT(_FIXUP_TABLE_)
 	cmpwi	r0,0
 	mtctr	r0
cpu/mpc86xx/start.S +4 -2
index 63cc8db..e65f1c0 100644
@@ -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 at sectoff@l
+	li	r0,__fixup_entries at sectoff@l
 	lwz	r3,GOT(_FIXUP_TABLE_)
 	cmpwi	r0,0
 	mtctr	r0
cpu/mpc8xx/start.S +4 -2
index 8864c37..e84326e 100644
@@ -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 at sectoff@l
+	li	r0,__fixup_entries at sectoff@l
 	lwz	r3,GOT(_FIXUP_TABLE_)
 	cmpwi	r0,0
 	mtctr	r0
cpu/ppc4xx/start.S +4 -2
index f2b8908..c3cf2ba 100644
@@ -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 at sectoff@l
+	li	r0,__fixup_entries at sectoff@l
 	lwz	r3,GOT(_FIXUP_TABLE_)
 	cmpwi	r0,0
 	mtctr	r0
Signature · 1 line
1.6.4.4
#1 lore raw

PATCH 1/1 relocation: Do not relocate NULL pointers.

Dear Joakim Tjernlund,

Quoted 11 lines · In message <[email protected]>…

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.

---

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!

Quoted 5 lines
 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 ++++--
Quoted 8 lines
 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

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I go on working for the same reason a hen goes on laying eggs."
- H. L. Mencken
#2 lore raw

PATCH 1/1 relocation: Do not relocate NULL pointers.

Quoted 11 lines

Dear Joakim Tjernlund,

Quoted 6 lines · In message <[email protected]>…

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.

Quoted 8 lines
Quoted 5 lines

---

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 :)

Quoted 21 lines

Thanks!

Quoted 5 lines
 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 ++++--
Quoted 8 lines
 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 :-(

Quoted 7 lines

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.

#3 lore raw

PATCH 1/1 relocation: Do not relocate NULL pointers.

Dear Joakim Tjernlund,

Quoted 5 lines · In message <OF5F1602B1.C165074D-ONC1257649.0030F813-C1257649.00311F2C@transmode…
Quoted 3 lines

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.

Quoted 6 lines
Quoted 4 lines

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

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There are three ways to get something done:
        (1) Do it yourself.
        (2) Hire someone to do it for you.
        (3) Forbid your kids to do it.
#4 lore raw

PATCH 1/1 relocation: Do not relocate NULL pointers.

Wolfgang Denk <[email protected]> wrote on 08/10/2009 14:44:07:

Quoted 9 lines

Dear Joakim Tjernlund,

In message <OF5F1602B1.C165074D-ONC1257649.0030F813-C1257649.

Quoted 4 lines · 00311F2C at transmode.se> you wrote:
Quoted 3 lines

Could you next time _please_ add this "v3" information to the Subject:, say as "[PATCH v3] relocation: ..." ?

Quoted 8 lines
Quoted 1 line

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

#5 lore raw

PATCH 1/1 relocation: Do not relocate NULL pointers.

In reply to Joakim Tjernlund
Quoted 7 lines
Quoted 5 lines

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

#6 lore raw

PATCH 1/1 relocation: Do not relocate NULL pointers.

Dear Peter Tyser,

Quoted 9 lines · In message <[email protected]> you wrote:
Quoted 7 lines
Quoted 5 lines

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

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
On my planet, to rest is to rest -- to cease using energy. To me,  it
is  quite  illogical to run up and down on green grass, using energy,
instead of saving it.
	-- Spock, "Shore Leave", stardate 3025.2