blob: 0def0416865f6c970a85f5c90036ecac1f666b24 [file] [log] [blame]
Juan Cespedes1cd999a2001-07-03 00:46:04 +02001#ifndef LTRACE_ELF_H
2#define LTRACE_ELF_H
3
Juan Cespedesd914a202004-11-10 00:15:33 +01004#include <gelf.h>
5#include <stdlib.h>
6
Juan Cespedes5e01f651998-03-08 22:31:44 +01007#include "ltrace.h"
Juan Cespedes96935a91997-08-09 23:45:39 +02008
Ian Wienand2d45b1a2006-02-20 22:48:07 +01009struct ltelf {
10 int fd;
11 Elf *elf;
12 GElf_Ehdr ehdr;
13 Elf_Data *dynsym;
14 size_t dynsym_count;
15 const char *dynstr;
16 GElf_Addr plt_addr;
17 size_t plt_size;
18 Elf_Data *relplt;
19 size_t relplt_count;
20 Elf_Data *symtab;
21 const char *strtab;
22 size_t symtab_count;
23 Elf_Data *opd;
24 GElf_Addr *opd_addr;
25 size_t opd_size;
26 Elf32_Word *hash;
Petr Machata35fe5182006-07-18 12:58:12 +020027 int hash_type;
Paul Gilliam76c61f12006-06-14 06:55:21 +020028 int lte_flags;
Eric Vaitl1228a912006-12-28 16:16:56 +010029#ifdef __mips__
30 size_t pltgot_addr;
31 size_t mips_local_gotno;
32 size_t mips_gotsym;
33#endif // __mips__
Juan Cespedes1cd999a2001-07-03 00:46:04 +020034};
35
Paul Gilliam76c61f12006-06-14 06:55:21 +020036#define LTE_HASH_MALLOCED 1
37#define LTE_PLT_EXECUTABLE 2
38
39#define PLTS_ARE_EXECUTABLE(lte) ((lte->lte_flags & LTE_PLT_EXECUTABLE) != 0)
40
Juan Cespedes1cd999a2001-07-03 00:46:04 +020041extern int library_num;
42extern char *library[MAX_LIBRARY];
Juan Cespedes1cd999a2001-07-03 00:46:04 +020043
Ian Wienand2d45b1a2006-02-20 22:48:07 +010044extern struct library_symbol *read_elf(struct process *);
Juan Cespedesd914a202004-11-10 00:15:33 +010045
Ian Wienand2d45b1a2006-02-20 22:48:07 +010046extern GElf_Addr arch_plt_sym_val(struct ltelf *, size_t, GElf_Rela *);
Juan Cespedes96935a91997-08-09 23:45:39 +020047
Olaf Hering03c087b2006-09-25 02:31:27 +020048#ifndef SHT_GNU_HASH
49#define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */
50#endif
Juan Cespedes1cd999a2001-07-03 00:46:04 +020051#endif