| /linux-6.15/tools/objtool/ |
| H A D | elf.c | 342 s = elf_getscn(elf->elf, i); in read_sections() 388 if (elf_nextscn(elf->elf, s)) { in read_sections() 993 struct elf *elf; in elf_open_read() local 998 elf = malloc(sizeof(*elf)); in elf_open_read() 1003 memset(elf, 0, sizeof(*elf)); in elf_open_read() 1021 elf->elf = elf_begin(elf->fd, cmd, NULL); in elf_open_read() 1022 if (!elf->elf) { in elf_open_read() 1027 if (!gelf_getehdr(elf->elf, &elf->ehdr)) { in elf_open_read() 1101 s = elf_newscn(elf->elf); in elf_create_section() 1335 if (elf->elf) in elf_close() [all …]
|
| H A D | orc_dump.c | 21 Elf *elf; in orc_dump() local 27 struct elf dummy_elf = {}; in orc_dump() 37 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); in orc_dump() 38 if (!elf) { in orc_dump() 43 if (!elf64_getehdr(elf)) { in orc_dump() 49 if (elf_getshdrnum(elf, &nr_sections)) { in orc_dump() 54 if (elf_getshdrstrndx(elf, &shstrtab_idx)) { in orc_dump() 60 scn = elf_getscn(elf, i); in orc_dump() 71 name = elf_strptr(elf, shstrtab_idx, sh.sh_name); in orc_dump() 120 scn = elf_getscn(elf, sym.st_shndx); in orc_dump() [all …]
|
| H A D | special.c | 68 static int get_alt_entry(struct elf *elf, const struct special_entry *entry, in get_alt_entry() argument 87 orig_reloc = find_reloc_by_dest(elf, sec, offset + entry->orig); in get_alt_entry() 98 new_reloc = find_reloc_by_dest(elf, sec, offset + entry->new); in get_alt_entry() 114 key_reloc = find_reloc_by_dest(elf, sec, offset + entry->key); in get_alt_entry() 130 int special_get_alts(struct elf *elf, struct list_head *alts) in special_get_alts() argument 141 sec = find_section_by_name(elf, entry->sec); in special_get_alts() 160 ret = get_alt_entry(elf, entry, sec, idx, alt); in special_get_alts()
|
| /linux-6.15/tools/objtool/include/objtool/ |
| H A D | elf.h | 84 struct elf { struct 85 Elf *elf; argument 112 struct section *elf_create_section(struct elf *elf, const char *name, 132 int elf_write_insn(struct elf *elf, struct section *sec, 135 int elf_write(struct elf *elf); 136 void elf_close(struct elf *elf); 154 static inline bool has_multiple_files(struct elf *elf) in has_multiple_files() argument 159 static inline size_t elf_addr_size(struct elf *elf) in elf_addr_size() argument 164 static inline size_t elf_rela_size(struct elf *elf) in elf_rela_size() argument 169 static inline unsigned int elf_data_rela_type(struct elf *elf) in elf_data_rela_type() argument [all …]
|
| H A D | endianness.h | 15 static inline bool need_bswap(struct elf *elf) in need_bswap() argument 18 (elf->ehdr.e_ident[EI_DATA] == ELFDATA2LSB); in need_bswap() 21 #define bswap_if_needed(elf, val) \ argument 24 bool __need_bswap = need_bswap(elf); \
|
| H A D | orc.h | 8 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-6.15/scripts/mod/ |
| H A D | symsearch.c | 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() 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() 124 void symsearch_init(struct elf_info *elf) in symsearch_init() argument 130 elf->symsearch->table_size = table_size; in symsearch_init() 132 symsearch_populate(elf, elf->symsearch->table, table_size); in symsearch_init() 133 qsort(elf->symsearch->table, table_size, in symsearch_init() 141 free(elf->symsearch); in symsearch_finish() 142 elf->symsearch = NULL; in symsearch_finish() [all …]
|
| H A D | modpost.c | 986 if (is_valid_name(elf, sym)) in find_tosym() 993 new_sym = symsearch_find_nearest(elf, addr, get_secindex(elf, sym), in find_tosym() 1000 if (secndx >= elf->num_sections) in is_executable_section() 1018 fromsym = sym_name(elf, from); in default_mismatch_handler() 1021 tosym = sym_name(elf, tsym); in default_mismatch_handler() 1049 else if (is_executable_section(elf, get_secindex(elf, tsym))) in default_mismatch_handler() 1074 label = find_fromsym(elf, faddr, elf->export_symbol_secndx); in check_export_symbol() 1090 name = sym_name(elf, sym); in check_export_symbol() 1139 const char *tosec = sec_name(elf, get_secindex(elf, sym)); in check_section_mismatch() 1346 switch (elf->hdr->e_machine) { in section_rela() [all …]
|
| /linux-6.15/arch/arm64/kvm/hyp/nvhe/ |
| H A D | gen-hyprel.c | 140 } elf; variable 167 elf.path, ## __VA_ARGS__); \ 175 elf.path, strerror(errno)); \ 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() 270 if (elf.begin == MAP_FAILED) { in init_elf() 280 elf.ehdr = elf_ptr(Elf64_Ehdr, 0); in init_elf() 295 elf.sh_table = section_by_off(elf64toh(elf.ehdr->e_shoff)); in init_elf() [all …]
|
| /linux-6.15/tools/perf/util/ |
| H A D | symbol-elf.c | 230 Elf *elf; in filename__has_section() local 687 Elf *elf; in dso__synthesize_plt_symbols() local 692 elf = ss->elf; in dso__synthesize_plt_symbols() 974 Elf *elf; in read_build_id() local 1127 Elf *elf; in filename__read_debuglink() local 1284 Elf *elf; in symsrc__init() local 1383 ss->elf = elf; in symsrc__init() 1620 Elf *elf; in dso__load_sym_internal() local 1628 elf = syms_ss->elf; in dso__load_sym_internal() 1974 Elf *elf; in file__read_maps() local [all …]
|
| H A D | unwind-libunwind-local.c | 174 Elf *elf; in elf_section_address_and_offset() local 180 if (elf == NULL) in elf_section_address_and_offset() 183 if (gelf_getehdr(elf, &ehdr) == NULL) in elf_section_address_and_offset() 193 elf_end(elf); in elf_section_address_and_offset() 216 if (elf == NULL) in elf_base_address() 218 (void)elf_getphdrnum(elf, &phdrnum); in elf_base_address() 227 elf_end(elf); in elf_base_address() 234 Elf *elf; in elf_is_exec() local 239 if (elf == NULL) in elf_is_exec() 241 if (gelf_getehdr(elf, &ehdr) == NULL) in elf_is_exec() [all …]
|
| /linux-6.15/tools/lib/bpf/ |
| H A D | elf.c | 28 Elf *elf; in elf_open() local 30 elf_fd->elf = NULL; in elf_open() 43 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); in elf_open() 44 if (!elf) { in elf_open() 50 elf_fd->elf = elf; in elf_open() 58 elf_end(elf_fd->elf); in elf_close() 85 Elf *elf; member 98 Elf *elf, const char *binary_path, in elf_sym_iter_new() argument 107 if (!gelf_getehdr(elf, &ehdr)) { in elf_sym_iter_new() 130 iter->elf = elf; in elf_sym_iter_new() [all …]
|
| H A D | usdt.c | 311 if (elf_kind(elf) != ELF_K_ELF) { in sanity_check_usdt_elf() 316 switch (gelf_getclass(elf)) { in sanity_check_usdt_elf() 334 if (!gelf_getehdr(elf, &ehdr)) in sanity_check_usdt_elf() 363 if (elf_getshdrstrndx(elf, &shstrndx)) in find_elf_sec_by_name() 367 if (!elf_rawdata(elf_getscn(elf, shstrndx), NULL)) in find_elf_sec_by_name() 370 while ((sec = elf_nextscn(elf, sec)) != NULL) { in find_elf_sec_by_name() 376 name = elf_strptr(elf, shstrndx, shdr->sh_name); in find_elf_sec_by_name() 411 if (elf_getphdrnum(elf, &n)) { in parse_elf_segs() 417 if (!gelf_getphdr(elf, i, &phdr)) { in parse_elf_segs() 608 err = parse_elf_segs(elf, path, &segs, &seg_cnt); in collect_usdt_targets() [all …]
|
| /linux-6.15/arch/powerpc/platforms/powernv/ |
| H A D | opal-core.c | 308 Elf64_Ehdr *elf; in create_opalcore() local 357 elf = (Elf64_Ehdr *)bufp; in create_opalcore() 360 elf->e_ident[EI_CLASS] = ELF_CLASS; in create_opalcore() 368 elf->e_entry = 0; in create_opalcore() 370 elf->e_shoff = 0; in create_opalcore() 371 elf->e_flags = 0; in create_opalcore() 375 elf->e_phnum = 0; in create_opalcore() 376 elf->e_shentsize = 0; in create_opalcore() 377 elf->e_shnum = 0; in create_opalcore() 378 elf->e_shstrndx = 0; in create_opalcore() [all …]
|
| /linux-6.15/arch/alpha/boot/tools/ |
| H A D | objstrip.c | 61 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-6.15/arch/mips/tools/ |
| H A D | Makefile | 2 hostprogs := elf-entry 3 PHONY += elf-entry 4 elf-entry: $(obj)/elf-entry
|
| /linux-6.15/scripts/gendwarfksyms/ |
| H A D | kabi.c | 108 Elf *elf; in kabi_read_rules() local 138 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); in kabi_read_rules() 139 if (!elf) in kabi_read_rules() 142 if (elf_getshdrstrndx(elf, &shstrndx) < 0) in kabi_read_rules() 145 scn = elf_nextscn(elf, NULL); in kabi_read_rules() 154 sname = elf_strptr(elf, shstrndx, shdr->sh_name); in kabi_read_rules() 165 scn = elf_nextscn(elf, scn); in kabi_read_rules() 170 check(elf_end(elf)); in kabi_read_rules() 222 check(elf_end(elf)); in kabi_read_rules()
|
| H A D | symbols.c | 200 Elf *elf; in elf_for_each_global() local 205 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); in elf_for_each_global() 206 if (!elf) in elf_for_each_global() 209 scn = elf_nextscn(elf, NULL); in elf_for_each_global() 223 scn = elf_nextscn(elf, scn); in elf_for_each_global() 226 sym_size = gelf_fsize(elf, ELF_T_SYM, 1, EV_CURRENT); in elf_for_each_global() 227 scn = elf_nextscn(elf, NULL); in elf_for_each_global() 266 name = elf_strptr(elf, shdr->sh_link, in elf_for_each_global() 278 scn = elf_nextscn(elf, scn); in elf_for_each_global() 281 check(elf_end(elf)); in elf_for_each_global()
|
| /linux-6.15/tools/bpf/resolve_btfids/ |
| H A D | main.c | 121 Elf *elf; member 335 Elf *elf; in elf_collect() local 347 elf = elf_begin(fd, ELF_C_RDWR_MMAP, NULL); in elf_collect() 348 if (!elf) { in elf_collect() 356 obj->efile.elf = elf; in elf_collect() 358 elf_flagelf(elf, ELF_C_SET, ELF_F_LAYOUT); in elf_collect() 360 if (elf_getshdrstrndx(elf, &shdrstrndx) != 0) { in elf_collect() 376 while ((scn = elf_nextscn(elf, scn)) != NULL) { in elf_collect() 423 if (compressed_section_fix(elf, scn, &sh)) in elf_collect() 836 if (obj.efile.elf) { in main() [all …]
|
| /linux-6.15/fs/ |
| H A D | binfmt_elf_fdpic.c | 1252 elf->e_entry = 0; in fill_elf_fdpic_header() 1254 elf->e_shoff = 0; in fill_elf_fdpic_header() 1258 elf->e_phnum = segs; in fill_elf_fdpic_header() 1259 elf->e_shentsize = 0; in fill_elf_fdpic_header() 1260 elf->e_shnum = 0; in fill_elf_fdpic_header() 1261 elf->e_shstrndx = 0; in fill_elf_fdpic_header() 1432 elf->e_shnum = 1; in fill_extnum_info() 1488 elf = kmalloc(sizeof(*elf), GFP_KERNEL); in elf_fdpic_core_dump() 1489 if (!elf) in elf_fdpic_core_dump() 1572 if (!dump_emit(cprm, elf, sizeof(*elf))) in elf_fdpic_core_dump() [all …]
|
| /linux-6.15/tools/objtool/arch/x86/ |
| H A D | orc.c | 100 int write_orc_entry(struct elf *elf, struct section *orc_sec, in write_orc_entry() argument 110 orc->sp_offset = bswap_if_needed(elf, orc->sp_offset); in write_orc_entry() 111 orc->bp_offset = bswap_if_needed(elf, orc->bp_offset); in write_orc_entry() 114 if (!elf_init_reloc_text_sym(elf, ip_sec, idx * sizeof(int), idx, in write_orc_entry() 177 void orc_print_dump(struct elf *dummy_elf, struct orc_entry *orc, int i) in orc_print_dump()
|
| /linux-6.15/arch/powerpc/kernel/ |
| H A D | fadump.c | 941 elf->e_entry = 0; in fadump_init_elfcore_header() 943 elf->e_shoff = 0; in fadump_init_elfcore_header() 946 elf->e_flags = 2; in fadump_init_elfcore_header() 948 elf->e_flags = 1; in fadump_init_elfcore_header() 950 elf->e_flags = 0; in fadump_init_elfcore_header() 954 elf->e_phnum = 0; in fadump_init_elfcore_header() 956 elf->e_shnum = 0; in fadump_init_elfcore_header() 1036 (elf->e_phnum)++; in fadump_populate_elfcorehdr() 1048 (elf->e_phnum)++; in fadump_populate_elfcorehdr() 1062 (elf->e_phnum)++; in fadump_populate_elfcorehdr() [all …]
|
| /linux-6.15/arch/x86/realmode/rm/ |
| H A D | Makefile | 44 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-6.15/tools/testing/selftests/sgx/ |
| H A D | Makefile | 23 TEST_FILES := $(OUTPUT)/test_encl.elf 25 all: $(TEST_CUSTOM_PROGS) $(OUTPUT)/test_encl.elf 50 $(OUTPUT)/test_encl.elf: test_encl.c test_encl_bootstrap.S 54 $(OUTPUT)/test_encl.elf \
|
| /linux-6.15/drivers/firmware/efi/libstub/ |
| H A D | Makefile.zboot | 49 LDFLAGS_vmlinuz.efi.elf := -T $(srctree)/drivers/firmware/efi/libstub/zboot.lds 50 $(obj)/vmlinuz.efi.elf: $(obj)/vmlinuz.o $(ZBOOT_DEPS) FORCE 54 $(obj)/vmlinuz.efi: $(obj)/vmlinuz.efi.elf FORCE 57 targets += zboot-header.o vmlinux.bin vmlinuz vmlinuz.o vmlinuz.efi.elf vmlinuz.efi
|