* [PATCH] powerpc: Fix COFF zImage booting on old powermacs
@ 2018-11-26 22:01 Paul Mackerras
2018-11-28 21:45 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Paul Mackerras @ 2018-11-26 22:01 UTC (permalink / raw)
To: linuxppc-dev
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>
---
arch/powerpc/boot/crt0.S | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S
index 32dfe6d..9b9d174 100644
--- a/arch/powerpc/boot/crt0.S
+++ b/arch/powerpc/boot/crt0.S
@@ -15,7 +15,7 @@
RELA = 7
RELACOUNT = 0x6ffffff9
- .text
+ .data
/* A procedure descriptor used when booting this as a COFF file.
* When making COFF, this comes first in the link and we're
* linked at 0x500000.
@@ -23,6 +23,8 @@ RELACOUNT = 0x6ffffff9
.globl _zimage_start_opd
_zimage_start_opd:
.long 0x500000, 0, 0, 0
+ .text
+ b _zimage_start
#ifdef __powerpc64__
.balign 8
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: powerpc: Fix COFF zImage booting on old powermacs
2018-11-26 22:01 [PATCH] powerpc: Fix COFF zImage booting on old powermacs Paul Mackerras
@ 2018-11-28 21:45 ` Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2018-11-28 21:45 UTC (permalink / raw)
To: Paul Mackerras, linuxppc-dev
On Mon, 2018-11-26 at 22:01:54 UTC, Paul Mackerras wrote:
> 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>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/5564597d51c8ff5b88d95c76255e18
cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-28 21:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-26 22:01 [PATCH] powerpc: Fix COFF zImage booting on old powermacs Paul Mackerras
2018-11-28 21:45 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).