* [PATCH] Fix PLT call stub for ppc64
@ 2012-11-07 19:07 Edjunior Barbosa Machado
2012-11-07 19:21 ` Ulrich Weigand
0 siblings, 1 reply; 5+ messages in thread
From: Edjunior Barbosa Machado @ 2012-11-07 19:07 UTC (permalink / raw)
To: gdb-patches; +Cc: uweigand
Hi,
GDB was unable to 'step' into a c/c++ function from a shared library on ppc64
due to a change in linker that removes a load
instruction from the PLT call stub
(http://sourceware.org/ml/binutils/2011-07/msg00141.html). This patch fixes this
on GDB, marking the mentioned instruction as optional, since it still might
appear if the linker is called with '--plt-static-chain'.
It also solves some unexpected failures in the testuite on ppc64 (verified on
fedora 17):
-FAIL: gdb.base/gdb1555.exp: Step into shared lib function
-FAIL: gdb.base/gdb1555.exp: Next while in a shared lib function
-FAIL: gdb.base/gnu-ifunc.exp: step
-FAIL: gdb.base/skip-solib.exp: step
-FAIL: gdb.base/skip-solib.exp: bt
-FAIL: gdb.base/so-impl-ld.exp: step into solib call
-FAIL: gdb.base/so-impl-ld.exp: step in solib call
-FAIL: gdb.base/so-impl-ld.exp: step out of solib call
Ok to commit?
Thanks,
--
Edjunior
gdb/ChangeLog
2012-11-07 Edjunior Machado <emachado@linux.vnet.ibm.com>
* ppc-linux-tdep.c (ppc64_standard_linkage3): Mark ld r11 instruction as
optional, following the change in PLT call stub on linker.
---
gdb/ppc-linux-tdep.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index ccded83..fcffa7d 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -446,8 +446,8 @@ static struct insn_pattern ppc64_standard_linkage3[] =
/* mtctr r11 */
{ insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
- /* ld r11, <any>(r2) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 0 },
+ /* ld r11, <any>(r2) <optional> */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 1 },
/* ld r2, <any>(r2) */
{ insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 2, 0, 0), 0 },
--
1.7.10.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix PLT call stub for ppc64
2012-11-07 19:07 [PATCH] Fix PLT call stub for ppc64 Edjunior Barbosa Machado
@ 2012-11-07 19:21 ` Ulrich Weigand
2012-11-07 20:46 ` Edjunior Barbosa Machado
0 siblings, 1 reply; 5+ messages in thread
From: Ulrich Weigand @ 2012-11-07 19:21 UTC (permalink / raw)
To: Edjunior Barbosa Machado; +Cc: gdb-patches
Edjunior Machado wrote:
> GDB was unable to 'step' into a c/c++ function from a shared library on ppc64
> due to a change in linker that removes a load
> instruction from the PLT call stub
> (http://sourceware.org/ml/binutils/2011-07/msg00141.html). This patch fixes this
> on GDB, marking the mentioned instruction as optional, since it still might
> appear if the linker is called with '--plt-static-chain'.
Hmm, looking at the binutils patch, it seems to me that the static chain load
in the *other* PLT stubs (ppc64_standard_linkage1, ppc64_standard_linkage2)
should now also be marked as optional, shouldn't it?
Otherwise looks good to me.
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix PLT call stub for ppc64
2012-11-07 19:21 ` Ulrich Weigand
@ 2012-11-07 20:46 ` Edjunior Barbosa Machado
2012-11-08 13:45 ` Ulrich Weigand
0 siblings, 1 reply; 5+ messages in thread
From: Edjunior Barbosa Machado @ 2012-11-07 20:46 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gdb-patches
On 11/07/2012 05:21 PM, Ulrich Weigand wrote:
> Hmm, looking at the binutils patch, it seems to me that the static chain load
> in the *other* PLT stubs (ppc64_standard_linkage1, ppc64_standard_linkage2)
> should now also be marked as optional, shouldn't it?
>
Thanks a lot for the comment, Ulrich.
Here's the new version of the patch, updating the other PLT stubs patterns
accordingly.
--
Edjunior
gdb/ChangeLog
2012-11-07 Edjunior Machado <emachado@linux.vnet.ibm.com>
* ppc-linux-tdep.c: Mark ld r11 instructions as optional, following the
change in PLT call stubs on linker.
---
gdb/ppc-linux-tdep.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c
index ccded83..f88d697 100644
--- a/gdb/ppc-linux-tdep.c
+++ b/gdb/ppc-linux-tdep.c
@@ -390,8 +390,8 @@ static struct insn_pattern ppc64_standard_linkage1[] =
/* mtctr r11 */
{ insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
- /* ld r11, <any>(r12) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
+ /* ld r11, <any>(r12) <optional> */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 1 },
/* bctr */
{ -1, 0x4e800420, 0 },
@@ -421,8 +421,8 @@ static struct insn_pattern ppc64_standard_linkage2[] =
/* ld r2, <any>(r12) */
{ insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 12, 0, 0), 0 },
- /* ld r11, <any>(r12) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
+ /* ld r11, <any>(r12) <optional> */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 1 },
/* bctr */
{ -1, 0x4e800420, 0 },
@@ -446,8 +446,8 @@ static struct insn_pattern ppc64_standard_linkage3[] =
/* mtctr r11 */
{ insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
- /* ld r11, <any>(r2) */
- { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 0 },
+ /* ld r11, <any>(r2) <optional> */
+ { insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 1 },
/* ld r2, <any>(r2) */
{ insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 2, 0, 0), 0 },
--
1.7.10.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix PLT call stub for ppc64
2012-11-07 20:46 ` Edjunior Barbosa Machado
@ 2012-11-08 13:45 ` Ulrich Weigand
2012-11-08 14:28 ` Edjunior Barbosa Machado
0 siblings, 1 reply; 5+ messages in thread
From: Ulrich Weigand @ 2012-11-08 13:45 UTC (permalink / raw)
To: Edjunior Barbosa Machado; +Cc: gdb-patches
Edjunior Machado wrote:
> gdb/ChangeLog
> 2012-11-07 Edjunior Machado <emachado@linux.vnet.ibm.com>
>
> * ppc-linux-tdep.c: Mark ld r11 instructions as optional, following the
> change in PLT call stubs on linker.
You should call out the modified variables (ppc64_standard_linkage1 etc)
in the ChangeLog. Otherwise, this is OK.
Thanks,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Fix PLT call stub for ppc64
2012-11-08 13:45 ` Ulrich Weigand
@ 2012-11-08 14:28 ` Edjunior Barbosa Machado
0 siblings, 0 replies; 5+ messages in thread
From: Edjunior Barbosa Machado @ 2012-11-08 14:28 UTC (permalink / raw)
To: Ulrich Weigand; +Cc: gdb-patches
On 11/08/2012 11:45 AM, Ulrich Weigand wrote:
> You should call out the modified variables (ppc64_standard_linkage1 etc)
> in the ChangeLog. Otherwise, this is OK.
>
Thanks again, Ulrich. Checked in with the suggested addition:
* ppc-linux-tdep.c (ppc64_standard_linkage1, ppc64_standard_linkage2,
ppc64_standard_linkage3): Mark ld r11 instructions as optional,
following the change in PLT call stubs on linker.
http://sourceware.org/ml/gdb-cvs/2012-11/msg00054.html
Thanks,
--
Edjunior
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-11-08 14:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-07 19:07 [PATCH] Fix PLT call stub for ppc64 Edjunior Barbosa Machado
2012-11-07 19:21 ` Ulrich Weigand
2012-11-07 20:46 ` Edjunior Barbosa Machado
2012-11-08 13:45 ` Ulrich Weigand
2012-11-08 14:28 ` Edjunior Barbosa Machado
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox