1 /* 2 * Copyright 2002-2016 Haiku, Inc. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef SYMBOLPATCHER_ELF_H 6 #define SYMBOLPATCHER_ELF_H 7 8 9 #include <elf.h> 10 11 /* Relocation types. */ 12 #define R_X86_64_NONE 0 /* No relocation. */ 13 #define R_X86_64_GLOB_DAT 6 /* Create GOT entry. */ 14 #define R_X86_64_JUMP_SLOT 7 /* Create PLT entry. */ 15 16 #define R_386_NONE 0 17 #define R_386_GLOB_DAT 6 /* set GOT entry to data address */ 18 #define R_386_JMP_SLOT 7 /* set GOT entry to code address */ 19 20 #ifdef B_HAIKU_64_BIT 21 typedef Elf64_Ehdr Elf_Ehdr; 22 typedef Elf64_Shdr Elf_Shdr; 23 typedef Elf64_Sym Elf_Sym; 24 typedef Elf64_Rel Elf_Rel; 25 typedef Elf64_Addr Elf_Addr; 26 typedef Elf64_Word Elf_Word; 27 #define ELFCLASS ELFCLASS64 28 #define ELF_ST_BIND ELF64_ST_BIND 29 #define ELF_ST_TYPE ELF64_ST_TYPE 30 #define ELF_R_SYM ELF64_R_SYM 31 #define ELF_R_TYPE ELF64_R_TYPE 32 #define R_NONE R_X86_64_NONE 33 #define R_GLOB_DAT R_X86_64_GLOB_DAT 34 #define R_JUMP_SLOT R_X86_64_JUMP_SLOT 35 #else 36 typedef Elf32_Ehdr Elf_Ehdr; 37 typedef Elf32_Shdr Elf_Shdr; 38 typedef Elf32_Sym Elf_Sym; 39 typedef Elf32_Rel Elf_Rel; 40 typedef Elf32_Addr Elf_Addr; 41 typedef Elf32_Word Elf_Word; 42 #define ELFCLASS ELFCLASS32 43 #define ELF_ST_BIND ELF32_ST_BIND 44 #define ELF_ST_TYPE ELF32_ST_TYPE 45 #define ELF_R_SYM ELF32_R_SYM 46 #define ELF_R_TYPE ELF32_R_TYPE 47 #define R_NONE R_386_NONE 48 #define R_GLOB_DAT R_386_GLOB_DAT 49 #define R_JUMP_SLOT R_386_JMP_SLOT 50 #endif 51 52 53 #endif /* SYMBOLPATCHER_ELF_H */ 54