]> git.sur5r.net Git - u-boot/commitdiff
powerpc: do not fixup NULL ptrs
authorJoakim Tjernlund <Joakim.Tjernlund@transmode.se>
Thu, 14 Oct 2010 09:51:44 +0000 (11:51 +0200)
committerWolfgang Denk <wd@denx.de>
Mon, 18 Oct 2010 20:39:37 +0000 (22:39 +0200)
The fixup routine must not fixup NULL pointers.
Problem can be seen by
 char *testfun(void) __attribute__((weak));
 char *(*myfun)(void) = testfun;

Then add
  printf("myfun:%p, &myfun:%p\n", myfun, &myfun);
before relocation and after relocation.
myfun should be NULL in both cases but it is not.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
12 files changed:
arch/powerpc/cpu/74xx_7xx/start.S
arch/powerpc/cpu/mpc512x/start.S
arch/powerpc/cpu/mpc5xx/start.S
arch/powerpc/cpu/mpc5xxx/start.S
arch/powerpc/cpu/mpc8220/start.S
arch/powerpc/cpu/mpc824x/start.S
arch/powerpc/cpu/mpc8260/start.S
arch/powerpc/cpu/mpc83xx/start.S
arch/powerpc/cpu/mpc85xx/start.S
arch/powerpc/cpu/mpc86xx/start.S
arch/powerpc/cpu/mpc8xx/start.S
arch/powerpc/cpu/ppc4xx/start.S

index e10c44ce47de79c1ace8016d95dfaed75b6982d8..573e6d08219860d51bc5843f8e384e403a50abd3 100644 (file)
@@ -709,10 +709,12 @@ in_ram:
        beq     4f
 3:     lwzu    r4,4(r3)
        lwzux   r0,r4,r11
+       cmpwi   r0,0
        add     r0,r0,r11
        stw     r10,0(r3)
+       beq-    5f
        stw     r0,0(r4)
-       bdnz    3b
+5:     bdnz    3b
 4:
 /* clear_bss: */
        /*
index d52cc4da1ba814f5229f920101fccacb22556941..2265c8cc11099ed49e2e34ae76feec0512a4341d 100644 (file)
@@ -613,10 +613,12 @@ in_ram:
        beq     4f
 3:     lwzu    r4,4(r3)
        lwzux   r0,r4,r11
+       cmpwi   r0,0
        add     r0,r0,r11
        stw     r10,0(r3)
+       beq-    5f
        stw     r0,0(r4)
-       bdnz    3b
+5:     bdnz    3b
 4:
 clear_bss:
        /*
index 26b9eac31ac69804f24314b45642ee139b0054d2..da42557224da101ae06ec6f4cf7f5bd94f56a138 100644 (file)
@@ -453,10 +453,12 @@ in_ram:
        beq     4f
 3:     lwzu    r4,4(r3)
        lwzux   r0,r4,r11
+       cmpwi   r0,0
        add     r0,r0,r11
        stw     r10,0(r3)
+       beq-    5f
        stw     r0,0(r4)
-       bdnz    3b
+5:     bdnz    3b
 4:
 clear_bss:
        /*
index 8b683b1997d3c9a1de7b127d62ea2b1511a406e7..92858fce3a4e600f91f88632ad4cc27716e44e22 100644 (file)
@@ -668,10 +668,12 @@ in_ram:
        beq     4f
 3:     lwzu    r4,4(r3)
        lwzux   r0,r4,r11
+       cmpwi   r0,0
        add     r0,r0,r11
        stw     r10,0(r3)
+       beq-    5f
        stw     r0,0(r4)
-       bdnz    3b
+5:     bdnz    3b
 4:
 clear_bss:
        /*
index 320ad4ee58cbfa80c958d4e14e03010aaad186b8..b5c160b607aae2c81184fbe7d36fbabd6b37824a 100644 (file)
@@ -641,10 +641,12 @@ in_ram:
        beq     4f
 3:     lwzu    r4,4(r3)
        lwzux   r0,r4,r11
+       cmpwi   r0,0
        add     r0,r0,r11
        stw     r10,0(r3)
+       beq-    5f
        stw     r0,0(r4)
-       bdnz    3b
+5:     bdnz    3b
 4:
 clear_bss:
        /*
index 3c44c002129fa7c3ddc33d3ba328249b6f704b89..d10231ee9485fc4da9932343f4aa5f7f0b77cd50 100644 (file)
@@ -583,10 +583,12 @@ in_ram:
        beq     4f
 3:     lwzu    r4,4(r3)
        lwzux   r0,r4,r11
+       cmpwi   r0,0
        add     r0,r0,r11
        stw     r10,0(r3)
+       beq-    5f
        stw     r0,0(r4)
-       bdnz    3b
+5:     bdnz    3b
 4:
 clear_bss:
        /*
index 48105e788d036c49aebbed0c2b2b831d0a5c17e7..55c64ea60c05ecc72316b877b50abe931590e4bc 100644 (file)
@@ -904,10 +904,12 @@ in_ram:
        beq     4f
 3:     lwzu    r4,4(r3)
        lwzux   r0,r4,r11
+       cmpwi   r0,0
        add     r0,r0,r11
        stw     r10,0(r3)
+       beq-    5f
        stw     r0,0(r4)
-       bdnz    3b
+5:     bdnz    3b
 4:
 clear_bss:
        /*
index 450cfb568ba32115fbf121801bd91e72a03ead40..536604f46252b586a896ec940d9d8da19cea75d4 100644 (file)
@@ -952,10 +952,12 @@ in_ram:
        beq     4f
 3:     lwzu    r4,4(r3)
        lwzux   r0,r4,r11
+       cmpwi   r0,0
        add     r0,r0,r11
        stw     r10,0(r3)
+       beq-    5f
        stw     r0,0(r4)
-       bdnz    3b
+5:     bdnz    3b
 4:
 #endif
 
index c9df7518c9d013dcf8f1b6e28f132ad1588e0e2f..7e5e6b17c019567826efe133d877b4a42586969f 100644 (file)
@@ -1037,10 +1037,12 @@ in_ram:
        beq     4f
 3:     lwzu    r4,4(r3)
        lwzux   r0,r4,r11
+       cmpwi   r0,0
        add     r0,r0,r11
        stw     r10,0(r3)
+       beq-    5f
        stw     r0,0(r4)
-       bdnz    3b
+5:     bdnz    3b
 4:
 clear_bss:
        /*
index c499db48fd10c244532d2776f1bbbbd01c8eb392..3817f19d53521e5c96fa7e5a121a031eab83353e 100644 (file)
@@ -727,10 +727,12 @@ in_ram:
        beq     4f
 3:     lwzu    r4,4(r3)
        lwzux   r0,r4,r11
+       cmpwi   r0,0
        add     r0,r0,r11
        stw     r10,0(r3)
+       beq-    5f
        stw     r0,0(r4)
-       bdnz    3b
+5:     bdnz    3b
 4:
 /* clear_bss: */
        /*
index 6073dabea5c9fe029c9c479fa9b25e48f21b1f39..4a8c5d9e48b00ced9c64bb6459cfc9b2f18e76ae 100644 (file)
@@ -584,10 +584,12 @@ in_ram:
        beq     4f
 3:     lwzu    r4,4(r3)
        lwzux   r0,r4,r11
+       cmpwi   r0,0
        add     r0,r0,r11
        stw     r10,0(r3)
+       beq-    5f
        stw     r0,0(r4)
-       bdnz    3b
+5:     bdnz    3b
 4:
 clear_bss:
        /*
index 03bde4d401c78c654e6839a69d56c7ee9d04f45b..87caea19b040308a7c484c55e6240e5021703d54 100644 (file)
@@ -1608,10 +1608,12 @@ in_ram:
        beq     4f
 3:     lwzu    r4,4(r3)
        lwzux   r0,r4,r11
+       cmpwi   r0,0
        add     r0,r0,r11
        stw     r10,0(r3)
+       beq-    5f
        stw     r0,0(r4)
-       bdnz    3b
+5:     bdnz    3b
 4:
 clear_bss:
        /*