2 * This file is part of ltrace.
3 * Copyright (C) 2012 Petr Machata
4 * Copyright (C) 2006 Paul Gilliam
5 * Copyright (C) 2002,2004 Juan Cespedes
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
22 #ifndef LTRACE_PPC_ARCH_H
23 #define LTRACE_PPC_ARCH_H
27 #define BREAKPOINT_VALUE { 0x7f, 0xe0, 0x00, 0x08 }
28 #define BREAKPOINT_LENGTH 4
29 #define DECR_PC_AFTER_BREAK 0
31 #define LT_ELFCLASS ELFCLASS32
32 #define LT_ELF_MACHINE EM_PPC
34 #ifdef __powerpc64__ // Says 'ltrace' is 64 bits, says nothing about target.
35 #define LT_ELFCLASS2 ELFCLASS64
36 #define LT_ELF_MACHINE2 EM_PPC64
37 #define ARCH_SUPPORTS_OPD
40 #define ARCH_HAVE_ATOMIC_SINGLESTEP
41 #define ARCH_HAVE_ADD_PLT_ENTRY
42 #define ARCH_HAVE_TRANSLATE_ADDRESS
43 #define ARCH_HAVE_DYNLINK_DONE
44 #define ARCH_HAVE_FETCH_ARG
45 #define ARCH_ENDIAN_BIG
46 #define ARCH_HAVE_SIZEOF
47 #define ARCH_HAVE_ALIGNOF
49 struct library_symbol;
51 #define ARCH_HAVE_LTELF_DATA
52 struct arch_ltelf_data {
53 GElf_Addr plt_stub_vma;
54 struct library_symbol *stubs;
61 #define ARCH_HAVE_LIBRARY_DATA
62 struct arch_library_data {
63 GElf_Addr pltgot_addr;
64 int bss_plt_prelinked;
68 /* Either a non-PLT symbol, or PPC32 symbol. */
71 /* PPC64 STUB, never resolved. */
74 /* Unresolved PLT symbol (.plt contains PLT address). */
77 /* Resolved PLT symbol. The corresponding .plt slot contained
78 * target address, which was changed to the address of
79 * corresponding PLT entry. The original is now saved in
84 #define ARCH_HAVE_LIBRARY_SYMBOL_DATA
85 struct arch_library_symbol_data {
86 enum ppc64_plt_type type;
87 GElf_Addr resolved_value;
89 /* Address of corresponding slot in .plt. */
90 GElf_Addr plt_slot_addr;
93 #define ARCH_HAVE_BREAKPOINT_DATA
94 struct arch_breakpoint_data {
95 /* We need this just for arch_breakpoint_init. */
98 #define ARCH_HAVE_PROCESS_DATA
99 struct arch_process_data {
100 /* Breakpoint that hits when the dynamic linker is about to
101 * update a .plt slot. NULL before that address is known. */
102 struct breakpoint *dl_plt_update_bp;
104 /* PLT update breakpoint looks here for the handler. */
105 struct process_stopping_handler *handler;
108 #endif /* LTRACE_PPC_ARCH_H */