1 #ifndef _INTERNAL_RELOC_H
2 #define _INTERNAL_RELOC_H
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 #define R_INFO ELF32_R_INFO
16 typedef Elf64_Ehdr Ehdr;
17 typedef Elf64_Phdr Phdr;
18 typedef Elf64_Sym Sym;
19 #define R_TYPE(x) ((x)&0x7fffffff)
20 #define R_SYM(x) ((x)>>32)
21 #define R_INFO ELF64_R_INFO
24 /* These enum constants provide unmatchable default values for
25 * any relocation type the arch does not use. */
45 struct fdpic_loadseg {
46 uintptr_t addr, p_vaddr, p_memsz;
49 struct fdpic_loadmap {
50 unsigned short version, nsegs;
51 struct fdpic_loadseg segs[];
54 struct fdpic_dummy_loadmap {
55 unsigned short version, nsegs;
56 struct fdpic_loadseg segs[1];
61 #ifndef FDPIC_CONSTDISP_FLAG
62 #define FDPIC_CONSTDISP_FLAG 0
69 #ifndef DL_NOMMU_SUPPORT
70 #define DL_NOMMU_SUPPORT 0
74 #define IS_RELATIVE(x,s) ( \
75 (R_TYPE(x) == REL_RELATIVE) || \
76 (R_TYPE(x) == REL_SYM_OR_REL && !R_SYM(x)) )
78 #define IS_RELATIVE(x,s) ( ( \
79 (R_TYPE(x) == REL_FUNCDESC_VAL) || \
80 (R_TYPE(x) == REL_SYMBOLIC) ) \
81 && (((s)[R_SYM(x)].st_info & 0xf) == STT_SECTION) )
84 #ifndef NEED_MIPS_GOT_RELOCS
85 #define NEED_MIPS_GOT_RELOCS 0
88 #ifndef DT_DEBUG_INDIRECT
89 #define DT_DEBUG_INDIRECT 0
95 typedef void (*stage2_func)(unsigned char *, size_t *);
96 typedef _Noreturn void (*stage3_func)(size_t *);