diff options
author | Alan Modra <amodra@gmail.com> | 2018-01-24 15:22:17 +1030 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2018-01-26 16:13:03 +1030 |
commit | 7433498b7f1a79bf98ba272fd461f0ff9f1daa02 (patch) | |
tree | ba080007a54ea8036d9837dc338c86a0e752a11c /gdb/ppc64-tdep.c | |
parent | 32253bb7963ac7caa166ec41e336372f2ffc03d4 (diff) | |
download | gdb-7433498b7f1a79bf98ba272fd461f0ff9f1daa02.zip gdb-7433498b7f1a79bf98ba272fd461f0ff9f1daa02.tar.gz gdb-7433498b7f1a79bf98ba272fd461f0ff9f1daa02.tar.bz2 |
PowerPC PLT stub matching
This patch fixes a number of bugs in ppc32 plt stub matching code.
1) The 4-insn stubs for shared libs and PIEs weren't matched.
2) The executable stub miscalculated PLT entry address (by oring a
sign-extended quantity rather than adding).
3) Comments were not accurate.
In addition, the insn arrays are made const.
* ppc-linux-tdep.c (powerpc32_plt_stub): Make const.
(powerpc32_plt_stub_so_1): Rename from powerpc32_plt_stub_so.
Remove nop. Make const. Comment.
(powerpc32_plt_stub_so_2): New.
(POWERPC32_PLT_CHECK_LEN): Rename from POWERPC32_PLT_STUB_LEN.
Correct count. Update uses.
(ppc_skip_trampoline_code): Match powerpc32_plt_stub_so_2 too.
Move common code reading PLT entry word. Correct
powerpc32_plt_stub PLT address calculation.
* ppc64-tdep.c (ppc64_standard_linkage1): Make const.
(ppc64_standard_linkage2, ppc64_standard_linkage3): Likewise.
(ppc64_standard_linkage4, ppc64_standard_linkage5): Likewise.
(ppc64_standard_linkage6, ppc64_standard_linkage7): Likewise.
(ppc64_standard_linkage8): Likewise.
* rs6000-tdep.c (ppc_insns_match_pattern): Make pattern const.
Correct insns description.
* ppc-tdep.h (ppc_insns_match_pattern): Update prototype.
Reviewed-By: Yao Qi <qiyaoltc@gmail.com>
Diffstat (limited to 'gdb/ppc64-tdep.c')
-rw-r--r-- | gdb/ppc64-tdep.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gdb/ppc64-tdep.c b/gdb/ppc64-tdep.c index 7417232..5d8ccb4 100644 --- a/gdb/ppc64-tdep.c +++ b/gdb/ppc64-tdep.c @@ -80,7 +80,7 @@ ppc64_plt_entry_point (struct frame_info *frame, CORE_ADDR plt_off) /* Old ELFv1 PLT call stub. */ -static struct ppc_insn_pattern ppc64_standard_linkage1[] = +static const struct ppc_insn_pattern ppc64_standard_linkage1[] = { /* addis r12, r2, <any> */ { insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 }, @@ -119,7 +119,7 @@ static struct ppc_insn_pattern ppc64_standard_linkage1[] = instructions following "cmpldi r2, 0", "bnectr+" and "b <glink_i>", but there isn't any need to match them. */ -static struct ppc_insn_pattern ppc64_standard_linkage2[] = +static const struct ppc_insn_pattern ppc64_standard_linkage2[] = { /* std r2, 40(r1) <optional> */ { -1, insn_ds (62, 2, 1, 40, 0), 1 }, @@ -162,7 +162,7 @@ static struct ppc_insn_pattern ppc64_standard_linkage2[] = /* ELFv1 PLT call stub to access PLT entries within +/- 32k of r2. */ -static struct ppc_insn_pattern ppc64_standard_linkage3[] = +static const struct ppc_insn_pattern ppc64_standard_linkage3[] = { /* std r2, 40(r1) <optional> */ { -1, insn_ds (62, 2, 1, 40, 0), 1 }, @@ -201,7 +201,7 @@ static struct ppc_insn_pattern ppc64_standard_linkage3[] = A more modern variant of ppc64_standard_linkage2 differing in register usage. */ -static struct ppc_insn_pattern ppc64_standard_linkage4[] = +static const struct ppc_insn_pattern ppc64_standard_linkage4[] = { /* std r2, 40(r1) <optional> */ { -1, insn_ds (62, 2, 1, 40, 0), 1 }, @@ -243,7 +243,7 @@ static struct ppc_insn_pattern ppc64_standard_linkage4[] = A more modern variant of ppc64_standard_linkage3 differing in register usage. */ -static struct ppc_insn_pattern ppc64_standard_linkage5[] = +static const struct ppc_insn_pattern ppc64_standard_linkage5[] = { /* std r2, 40(r1) <optional> */ { -1, insn_ds (62, 2, 1, 40, 0), 1 }, @@ -280,7 +280,7 @@ static struct ppc_insn_pattern ppc64_standard_linkage5[] = /* ELFv2 PLT call stub to access PLT entries more than +/- 32k from r2. */ -static struct ppc_insn_pattern ppc64_standard_linkage6[] = +static const struct ppc_insn_pattern ppc64_standard_linkage6[] = { /* std r2, 24(r1) <optional> */ { -1, insn_ds (62, 2, 1, 24, 0), 1 }, @@ -302,7 +302,7 @@ static struct ppc_insn_pattern ppc64_standard_linkage6[] = /* ELFv2 PLT call stub to access PLT entries within +/- 32k of r2. */ -static struct ppc_insn_pattern ppc64_standard_linkage7[] = +static const struct ppc_insn_pattern ppc64_standard_linkage7[] = { /* std r2, 24(r1) <optional> */ { -1, insn_ds (62, 2, 1, 24, 0), 1 }, @@ -322,7 +322,7 @@ static struct ppc_insn_pattern ppc64_standard_linkage7[] = /* ELFv2 PLT call stub to access PLT entries more than +/- 32k from r2, supporting fusion. */ -static struct ppc_insn_pattern ppc64_standard_linkage8[] = +static const struct ppc_insn_pattern ppc64_standard_linkage8[] = { /* std r2, 24(r1) <optional> */ { -1, insn_ds (62, 2, 1, 24, 0), 1 }, |