Lines Matching defs:elf

15 #include <arch/elf.h>
82 struct elf {
83 Elf *elf;
108 struct elf *elf_open_read(const char *name, int flags);
110 struct section *elf_create_section(struct elf *elf, const char *name,
112 struct section *elf_create_section_pair(struct elf *elf, const char *name,
116 struct symbol *elf_create_prefix_symbol(struct elf *elf, struct symbol *orig, long size);
118 struct reloc *elf_init_reloc_text_sym(struct elf *elf, struct section *sec,
124 struct reloc *elf_init_reloc_data_sym(struct elf *elf, struct section *sec,
130 int elf_write_insn(struct elf *elf, struct section *sec,
133 int elf_write(struct elf *elf);
134 void elf_close(struct elf *elf);
136 struct section *find_section_by_name(const struct elf *elf, const char *name);
139 struct symbol *find_symbol_by_name(const struct elf *elf, const char *name);
142 struct reloc *find_reloc_by_dest(const struct elf *elf, struct section *sec, unsigned long offset);
143 struct reloc *find_reloc_by_dest_range(const struct elf *elf, struct section *sec,
152 static inline bool has_multiple_files(struct elf *elf)
154 return elf->num_files > 1;
157 static inline size_t elf_addr_size(struct elf *elf)
159 return elf->ehdr.e_ident[EI_CLASS] == ELFCLASS32 ? 4 : 8;
162 static inline size_t elf_rela_size(struct elf *elf)
164 return elf_addr_size(elf) == 4 ? sizeof(Elf32_Rela) : sizeof(Elf64_Rela);
167 static inline unsigned int elf_data_rela_type(struct elf *elf)
169 return elf_addr_size(elf) == 4 ? R_DATA32 : R_DATA64;
172 static inline unsigned int elf_text_rela_type(struct elf *elf)
174 return elf_addr_size(elf) == 4 ? R_TEXT32 : R_TEXT64;
187 static inline void mark_sec_changed(struct elf *elf, struct section *sec,
191 elf->changed |= changed;
242 static inline void set_reloc_offset(struct elf *elf, struct reloc *reloc, u64 offset)
245 mark_sec_changed(elf, reloc->sec, true);
253 static inline void set_reloc_addend(struct elf *elf, struct reloc *reloc, s64 addend)
256 mark_sec_changed(elf, reloc->sec, true);
278 static inline void set_reloc_sym(struct elf *elf, struct reloc *reloc, unsigned int sym)
286 mark_sec_changed(elf, reloc->sec, true);
288 static inline void set_reloc_type(struct elf *elf, struct reloc *reloc, unsigned int type)
296 mark_sec_changed(elf, reloc->sec, true);
300 list_for_each_entry(sec, &file->elf->sections, list)