Re: [PATCH] Fix PPC non-CFI + CFI unwinding (incomplete in HEAD)

Daniel Jacobowitz
2007-01-13T16:40:38Z

On Sat, Jan 13, 2007 at 05:31:32PM +0100, Mark Kettenis wrote:
> > Date: Sat, 13 Jan 2007 11:04:20 -0500
> > From: Daniel Jacobowitz <drow@false.org>
> >
> > On Sat, Jan 13, 2007 at 10:30:52AM +0100, Jan Kratochvil wrote:
> > > 2007-01-01 Jan Kratochvil <jan.kratochvil@redhat.com>
> > >
> > > * rs6000-tdep.c (skip_prologue): Handle bl->brlr used by PIC code.
> >
> > IIRC Joel was working on a patch for this case too. I'd been hoping one of
> > our PPC experts would look at it...
>
> I've completely lost track of the various powerpc prologue scanner
> fixes floating around. Is this patch supposed to fix the same problem
> as the test below exposes?

No, I don't think so - it's about the blrl at the front of the GOT in
PIC code.

I was thinking of this:
http://sourceware.org/ml/gdb-patches/2004-12/msg00249.html
http://sourceware.org/ml/gdb-patches/2005-06/msg00242.html

I think someone needs to combine Joel's and Jan's patches. Joel's is
nicer in that it uses branch_dest and the right mask for blrl; Jan's
is nicer in that it checks whether lr was saved or is now lost.

> + " stwu %r1,-32(%r1)\n"
> + " lis %r9,-16342\n"
> + " lis %r11,-16342\n"
> + " mflr %r0\n"
> + " addi %r11,%r11,3776\n"
> + " stmw %r27,12(%r1)\n"
> + " addi %r31,%r9,3152\n"
> + " cmplw %cr7,%r31,%r11\n"
> + " stw %r0,36(%r1)\n"
> + " mr %r30,%r3\n"
> + " bl optimized_1_marker\n"
> + " lwz %r0,36(%r1)\n"
> + " lmw %r27,12(%r1)\n"
> + " addi %r1,%r1,32\n"
> " blr");

Looks like a different problem to me :-(

By the way, Mark, did you see this message?
http://sourceware.org/ml/gdb-patches/2006-10/msg00233.html

I'd still like to fix that problem one way or another. If you haven't
got time to look at it, I was considering setting up a virtual machine
for the appropriate version of OpenBSD - it would be fearsomely slow,
but I'm sure it would work.

--
Daniel Jacobowitz
CodeSourcery