PowerPC PLT stub matching
authorAlan Modra <amodra@gmail.com>
Wed, 24 Jan 2018 04:52:17 +0000 (15:22 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 26 Jan 2018 05:43:03 +0000 (16:13 +1030)
commit7433498b7f1a79bf98ba272fd461f0ff9f1daa02
treeba080007a54ea8036d9837dc338c86a0e752a11c
parent32253bb7963ac7caa166ec41e336372f2ffc03d4
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>
gdb/ChangeLog
gdb/ppc-linux-tdep.c
gdb/ppc-tdep.h
gdb/ppc64-tdep.c
gdb/rs6000-tdep.c