2013-02-02 04:59:08 +08:00
|
|
|
/* Common target-dependent code for ppc64 GDB, the GNU debugger.
|
|
|
|
|
2024-01-12 23:30:44 +08:00
|
|
|
Copyright (C) 1986-2024 Free Software Foundation, Inc.
|
2013-02-02 04:59:08 +08:00
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
|
2024-04-23 04:10:14 +08:00
|
|
|
#include "extract-store-integer.h"
|
2013-02-02 04:59:08 +08:00
|
|
|
#include "frame.h"
|
|
|
|
#include "gdbcore.h"
|
2015-01-17 14:30:59 +08:00
|
|
|
#include "infrun.h"
|
2013-02-02 04:59:08 +08:00
|
|
|
#include "ppc-tdep.h"
|
|
|
|
#include "ppc64-tdep.h"
|
2013-02-23 07:24:24 +08:00
|
|
|
#include "elf-bfd.h"
|
2013-02-02 04:59:08 +08:00
|
|
|
|
|
|
|
/* Macros for matching instructions. Note that, since all the
|
|
|
|
operands are masked off before they're or-ed into the instruction,
|
|
|
|
you can use -1 to make masks. */
|
|
|
|
|
|
|
|
#define insn_d(opcd, rts, ra, d) \
|
2018-08-08 03:13:58 +08:00
|
|
|
((((unsigned (opcd)) & 0x3f) << 26) \
|
|
|
|
| (((unsigned (rts)) & 0x1f) << 21) \
|
|
|
|
| (((unsigned (ra)) & 0x1f) << 16) \
|
|
|
|
| ((unsigned (d)) & 0xffff))
|
2013-02-02 04:59:08 +08:00
|
|
|
|
|
|
|
#define insn_ds(opcd, rts, ra, d, xo) \
|
2018-08-08 03:13:58 +08:00
|
|
|
((((unsigned (opcd)) & 0x3f) << 26) \
|
|
|
|
| (((unsigned (rts)) & 0x1f) << 21) \
|
|
|
|
| (((unsigned (ra)) & 0x1f) << 16) \
|
|
|
|
| ((unsigned (d)) & 0xfffc) \
|
|
|
|
| ((unsigned (xo)) & 0x3))
|
2013-02-02 04:59:08 +08:00
|
|
|
|
|
|
|
#define insn_xfx(opcd, rts, spr, xo) \
|
2018-08-08 03:13:58 +08:00
|
|
|
((((unsigned (opcd)) & 0x3f) << 26) \
|
|
|
|
| (((unsigned (rts)) & 0x1f) << 21) \
|
|
|
|
| (((unsigned (spr)) & 0x1f) << 16) \
|
|
|
|
| (((unsigned (spr)) & 0x3e0) << 6) \
|
|
|
|
| (((unsigned (xo)) & 0x3ff) << 1))
|
2013-02-02 04:59:08 +08:00
|
|
|
|
Add Power 10 PLT instruction patterns
gdb/ChangeLog:
2021-06-07 Carl Love <cel@us.ibm.com>
* ppc-tdep.h (ppc_insn_prefix_dform): Declare.
* ppc64-tdep.c(insn_md, insn_x, insn_xo): New macros.
(ppc64_plt_pcrel_entry_point, ppc64_pcrel_linkage1_target,
ppc64_pcrel_linkage2_target): New functions.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New ppc
instruction patterns.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New variables
in define MAX expression.
(ppc64_skip_trampoline_code_1): Handle ppc64_standard_linkage9,
ppc64_standard_linkage10, ppc64_standard_linkage11,
ppc64_standard_linkage12.
* (ppc_insn_prefix_dform): New function.
2021-04-30 06:19:13 +08:00
|
|
|
#define prefix(a, b, R, do) \
|
|
|
|
(((0x1) << 26) \
|
|
|
|
| (((unsigned (a)) & 0x3) << 24) \
|
|
|
|
| (((unsigned (b)) & 0x1) << 23) \
|
|
|
|
| (((unsigned (R)) & 0x1) << 20) \
|
|
|
|
| ((unsigned (do)) & 0x3ffff))
|
|
|
|
|
|
|
|
#define insn_md(opcd, ra, rs, sh, me, rc) \
|
|
|
|
((((unsigned (opcd)) & 0x3f) << 26) \
|
|
|
|
| (((unsigned (rs)) & 0x1f) << 21) \
|
|
|
|
| (((unsigned (ra)) & 0x1f) << 16) \
|
|
|
|
| (((unsigned (sh)) & 0x3e) << 11) \
|
|
|
|
| (((unsigned (me)) & 0x3f) << 25) \
|
|
|
|
| (((unsigned (sh)) & 0x1) << 1) \
|
|
|
|
| ((unsigned (rc)) & 0x1))
|
|
|
|
|
|
|
|
#define insn_x(opcd, rt, ra, rb, opc2) \
|
|
|
|
((((unsigned (opcd)) & 0x3f) << 26) \
|
|
|
|
| (((unsigned (rt)) & 0x1f) << 21) \
|
|
|
|
| (((unsigned (ra)) & 0x1f) << 16) \
|
|
|
|
| (((unsigned (rb)) & 0x3e) << 11) \
|
|
|
|
| (((unsigned (opc2)) & 0x3FF) << 1))
|
|
|
|
|
|
|
|
#define insn_xo(opcd, rt, ra, rb, oe, rc, opc2) \
|
|
|
|
((((unsigned (opcd)) & 0x3f) << 26) \
|
|
|
|
| (((unsigned (rt)) & 0x1f) << 21) \
|
|
|
|
| (((unsigned (ra)) & 0x1f) << 16) \
|
|
|
|
| (((unsigned (rb)) & 0x3e) << 11) \
|
|
|
|
| (((unsigned (oe)) & 0x1) << 10) \
|
|
|
|
| (((unsigned (opc2)) & 0x1FF) << 1) \
|
|
|
|
| (((unsigned (rc)))))
|
|
|
|
|
2017-12-11 15:01:11 +08:00
|
|
|
/* PLT_OFF is the TOC-relative offset of a 64-bit PowerPC PLT entry.
|
|
|
|
Return the function's entry point. */
|
2013-02-02 04:59:08 +08:00
|
|
|
|
|
|
|
static CORE_ADDR
|
gdb: pass frames as `const frame_info_ptr &`
We currently pass frames to function by value, as `frame_info_ptr`.
This is somewhat expensive:
- the size of `frame_info_ptr` is 64 bytes, which is a bit big to pass
by value
- the constructors and destructor link/unlink the object in the global
`frame_info_ptr::frame_list` list. This is an `intrusive_list`, so
it's not so bad: it's just assigning a few points, there's no memory
allocation as if it was `std::list`, but still it's useless to do
that over and over.
As suggested by Tom Tromey, change many function signatures to accept
`const frame_info_ptr &` instead of `frame_info_ptr`.
Some functions reassign their `frame_info_ptr` parameter, like:
void
the_func (frame_info_ptr frame)
{
for (; frame != nullptr; frame = get_prev_frame (frame))
{
...
}
}
I wondered what to do about them, do I leave them as-is or change them
(and need to introduce a separate local variable that can be
re-assigned). I opted for the later for consistency. It might not be
clear why some functions take `const frame_info_ptr &` while others take
`frame_info_ptr`. Also, if a function took a `frame_info_ptr` because
it did re-assign its parameter, I doubt that we would think to change it
to `const frame_info_ptr &` should the implementation change such that
it doesn't need to take `frame_info_ptr` anymore. It seems better to
have a simple rule and apply it everywhere.
Change-Id: I59d10addef687d157f82ccf4d54f5dde9a963fd0
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-20 02:07:47 +08:00
|
|
|
ppc64_plt_entry_point (const frame_info_ptr &frame, CORE_ADDR plt_off)
|
2013-02-02 04:59:08 +08:00
|
|
|
{
|
2017-12-11 15:01:11 +08:00
|
|
|
struct gdbarch *gdbarch = get_frame_arch (frame);
|
2013-02-02 04:59:08 +08:00
|
|
|
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
|
gdb: move the type cast into gdbarch_tdep
I built GDB for all targets on a x86-64/GNU-Linux system, and
then (accidentally) passed GDB a RISC-V binary, and asked GDB to "run"
the binary on the native target. I got this error:
(gdb) show architecture
The target architecture is set to "auto" (currently "i386").
(gdb) file /tmp/hello.rv32.exe
Reading symbols from /tmp/hello.rv32.exe...
(gdb) show architecture
The target architecture is set to "auto" (currently "riscv:rv32").
(gdb) run
Starting program: /tmp/hello.rv32.exe
../../src/gdb/i387-tdep.c:596: internal-error: i387_supply_fxsave: Assertion `tdep->st0_regnum >= I386_ST0_REGNUM' failed.
What's going on here is this; initially the architecture is i386, this
is based on the default architecture, which is set based on the native
target. After loading the RISC-V executable the architecture of the
current inferior is updated based on the architecture of the
executable.
When we "run", GDB does a fork & exec, with the inferior being
controlled through ptrace. GDB sees an initial stop from the inferior
as soon as the inferior comes to life. In response to this stop GDB
ends up calling save_stop_reason (linux-nat.c), which ends up trying
to read register from the inferior, to do this we end up calling
target_ops::fetch_registers, which, for the x86-64 native target,
calls amd64_linux_nat_target::fetch_registers.
After this I eventually end up in i387_supply_fxsave, different x86
based targets will end in different functions to fetch registers, but
it doesn't really matter which function we end up in, the problem is
this line, which is repeated in many places:
i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
The problem here is that the ARCH in this line comes from the current
inferior, which, as we discussed above, will be a RISC-V gdbarch, the
tdep field will actually be of type riscv_gdbarch_tdep, not
i386_gdbarch_tdep. After this cast we are relying on undefined
behaviour, in my case I happen to trigger an assert, but this might
not always be the case.
The thing I tried that exposed this problem was of course, trying to
start an executable of the wrong architecture on a native target. I
don't think that the correct solution for this problem is to detect,
at the point of cast, that the gdbarch_tdep object is of the wrong
type, but, I did wonder, is there a way that we could protect
ourselves from incorrectly casting the gdbarch_tdep object?
I think that there is something we can do here, and this commit is the
first step in that direction, though no actual check is added by this
commit.
This commit can be split into two parts:
(1) In gdbarch.h and arch-utils.c. In these files I have modified
gdbarch_tdep (the function) so that it now takes a template argument,
like this:
template<typename TDepType>
static inline TDepType *
gdbarch_tdep (struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep_1 (gdbarch);
return static_cast<TDepType *> (tdep);
}
After this change we are no better protected, but the cast is now
done within the gdbarch_tdep function rather than at the call sites,
this leads to the second, much larger change in this commit,
(2) Everywhere gdbarch_tdep is called, we make changes like this:
- i386_gdbarch_tdep *tdep = (i386_gdbarch_tdep *) gdbarch_tdep (arch);
+ i386_gdbarch_tdep *tdep = gdbarch_tdep<i386_gdbarch_tdep> (arch);
There should be no functional change after this commit.
In the next commit I will build on this change to add an assertion in
gdbarch_tdep that checks we are casting to the correct type.
2022-05-19 20:20:17 +08:00
|
|
|
ppc_gdbarch_tdep *tdep = gdbarch_tdep<ppc_gdbarch_tdep> (gdbarch);
|
2017-12-11 15:01:11 +08:00
|
|
|
CORE_ADDR tocp;
|
|
|
|
|
|
|
|
if (execution_direction == EXEC_REVERSE)
|
|
|
|
{
|
|
|
|
/* If executing in reverse, r2 will have been stored to the stack. */
|
|
|
|
CORE_ADDR sp = get_frame_register_unsigned (frame,
|
|
|
|
tdep->ppc_gp0_regnum + 1);
|
|
|
|
unsigned int sp_off = tdep->elf_abi == POWERPC_ELF_V1 ? 40 : 24;
|
|
|
|
tocp = read_memory_unsigned_integer (sp + sp_off, 8, byte_order);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
tocp = get_frame_register_unsigned (frame, tdep->ppc_gp0_regnum + 2);
|
|
|
|
|
2013-11-11 11:44:40 +08:00
|
|
|
/* The first word of the PLT entry is the function entry point. */
|
2017-12-11 15:01:11 +08:00
|
|
|
return read_memory_unsigned_integer (tocp + plt_off, 8, byte_order);
|
2013-02-02 04:59:08 +08:00
|
|
|
}
|
|
|
|
|
Add Power 10 PLT instruction patterns
gdb/ChangeLog:
2021-06-07 Carl Love <cel@us.ibm.com>
* ppc-tdep.h (ppc_insn_prefix_dform): Declare.
* ppc64-tdep.c(insn_md, insn_x, insn_xo): New macros.
(ppc64_plt_pcrel_entry_point, ppc64_pcrel_linkage1_target,
ppc64_pcrel_linkage2_target): New functions.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New ppc
instruction patterns.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New variables
in define MAX expression.
(ppc64_skip_trampoline_code_1): Handle ppc64_standard_linkage9,
ppc64_standard_linkage10, ppc64_standard_linkage11,
ppc64_standard_linkage12.
* (ppc_insn_prefix_dform): New function.
2021-04-30 06:19:13 +08:00
|
|
|
static CORE_ADDR
|
gdb: pass frames as `const frame_info_ptr &`
We currently pass frames to function by value, as `frame_info_ptr`.
This is somewhat expensive:
- the size of `frame_info_ptr` is 64 bytes, which is a bit big to pass
by value
- the constructors and destructor link/unlink the object in the global
`frame_info_ptr::frame_list` list. This is an `intrusive_list`, so
it's not so bad: it's just assigning a few points, there's no memory
allocation as if it was `std::list`, but still it's useless to do
that over and over.
As suggested by Tom Tromey, change many function signatures to accept
`const frame_info_ptr &` instead of `frame_info_ptr`.
Some functions reassign their `frame_info_ptr` parameter, like:
void
the_func (frame_info_ptr frame)
{
for (; frame != nullptr; frame = get_prev_frame (frame))
{
...
}
}
I wondered what to do about them, do I leave them as-is or change them
(and need to introduce a separate local variable that can be
re-assigned). I opted for the later for consistency. It might not be
clear why some functions take `const frame_info_ptr &` while others take
`frame_info_ptr`. Also, if a function took a `frame_info_ptr` because
it did re-assign its parameter, I doubt that we would think to change it
to `const frame_info_ptr &` should the implementation change such that
it doesn't need to take `frame_info_ptr` anymore. It seems better to
have a simple rule and apply it everywhere.
Change-Id: I59d10addef687d157f82ccf4d54f5dde9a963fd0
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-20 02:07:47 +08:00
|
|
|
ppc64_plt_pcrel_entry_point (const frame_info_ptr &frame, CORE_ADDR plt_off,
|
Add Power 10 PLT instruction patterns
gdb/ChangeLog:
2021-06-07 Carl Love <cel@us.ibm.com>
* ppc-tdep.h (ppc_insn_prefix_dform): Declare.
* ppc64-tdep.c(insn_md, insn_x, insn_xo): New macros.
(ppc64_plt_pcrel_entry_point, ppc64_pcrel_linkage1_target,
ppc64_pcrel_linkage2_target): New functions.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New ppc
instruction patterns.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New variables
in define MAX expression.
(ppc64_skip_trampoline_code_1): Handle ppc64_standard_linkage9,
ppc64_standard_linkage10, ppc64_standard_linkage11,
ppc64_standard_linkage12.
* (ppc_insn_prefix_dform): New function.
2021-04-30 06:19:13 +08:00
|
|
|
CORE_ADDR pc)
|
|
|
|
{
|
|
|
|
struct gdbarch *gdbarch = get_frame_arch (frame);
|
|
|
|
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
|
|
|
|
|
|
|
|
/* Execution direction doesn't matter, entry is pc + plt_off either way.
|
|
|
|
The first word of the PLT entry is the function entry point. */
|
|
|
|
return read_memory_unsigned_integer (pc + plt_off, 8, byte_order);
|
|
|
|
}
|
|
|
|
|
2013-06-04 10:44:35 +08:00
|
|
|
/* Patterns for the standard linkage functions. These are built by
|
|
|
|
build_plt_stub in bfd/elf64-ppc.c. */
|
|
|
|
|
2013-11-11 11:44:40 +08:00
|
|
|
/* Old ELFv1 PLT call stub. */
|
2013-02-02 04:59:08 +08:00
|
|
|
|
2018-01-24 12:52:17 +08:00
|
|
|
static const struct ppc_insn_pattern ppc64_standard_linkage1[] =
|
2013-02-02 04:59:08 +08:00
|
|
|
{
|
|
|
|
/* addis r12, r2, <any> */
|
|
|
|
{ insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
|
|
|
|
|
|
|
|
/* std r2, 40(r1) */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 0 },
|
2013-02-02 04:59:08 +08:00
|
|
|
|
|
|
|
/* ld r11, <any>(r12) */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
|
|
|
|
|
|
|
|
/* addis r12, r12, 1 <optional> */
|
|
|
|
{ insn_d (-1, -1, -1, -1), insn_d (15, 12, 12, 1), 1 },
|
|
|
|
|
|
|
|
/* ld r2, <any>(r12) */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 12, 0, 0), 0 },
|
|
|
|
|
|
|
|
/* addis r12, r12, 1 <optional> */
|
|
|
|
{ insn_d (-1, -1, -1, -1), insn_d (15, 12, 12, 1), 1 },
|
|
|
|
|
|
|
|
/* mtctr r11 */
|
|
|
|
{ insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
|
|
|
|
|
|
|
|
/* ld r11, <any>(r12) <optional> */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 1 },
|
|
|
|
|
|
|
|
/* bctr */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x4e800420, 0 },
|
2013-02-02 04:59:08 +08:00
|
|
|
|
|
|
|
{ 0, 0, 0 }
|
|
|
|
};
|
|
|
|
|
2013-11-11 11:44:40 +08:00
|
|
|
/* ELFv1 PLT call stub to access PLT entries more than +/- 32k from r2.
|
2013-06-04 10:44:35 +08:00
|
|
|
Also supports older stub with different placement of std 2,40(1),
|
|
|
|
a stub that omits the std 2,40(1), and both versions of power7
|
|
|
|
thread safety read barriers. Note that there are actually two more
|
|
|
|
instructions following "cmpldi r2, 0", "bnectr+" and "b <glink_i>",
|
|
|
|
but there isn't any need to match them. */
|
2013-02-02 04:59:08 +08:00
|
|
|
|
2018-01-24 12:52:17 +08:00
|
|
|
static const struct ppc_insn_pattern ppc64_standard_linkage2[] =
|
2013-02-02 04:59:08 +08:00
|
|
|
{
|
2013-06-04 10:44:35 +08:00
|
|
|
/* std r2, 40(r1) <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
|
2013-06-04 10:44:35 +08:00
|
|
|
|
2013-02-02 04:59:08 +08:00
|
|
|
/* addis r12, r2, <any> */
|
|
|
|
{ insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
|
|
|
|
|
2013-06-04 10:44:35 +08:00
|
|
|
/* std r2, 40(r1) <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
|
2013-02-02 04:59:08 +08:00
|
|
|
|
|
|
|
/* ld r11, <any>(r12) */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 0 },
|
|
|
|
|
|
|
|
/* addi r12, r12, <any> <optional> */
|
|
|
|
{ insn_d (-1, -1, -1, 0), insn_d (14, 12, 12, 0), 1 },
|
|
|
|
|
|
|
|
/* mtctr r11 */
|
|
|
|
{ insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
|
|
|
|
|
2013-06-04 10:44:35 +08:00
|
|
|
/* xor r11, r11, r11 <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x7d6b5a78, 1 },
|
2013-06-04 10:44:35 +08:00
|
|
|
|
|
|
|
/* add r12, r12, r11 <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x7d8c5a14, 1 },
|
2013-06-04 10:44:35 +08:00
|
|
|
|
2013-02-02 04:59:08 +08:00
|
|
|
/* ld r2, <any>(r12) */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 12, 0, 0), 0 },
|
|
|
|
|
|
|
|
/* ld r11, <any>(r12) <optional> */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 12, 0, 0), 1 },
|
|
|
|
|
2013-06-04 10:44:35 +08:00
|
|
|
/* bctr <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x4e800420, 1 },
|
2013-06-04 10:44:35 +08:00
|
|
|
|
|
|
|
/* cmpldi r2, 0 <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x28220000, 1 },
|
2013-02-02 04:59:08 +08:00
|
|
|
|
|
|
|
{ 0, 0, 0 }
|
|
|
|
};
|
|
|
|
|
2013-11-11 11:44:40 +08:00
|
|
|
/* ELFv1 PLT call stub to access PLT entries within +/- 32k of r2. */
|
2013-02-02 04:59:08 +08:00
|
|
|
|
2018-01-24 12:52:17 +08:00
|
|
|
static const struct ppc_insn_pattern ppc64_standard_linkage3[] =
|
2013-02-02 04:59:08 +08:00
|
|
|
{
|
2013-06-04 10:44:35 +08:00
|
|
|
/* std r2, 40(r1) <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
|
2013-02-02 04:59:08 +08:00
|
|
|
|
|
|
|
/* ld r11, <any>(r2) */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 2, 0, 0), 0 },
|
|
|
|
|
|
|
|
/* addi r2, r2, <any> <optional> */
|
|
|
|
{ insn_d (-1, -1, -1, 0), insn_d (14, 2, 2, 0), 1 },
|
|
|
|
|
|
|
|
/* mtctr r11 */
|
|
|
|
{ insn_xfx (-1, -1, -1, -1), insn_xfx (31, 11, 9, 467), 0 },
|
|
|
|
|
2013-06-04 10:44:35 +08:00
|
|
|
/* xor r11, r11, r11 <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x7d6b5a78, 1 },
|
2013-06-04 10:44:35 +08:00
|
|
|
|
|
|
|
/* add r2, r2, r11 <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x7c425a14, 1 },
|
2013-06-04 10:44:35 +08:00
|
|
|
|
2013-02-02 04:59:08 +08:00
|
|
|
/* 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 },
|
|
|
|
|
2013-06-04 10:44:35 +08:00
|
|
|
/* bctr <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x4e800420, 1 },
|
2013-06-04 10:44:35 +08:00
|
|
|
|
|
|
|
/* cmpldi r2, 0 <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x28220000, 1 },
|
2013-02-02 04:59:08 +08:00
|
|
|
|
|
|
|
{ 0, 0, 0 }
|
|
|
|
};
|
|
|
|
|
2013-11-11 11:44:40 +08:00
|
|
|
/* ELFv1 PLT call stub to access PLT entries more than +/- 32k from r2.
|
|
|
|
A more modern variant of ppc64_standard_linkage2 differing in
|
|
|
|
register usage. */
|
|
|
|
|
2018-01-24 12:52:17 +08:00
|
|
|
static const struct ppc_insn_pattern ppc64_standard_linkage4[] =
|
2013-11-11 11:44:40 +08:00
|
|
|
{
|
|
|
|
/* std r2, 40(r1) <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
|
2013-11-11 11:44:40 +08:00
|
|
|
|
|
|
|
/* addis r11, r2, <any> */
|
|
|
|
{ insn_d (-1, -1, -1, 0), insn_d (15, 11, 2, 0), 0 },
|
|
|
|
|
|
|
|
/* ld r12, <any>(r11) */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 11, 0, 0), 0 },
|
|
|
|
|
|
|
|
/* addi r11, r11, <any> <optional> */
|
|
|
|
{ insn_d (-1, -1, -1, 0), insn_d (14, 11, 11, 0), 1 },
|
|
|
|
|
|
|
|
/* mtctr r12 */
|
|
|
|
{ insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
|
|
|
|
|
|
|
|
/* xor r2, r12, r12 <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x7d826278, 1 },
|
2013-11-11 11:44:40 +08:00
|
|
|
|
|
|
|
/* add r11, r11, r2 <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x7d6b1214, 1 },
|
2013-11-11 11:44:40 +08:00
|
|
|
|
|
|
|
/* ld r2, <any>(r11) */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 2, 11, 0, 0), 0 },
|
|
|
|
|
|
|
|
/* ld r11, <any>(r11) <optional> */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 11, 11, 0, 0), 1 },
|
|
|
|
|
|
|
|
/* bctr <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x4e800420, 1 },
|
2013-11-11 11:44:40 +08:00
|
|
|
|
|
|
|
/* cmpldi r2, 0 <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x28220000, 1 },
|
2013-11-11 11:44:40 +08:00
|
|
|
|
|
|
|
{ 0, 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
/* ELFv1 PLT call stub to access PLT entries within +/- 32k of r2.
|
|
|
|
A more modern variant of ppc64_standard_linkage3 differing in
|
|
|
|
register usage. */
|
|
|
|
|
2018-01-24 12:52:17 +08:00
|
|
|
static const struct ppc_insn_pattern ppc64_standard_linkage5[] =
|
2013-11-11 11:44:40 +08:00
|
|
|
{
|
|
|
|
/* std r2, 40(r1) <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, insn_ds (62, 2, 1, 40, 0), 1 },
|
2013-11-11 11:44:40 +08:00
|
|
|
|
|
|
|
/* ld r12, <any>(r2) */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 2, 0, 0), 0 },
|
|
|
|
|
|
|
|
/* addi r2, r2, <any> <optional> */
|
|
|
|
{ insn_d (-1, -1, -1, 0), insn_d (14, 2, 2, 0), 1 },
|
|
|
|
|
|
|
|
/* mtctr r12 */
|
|
|
|
{ insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
|
|
|
|
|
|
|
|
/* xor r11, r12, r12 <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x7d8b6278, 1 },
|
2013-11-11 11:44:40 +08:00
|
|
|
|
|
|
|
/* add r2, r2, r11 <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x7c425a14, 1 },
|
2013-11-11 11:44:40 +08:00
|
|
|
|
|
|
|
/* 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 },
|
|
|
|
|
|
|
|
/* bctr <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x4e800420, 1 },
|
2013-11-11 11:44:40 +08:00
|
|
|
|
|
|
|
/* cmpldi r2, 0 <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x28220000, 1 },
|
2013-11-11 11:44:40 +08:00
|
|
|
|
|
|
|
{ 0, 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
/* ELFv2 PLT call stub to access PLT entries more than +/- 32k from r2. */
|
|
|
|
|
2018-01-24 12:52:17 +08:00
|
|
|
static const struct ppc_insn_pattern ppc64_standard_linkage6[] =
|
2013-11-11 11:44:40 +08:00
|
|
|
{
|
|
|
|
/* std r2, 24(r1) <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, insn_ds (62, 2, 1, 24, 0), 1 },
|
2013-11-11 11:44:40 +08:00
|
|
|
|
|
|
|
/* addis r11, r2, <any> */
|
|
|
|
{ insn_d (-1, -1, -1, 0), insn_d (15, 11, 2, 0), 0 },
|
|
|
|
|
|
|
|
/* ld r12, <any>(r11) */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 11, 0, 0), 0 },
|
|
|
|
|
|
|
|
/* mtctr r12 */
|
|
|
|
{ insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
|
|
|
|
|
|
|
|
/* bctr */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x4e800420, 0 },
|
2013-11-11 11:44:40 +08:00
|
|
|
|
|
|
|
{ 0, 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
/* ELFv2 PLT call stub to access PLT entries within +/- 32k of r2. */
|
|
|
|
|
2018-01-24 12:52:17 +08:00
|
|
|
static const struct ppc_insn_pattern ppc64_standard_linkage7[] =
|
2013-11-11 11:44:40 +08:00
|
|
|
{
|
|
|
|
/* std r2, 24(r1) <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, insn_ds (62, 2, 1, 24, 0), 1 },
|
2013-11-11 11:44:40 +08:00
|
|
|
|
|
|
|
/* ld r12, <any>(r2) */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 2, 0, 0), 0 },
|
|
|
|
|
|
|
|
/* mtctr r12 */
|
|
|
|
{ insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
|
|
|
|
|
|
|
|
/* bctr */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x4e800420, 0 },
|
2013-11-11 11:44:40 +08:00
|
|
|
|
|
|
|
{ 0, 0, 0 }
|
|
|
|
};
|
|
|
|
|
Support fusion for ELFv2 stubs
Power8 fuses addis,addi and addis,ld sequences when the target of the
addis is the same as the addi/ld. Thus
addis r12,r2,xxx@ha
addi r12,r12,xxx@l / ld r12,xxx@l(r12)
is faster than
addis r11,r2,xxx@ha
addi r12,r11,xxx@l / ld r12,xxx@l(r11)
So use the form that allows fusion in plt call and branch stubs.
bfd/
* elf64-ppc.c (ADDIS_R12_R2): Define.
(build_plt_stub): Support fusion on ELFv2 stub.
(ppc_build_one_stub): Likewise for plt branch stubs.
gold/
* powerpc.cc (addis_12_2): Define.
(Stub_table::do_write): Support fusion on ELFv2 stubs.
ld/testsuite/
* ld-powerpc/elfv2exe.d: Update for changed plt call stubs.
gdb/
* ppc64-tdep.c (ppc64_standard_linkage8): New.
(ppc64_skip_trampoline_code): Recognise ELFv2 stub supporting fusion.
2014-06-03 09:25:29 +08:00
|
|
|
/* ELFv2 PLT call stub to access PLT entries more than +/- 32k from r2,
|
|
|
|
supporting fusion. */
|
|
|
|
|
2018-01-24 12:52:17 +08:00
|
|
|
static const struct ppc_insn_pattern ppc64_standard_linkage8[] =
|
Support fusion for ELFv2 stubs
Power8 fuses addis,addi and addis,ld sequences when the target of the
addis is the same as the addi/ld. Thus
addis r12,r2,xxx@ha
addi r12,r12,xxx@l / ld r12,xxx@l(r12)
is faster than
addis r11,r2,xxx@ha
addi r12,r11,xxx@l / ld r12,xxx@l(r11)
So use the form that allows fusion in plt call and branch stubs.
bfd/
* elf64-ppc.c (ADDIS_R12_R2): Define.
(build_plt_stub): Support fusion on ELFv2 stub.
(ppc_build_one_stub): Likewise for plt branch stubs.
gold/
* powerpc.cc (addis_12_2): Define.
(Stub_table::do_write): Support fusion on ELFv2 stubs.
ld/testsuite/
* ld-powerpc/elfv2exe.d: Update for changed plt call stubs.
gdb/
* ppc64-tdep.c (ppc64_standard_linkage8): New.
(ppc64_skip_trampoline_code): Recognise ELFv2 stub supporting fusion.
2014-06-03 09:25:29 +08:00
|
|
|
{
|
|
|
|
/* std r2, 24(r1) <optional> */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, insn_ds (62, 2, 1, 24, 0), 1 },
|
Support fusion for ELFv2 stubs
Power8 fuses addis,addi and addis,ld sequences when the target of the
addis is the same as the addi/ld. Thus
addis r12,r2,xxx@ha
addi r12,r12,xxx@l / ld r12,xxx@l(r12)
is faster than
addis r11,r2,xxx@ha
addi r12,r11,xxx@l / ld r12,xxx@l(r11)
So use the form that allows fusion in plt call and branch stubs.
bfd/
* elf64-ppc.c (ADDIS_R12_R2): Define.
(build_plt_stub): Support fusion on ELFv2 stub.
(ppc_build_one_stub): Likewise for plt branch stubs.
gold/
* powerpc.cc (addis_12_2): Define.
(Stub_table::do_write): Support fusion on ELFv2 stubs.
ld/testsuite/
* ld-powerpc/elfv2exe.d: Update for changed plt call stubs.
gdb/
* ppc64-tdep.c (ppc64_standard_linkage8): New.
(ppc64_skip_trampoline_code): Recognise ELFv2 stub supporting fusion.
2014-06-03 09:25:29 +08:00
|
|
|
|
|
|
|
/* addis r12, r2, <any> */
|
|
|
|
{ insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
|
|
|
|
|
|
|
|
/* ld r12, <any>(r12) */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, -1), insn_ds (58, 12, 12, 0, 0), 0 },
|
|
|
|
|
|
|
|
/* mtctr r12 */
|
|
|
|
{ insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
|
|
|
|
|
|
|
|
/* bctr */
|
2018-08-08 03:13:58 +08:00
|
|
|
{ (unsigned) -1, 0x4e800420, 0 },
|
Support fusion for ELFv2 stubs
Power8 fuses addis,addi and addis,ld sequences when the target of the
addis is the same as the addi/ld. Thus
addis r12,r2,xxx@ha
addi r12,r12,xxx@l / ld r12,xxx@l(r12)
is faster than
addis r11,r2,xxx@ha
addi r12,r11,xxx@l / ld r12,xxx@l(r11)
So use the form that allows fusion in plt call and branch stubs.
bfd/
* elf64-ppc.c (ADDIS_R12_R2): Define.
(build_plt_stub): Support fusion on ELFv2 stub.
(ppc_build_one_stub): Likewise for plt branch stubs.
gold/
* powerpc.cc (addis_12_2): Define.
(Stub_table::do_write): Support fusion on ELFv2 stubs.
ld/testsuite/
* ld-powerpc/elfv2exe.d: Update for changed plt call stubs.
gdb/
* ppc64-tdep.c (ppc64_standard_linkage8): New.
(ppc64_skip_trampoline_code): Recognise ELFv2 stub supporting fusion.
2014-06-03 09:25:29 +08:00
|
|
|
|
|
|
|
{ 0, 0, 0 }
|
|
|
|
};
|
|
|
|
|
Add Power 10 PLT instruction patterns
gdb/ChangeLog:
2021-06-07 Carl Love <cel@us.ibm.com>
* ppc-tdep.h (ppc_insn_prefix_dform): Declare.
* ppc64-tdep.c(insn_md, insn_x, insn_xo): New macros.
(ppc64_plt_pcrel_entry_point, ppc64_pcrel_linkage1_target,
ppc64_pcrel_linkage2_target): New functions.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New ppc
instruction patterns.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New variables
in define MAX expression.
(ppc64_skip_trampoline_code_1): Handle ppc64_standard_linkage9,
ppc64_standard_linkage10, ppc64_standard_linkage11,
ppc64_standard_linkage12.
* (ppc_insn_prefix_dform): New function.
2021-04-30 06:19:13 +08:00
|
|
|
/* Power 10 ELFv2 PLT call stubs */
|
|
|
|
static const struct ppc_insn_pattern ppc64_standard_linkage9[] =
|
|
|
|
{
|
|
|
|
/* std %r2,0+40(%r1) <optional> */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
|
|
|
|
|
|
|
|
/* pld r12, <any> */
|
|
|
|
{ prefix (-1, -1, 1, 0), prefix (0, 0, 1, 0), 0 },
|
|
|
|
{ insn_d (-1, -1, -1, 0), insn_d (57, 12, 0, 0), 0 },
|
|
|
|
|
|
|
|
/* mtctr r12 */
|
|
|
|
{ insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
|
|
|
|
|
|
|
|
/* bctr */
|
|
|
|
{ (unsigned) -1, 0x4e800420, 0 },
|
|
|
|
|
|
|
|
{ 0, 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct ppc_insn_pattern ppc64_standard_linkage10[] =
|
|
|
|
{
|
|
|
|
/* std %r2,0+40(%r1) <optional> */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
|
|
|
|
|
|
|
|
/* paddi r12,<any> */
|
|
|
|
{ prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 },
|
|
|
|
{ insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 },
|
|
|
|
|
|
|
|
/* mtctr r12 <optional> */
|
|
|
|
{ insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
|
|
|
|
|
|
|
|
/* bctr */
|
|
|
|
{ (unsigned) -1, 0x4e800420, 0 },
|
|
|
|
|
|
|
|
{ 0, 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct ppc_insn_pattern ppc64_standard_linkage11[] =
|
|
|
|
{
|
|
|
|
/* std %r2,0+40(%r1) <optional> */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
|
|
|
|
|
|
|
|
/* li %r11,0 <optional> */
|
|
|
|
{ insn_d (-1, -1, -1, 0), insn_d (14, 11, 0, 0), 1 },
|
|
|
|
|
|
|
|
/* sldi %r11,%r11,34 <eq to rldicr rx,ry,n, 63-n> <optional> */
|
|
|
|
{ insn_md (-1, -1, -1, 0, 0, 1), insn_md (30, 11, 11, 34, 63-34, 0), 1 },
|
|
|
|
|
|
|
|
/* paddi r12, <any> */
|
|
|
|
{ prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 },
|
|
|
|
{ insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 },
|
|
|
|
|
|
|
|
/* ldx %r12,%r11,%r12 <optional> */
|
|
|
|
{ (unsigned) -1, insn_x (31, 12, 11, 12, 21), 1 },
|
|
|
|
|
|
|
|
/* add %r12,%r11,%r12 <optional> */
|
|
|
|
{ (unsigned) -1, insn_xo (31, 12, 11, 12, 0, 0, 40), 1 },
|
|
|
|
|
|
|
|
/* mtctr r12 */
|
|
|
|
{ insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
|
|
|
|
|
|
|
|
/* bctr */ // 13, 14, 15, 16
|
|
|
|
{ (unsigned) -1, 0x4e800420, 0 },
|
|
|
|
|
|
|
|
{ 0, 0, 0 }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct ppc_insn_pattern ppc64_standard_linkage12[] =
|
|
|
|
{
|
|
|
|
/* std %r2,0+40(%r1) <optional> */
|
|
|
|
{ insn_ds (-1, -1, -1, 0, 1), insn_ds (62, 2, 1, 40, 0), 1 },
|
|
|
|
|
|
|
|
/* lis %r11,xxx@ha <equivalent addis rx, 0, val> */
|
|
|
|
/* addis r12, r2, <any> */
|
|
|
|
{ insn_d (-1, -1, -1, 0), insn_d (15, 12, 2, 0), 0 },
|
|
|
|
|
|
|
|
/* ori %r11,%r11,xxx@l */
|
|
|
|
{ insn_d (-1, -1, -1, 0), insn_d (24, 11, 11, 0), 0 },
|
|
|
|
|
|
|
|
/* sldi %r11,%r11,34 <optional> */
|
|
|
|
{ (unsigned) -1, insn_md (30, 11, 11, 34, 63-34, 0), 1 },
|
|
|
|
|
|
|
|
/*paddi r12,<any> */
|
|
|
|
{ prefix (-1, -1, 1, 0), prefix (2, 0, 1, 0), 0 },
|
|
|
|
{ insn_d (-1, -1, -1, 0), insn_d (14, 12, 0, 0), 0 },
|
|
|
|
|
|
|
|
/* sldi %r11,%r11,34 <optional> */
|
|
|
|
{ (unsigned) -1, insn_md (30, 11, 11, 34, 63-34, 0), 1 },
|
|
|
|
|
|
|
|
/* ldx %r12,%r11,%r12 <optional> */
|
|
|
|
{ (unsigned) -1, insn_x (31, 12, 11, 12, 21), 1 },
|
|
|
|
|
|
|
|
/* add %r12,%r11,%r12 <optional> */
|
|
|
|
{ (unsigned) -1, insn_xo (31, 12, 11, 12, 0, 0, 40), 1 },
|
|
|
|
|
|
|
|
/* mtctr r12 */
|
|
|
|
{ insn_xfx (-1, -1, -1, -1), insn_xfx (31, 12, 9, 467), 0 },
|
|
|
|
|
|
|
|
/* bctr */ // 17, 18, 19, 20
|
|
|
|
{ (unsigned) -1, 0x4e800420, 0 },
|
|
|
|
|
|
|
|
{ 0, 0, 0 }
|
|
|
|
};
|
|
|
|
|
2013-02-02 04:59:08 +08:00
|
|
|
/* When the dynamic linker is doing lazy symbol resolution, the first
|
|
|
|
call to a function in another object will go like this:
|
|
|
|
|
|
|
|
- The user's function calls the linkage function:
|
|
|
|
|
2013-06-04 10:44:35 +08:00
|
|
|
100003d4: 4b ff ff ad bl 10000380 <nnnn.plt_call.printf>
|
|
|
|
100003d8: e8 41 00 28 ld r2,40(r1)
|
2013-02-02 04:59:08 +08:00
|
|
|
|
2013-06-04 10:44:35 +08:00
|
|
|
- The linkage function loads the entry point and toc pointer from
|
|
|
|
the function descriptor in the PLT, and jumps to it:
|
2013-02-02 04:59:08 +08:00
|
|
|
|
2013-06-04 10:44:35 +08:00
|
|
|
<nnnn.plt_call.printf>:
|
|
|
|
10000380: f8 41 00 28 std r2,40(r1)
|
|
|
|
10000384: e9 62 80 78 ld r11,-32648(r2)
|
|
|
|
10000388: 7d 69 03 a6 mtctr r11
|
|
|
|
1000038c: e8 42 80 80 ld r2,-32640(r2)
|
|
|
|
10000390: 28 22 00 00 cmpldi r2,0
|
|
|
|
10000394: 4c e2 04 20 bnectr+
|
|
|
|
10000398: 48 00 03 a0 b 10000738 <printf@plt>
|
2013-02-02 04:59:08 +08:00
|
|
|
|
|
|
|
- But since this is the first time that PLT entry has been used, it
|
2013-06-04 10:44:35 +08:00
|
|
|
sends control to its glink entry. That loads the number of the
|
|
|
|
PLT entry and jumps to the common glink0 code:
|
2013-02-02 04:59:08 +08:00
|
|
|
|
2013-06-04 10:44:35 +08:00
|
|
|
<printf@plt>:
|
|
|
|
10000738: 38 00 00 01 li r0,1
|
|
|
|
1000073c: 4b ff ff bc b 100006f8 <__glink_PLTresolve>
|
2013-02-02 04:59:08 +08:00
|
|
|
|
|
|
|
- The common glink0 code then transfers control to the dynamic
|
2013-06-04 10:44:35 +08:00
|
|
|
linker's fixup code:
|
|
|
|
|
|
|
|
100006f0: 0000000000010440 .quad plt0 - (. + 16)
|
|
|
|
<__glink_PLTresolve>:
|
|
|
|
100006f8: 7d 88 02 a6 mflr r12
|
|
|
|
100006fc: 42 9f 00 05 bcl 20,4*cr7+so,10000700
|
|
|
|
10000700: 7d 68 02 a6 mflr r11
|
|
|
|
10000704: e8 4b ff f0 ld r2,-16(r11)
|
|
|
|
10000708: 7d 88 03 a6 mtlr r12
|
|
|
|
1000070c: 7d 82 5a 14 add r12,r2,r11
|
|
|
|
10000710: e9 6c 00 00 ld r11,0(r12)
|
|
|
|
10000714: e8 4c 00 08 ld r2,8(r12)
|
|
|
|
10000718: 7d 69 03 a6 mtctr r11
|
|
|
|
1000071c: e9 6c 00 10 ld r11,16(r12)
|
|
|
|
10000720: 4e 80 04 20 bctr
|
2013-02-02 04:59:08 +08:00
|
|
|
|
|
|
|
Eventually, this code will figure out how to skip all of this,
|
|
|
|
including the dynamic linker. At the moment, we just get through
|
|
|
|
the linkage function. */
|
|
|
|
|
|
|
|
/* If the current thread is about to execute a series of instructions
|
2017-12-11 15:01:11 +08:00
|
|
|
matching the ppc64_standard_linkage pattern, and INSN is the result
|
2013-02-02 04:59:08 +08:00
|
|
|
from that pattern match, return the code address to which the
|
|
|
|
standard linkage function will send them. (This doesn't deal with
|
|
|
|
dynamic linker lazy symbol resolution stubs.) */
|
|
|
|
|
|
|
|
static CORE_ADDR
|
gdb: pass frames as `const frame_info_ptr &`
We currently pass frames to function by value, as `frame_info_ptr`.
This is somewhat expensive:
- the size of `frame_info_ptr` is 64 bytes, which is a bit big to pass
by value
- the constructors and destructor link/unlink the object in the global
`frame_info_ptr::frame_list` list. This is an `intrusive_list`, so
it's not so bad: it's just assigning a few points, there's no memory
allocation as if it was `std::list`, but still it's useless to do
that over and over.
As suggested by Tom Tromey, change many function signatures to accept
`const frame_info_ptr &` instead of `frame_info_ptr`.
Some functions reassign their `frame_info_ptr` parameter, like:
void
the_func (frame_info_ptr frame)
{
for (; frame != nullptr; frame = get_prev_frame (frame))
{
...
}
}
I wondered what to do about them, do I leave them as-is or change them
(and need to introduce a separate local variable that can be
re-assigned). I opted for the later for consistency. It might not be
clear why some functions take `const frame_info_ptr &` while others take
`frame_info_ptr`. Also, if a function took a `frame_info_ptr` because
it did re-assign its parameter, I doubt that we would think to change it
to `const frame_info_ptr &` should the implementation change such that
it doesn't need to take `frame_info_ptr` anymore. It seems better to
have a simple rule and apply it everywhere.
Change-Id: I59d10addef687d157f82ccf4d54f5dde9a963fd0
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-20 02:07:47 +08:00
|
|
|
ppc64_standard_linkage1_target (const frame_info_ptr &frame, unsigned int *insn)
|
2013-02-02 04:59:08 +08:00
|
|
|
{
|
2017-12-11 15:01:11 +08:00
|
|
|
CORE_ADDR plt_off = ((ppc_insn_d_field (insn[0]) << 16)
|
|
|
|
+ ppc_insn_ds_field (insn[2]));
|
2013-02-02 04:59:08 +08:00
|
|
|
|
2017-12-11 15:01:11 +08:00
|
|
|
return ppc64_plt_entry_point (frame, plt_off);
|
2013-02-02 04:59:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static CORE_ADDR
|
gdb: pass frames as `const frame_info_ptr &`
We currently pass frames to function by value, as `frame_info_ptr`.
This is somewhat expensive:
- the size of `frame_info_ptr` is 64 bytes, which is a bit big to pass
by value
- the constructors and destructor link/unlink the object in the global
`frame_info_ptr::frame_list` list. This is an `intrusive_list`, so
it's not so bad: it's just assigning a few points, there's no memory
allocation as if it was `std::list`, but still it's useless to do
that over and over.
As suggested by Tom Tromey, change many function signatures to accept
`const frame_info_ptr &` instead of `frame_info_ptr`.
Some functions reassign their `frame_info_ptr` parameter, like:
void
the_func (frame_info_ptr frame)
{
for (; frame != nullptr; frame = get_prev_frame (frame))
{
...
}
}
I wondered what to do about them, do I leave them as-is or change them
(and need to introduce a separate local variable that can be
re-assigned). I opted for the later for consistency. It might not be
clear why some functions take `const frame_info_ptr &` while others take
`frame_info_ptr`. Also, if a function took a `frame_info_ptr` because
it did re-assign its parameter, I doubt that we would think to change it
to `const frame_info_ptr &` should the implementation change such that
it doesn't need to take `frame_info_ptr` anymore. It seems better to
have a simple rule and apply it everywhere.
Change-Id: I59d10addef687d157f82ccf4d54f5dde9a963fd0
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-20 02:07:47 +08:00
|
|
|
ppc64_standard_linkage2_target (const frame_info_ptr &frame, unsigned int *insn)
|
2013-02-02 04:59:08 +08:00
|
|
|
{
|
2017-12-11 15:01:11 +08:00
|
|
|
CORE_ADDR plt_off = ((ppc_insn_d_field (insn[1]) << 16)
|
|
|
|
+ ppc_insn_ds_field (insn[3]));
|
2013-02-02 04:59:08 +08:00
|
|
|
|
2017-12-11 15:01:11 +08:00
|
|
|
return ppc64_plt_entry_point (frame, plt_off);
|
2013-02-02 04:59:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static CORE_ADDR
|
gdb: pass frames as `const frame_info_ptr &`
We currently pass frames to function by value, as `frame_info_ptr`.
This is somewhat expensive:
- the size of `frame_info_ptr` is 64 bytes, which is a bit big to pass
by value
- the constructors and destructor link/unlink the object in the global
`frame_info_ptr::frame_list` list. This is an `intrusive_list`, so
it's not so bad: it's just assigning a few points, there's no memory
allocation as if it was `std::list`, but still it's useless to do
that over and over.
As suggested by Tom Tromey, change many function signatures to accept
`const frame_info_ptr &` instead of `frame_info_ptr`.
Some functions reassign their `frame_info_ptr` parameter, like:
void
the_func (frame_info_ptr frame)
{
for (; frame != nullptr; frame = get_prev_frame (frame))
{
...
}
}
I wondered what to do about them, do I leave them as-is or change them
(and need to introduce a separate local variable that can be
re-assigned). I opted for the later for consistency. It might not be
clear why some functions take `const frame_info_ptr &` while others take
`frame_info_ptr`. Also, if a function took a `frame_info_ptr` because
it did re-assign its parameter, I doubt that we would think to change it
to `const frame_info_ptr &` should the implementation change such that
it doesn't need to take `frame_info_ptr` anymore. It seems better to
have a simple rule and apply it everywhere.
Change-Id: I59d10addef687d157f82ccf4d54f5dde9a963fd0
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-20 02:07:47 +08:00
|
|
|
ppc64_standard_linkage3_target (const frame_info_ptr &frame, unsigned int *insn)
|
2013-02-02 04:59:08 +08:00
|
|
|
{
|
2017-12-11 15:01:11 +08:00
|
|
|
CORE_ADDR plt_off = ppc_insn_ds_field (insn[1]);
|
2013-02-02 04:59:08 +08:00
|
|
|
|
2017-12-11 15:01:11 +08:00
|
|
|
return ppc64_plt_entry_point (frame, plt_off);
|
2013-11-11 11:44:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static CORE_ADDR
|
gdb: pass frames as `const frame_info_ptr &`
We currently pass frames to function by value, as `frame_info_ptr`.
This is somewhat expensive:
- the size of `frame_info_ptr` is 64 bytes, which is a bit big to pass
by value
- the constructors and destructor link/unlink the object in the global
`frame_info_ptr::frame_list` list. This is an `intrusive_list`, so
it's not so bad: it's just assigning a few points, there's no memory
allocation as if it was `std::list`, but still it's useless to do
that over and over.
As suggested by Tom Tromey, change many function signatures to accept
`const frame_info_ptr &` instead of `frame_info_ptr`.
Some functions reassign their `frame_info_ptr` parameter, like:
void
the_func (frame_info_ptr frame)
{
for (; frame != nullptr; frame = get_prev_frame (frame))
{
...
}
}
I wondered what to do about them, do I leave them as-is or change them
(and need to introduce a separate local variable that can be
re-assigned). I opted for the later for consistency. It might not be
clear why some functions take `const frame_info_ptr &` while others take
`frame_info_ptr`. Also, if a function took a `frame_info_ptr` because
it did re-assign its parameter, I doubt that we would think to change it
to `const frame_info_ptr &` should the implementation change such that
it doesn't need to take `frame_info_ptr` anymore. It seems better to
have a simple rule and apply it everywhere.
Change-Id: I59d10addef687d157f82ccf4d54f5dde9a963fd0
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-20 02:07:47 +08:00
|
|
|
ppc64_standard_linkage4_target (const frame_info_ptr &frame, unsigned int *insn)
|
2013-11-11 11:44:40 +08:00
|
|
|
{
|
2017-12-11 15:01:11 +08:00
|
|
|
CORE_ADDR plt_off = ((ppc_insn_d_field (insn[1]) << 16)
|
|
|
|
+ ppc_insn_ds_field (insn[2]));
|
2013-11-11 11:44:40 +08:00
|
|
|
|
2017-12-11 15:01:11 +08:00
|
|
|
return ppc64_plt_entry_point (frame, plt_off);
|
2013-02-02 04:59:08 +08:00
|
|
|
}
|
|
|
|
|
Add Power 10 PLT instruction patterns
gdb/ChangeLog:
2021-06-07 Carl Love <cel@us.ibm.com>
* ppc-tdep.h (ppc_insn_prefix_dform): Declare.
* ppc64-tdep.c(insn_md, insn_x, insn_xo): New macros.
(ppc64_plt_pcrel_entry_point, ppc64_pcrel_linkage1_target,
ppc64_pcrel_linkage2_target): New functions.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New ppc
instruction patterns.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New variables
in define MAX expression.
(ppc64_skip_trampoline_code_1): Handle ppc64_standard_linkage9,
ppc64_standard_linkage10, ppc64_standard_linkage11,
ppc64_standard_linkage12.
* (ppc_insn_prefix_dform): New function.
2021-04-30 06:19:13 +08:00
|
|
|
static CORE_ADDR
|
gdb: pass frames as `const frame_info_ptr &`
We currently pass frames to function by value, as `frame_info_ptr`.
This is somewhat expensive:
- the size of `frame_info_ptr` is 64 bytes, which is a bit big to pass
by value
- the constructors and destructor link/unlink the object in the global
`frame_info_ptr::frame_list` list. This is an `intrusive_list`, so
it's not so bad: it's just assigning a few points, there's no memory
allocation as if it was `std::list`, but still it's useless to do
that over and over.
As suggested by Tom Tromey, change many function signatures to accept
`const frame_info_ptr &` instead of `frame_info_ptr`.
Some functions reassign their `frame_info_ptr` parameter, like:
void
the_func (frame_info_ptr frame)
{
for (; frame != nullptr; frame = get_prev_frame (frame))
{
...
}
}
I wondered what to do about them, do I leave them as-is or change them
(and need to introduce a separate local variable that can be
re-assigned). I opted for the later for consistency. It might not be
clear why some functions take `const frame_info_ptr &` while others take
`frame_info_ptr`. Also, if a function took a `frame_info_ptr` because
it did re-assign its parameter, I doubt that we would think to change it
to `const frame_info_ptr &` should the implementation change such that
it doesn't need to take `frame_info_ptr` anymore. It seems better to
have a simple rule and apply it everywhere.
Change-Id: I59d10addef687d157f82ccf4d54f5dde9a963fd0
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-20 02:07:47 +08:00
|
|
|
ppc64_pcrel_linkage1_target (const frame_info_ptr &frame, unsigned int *insn,
|
Add Power 10 PLT instruction patterns
gdb/ChangeLog:
2021-06-07 Carl Love <cel@us.ibm.com>
* ppc-tdep.h (ppc_insn_prefix_dform): Declare.
* ppc64-tdep.c(insn_md, insn_x, insn_xo): New macros.
(ppc64_plt_pcrel_entry_point, ppc64_pcrel_linkage1_target,
ppc64_pcrel_linkage2_target): New functions.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New ppc
instruction patterns.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New variables
in define MAX expression.
(ppc64_skip_trampoline_code_1): Handle ppc64_standard_linkage9,
ppc64_standard_linkage10, ppc64_standard_linkage11,
ppc64_standard_linkage12.
* (ppc_insn_prefix_dform): New function.
2021-04-30 06:19:13 +08:00
|
|
|
CORE_ADDR pc)
|
|
|
|
{
|
|
|
|
/* insn[0] is for the std instruction. */
|
|
|
|
CORE_ADDR plt_off = ppc_insn_prefix_dform (insn[1], insn[2]);
|
|
|
|
|
|
|
|
return ppc64_plt_pcrel_entry_point (frame, plt_off, pc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static CORE_ADDR
|
gdb: pass frames as `const frame_info_ptr &`
We currently pass frames to function by value, as `frame_info_ptr`.
This is somewhat expensive:
- the size of `frame_info_ptr` is 64 bytes, which is a bit big to pass
by value
- the constructors and destructor link/unlink the object in the global
`frame_info_ptr::frame_list` list. This is an `intrusive_list`, so
it's not so bad: it's just assigning a few points, there's no memory
allocation as if it was `std::list`, but still it's useless to do
that over and over.
As suggested by Tom Tromey, change many function signatures to accept
`const frame_info_ptr &` instead of `frame_info_ptr`.
Some functions reassign their `frame_info_ptr` parameter, like:
void
the_func (frame_info_ptr frame)
{
for (; frame != nullptr; frame = get_prev_frame (frame))
{
...
}
}
I wondered what to do about them, do I leave them as-is or change them
(and need to introduce a separate local variable that can be
re-assigned). I opted for the later for consistency. It might not be
clear why some functions take `const frame_info_ptr &` while others take
`frame_info_ptr`. Also, if a function took a `frame_info_ptr` because
it did re-assign its parameter, I doubt that we would think to change it
to `const frame_info_ptr &` should the implementation change such that
it doesn't need to take `frame_info_ptr` anymore. It seems better to
have a simple rule and apply it everywhere.
Change-Id: I59d10addef687d157f82ccf4d54f5dde9a963fd0
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-20 02:07:47 +08:00
|
|
|
ppc64_pcrel_linkage2_target (const frame_info_ptr &frame, unsigned int *insn,
|
Add Power 10 PLT instruction patterns
gdb/ChangeLog:
2021-06-07 Carl Love <cel@us.ibm.com>
* ppc-tdep.h (ppc_insn_prefix_dform): Declare.
* ppc64-tdep.c(insn_md, insn_x, insn_xo): New macros.
(ppc64_plt_pcrel_entry_point, ppc64_pcrel_linkage1_target,
ppc64_pcrel_linkage2_target): New functions.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New ppc
instruction patterns.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New variables
in define MAX expression.
(ppc64_skip_trampoline_code_1): Handle ppc64_standard_linkage9,
ppc64_standard_linkage10, ppc64_standard_linkage11,
ppc64_standard_linkage12.
* (ppc_insn_prefix_dform): New function.
2021-04-30 06:19:13 +08:00
|
|
|
CORE_ADDR pc)
|
|
|
|
{
|
|
|
|
CORE_ADDR plt_off;
|
|
|
|
|
|
|
|
/* insn[0] is for the std instruction.
|
|
|
|
insn[1] is for the li r11 instruction */
|
|
|
|
plt_off = ppc_insn_prefix_dform (insn[2], insn[3]);
|
|
|
|
|
|
|
|
return ppc64_plt_pcrel_entry_point (frame, plt_off, pc);
|
|
|
|
}
|
|
|
|
|
2013-02-02 04:59:08 +08:00
|
|
|
|
|
|
|
/* Given that we've begun executing a call trampoline at PC, return
|
Add missing comments in rs6000-tdep.c, ppc64-tdep.c and ppc-linux-tdep.c.
gdb/ChangeLog:
* ppc-linux-tdep.c (ppc_skip_trampoline_code,
ppc_canonicalize_syscall, ppc_linux_syscall_record,
ppc_linux_record_signal, ppc_init_linux_record_tdep): Add comments.
* ppc64-tdep.c (ppc64_skip_trampoline_code): Likewise.
* rs6000-tdep.c (rs6000_epilogue_frame_cache,
rs6000_epilogue_frame_this_id, rs6000_epilogue_frame_prev_register,
rs6000_epilogue_frame_sniffer, ppc_record_vsr, ppc_process_record_op4,
ppc_process_record_op19, ppc_process_record_op31,
ppc_process_record_op59, ppc_process_record_op60,
ppc_process_record_op63): Likewise.
2015-01-19 23:34:07 +08:00
|
|
|
the entry point of the function the trampoline will go to.
|
|
|
|
|
|
|
|
When the execution direction is EXEC_REVERSE, scan backward to
|
|
|
|
check whether we are in the middle of a PLT stub. */
|
2013-02-02 04:59:08 +08:00
|
|
|
|
[ppc64le] Use skip_entrypoint for skip_trampoline_code
ppc64le loses control when stepping between two PLT-called functions inside
a shared library:
29 shlib_second (); /* first-hit */^M
(gdb) PASS: gdb.base/solib-intra-step.exp: first-hit
step^M
^M
Program received signal SIGABRT, Aborted.^M
0x00003fffb7cbe578 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56^M
56 return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);^M
(gdb) FAIL: gdb.base/solib-intra-step.exp: second-hit
->
29 shlib_second (); /* first-hit */^M
(gdb) PASS: gdb.base/solib-intra-step.exp: first-hit
step^M
shlib_second () at ./gdb.base/solib-intra-step-lib.c:23^M
23 abort (); /* second-hit */^M
(gdb) PASS: gdb.base/solib-intra-step.exp: second-hit
This is because gdbarch_skip_trampoline_code() will resolve the final function
as shlib_second+0 and place there the breakpoint, but ld.so will jump after
the breakpoint - at shlib_second+8 - as it is ELFv2 local symbol optimization:
Dump of assembler code for function shlib_second:
0x0000000000000804 <+0>: addis r2,r12,2
0x0000000000000808 <+4>: addi r2,r2,30668
0x000000000000080c <+8>: mflr r0
Currently gdbarch_skip_entrypoint() has been called in skip_prologue_sal() and
fill_in_stop_func() but that is not enough. I believe
gdbarch_skip_entrypoint() should be called after every
gdbarch_skip_trampoline_code().
gdb/ChangeLog
2015-09-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* linespec.c (minsym_found): Call gdbarch_skip_entrypoint.
* ppc64-tdep.c (ppc64_skip_trampoline_code): Rename to ...
(ppc64_skip_trampoline_code_1): ... here.
(ppc64_skip_trampoline_code): New wrapper function.
* symtab.c (find_function_start_sal): Call gdbarch_skip_entrypoint.
gdb/testsuite/ChangeLog
2015-09-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.opt/solib-intra-step-lib.c: New file.
* gdb.opt/solib-intra-step-main.c: New file.
* gdb.opt/solib-intra-step.exp: New file.
2015-09-16 01:08:04 +08:00
|
|
|
static CORE_ADDR
|
gdb: pass frames as `const frame_info_ptr &`
We currently pass frames to function by value, as `frame_info_ptr`.
This is somewhat expensive:
- the size of `frame_info_ptr` is 64 bytes, which is a bit big to pass
by value
- the constructors and destructor link/unlink the object in the global
`frame_info_ptr::frame_list` list. This is an `intrusive_list`, so
it's not so bad: it's just assigning a few points, there's no memory
allocation as if it was `std::list`, but still it's useless to do
that over and over.
As suggested by Tom Tromey, change many function signatures to accept
`const frame_info_ptr &` instead of `frame_info_ptr`.
Some functions reassign their `frame_info_ptr` parameter, like:
void
the_func (frame_info_ptr frame)
{
for (; frame != nullptr; frame = get_prev_frame (frame))
{
...
}
}
I wondered what to do about them, do I leave them as-is or change them
(and need to introduce a separate local variable that can be
re-assigned). I opted for the later for consistency. It might not be
clear why some functions take `const frame_info_ptr &` while others take
`frame_info_ptr`. Also, if a function took a `frame_info_ptr` because
it did re-assign its parameter, I doubt that we would think to change it
to `const frame_info_ptr &` should the implementation change such that
it doesn't need to take `frame_info_ptr` anymore. It seems better to
have a simple rule and apply it everywhere.
Change-Id: I59d10addef687d157f82ccf4d54f5dde9a963fd0
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-20 02:07:47 +08:00
|
|
|
ppc64_skip_trampoline_code_1 (const frame_info_ptr &frame, CORE_ADDR pc)
|
2013-02-02 04:59:08 +08:00
|
|
|
{
|
2013-06-04 10:44:35 +08:00
|
|
|
#define MAX(a,b) ((a) > (b) ? (a) : (b))
|
2013-11-11 11:44:40 +08:00
|
|
|
unsigned int insns[MAX (MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage1),
|
|
|
|
ARRAY_SIZE (ppc64_standard_linkage2)),
|
|
|
|
MAX (ARRAY_SIZE (ppc64_standard_linkage3),
|
|
|
|
ARRAY_SIZE (ppc64_standard_linkage4))),
|
Add Power 10 PLT instruction patterns
gdb/ChangeLog:
2021-06-07 Carl Love <cel@us.ibm.com>
* ppc-tdep.h (ppc_insn_prefix_dform): Declare.
* ppc64-tdep.c(insn_md, insn_x, insn_xo): New macros.
(ppc64_plt_pcrel_entry_point, ppc64_pcrel_linkage1_target,
ppc64_pcrel_linkage2_target): New functions.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New ppc
instruction patterns.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New variables
in define MAX expression.
(ppc64_skip_trampoline_code_1): Handle ppc64_standard_linkage9,
ppc64_standard_linkage10, ppc64_standard_linkage11,
ppc64_standard_linkage12.
* (ppc_insn_prefix_dform): New function.
2021-04-30 06:19:13 +08:00
|
|
|
MAX(MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage5),
|
2013-11-11 11:44:40 +08:00
|
|
|
ARRAY_SIZE (ppc64_standard_linkage6)),
|
Support fusion for ELFv2 stubs
Power8 fuses addis,addi and addis,ld sequences when the target of the
addis is the same as the addi/ld. Thus
addis r12,r2,xxx@ha
addi r12,r12,xxx@l / ld r12,xxx@l(r12)
is faster than
addis r11,r2,xxx@ha
addi r12,r11,xxx@l / ld r12,xxx@l(r11)
So use the form that allows fusion in plt call and branch stubs.
bfd/
* elf64-ppc.c (ADDIS_R12_R2): Define.
(build_plt_stub): Support fusion on ELFv2 stub.
(ppc_build_one_stub): Likewise for plt branch stubs.
gold/
* powerpc.cc (addis_12_2): Define.
(Stub_table::do_write): Support fusion on ELFv2 stubs.
ld/testsuite/
* ld-powerpc/elfv2exe.d: Update for changed plt call stubs.
gdb/
* ppc64-tdep.c (ppc64_standard_linkage8): New.
(ppc64_skip_trampoline_code): Recognise ELFv2 stub supporting fusion.
2014-06-03 09:25:29 +08:00
|
|
|
MAX (ARRAY_SIZE (ppc64_standard_linkage7),
|
Add Power 10 PLT instruction patterns
gdb/ChangeLog:
2021-06-07 Carl Love <cel@us.ibm.com>
* ppc-tdep.h (ppc_insn_prefix_dform): Declare.
* ppc64-tdep.c(insn_md, insn_x, insn_xo): New macros.
(ppc64_plt_pcrel_entry_point, ppc64_pcrel_linkage1_target,
ppc64_pcrel_linkage2_target): New functions.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New ppc
instruction patterns.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New variables
in define MAX expression.
(ppc64_skip_trampoline_code_1): Handle ppc64_standard_linkage9,
ppc64_standard_linkage10, ppc64_standard_linkage11,
ppc64_standard_linkage12.
* (ppc_insn_prefix_dform): New function.
2021-04-30 06:19:13 +08:00
|
|
|
ARRAY_SIZE (ppc64_standard_linkage8))),
|
2023-03-10 03:56:09 +08:00
|
|
|
MAX (MAX (ARRAY_SIZE (ppc64_standard_linkage9),
|
Add Power 10 PLT instruction patterns
gdb/ChangeLog:
2021-06-07 Carl Love <cel@us.ibm.com>
* ppc-tdep.h (ppc_insn_prefix_dform): Declare.
* ppc64-tdep.c(insn_md, insn_x, insn_xo): New macros.
(ppc64_plt_pcrel_entry_point, ppc64_pcrel_linkage1_target,
ppc64_pcrel_linkage2_target): New functions.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New ppc
instruction patterns.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New variables
in define MAX expression.
(ppc64_skip_trampoline_code_1): Handle ppc64_standard_linkage9,
ppc64_standard_linkage10, ppc64_standard_linkage11,
ppc64_standard_linkage12.
* (ppc_insn_prefix_dform): New function.
2021-04-30 06:19:13 +08:00
|
|
|
ARRAY_SIZE (ppc64_standard_linkage10)),
|
2023-03-10 03:56:09 +08:00
|
|
|
MAX (ARRAY_SIZE (ppc64_standard_linkage11),
|
Add Power 10 PLT instruction patterns
gdb/ChangeLog:
2021-06-07 Carl Love <cel@us.ibm.com>
* ppc-tdep.h (ppc_insn_prefix_dform): Declare.
* ppc64-tdep.c(insn_md, insn_x, insn_xo): New macros.
(ppc64_plt_pcrel_entry_point, ppc64_pcrel_linkage1_target,
ppc64_pcrel_linkage2_target): New functions.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New ppc
instruction patterns.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New variables
in define MAX expression.
(ppc64_skip_trampoline_code_1): Handle ppc64_standard_linkage9,
ppc64_standard_linkage10, ppc64_standard_linkage11,
ppc64_standard_linkage12.
* (ppc_insn_prefix_dform): New function.
2021-04-30 06:19:13 +08:00
|
|
|
ARRAY_SIZE (ppc64_standard_linkage12)))))
|
|
|
|
|
Support fusion for ELFv2 stubs
Power8 fuses addis,addi and addis,ld sequences when the target of the
addis is the same as the addi/ld. Thus
addis r12,r2,xxx@ha
addi r12,r12,xxx@l / ld r12,xxx@l(r12)
is faster than
addis r11,r2,xxx@ha
addi r12,r11,xxx@l / ld r12,xxx@l(r11)
So use the form that allows fusion in plt call and branch stubs.
bfd/
* elf64-ppc.c (ADDIS_R12_R2): Define.
(build_plt_stub): Support fusion on ELFv2 stub.
(ppc_build_one_stub): Likewise for plt branch stubs.
gold/
* powerpc.cc (addis_12_2): Define.
(Stub_table::do_write): Support fusion on ELFv2 stubs.
ld/testsuite/
* ld-powerpc/elfv2exe.d: Update for changed plt call stubs.
gdb/
* ppc64-tdep.c (ppc64_standard_linkage8): New.
(ppc64_skip_trampoline_code): Recognise ELFv2 stub supporting fusion.
2014-06-03 09:25:29 +08:00
|
|
|
- 1];
|
2013-02-02 04:59:08 +08:00
|
|
|
CORE_ADDR target;
|
2015-01-17 14:30:59 +08:00
|
|
|
int scan_limit, i;
|
|
|
|
|
|
|
|
scan_limit = 1;
|
|
|
|
/* When reverse-debugging, scan backward to check whether we are
|
|
|
|
in the middle of trampoline code. */
|
|
|
|
if (execution_direction == EXEC_REVERSE)
|
|
|
|
scan_limit = ARRAY_SIZE (insns) - 1;
|
|
|
|
|
|
|
|
for (i = 0; i < scan_limit; i++)
|
|
|
|
{
|
Add Power 10 PLT instruction patterns
gdb/ChangeLog:
2021-06-07 Carl Love <cel@us.ibm.com>
* ppc-tdep.h (ppc_insn_prefix_dform): Declare.
* ppc64-tdep.c(insn_md, insn_x, insn_xo): New macros.
(ppc64_plt_pcrel_entry_point, ppc64_pcrel_linkage1_target,
ppc64_pcrel_linkage2_target): New functions.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New ppc
instruction patterns.
(ppc64_standard_linkage9, ppc64_standard_linkage10,
ppc64_standard_linkage11, ppc64_standard_linkage12): New variables
in define MAX expression.
(ppc64_skip_trampoline_code_1): Handle ppc64_standard_linkage9,
ppc64_standard_linkage10, ppc64_standard_linkage11,
ppc64_standard_linkage12.
* (ppc_insn_prefix_dform): New function.
2021-04-30 06:19:13 +08:00
|
|
|
if (i < ARRAY_SIZE (ppc64_standard_linkage12) - 1
|
|
|
|
&& ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage12, insns))
|
|
|
|
pc = ppc64_pcrel_linkage1_target (frame, insns, pc);
|
|
|
|
else if (i < ARRAY_SIZE (ppc64_standard_linkage11) - 1
|
|
|
|
&& ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage11, insns))
|
|
|
|
pc = ppc64_pcrel_linkage2_target (frame, insns, pc);
|
|
|
|
else if (i < ARRAY_SIZE (ppc64_standard_linkage10) - 1
|
|
|
|
&& ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage10, insns))
|
|
|
|
pc = ppc64_pcrel_linkage1_target (frame, insns, pc);
|
|
|
|
else if (i < ARRAY_SIZE (ppc64_standard_linkage9) - 1
|
|
|
|
&& ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage9, insns))
|
|
|
|
pc = ppc64_pcrel_linkage1_target (frame, insns, pc);
|
|
|
|
else if (i < ARRAY_SIZE (ppc64_standard_linkage8) - 1
|
2015-01-17 14:30:59 +08:00
|
|
|
&& ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage8, insns))
|
2017-12-11 15:01:11 +08:00
|
|
|
pc = ppc64_standard_linkage4_target (frame, insns);
|
2015-01-17 14:30:59 +08:00
|
|
|
else if (i < ARRAY_SIZE (ppc64_standard_linkage7) - 1
|
|
|
|
&& ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage7,
|
|
|
|
insns))
|
2017-12-11 15:01:11 +08:00
|
|
|
pc = ppc64_standard_linkage3_target (frame, insns);
|
2015-01-17 14:30:59 +08:00
|
|
|
else if (i < ARRAY_SIZE (ppc64_standard_linkage6) - 1
|
|
|
|
&& ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage6,
|
|
|
|
insns))
|
2017-12-11 15:01:11 +08:00
|
|
|
pc = ppc64_standard_linkage4_target (frame, insns);
|
2015-01-17 14:30:59 +08:00
|
|
|
else if (i < ARRAY_SIZE (ppc64_standard_linkage5) - 1
|
|
|
|
&& ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage5,
|
|
|
|
insns)
|
|
|
|
&& (insns[8] != 0 || insns[9] != 0))
|
2017-12-11 15:01:11 +08:00
|
|
|
pc = ppc64_standard_linkage3_target (frame, insns);
|
2015-01-17 14:30:59 +08:00
|
|
|
else if (i < ARRAY_SIZE (ppc64_standard_linkage4) - 1
|
|
|
|
&& ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage4,
|
|
|
|
insns)
|
|
|
|
&& (insns[9] != 0 || insns[10] != 0))
|
2017-12-11 15:01:11 +08:00
|
|
|
pc = ppc64_standard_linkage4_target (frame, insns);
|
2015-01-17 14:30:59 +08:00
|
|
|
else if (i < ARRAY_SIZE (ppc64_standard_linkage3) - 1
|
|
|
|
&& ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage3,
|
|
|
|
insns)
|
|
|
|
&& (insns[8] != 0 || insns[9] != 0))
|
2017-12-11 15:01:11 +08:00
|
|
|
pc = ppc64_standard_linkage3_target (frame, insns);
|
2015-01-17 14:30:59 +08:00
|
|
|
else if (i < ARRAY_SIZE (ppc64_standard_linkage2) - 1
|
|
|
|
&& ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage2,
|
|
|
|
insns)
|
|
|
|
&& (insns[10] != 0 || insns[11] != 0))
|
2017-12-11 15:01:11 +08:00
|
|
|
pc = ppc64_standard_linkage2_target (frame, insns);
|
2015-01-17 14:30:59 +08:00
|
|
|
else if (i < ARRAY_SIZE (ppc64_standard_linkage1) - 1
|
|
|
|
&& ppc_insns_match_pattern (frame, pc, ppc64_standard_linkage1,
|
|
|
|
insns))
|
2017-12-11 15:01:11 +08:00
|
|
|
pc = ppc64_standard_linkage1_target (frame, insns);
|
2015-01-17 14:30:59 +08:00
|
|
|
else
|
|
|
|
{
|
2023-06-05 18:53:15 +08:00
|
|
|
/* Scan backward one more instruction if it doesn't match. */
|
2015-01-17 14:30:59 +08:00
|
|
|
pc -= 4;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The PLT descriptor will either point to the already resolved target
|
gdb, gdbserver, gdbsupport: fix leading space vs tabs issues
Many spots incorrectly use only spaces for indentation (for example,
there are a lot of spots in ada-lang.c). I've always found it awkward
when I needed to edit one of these spots: do I keep the original wrong
indentation, or do I fix it? What if the lines around it are also
wrong, do I fix them too? I probably don't want to fix them in the same
patch, to avoid adding noise to my patch.
So I propose to fix as much as possible once and for all (hopefully).
One typical counter argument for this is that it makes code archeology
more difficult, because git-blame will show this commit as the last
change for these lines. My counter counter argument is: when
git-blaming, you often need to do "blame the file at the parent commit"
anyway, to go past some other refactor that touched the line you are
interested in, but is not the change you are looking for. So you
already need a somewhat efficient way to do this.
Using some interactive tool, rather than plain git-blame, makes this
trivial. For example, I use "tig blame <file>", where going back past
the commit that changed the currently selected line is one keystroke.
It looks like Magit in Emacs does it too (though I've never used it).
Web viewers of Github and Gitlab do it too. My point is that it won't
really make archeology more difficult.
The other typical counter argument is that it will cause conflicts with
existing patches. That's true... but it's a one time cost, and those
are not conflicts that are difficult to resolve. I have also tried "git
rebase --ignore-whitespace", it seems to work well. Although that will
re-introduce the faulty indentation, so one needs to take care of fixing
the indentation in the patch after that (which is easy).
gdb/ChangeLog:
* aarch64-linux-tdep.c: Fix indentation.
* aarch64-ravenscar-thread.c: Fix indentation.
* aarch64-tdep.c: Fix indentation.
* aarch64-tdep.h: Fix indentation.
* ada-lang.c: Fix indentation.
* ada-lang.h: Fix indentation.
* ada-tasks.c: Fix indentation.
* ada-typeprint.c: Fix indentation.
* ada-valprint.c: Fix indentation.
* ada-varobj.c: Fix indentation.
* addrmap.c: Fix indentation.
* addrmap.h: Fix indentation.
* agent.c: Fix indentation.
* aix-thread.c: Fix indentation.
* alpha-bsd-nat.c: Fix indentation.
* alpha-linux-tdep.c: Fix indentation.
* alpha-mdebug-tdep.c: Fix indentation.
* alpha-nbsd-tdep.c: Fix indentation.
* alpha-obsd-tdep.c: Fix indentation.
* alpha-tdep.c: Fix indentation.
* amd64-bsd-nat.c: Fix indentation.
* amd64-darwin-tdep.c: Fix indentation.
* amd64-linux-nat.c: Fix indentation.
* amd64-linux-tdep.c: Fix indentation.
* amd64-nat.c: Fix indentation.
* amd64-obsd-tdep.c: Fix indentation.
* amd64-tdep.c: Fix indentation.
* amd64-windows-tdep.c: Fix indentation.
* annotate.c: Fix indentation.
* arc-tdep.c: Fix indentation.
* arch-utils.c: Fix indentation.
* arch/arm-get-next-pcs.c: Fix indentation.
* arch/arm.c: Fix indentation.
* arm-linux-nat.c: Fix indentation.
* arm-linux-tdep.c: Fix indentation.
* arm-nbsd-tdep.c: Fix indentation.
* arm-pikeos-tdep.c: Fix indentation.
* arm-tdep.c: Fix indentation.
* arm-tdep.h: Fix indentation.
* arm-wince-tdep.c: Fix indentation.
* auto-load.c: Fix indentation.
* auxv.c: Fix indentation.
* avr-tdep.c: Fix indentation.
* ax-gdb.c: Fix indentation.
* ax-general.c: Fix indentation.
* bfin-linux-tdep.c: Fix indentation.
* block.c: Fix indentation.
* block.h: Fix indentation.
* blockframe.c: Fix indentation.
* bpf-tdep.c: Fix indentation.
* break-catch-sig.c: Fix indentation.
* break-catch-syscall.c: Fix indentation.
* break-catch-throw.c: Fix indentation.
* breakpoint.c: Fix indentation.
* breakpoint.h: Fix indentation.
* bsd-uthread.c: Fix indentation.
* btrace.c: Fix indentation.
* build-id.c: Fix indentation.
* buildsym-legacy.h: Fix indentation.
* buildsym.c: Fix indentation.
* c-typeprint.c: Fix indentation.
* c-valprint.c: Fix indentation.
* c-varobj.c: Fix indentation.
* charset.c: Fix indentation.
* cli/cli-cmds.c: Fix indentation.
* cli/cli-decode.c: Fix indentation.
* cli/cli-decode.h: Fix indentation.
* cli/cli-script.c: Fix indentation.
* cli/cli-setshow.c: Fix indentation.
* coff-pe-read.c: Fix indentation.
* coffread.c: Fix indentation.
* compile/compile-cplus-types.c: Fix indentation.
* compile/compile-object-load.c: Fix indentation.
* compile/compile-object-run.c: Fix indentation.
* completer.c: Fix indentation.
* corefile.c: Fix indentation.
* corelow.c: Fix indentation.
* cp-abi.h: Fix indentation.
* cp-namespace.c: Fix indentation.
* cp-support.c: Fix indentation.
* cp-valprint.c: Fix indentation.
* cris-linux-tdep.c: Fix indentation.
* cris-tdep.c: Fix indentation.
* darwin-nat-info.c: Fix indentation.
* darwin-nat.c: Fix indentation.
* darwin-nat.h: Fix indentation.
* dbxread.c: Fix indentation.
* dcache.c: Fix indentation.
* disasm.c: Fix indentation.
* dtrace-probe.c: Fix indentation.
* dwarf2/abbrev.c: Fix indentation.
* dwarf2/attribute.c: Fix indentation.
* dwarf2/expr.c: Fix indentation.
* dwarf2/frame.c: Fix indentation.
* dwarf2/index-cache.c: Fix indentation.
* dwarf2/index-write.c: Fix indentation.
* dwarf2/line-header.c: Fix indentation.
* dwarf2/loc.c: Fix indentation.
* dwarf2/macro.c: Fix indentation.
* dwarf2/read.c: Fix indentation.
* dwarf2/read.h: Fix indentation.
* elfread.c: Fix indentation.
* eval.c: Fix indentation.
* event-top.c: Fix indentation.
* exec.c: Fix indentation.
* exec.h: Fix indentation.
* expprint.c: Fix indentation.
* f-lang.c: Fix indentation.
* f-typeprint.c: Fix indentation.
* f-valprint.c: Fix indentation.
* fbsd-nat.c: Fix indentation.
* fbsd-tdep.c: Fix indentation.
* findvar.c: Fix indentation.
* fork-child.c: Fix indentation.
* frame-unwind.c: Fix indentation.
* frame-unwind.h: Fix indentation.
* frame.c: Fix indentation.
* frv-linux-tdep.c: Fix indentation.
* frv-tdep.c: Fix indentation.
* frv-tdep.h: Fix indentation.
* ft32-tdep.c: Fix indentation.
* gcore.c: Fix indentation.
* gdb_bfd.c: Fix indentation.
* gdbarch.sh: Fix indentation.
* gdbarch.c: Re-generate
* gdbarch.h: Re-generate.
* gdbcore.h: Fix indentation.
* gdbthread.h: Fix indentation.
* gdbtypes.c: Fix indentation.
* gdbtypes.h: Fix indentation.
* glibc-tdep.c: Fix indentation.
* gnu-nat.c: Fix indentation.
* gnu-nat.h: Fix indentation.
* gnu-v2-abi.c: Fix indentation.
* gnu-v3-abi.c: Fix indentation.
* go32-nat.c: Fix indentation.
* guile/guile-internal.h: Fix indentation.
* guile/scm-cmd.c: Fix indentation.
* guile/scm-frame.c: Fix indentation.
* guile/scm-iterator.c: Fix indentation.
* guile/scm-math.c: Fix indentation.
* guile/scm-ports.c: Fix indentation.
* guile/scm-pretty-print.c: Fix indentation.
* guile/scm-value.c: Fix indentation.
* h8300-tdep.c: Fix indentation.
* hppa-linux-nat.c: Fix indentation.
* hppa-linux-tdep.c: Fix indentation.
* hppa-nbsd-nat.c: Fix indentation.
* hppa-nbsd-tdep.c: Fix indentation.
* hppa-obsd-nat.c: Fix indentation.
* hppa-tdep.c: Fix indentation.
* hppa-tdep.h: Fix indentation.
* i386-bsd-nat.c: Fix indentation.
* i386-darwin-nat.c: Fix indentation.
* i386-darwin-tdep.c: Fix indentation.
* i386-dicos-tdep.c: Fix indentation.
* i386-gnu-nat.c: Fix indentation.
* i386-linux-nat.c: Fix indentation.
* i386-linux-tdep.c: Fix indentation.
* i386-nto-tdep.c: Fix indentation.
* i386-obsd-tdep.c: Fix indentation.
* i386-sol2-nat.c: Fix indentation.
* i386-tdep.c: Fix indentation.
* i386-tdep.h: Fix indentation.
* i386-windows-tdep.c: Fix indentation.
* i387-tdep.c: Fix indentation.
* i387-tdep.h: Fix indentation.
* ia64-libunwind-tdep.c: Fix indentation.
* ia64-libunwind-tdep.h: Fix indentation.
* ia64-linux-nat.c: Fix indentation.
* ia64-linux-tdep.c: Fix indentation.
* ia64-tdep.c: Fix indentation.
* ia64-tdep.h: Fix indentation.
* ia64-vms-tdep.c: Fix indentation.
* infcall.c: Fix indentation.
* infcmd.c: Fix indentation.
* inferior.c: Fix indentation.
* infrun.c: Fix indentation.
* iq2000-tdep.c: Fix indentation.
* language.c: Fix indentation.
* linespec.c: Fix indentation.
* linux-fork.c: Fix indentation.
* linux-nat.c: Fix indentation.
* linux-tdep.c: Fix indentation.
* linux-thread-db.c: Fix indentation.
* lm32-tdep.c: Fix indentation.
* m2-lang.c: Fix indentation.
* m2-typeprint.c: Fix indentation.
* m2-valprint.c: Fix indentation.
* m32c-tdep.c: Fix indentation.
* m32r-linux-tdep.c: Fix indentation.
* m32r-tdep.c: Fix indentation.
* m68hc11-tdep.c: Fix indentation.
* m68k-bsd-nat.c: Fix indentation.
* m68k-linux-nat.c: Fix indentation.
* m68k-linux-tdep.c: Fix indentation.
* m68k-tdep.c: Fix indentation.
* machoread.c: Fix indentation.
* macrocmd.c: Fix indentation.
* macroexp.c: Fix indentation.
* macroscope.c: Fix indentation.
* macrotab.c: Fix indentation.
* macrotab.h: Fix indentation.
* main.c: Fix indentation.
* mdebugread.c: Fix indentation.
* mep-tdep.c: Fix indentation.
* mi/mi-cmd-catch.c: Fix indentation.
* mi/mi-cmd-disas.c: Fix indentation.
* mi/mi-cmd-env.c: Fix indentation.
* mi/mi-cmd-stack.c: Fix indentation.
* mi/mi-cmd-var.c: Fix indentation.
* mi/mi-cmds.c: Fix indentation.
* mi/mi-main.c: Fix indentation.
* mi/mi-parse.c: Fix indentation.
* microblaze-tdep.c: Fix indentation.
* minidebug.c: Fix indentation.
* minsyms.c: Fix indentation.
* mips-linux-nat.c: Fix indentation.
* mips-linux-tdep.c: Fix indentation.
* mips-nbsd-tdep.c: Fix indentation.
* mips-tdep.c: Fix indentation.
* mn10300-linux-tdep.c: Fix indentation.
* mn10300-tdep.c: Fix indentation.
* moxie-tdep.c: Fix indentation.
* msp430-tdep.c: Fix indentation.
* namespace.h: Fix indentation.
* nat/fork-inferior.c: Fix indentation.
* nat/gdb_ptrace.h: Fix indentation.
* nat/linux-namespaces.c: Fix indentation.
* nat/linux-osdata.c: Fix indentation.
* nat/netbsd-nat.c: Fix indentation.
* nat/x86-dregs.c: Fix indentation.
* nbsd-nat.c: Fix indentation.
* nbsd-tdep.c: Fix indentation.
* nios2-linux-tdep.c: Fix indentation.
* nios2-tdep.c: Fix indentation.
* nto-procfs.c: Fix indentation.
* nto-tdep.c: Fix indentation.
* objfiles.c: Fix indentation.
* objfiles.h: Fix indentation.
* opencl-lang.c: Fix indentation.
* or1k-tdep.c: Fix indentation.
* osabi.c: Fix indentation.
* osabi.h: Fix indentation.
* osdata.c: Fix indentation.
* p-lang.c: Fix indentation.
* p-typeprint.c: Fix indentation.
* p-valprint.c: Fix indentation.
* parse.c: Fix indentation.
* ppc-linux-nat.c: Fix indentation.
* ppc-linux-tdep.c: Fix indentation.
* ppc-nbsd-nat.c: Fix indentation.
* ppc-nbsd-tdep.c: Fix indentation.
* ppc-obsd-nat.c: Fix indentation.
* ppc-ravenscar-thread.c: Fix indentation.
* ppc-sysv-tdep.c: Fix indentation.
* ppc64-tdep.c: Fix indentation.
* printcmd.c: Fix indentation.
* proc-api.c: Fix indentation.
* producer.c: Fix indentation.
* producer.h: Fix indentation.
* prologue-value.c: Fix indentation.
* prologue-value.h: Fix indentation.
* psymtab.c: Fix indentation.
* python/py-arch.c: Fix indentation.
* python/py-bpevent.c: Fix indentation.
* python/py-event.c: Fix indentation.
* python/py-event.h: Fix indentation.
* python/py-finishbreakpoint.c: Fix indentation.
* python/py-frame.c: Fix indentation.
* python/py-framefilter.c: Fix indentation.
* python/py-inferior.c: Fix indentation.
* python/py-infthread.c: Fix indentation.
* python/py-objfile.c: Fix indentation.
* python/py-prettyprint.c: Fix indentation.
* python/py-registers.c: Fix indentation.
* python/py-signalevent.c: Fix indentation.
* python/py-stopevent.c: Fix indentation.
* python/py-stopevent.h: Fix indentation.
* python/py-threadevent.c: Fix indentation.
* python/py-tui.c: Fix indentation.
* python/py-unwind.c: Fix indentation.
* python/py-value.c: Fix indentation.
* python/py-xmethods.c: Fix indentation.
* python/python-internal.h: Fix indentation.
* python/python.c: Fix indentation.
* ravenscar-thread.c: Fix indentation.
* record-btrace.c: Fix indentation.
* record-full.c: Fix indentation.
* record.c: Fix indentation.
* reggroups.c: Fix indentation.
* regset.h: Fix indentation.
* remote-fileio.c: Fix indentation.
* remote.c: Fix indentation.
* reverse.c: Fix indentation.
* riscv-linux-tdep.c: Fix indentation.
* riscv-ravenscar-thread.c: Fix indentation.
* riscv-tdep.c: Fix indentation.
* rl78-tdep.c: Fix indentation.
* rs6000-aix-tdep.c: Fix indentation.
* rs6000-lynx178-tdep.c: Fix indentation.
* rs6000-nat.c: Fix indentation.
* rs6000-tdep.c: Fix indentation.
* rust-lang.c: Fix indentation.
* rx-tdep.c: Fix indentation.
* s12z-tdep.c: Fix indentation.
* s390-linux-tdep.c: Fix indentation.
* score-tdep.c: Fix indentation.
* ser-base.c: Fix indentation.
* ser-mingw.c: Fix indentation.
* ser-uds.c: Fix indentation.
* ser-unix.c: Fix indentation.
* serial.c: Fix indentation.
* sh-linux-tdep.c: Fix indentation.
* sh-nbsd-tdep.c: Fix indentation.
* sh-tdep.c: Fix indentation.
* skip.c: Fix indentation.
* sol-thread.c: Fix indentation.
* solib-aix.c: Fix indentation.
* solib-darwin.c: Fix indentation.
* solib-frv.c: Fix indentation.
* solib-svr4.c: Fix indentation.
* solib.c: Fix indentation.
* source.c: Fix indentation.
* sparc-linux-tdep.c: Fix indentation.
* sparc-nbsd-tdep.c: Fix indentation.
* sparc-obsd-tdep.c: Fix indentation.
* sparc-ravenscar-thread.c: Fix indentation.
* sparc-tdep.c: Fix indentation.
* sparc64-linux-tdep.c: Fix indentation.
* sparc64-nbsd-tdep.c: Fix indentation.
* sparc64-obsd-tdep.c: Fix indentation.
* sparc64-tdep.c: Fix indentation.
* stabsread.c: Fix indentation.
* stack.c: Fix indentation.
* stap-probe.c: Fix indentation.
* stubs/ia64vms-stub.c: Fix indentation.
* stubs/m32r-stub.c: Fix indentation.
* stubs/m68k-stub.c: Fix indentation.
* stubs/sh-stub.c: Fix indentation.
* stubs/sparc-stub.c: Fix indentation.
* symfile-mem.c: Fix indentation.
* symfile.c: Fix indentation.
* symfile.h: Fix indentation.
* symmisc.c: Fix indentation.
* symtab.c: Fix indentation.
* symtab.h: Fix indentation.
* target-float.c: Fix indentation.
* target.c: Fix indentation.
* target.h: Fix indentation.
* tic6x-tdep.c: Fix indentation.
* tilegx-linux-tdep.c: Fix indentation.
* tilegx-tdep.c: Fix indentation.
* top.c: Fix indentation.
* tracefile-tfile.c: Fix indentation.
* tracepoint.c: Fix indentation.
* tui/tui-disasm.c: Fix indentation.
* tui/tui-io.c: Fix indentation.
* tui/tui-regs.c: Fix indentation.
* tui/tui-stack.c: Fix indentation.
* tui/tui-win.c: Fix indentation.
* tui/tui-winsource.c: Fix indentation.
* tui/tui.c: Fix indentation.
* typeprint.c: Fix indentation.
* ui-out.h: Fix indentation.
* unittests/copy_bitwise-selftests.c: Fix indentation.
* unittests/memory-map-selftests.c: Fix indentation.
* utils.c: Fix indentation.
* v850-tdep.c: Fix indentation.
* valarith.c: Fix indentation.
* valops.c: Fix indentation.
* valprint.c: Fix indentation.
* valprint.h: Fix indentation.
* value.c: Fix indentation.
* value.h: Fix indentation.
* varobj.c: Fix indentation.
* vax-tdep.c: Fix indentation.
* windows-nat.c: Fix indentation.
* windows-tdep.c: Fix indentation.
* xcoffread.c: Fix indentation.
* xml-syscall.c: Fix indentation.
* xml-tdesc.c: Fix indentation.
* xstormy16-tdep.c: Fix indentation.
* xtensa-config.c: Fix indentation.
* xtensa-linux-nat.c: Fix indentation.
* xtensa-linux-tdep.c: Fix indentation.
* xtensa-tdep.c: Fix indentation.
gdbserver/ChangeLog:
* ax.cc: Fix indentation.
* dll.cc: Fix indentation.
* inferiors.h: Fix indentation.
* linux-low.cc: Fix indentation.
* linux-nios2-low.cc: Fix indentation.
* linux-ppc-ipa.cc: Fix indentation.
* linux-ppc-low.cc: Fix indentation.
* linux-x86-low.cc: Fix indentation.
* linux-xtensa-low.cc: Fix indentation.
* regcache.cc: Fix indentation.
* server.cc: Fix indentation.
* tracepoint.cc: Fix indentation.
gdbsupport/ChangeLog:
* common-exceptions.h: Fix indentation.
* event-loop.cc: Fix indentation.
* fileio.cc: Fix indentation.
* filestuff.cc: Fix indentation.
* gdb-dlfcn.cc: Fix indentation.
* gdb_string_view.h: Fix indentation.
* job-control.cc: Fix indentation.
* signals.cc: Fix indentation.
Change-Id: I4bad7ae6be0fbe14168b8ebafb98ffe14964a695
2020-11-02 23:26:14 +08:00
|
|
|
address, or else to a glink stub. As the latter carry synthetic @plt
|
|
|
|
symbols, find_solib_trampoline_target should be able to resolve them. */
|
2015-01-17 14:30:59 +08:00
|
|
|
target = find_solib_trampoline_target (frame, pc);
|
|
|
|
return target ? target : pc;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2013-02-02 04:59:08 +08:00
|
|
|
}
|
|
|
|
|
[ppc64le] Use skip_entrypoint for skip_trampoline_code
ppc64le loses control when stepping between two PLT-called functions inside
a shared library:
29 shlib_second (); /* first-hit */^M
(gdb) PASS: gdb.base/solib-intra-step.exp: first-hit
step^M
^M
Program received signal SIGABRT, Aborted.^M
0x00003fffb7cbe578 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56^M
56 return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);^M
(gdb) FAIL: gdb.base/solib-intra-step.exp: second-hit
->
29 shlib_second (); /* first-hit */^M
(gdb) PASS: gdb.base/solib-intra-step.exp: first-hit
step^M
shlib_second () at ./gdb.base/solib-intra-step-lib.c:23^M
23 abort (); /* second-hit */^M
(gdb) PASS: gdb.base/solib-intra-step.exp: second-hit
This is because gdbarch_skip_trampoline_code() will resolve the final function
as shlib_second+0 and place there the breakpoint, but ld.so will jump after
the breakpoint - at shlib_second+8 - as it is ELFv2 local symbol optimization:
Dump of assembler code for function shlib_second:
0x0000000000000804 <+0>: addis r2,r12,2
0x0000000000000808 <+4>: addi r2,r2,30668
0x000000000000080c <+8>: mflr r0
Currently gdbarch_skip_entrypoint() has been called in skip_prologue_sal() and
fill_in_stop_func() but that is not enough. I believe
gdbarch_skip_entrypoint() should be called after every
gdbarch_skip_trampoline_code().
gdb/ChangeLog
2015-09-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* linespec.c (minsym_found): Call gdbarch_skip_entrypoint.
* ppc64-tdep.c (ppc64_skip_trampoline_code): Rename to ...
(ppc64_skip_trampoline_code_1): ... here.
(ppc64_skip_trampoline_code): New wrapper function.
* symtab.c (find_function_start_sal): Call gdbarch_skip_entrypoint.
gdb/testsuite/ChangeLog
2015-09-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.opt/solib-intra-step-lib.c: New file.
* gdb.opt/solib-intra-step-main.c: New file.
* gdb.opt/solib-intra-step.exp: New file.
2015-09-16 01:08:04 +08:00
|
|
|
/* Wrapper of ppc64_skip_trampoline_code_1 checking also
|
|
|
|
ppc_elfv2_skip_entrypoint. */
|
|
|
|
|
|
|
|
CORE_ADDR
|
gdb: pass frames as `const frame_info_ptr &`
We currently pass frames to function by value, as `frame_info_ptr`.
This is somewhat expensive:
- the size of `frame_info_ptr` is 64 bytes, which is a bit big to pass
by value
- the constructors and destructor link/unlink the object in the global
`frame_info_ptr::frame_list` list. This is an `intrusive_list`, so
it's not so bad: it's just assigning a few points, there's no memory
allocation as if it was `std::list`, but still it's useless to do
that over and over.
As suggested by Tom Tromey, change many function signatures to accept
`const frame_info_ptr &` instead of `frame_info_ptr`.
Some functions reassign their `frame_info_ptr` parameter, like:
void
the_func (frame_info_ptr frame)
{
for (; frame != nullptr; frame = get_prev_frame (frame))
{
...
}
}
I wondered what to do about them, do I leave them as-is or change them
(and need to introduce a separate local variable that can be
re-assigned). I opted for the later for consistency. It might not be
clear why some functions take `const frame_info_ptr &` while others take
`frame_info_ptr`. Also, if a function took a `frame_info_ptr` because
it did re-assign its parameter, I doubt that we would think to change it
to `const frame_info_ptr &` should the implementation change such that
it doesn't need to take `frame_info_ptr` anymore. It seems better to
have a simple rule and apply it everywhere.
Change-Id: I59d10addef687d157f82ccf4d54f5dde9a963fd0
Approved-By: Andrew Burgess <aburgess@redhat.com>
2024-02-20 02:07:47 +08:00
|
|
|
ppc64_skip_trampoline_code (const frame_info_ptr &frame, CORE_ADDR pc)
|
[ppc64le] Use skip_entrypoint for skip_trampoline_code
ppc64le loses control when stepping between two PLT-called functions inside
a shared library:
29 shlib_second (); /* first-hit */^M
(gdb) PASS: gdb.base/solib-intra-step.exp: first-hit
step^M
^M
Program received signal SIGABRT, Aborted.^M
0x00003fffb7cbe578 in __GI_raise (sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56^M
56 return INLINE_SYSCALL (tgkill, 3, pid, selftid, sig);^M
(gdb) FAIL: gdb.base/solib-intra-step.exp: second-hit
->
29 shlib_second (); /* first-hit */^M
(gdb) PASS: gdb.base/solib-intra-step.exp: first-hit
step^M
shlib_second () at ./gdb.base/solib-intra-step-lib.c:23^M
23 abort (); /* second-hit */^M
(gdb) PASS: gdb.base/solib-intra-step.exp: second-hit
This is because gdbarch_skip_trampoline_code() will resolve the final function
as shlib_second+0 and place there the breakpoint, but ld.so will jump after
the breakpoint - at shlib_second+8 - as it is ELFv2 local symbol optimization:
Dump of assembler code for function shlib_second:
0x0000000000000804 <+0>: addis r2,r12,2
0x0000000000000808 <+4>: addi r2,r2,30668
0x000000000000080c <+8>: mflr r0
Currently gdbarch_skip_entrypoint() has been called in skip_prologue_sal() and
fill_in_stop_func() but that is not enough. I believe
gdbarch_skip_entrypoint() should be called after every
gdbarch_skip_trampoline_code().
gdb/ChangeLog
2015-09-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* linespec.c (minsym_found): Call gdbarch_skip_entrypoint.
* ppc64-tdep.c (ppc64_skip_trampoline_code): Rename to ...
(ppc64_skip_trampoline_code_1): ... here.
(ppc64_skip_trampoline_code): New wrapper function.
* symtab.c (find_function_start_sal): Call gdbarch_skip_entrypoint.
gdb/testsuite/ChangeLog
2015-09-15 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.opt/solib-intra-step-lib.c: New file.
* gdb.opt/solib-intra-step-main.c: New file.
* gdb.opt/solib-intra-step.exp: New file.
2015-09-16 01:08:04 +08:00
|
|
|
{
|
|
|
|
struct gdbarch *gdbarch = get_frame_arch (frame);
|
|
|
|
|
|
|
|
pc = ppc64_skip_trampoline_code_1 (frame, pc);
|
|
|
|
if (pc != 0 && gdbarch_skip_entrypoint_p (gdbarch))
|
|
|
|
pc = gdbarch_skip_entrypoint (gdbarch, pc);
|
|
|
|
return pc;
|
|
|
|
}
|
|
|
|
|
2013-02-02 04:59:08 +08:00
|
|
|
/* Support for convert_from_func_ptr_addr (ARCH, ADDR, TARG) on PPC64
|
|
|
|
GNU/Linux.
|
|
|
|
|
|
|
|
Usually a function pointer's representation is simply the address
|
|
|
|
of the function. On GNU/Linux on the PowerPC however, a function
|
|
|
|
pointer may be a pointer to a function descriptor.
|
|
|
|
|
|
|
|
For PPC64, a function descriptor is a TOC entry, in a data section,
|
|
|
|
which contains three words: the first word is the address of the
|
|
|
|
function, the second word is the TOC pointer (r2), and the third word
|
|
|
|
is the static chain value.
|
|
|
|
|
|
|
|
Throughout GDB it is currently assumed that a function pointer contains
|
|
|
|
the address of the function, which is not easy to fix. In addition, the
|
|
|
|
conversion of a function address to a function pointer would
|
|
|
|
require allocation of a TOC entry in the inferior's memory space,
|
|
|
|
with all its drawbacks. To be able to call C++ virtual methods in
|
|
|
|
the inferior (which are called via function pointers),
|
|
|
|
find_function_addr uses this function to get the function address
|
|
|
|
from a function pointer.
|
|
|
|
|
|
|
|
If ADDR points at what is clearly a function descriptor, transform
|
|
|
|
it into the address of the corresponding function, if needed. Be
|
|
|
|
conservative, otherwise GDB will do the transformation on any
|
|
|
|
random addresses such as occur when there is no symbol table. */
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
ppc64_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
|
|
|
|
CORE_ADDR addr,
|
|
|
|
struct target_ops *targ)
|
|
|
|
{
|
|
|
|
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
|
2021-02-12 19:39:23 +08:00
|
|
|
const struct target_section *s = target_section_by_addr (targ, addr);
|
2013-02-02 04:59:08 +08:00
|
|
|
|
|
|
|
/* Check if ADDR points to a function descriptor. */
|
|
|
|
if (s && strcmp (s->the_bfd_section->name, ".opd") == 0)
|
|
|
|
{
|
|
|
|
/* There may be relocations that need to be applied to the .opd
|
|
|
|
section. Unfortunately, this function may be called at a time
|
|
|
|
where these relocations have not yet been performed -- this can
|
|
|
|
happen for example shortly after a library has been loaded with
|
|
|
|
dlopen, but ld.so has not yet applied the relocations.
|
|
|
|
|
|
|
|
To cope with both the case where the relocation has been applied,
|
|
|
|
and the case where it has not yet been applied, we do *not* read
|
|
|
|
the (maybe) relocated value from target memory, but we instead
|
|
|
|
read the non-relocated value from the BFD, and apply the relocation
|
|
|
|
offset manually.
|
|
|
|
|
|
|
|
This makes the assumption that all .opd entries are always relocated
|
|
|
|
by the same offset the section itself was relocated. This should
|
|
|
|
always be the case for GNU/Linux executables and shared libraries.
|
|
|
|
Note that other kind of object files (e.g. those added via
|
|
|
|
add-symbol-files) will currently never end up here anyway, as this
|
|
|
|
function accesses *target* sections only; only the main exec and
|
|
|
|
shared libraries are ever added to the target. */
|
|
|
|
|
|
|
|
gdb_byte buf[8];
|
|
|
|
int res;
|
|
|
|
|
2013-07-17 13:28:04 +08:00
|
|
|
res = bfd_get_section_contents (s->the_bfd_section->owner,
|
|
|
|
s->the_bfd_section,
|
2013-02-02 04:59:08 +08:00
|
|
|
&buf, addr - s->addr, 8);
|
|
|
|
if (res != 0)
|
bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions. The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections. Those sections shouldn't be modified
anyway.
The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma. I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section. This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.
bfd/
* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
(bfd_get_section_lma, bfd_get_section_alignment),
(bfd_get_section_size, bfd_get_section_flags),
(bfd_get_section_userdata): Delete.
(bfd_section_name, bfd_section_size, bfd_section_vma),
(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
(bfd_section_flags, bfd_section_userdata): New.
(bfd_is_com_section): Rename parameter.
* section.c (bfd_set_section_userdata, bfd_set_section_vma),
(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
(bfd_set_section_size): Delete bfd parameter, rename section parameter.
(bfd_set_section_lma): New.
* bfd-in2.h: Regenerate.
* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
update callers.
* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
* elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c,
* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
* elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c,
* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
* xcofflink.c: Update throughout for bfd section macro and function
changes.
binutils/
* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
throughout for bfd section macro and function changes.
gas/
* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
bfd section macro and function changes.
* write.c (compress_debug): Use bfd_rename_section.
gdb/
* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
* solib-spu.c, * solib-svr4.c, * solib-target.c,
* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
* mi/mi-interp.c: Update throughout for bfd section macro and
function changes.
* gcore (gcore_create_callback): Use bfd_set_section_lma.
* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
* corefile.c, * symtab.c: Update throughout for bfd section
macro and function changes.
ld/
* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
* emultempl/aarch64elf.em, * emultempl/aix.em,
* emultempl/armcoff.em, * emultempl/armelf.em,
* emultempl/cr16elf.em, * emultempl/cskyelf.em,
* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
* emultempl/mmo.em, * emultempl/msp430.em,
* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
throughout for bfd section macro and function changes.
libctf/
* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
* arc-ext.c: Update throughout for bfd section macro changes.
sim/
* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 18:55:17 +08:00
|
|
|
return (extract_unsigned_integer (buf, 8, byte_order)
|
|
|
|
- bfd_section_vma (s->the_bfd_section) + s->addr);
|
2013-02-02 04:59:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return addr;
|
|
|
|
}
|
2013-02-23 07:24:24 +08:00
|
|
|
|
|
|
|
/* A synthetic 'dot' symbols on ppc64 has the udata.p entry pointing
|
|
|
|
back to the original ELF symbol it was derived from. Get the size
|
|
|
|
from that symbol. */
|
|
|
|
|
|
|
|
void
|
|
|
|
ppc64_elf_make_msymbol_special (asymbol *sym, struct minimal_symbol *msym)
|
|
|
|
{
|
|
|
|
if ((sym->flags & BSF_SYNTHETIC) != 0 && sym->udata.p != NULL)
|
|
|
|
{
|
|
|
|
elf_symbol_type *elf_sym = (elf_symbol_type *) sym->udata.p;
|
2022-01-28 23:41:49 +08:00
|
|
|
msym->set_size (elf_sym->internal_elf_sym.st_size);
|
2013-02-23 07:24:24 +08:00
|
|
|
}
|
|
|
|
}
|