Home
last modified time | relevance | path

Searched refs:elf (Results 1 – 25 of 150) sorted by relevance

123456

/linux/tools/objtool/
H A Delf.c33 #define __elf_table(name) (elf->name##_hash)
34 #define __elf_bits(name) (elf->name##_bits)
133 struct section *find_section_by_name(const struct elf *elf, const char *name) in find_section_by_name() argument
145 static struct section *find_section_by_index(struct elf *elf, in find_section_by_index() argument
158 static struct symbol *find_symbol_by_index(struct elf *elf, unsigned int idx) in find_symbol_by_index() argument
277 struct symbol *find_symbol_by_name(const struct elf *elf, const char *name) in find_symbol_by_name() argument
290 static struct symbol *find_local_symbol_by_file_and_name(const struct elf *elf, in find_local_symbol_by_file_and_name() argument
306 struct symbol *find_global_symbol_by_name(const struct elf *elf, const char *name) in find_global_symbol_by_name() argument
318 struct reloc *find_reloc_by_dest_range(const struct elf *elf, struct section *sec, in find_reloc_by_dest_range() argument
348 struct reloc *find_reloc_by_dest(const struct elf *elf, struct section *sec, unsigned long offset) in find_reloc_by_dest() argument
[all …]
H A Dklp-post-link.c22 static int fix_klp_relocs(struct elf *elf) in fix_klp_relocs() argument
26 klp_relocs = find_section_by_name(elf, KLP_RELOCS_SEC); in fix_klp_relocs()
30 symtab = find_section_by_name(elf, ".symtab"); in fix_klp_relocs()
55 reloc = find_reloc_by_dest(elf, klp_relocs, in fix_klp_relocs()
66 reloc = find_reloc_by_dest(elf, klp_relocs, in fix_klp_relocs()
90 klp_rsec = find_section_by_name(elf, rsec_name); in fix_klp_relocs()
92 klp_rsec = elf_create_section(elf, rsec_name, 0, in fix_klp_relocs()
93 elf_rela_size(elf), in fix_klp_relocs()
94 SHT_RELA, elf_addr_size(elf), in fix_klp_relocs()
106 if (!elf_create_reloc(elf, sec, offset, klp_sym, addend, klp_reloc->type)) in fix_klp_relocs()
[all …]
H A Dorc_dump.c20 Elf *elf; in orc_dump() local
26 struct elf dummy_elf = {}; in orc_dump()
36 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); in orc_dump()
37 if (!elf) { in orc_dump()
42 if (!elf64_getehdr(elf)) { in orc_dump()
46 memcpy(&dummy_elf.ehdr, elf64_getehdr(elf), sizeof(dummy_elf.ehdr)); in orc_dump()
48 if (elf_getshdrnum(elf, &nr_sections)) { in orc_dump()
53 if (elf_getshdrstrndx(elf, &shstrtab_idx)) { in orc_dump()
59 scn = elf_getscn(elf, i); in orc_dump()
70 name = elf_strptr(elf, shstrtab_idx, sh.sh_name); in orc_dump()
[all …]
H A Dklp-diff.c27 struct elf *orig, *patched, *out;
168 static int read_sym_checksums(struct elf *elf) in read_sym_checksums() argument
172 sec = find_section_by_name(elf, ".discard.sym_checksum"); in read_sym_checksums()
175 elf->name); in read_sym_checksums()
196 reloc = find_reloc_by_dest(elf, sec, i * sizeof(*sym_checksum)); in read_sym_checksums()
216 static struct symbol *first_file_symbol(struct elf *elf) in first_file_symbol() argument
220 for_each_sym(elf, sym) { in first_file_symbol()
228 static struct symbol *next_file_symbol(struct elf *elf, struct symbol *sym) in next_file_symbol() argument
230 for_each_sym_continue(elf, sym) { in next_file_symbol()
474 static unsigned long find_sympos(struct elf *elf, struct symbol *sym) in find_sympos() argument
[all …]
H A Dspecial.c67 static int get_alt_entry(struct elf *elf, const struct special_entry *entry, in get_alt_entry() argument
88 orig_reloc = find_reloc_by_dest(elf, sec, offset + entry->orig); in get_alt_entry()
99 new_reloc = find_reloc_by_dest(elf, sec, offset + entry->new); in get_alt_entry()
115 key_reloc = find_reloc_by_dest(elf, sec, offset + entry->key); in get_alt_entry()
131 int special_get_alts(struct elf *elf, struct list_head *alts) in special_get_alts() argument
142 sec = find_section_by_name(elf, entry->sec); in special_get_alts()
161 if (get_alt_entry(elf, entry, sec, idx, alt)) in special_get_alts()
H A Dorc_gen.c59 for_each_sec(file->elf, sec) { in orc_create()
123 sec = find_section_by_name(file->elf, ".orc_unwind"); in orc_create()
128 orc_sec = elf_create_section(file->elf, ".orc_unwind", in orc_create()
137 sec = elf_create_section_pair(file->elf, ".orc_unwind_ip", sizeof(int), nr, nr); in orc_create()
143 if (write_orc_entry(file->elf, orc_sec, sec, idx++, in orc_create()
H A Dcheck.c113 for_each_sec(file->elf, __sec) \
418 for_each_sec(file->elf, sec) { in decode_instructions()
563 sym = find_symbol_by_name(file->elf, symname); in add_pv_ops()
578 reloc = find_reloc_by_dest_range(file->elf, sym->sec, off, end - off); in add_pv_ops()
620 sym = find_symbol_by_name(file->elf, pv_ops_tables[idx].name); in init_pv_ops()
658 sec = find_section_by_name(file->elf, ".modinfo"); in is_livepatch_module()
674 sec = find_section_by_name(file->elf, ".static_call_sites"); in create_static_call_sections()
694 sec = elf_create_section_pair(file->elf, ".static_call_sites", in create_static_call_sections()
706 if (!elf_init_reloc_text_sym(file->elf, sec, in create_static_call_sections()
725 key_sym = find_symbol_by_name(file->elf, tmp); in create_static_call_sections()
[all …]
/linux/tools/objtool/include/objtool/
H A Delf.h24 #define bswap_if_needed(elf, val) __bswap_if_needed(&elf->ehdr, val) argument
106 struct elf { struct
107 Elf *elf; argument
133 struct elf *elf_open_read(const char *name, int flags); argument
134 struct elf *elf_create_file(GElf_Ehdr *ehdr, const char *name);
136 struct section *elf_create_section(struct elf *elf, const char *name,
140 struct section *elf_create_section_pair(struct elf *elf, const char *name,
144 struct section *elf_create_rela_section(struct elf *elf, struct section *sec,
147 struct symbol *elf_create_symbol(struct elf *elf, const char *name,
151 struct symbol *elf_create_section_symbol(struct elf *elf, struct section *sec);
[all …]
H A Dorc.h8 void orc_print_dump(struct elf *dummy_elf, struct orc_entry *orc, int i);
9 int write_orc_entry(struct elf *elf, struct section *orc_sec,
/linux/scripts/mod/
H A Dsymsearch.c50 static unsigned int symbol_count(struct elf_info *elf) in symbol_count() argument
54 for (Elf_Sym *sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { in symbol_count()
55 if (is_valid_name(elf, sym)) in symbol_count()
68 static void symsearch_populate(struct elf_info *elf, in symsearch_populate() argument
72 bool is_arm = (elf->hdr->e_machine == EM_ARM); in symsearch_populate()
74 for (Elf_Sym *sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { in symsearch_populate()
75 if (is_valid_name(elf, sym)) { in symsearch_populate()
78 table->symbol_index = sym - elf->symtab_start; in symsearch_populate()
79 table->section_index = get_secindex(elf, sym); in symsearch_populate()
124 void symsearch_init(struct elf_info *elf) in symsearch_init() argument
[all …]
H A Dmodpost.c711 static const char *sym_name(struct elf_info *elf, Elf_Sym *sym) in sym_name() argument
713 return sym ? elf->strtab + sym->st_name : ""; in sym_name()
771 static void check_section(const char *modname, struct elf_info *elf, in check_section() argument
774 const char *sec = sech_name(elf, sechdr); in check_section()
986 static Elf_Sym *find_fromsym(struct elf_info *elf, Elf_Addr addr, in find_fromsym() argument
989 return symsearch_find_nearest(elf, addr, secndx, false, ~0); in find_fromsym()
992 static Elf_Sym *find_tosym(struct elf_info *elf, Elf_Addr addr, Elf_Sym *sym) in find_tosym() argument
997 if (is_valid_name(elf, sym)) in find_tosym()
1004 new_sym = symsearch_find_nearest(elf, addr, get_secindex(elf, sym), in find_tosym()
1009 static bool is_executable_section(struct elf_info *elf, unsigned int secndx) in is_executable_section() argument
[all …]
/linux/arch/arm64/kvm/hyp/nvhe/
H A Dgen-hyprel.c140 } elf; variable
167 elf.path, ## __VA_ARGS__); \
175 elf.path, strerror(errno)); \
201 #define elf_ptr(type, off) ((type *)(elf.begin + (off)))
205 for (var = elf.sh_table; var < elf.sh_table + elf16toh(elf.ehdr->e_shnum); ++var)
221 return elf.sh_string + elf32toh(shdr->sh_name); in section_name()
241 return &elf.sh_table[idx]; in section_by_idx()
254 elf.path = path; in init_elf()
269 elf.begin = mmap(0, stat.st_size, PROT_READ, MAP_PRIVATE, fd, 0); in init_elf()
270 if (elf.begin == MAP_FAILED) { in init_elf()
[all …]
/linux/tools/perf/util/
H A Dsymbol-elf.c54 static int elf_getphdrnum(Elf *elf, size_t *dst) in elf_getphdrnum() argument
59 ehdr = gelf_getehdr(elf, &gehdr); in elf_getphdrnum()
70 static int elf_getshdrstrndx(Elf *elf __maybe_unused, size_t *dst __maybe_unused) in elf_getshdrstrndx()
167 static size_t elf_addr_to_index(Elf *elf, GElf_Addr addr) in elf_addr_to_index() argument
173 while ((sec = elf_nextscn(elf, sec)) != NULL) { in elf_addr_to_index()
186 Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep, in elf_section_by_name() argument
193 if (!elf_rawdata(elf_getscn(elf, ep->e_shstrndx), NULL)) in elf_section_by_name()
196 while ((sec = elf_nextscn(elf, sec)) != NULL) { in elf_section_by_name()
200 str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name); in elf_section_by_name()
215 Elf *elf; in filename__has_section() local
[all …]
H A Dunwind-libunwind-local.c174 Elf *elf; in elf_section_address_and_offset() local
179 elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); in elf_section_address_and_offset()
180 if (elf == NULL) in elf_section_address_and_offset()
183 if (gelf_getehdr(elf, &ehdr) == NULL) in elf_section_address_and_offset()
186 if (!elf_section_by_name(elf, &ehdr, &shdr, name, NULL)) in elf_section_address_and_offset()
193 elf_end(elf); in elf_section_address_and_offset()
211 Elf *elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); in elf_base_address() local
216 if (elf == NULL) in elf_base_address()
218 (void)elf_getphdrnum(elf, &phdrnum); in elf_base_address()
221 if (gelf_getphdr(elf, i, &phdr) && phdr.p_type == PT_LOAD) { in elf_base_address()
[all …]
/linux/tools/lib/bpf/
H A Delf.c27 Elf *elf; in elf_open() local
29 elf_fd->elf = NULL; in elf_open()
42 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); in elf_open()
43 if (!elf) { in elf_open()
49 elf_fd->elf = elf; in elf_open()
57 elf_end(elf_fd->elf); in elf_close()
62 static Elf_Scn *elf_find_next_scn_by_type(Elf *elf, int sh_type, Elf_Scn *scn) in elf_find_next_scn_by_type() argument
64 while ((scn = elf_nextscn(elf, scn)) != NULL) { in elf_find_next_scn_by_type()
84 Elf *elf; member
97 Elf *elf, const char *binary_path, in elf_sym_iter_new() argument
[all …]
/linux/arch/powerpc/platforms/powernv/
H A Dopal-core.c308 Elf64_Ehdr *elf; in create_opalcore() local
357 elf = (Elf64_Ehdr *)bufp; in create_opalcore()
359 memcpy(elf->e_ident, ELFMAG, SELFMAG); in create_opalcore()
360 elf->e_ident[EI_CLASS] = ELF_CLASS; in create_opalcore()
361 elf->e_ident[EI_DATA] = ELFDATA2MSB; in create_opalcore()
362 elf->e_ident[EI_VERSION] = EV_CURRENT; in create_opalcore()
363 elf->e_ident[EI_OSABI] = ELF_OSABI; in create_opalcore()
364 memset(elf->e_ident+EI_PAD, 0, EI_NIDENT-EI_PAD); in create_opalcore()
365 elf->e_type = cpu_to_be16(ET_CORE); in create_opalcore()
366 elf->e_machine = cpu_to_be16(ELF_ARCH); in create_opalcore()
[all …]
/linux/arch/alpha/boot/tools/
H A Dobjstrip.c61 struct elfhdr *elf; in main() local
149 elf = (struct elfhdr *) buf; in main()
151 if (memcmp(&elf->e_ident[EI_MAG0], ELFMAG, SELFMAG) == 0) { in main()
152 if (elf->e_type != ET_EXEC) { in main()
157 if (!elf_check_arch(elf)) { in main()
159 prog_name, elf->e_machine); in main()
162 if (elf->e_phnum != 1) { in main()
165 prog_name, elf->e_phnum); in main()
168 e_entry = elf->e_entry; in main()
170 lseek(fd, elf->e_phoff, SEEK_SET); in main()
/linux/scripts/gendwarfksyms/
H A Dkabi.c124 Elf *elf; in kabi_read_rules() local
162 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); in kabi_read_rules()
163 if (!elf) in kabi_read_rules()
166 if (elf_getshdrstrndx(elf, &shstrndx) < 0) in kabi_read_rules()
169 scn = elf_nextscn(elf, NULL); in kabi_read_rules()
178 sname = elf_strptr(elf, shstrndx, shdr->sh_name); in kabi_read_rules()
189 scn = elf_nextscn(elf, scn); in kabi_read_rules()
194 check(elf_end(elf)); in kabi_read_rules()
246 check(elf_end(elf)); in kabi_read_rules()
H A Dsymbols.c203 Elf *elf; in elf_for_each_global() local
208 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); in elf_for_each_global()
209 if (!elf) in elf_for_each_global()
212 scn = elf_nextscn(elf, NULL); in elf_for_each_global()
226 scn = elf_nextscn(elf, scn); in elf_for_each_global()
229 sym_size = gelf_fsize(elf, ELF_T_SYM, 1, EV_CURRENT); in elf_for_each_global()
230 scn = elf_nextscn(elf, NULL); in elf_for_each_global()
269 name = elf_strptr(elf, shdr->sh_link, in elf_for_each_global()
281 scn = elf_nextscn(elf, scn); in elf_for_each_global()
284 check(elf_end(elf)); in elf_for_each_global()
/linux/fs/
H A Dbinfmt_elf_fdpic.c1246 static inline void fill_elf_fdpic_header(struct elfhdr *elf, int segs) in fill_elf_fdpic_header() argument
1248 memcpy(elf->e_ident, ELFMAG, SELFMAG); in fill_elf_fdpic_header()
1249 elf->e_ident[EI_CLASS] = ELF_CLASS; in fill_elf_fdpic_header()
1250 elf->e_ident[EI_DATA] = ELF_DATA; in fill_elf_fdpic_header()
1251 elf->e_ident[EI_VERSION] = EV_CURRENT; in fill_elf_fdpic_header()
1252 elf->e_ident[EI_OSABI] = ELF_OSABI; in fill_elf_fdpic_header()
1253 memset(elf->e_ident+EI_PAD, 0, EI_NIDENT-EI_PAD); in fill_elf_fdpic_header()
1255 elf->e_type = ET_CORE; in fill_elf_fdpic_header()
1256 elf->e_machine = ELF_ARCH; in fill_elf_fdpic_header()
1257 elf->e_version = EV_CURRENT; in fill_elf_fdpic_header()
[all …]
/linux/arch/powerpc/kernel/
H A Dfadump.c926 struct elfhdr *elf; in fadump_init_elfcore_header() local
928 elf = (struct elfhdr *) bufp; in fadump_init_elfcore_header()
930 memcpy(elf->e_ident, ELFMAG, SELFMAG); in fadump_init_elfcore_header()
931 elf->e_ident[EI_CLASS] = ELF_CLASS; in fadump_init_elfcore_header()
932 elf->e_ident[EI_DATA] = ELF_DATA; in fadump_init_elfcore_header()
933 elf->e_ident[EI_VERSION] = EV_CURRENT; in fadump_init_elfcore_header()
934 elf->e_ident[EI_OSABI] = ELF_OSABI; in fadump_init_elfcore_header()
935 memset(elf->e_ident+EI_PAD, 0, EI_NIDENT-EI_PAD); in fadump_init_elfcore_header()
936 elf->e_type = ET_CORE; in fadump_init_elfcore_header()
937 elf->e_machine = ELF_ARCH; in fadump_init_elfcore_header()
[all …]
/linux/arch/mips/tools/
H A DMakefile2 hostprogs := elf-entry
3 PHONY += elf-entry
4 elf-entry: $(obj)/elf-entry
/linux/tools/objtool/arch/x86/
H A Dorc.c99 int write_orc_entry(struct elf *elf, struct section *orc_sec, in write_orc_entry() argument
109 orc->sp_offset = bswap_if_needed(elf, orc->sp_offset); in write_orc_entry()
110 orc->bp_offset = bswap_if_needed(elf, orc->bp_offset); in write_orc_entry()
113 if (!elf_init_reloc_text_sym(elf, ip_sec, idx * sizeof(int), idx, in write_orc_entry()
176 void orc_print_dump(struct elf *dummy_elf, struct orc_entry *orc, int i) in orc_print_dump()
/linux/arch/x86/realmode/rm/
H A DMakefile44 LDFLAGS_realmode.elf := -m elf_i386 --emit-relocs -T
47 targets += realmode.elf
48 $(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE
54 $(obj)/realmode.bin: $(obj)/realmode.elf $(obj)/realmode.relocs FORCE
61 $(obj)/realmode.relocs: $(obj)/realmode.elf FORCE
/linux/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/
H A Dgh100.c196 elf_validate_sections(const void *elf, size_t length) in elf_validate_sections() argument
198 const struct elf32_hdr *ehdr = elf; in elf_validate_sections()
199 const struct elf32_shdr *shdr = elf + ehdr->e_shoff; in elf_validate_sections()
229 u32 crc32 = crc32_le(~0, elf + shdr[i].sh_offset, shdr[i].sh_size) ^ ~0; in elf_validate_sections()
246 elf_section(const void *elf, const char *name, unsigned int *len) in elf_section() argument
248 const struct elf32_hdr *ehdr = elf; in elf_section()
249 const struct elf32_shdr *shdr = elf + ehdr->e_shoff; in elf_section()
250 const char *names = elf + shdr[ehdr->e_shstrndx].sh_offset; in elf_section()
255 return elf + shdr[i].sh_offset; in elf_section()

123456