OLD | NEW |
(Empty) | |
| 1 #ifndef _INTERNAL_RELOC_H |
| 2 #define _INTERNAL_RELOC_H |
| 3 |
| 4 #include <features.h> |
| 5 #include <elf.h> |
| 6 #include <stdint.h> |
| 7 |
| 8 #if UINTPTR_MAX == 0xffffffff |
| 9 typedef Elf32_Ehdr Ehdr; |
| 10 typedef Elf32_Phdr Phdr; |
| 11 typedef Elf32_Sym Sym; |
| 12 #define R_TYPE(x) ((x)&255) |
| 13 #define R_SYM(x) ((x)>>8) |
| 14 #else |
| 15 typedef Elf64_Ehdr Ehdr; |
| 16 typedef Elf64_Phdr Phdr; |
| 17 typedef Elf64_Sym Sym; |
| 18 #define R_TYPE(x) ((x)&0x7fffffff) |
| 19 #define R_SYM(x) ((x)>>32) |
| 20 #endif |
| 21 |
| 22 /* These enum constants provide unmatchable default values for |
| 23 * any relocation type the arch does not use. */ |
| 24 enum { |
| 25 REL_NONE = 0, |
| 26 REL_SYMBOLIC = -100, |
| 27 REL_GOT, |
| 28 REL_PLT, |
| 29 REL_RELATIVE, |
| 30 REL_OFFSET, |
| 31 REL_OFFSET32, |
| 32 REL_COPY, |
| 33 REL_SYM_OR_REL, |
| 34 REL_DTPMOD, |
| 35 REL_DTPOFF, |
| 36 REL_TPOFF, |
| 37 REL_TPOFF_NEG, |
| 38 REL_TLSDESC, |
| 39 REL_FUNCDESC, |
| 40 REL_FUNCDESC_VAL, |
| 41 }; |
| 42 |
| 43 struct fdpic_loadseg { |
| 44 uintptr_t addr, p_vaddr, p_memsz; |
| 45 }; |
| 46 |
| 47 struct fdpic_loadmap { |
| 48 unsigned short version, nsegs; |
| 49 struct fdpic_loadseg segs[]; |
| 50 }; |
| 51 |
| 52 struct fdpic_dummy_loadmap { |
| 53 unsigned short version, nsegs; |
| 54 struct fdpic_loadseg segs[1]; |
| 55 }; |
| 56 |
| 57 #include "reloc.h" |
| 58 |
| 59 #ifndef FDPIC_CONSTDISP_FLAG |
| 60 #define FDPIC_CONSTDISP_FLAG 0 |
| 61 #endif |
| 62 |
| 63 #ifndef DL_FDPIC |
| 64 #define DL_FDPIC 0 |
| 65 #endif |
| 66 |
| 67 #ifndef DL_NOMMU_SUPPORT |
| 68 #define DL_NOMMU_SUPPORT 0 |
| 69 #endif |
| 70 |
| 71 #if !DL_FDPIC |
| 72 #define IS_RELATIVE(x,s) ( \ |
| 73 (R_TYPE(x) == REL_RELATIVE) || \ |
| 74 (R_TYPE(x) == REL_SYM_OR_REL && !R_SYM(x)) ) |
| 75 #else |
| 76 #define IS_RELATIVE(x,s) ( ( \ |
| 77 (R_TYPE(x) == REL_FUNCDESC_VAL) || \ |
| 78 (R_TYPE(x) == REL_SYMBOLIC) ) \ |
| 79 && (((s)[R_SYM(x)].st_info & 0xf) == STT_SECTION) ) |
| 80 #endif |
| 81 |
| 82 #ifndef NEED_MIPS_GOT_RELOCS |
| 83 #define NEED_MIPS_GOT_RELOCS 0 |
| 84 #endif |
| 85 |
| 86 #define AUX_CNT 32 |
| 87 #define DYN_CNT 32 |
| 88 |
| 89 typedef void (*stage2_func)(unsigned char *, size_t *); |
| 90 typedef _Noreturn void (*stage3_func)(size_t *); |
| 91 |
| 92 #endif |
OLD | NEW |