diff options
author | Paul Mackerras <paulus@ozlabs.org> | 2018-11-26 17:01:54 -0500 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2018-11-26 18:55:11 -0500 |
commit | 5564597d51c8ff5b88d95c76255e18b13b760879 (patch) | |
tree | 136f51b19c5722ed61476f724bf69d5912d56ad1 /arch/powerpc/boot | |
parent | b2fed34a628df6118b5d4e13f49a33e15f704fa9 (diff) |
powerpc: Fix COFF zImage booting on old powermacs
Commit 6975a783d7b4 ("powerpc/boot: Allow building the zImage wrapper
as a relocatable ET_DYN", 2011-04-12) changed the procedure descriptor
at the start of crt0.S to have a hard-coded start address of 0x500000
rather than a reference to _zimage_start, presumably because having
a reference to a symbol introduced a relocation which is awkward to
handle in a position-independent executable. Unfortunately, what is
at 0x500000 in the COFF image is not the first instruction, but the
procedure descriptor itself, that is, a word containing 0x500000,
which is not a valid instruction. Hence, booting a COFF zImage
results in a "DEFAULT CATCH!, code=FFF00700" message from Open
Firmware.
This fixes the problem by (a) putting the procedure descriptor in the
data section and (b) adding a branch to _zimage_start as the first
instruction in the program.
Fixes: 6975a783d7b4 ("powerpc/boot: Allow building the zImage wrapper as a relocatable ET_DYN")
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/boot')
-rw-r--r-- | arch/powerpc/boot/crt0.S | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S index 32dfe6d083f3..9b9d17437373 100644 --- a/arch/powerpc/boot/crt0.S +++ b/arch/powerpc/boot/crt0.S | |||
@@ -15,7 +15,7 @@ | |||
15 | RELA = 7 | 15 | RELA = 7 |
16 | RELACOUNT = 0x6ffffff9 | 16 | RELACOUNT = 0x6ffffff9 |
17 | 17 | ||
18 | .text | 18 | .data |
19 | /* A procedure descriptor used when booting this as a COFF file. | 19 | /* A procedure descriptor used when booting this as a COFF file. |
20 | * When making COFF, this comes first in the link and we're | 20 | * When making COFF, this comes first in the link and we're |
21 | * linked at 0x500000. | 21 | * linked at 0x500000. |
@@ -23,6 +23,8 @@ RELACOUNT = 0x6ffffff9 | |||
23 | .globl _zimage_start_opd | 23 | .globl _zimage_start_opd |
24 | _zimage_start_opd: | 24 | _zimage_start_opd: |
25 | .long 0x500000, 0, 0, 0 | 25 | .long 0x500000, 0, 0, 0 |
26 | .text | ||
27 | b _zimage_start | ||
26 | 28 | ||
27 | #ifdef __powerpc64__ | 29 | #ifdef __powerpc64__ |
28 | .balign 8 | 30 | .balign 8 |