Home
last modified time | relevance | path

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

1234

/linux-6.6.21/tools/objtool/
Delf.c32 #define __elf_table(name) (elf->name##_hash)
33 #define __elf_bits(name) (elf->name##_bits)
132 struct section *find_section_by_name(const struct elf *elf, const char *name) in find_section_by_name() argument
144 static struct section *find_section_by_index(struct elf *elf, in find_section_by_index() argument
157 static struct symbol *find_symbol_by_index(struct elf *elf, unsigned int idx) in find_symbol_by_index() argument
256 struct symbol *find_symbol_by_name(const struct elf *elf, const char *name) in find_symbol_by_name() argument
268 struct reloc *find_reloc_by_dest_range(const struct elf *elf, struct section *sec, in find_reloc_by_dest_range() argument
298 struct reloc *find_reloc_by_dest(const struct elf *elf, struct section *sec, unsigned long offset) in find_reloc_by_dest() argument
300 return find_reloc_by_dest_range(elf, sec, offset, 1); in find_reloc_by_dest()
308 static int read_sections(struct elf *elf) in read_sections() argument
[all …]
Dorc_dump.c76 Elf *elf; in orc_dump() local
82 struct elf dummy_elf = {}; in orc_dump()
95 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); in orc_dump()
96 if (!elf) { in orc_dump()
101 if (!elf64_getehdr(elf)) { in orc_dump()
105 memcpy(&dummy_elf.ehdr, elf64_getehdr(elf), sizeof(dummy_elf.ehdr)); in orc_dump()
107 if (elf_getshdrnum(elf, &nr_sections)) { in orc_dump()
112 if (elf_getshdrstrndx(elf, &shstrtab_idx)) { in orc_dump()
118 scn = elf_getscn(elf, i); in orc_dump()
129 name = elf_strptr(elf, shstrtab_idx, sh.sh_name); in orc_dump()
[all …]
Dspecial.c68 static int get_alt_entry(struct elf *elf, const struct special_entry *entry, in get_alt_entry() argument
90 feature = bswap_if_needed(elf, in get_alt_entry()
97 orig_reloc = find_reloc_by_dest(elf, sec, offset + entry->orig); in get_alt_entry()
106 new_reloc = find_reloc_by_dest(elf, sec, offset + entry->new); in get_alt_entry()
123 key_reloc = find_reloc_by_dest(elf, sec, offset + entry->key); in get_alt_entry()
140 int special_get_alts(struct elf *elf, struct list_head *alts) in special_get_alts() argument
151 sec = find_section_by_name(elf, entry->sec); in special_get_alts()
171 ret = get_alt_entry(elf, entry, sec, idx, alt); in special_get_alts()
Dorc_gen.c107 static int write_orc_entry(struct elf *elf, struct section *orc_sec, in write_orc_entry() argument
117 orc->sp_offset = bswap_if_needed(elf, orc->sp_offset); in write_orc_entry()
118 orc->bp_offset = bswap_if_needed(elf, orc->bp_offset); in write_orc_entry()
121 if (!elf_init_reloc_text_sym(elf, ip_sec, idx * sizeof(int), idx, in write_orc_entry()
235 sec = find_section_by_name(file->elf, ".orc_unwind"); in orc_create()
240 orc_sec = elf_create_section(file->elf, ".orc_unwind", in orc_create()
245 sec = elf_create_section_pair(file->elf, ".orc_unwind_ip", sizeof(int), nr, nr); in orc_create()
251 if (write_orc_entry(file->elf, orc_sec, sec, idx++, in orc_create()
Dcheck.c499 sym = find_symbol_by_name(file->elf, symname); in add_pv_ops()
506 reloc = find_reloc_by_dest_range(file->elf, sym->sec, off, end - off); in add_pv_ops()
548 sym = find_symbol_by_name(file->elf, "pv_ops"); in init_pv_ops()
592 rsec = find_section_by_name(file->elf, ".rela.discard.unreachable"); in add_dead_ends()
631 rsec = find_section_by_name(file->elf, ".rela.discard.reachable"); in add_dead_ends()
675 sec = find_section_by_name(file->elf, ".static_call_sites"); in create_static_call_sections()
689 sec = elf_create_section_pair(file->elf, ".static_call_sites", in create_static_call_sections()
701 if (!elf_init_reloc_text_sym(file->elf, sec, in create_static_call_sections()
721 key_sym = find_symbol_by_name(file->elf, tmp); in create_static_call_sections()
743 if (!elf_init_reloc_data_sym(file->elf, sec, in create_static_call_sections()
[all …]
/linux-6.6.21/tools/objtool/include/objtool/
Delf.h81 struct elf { struct
82 Elf *elf; member
107 struct elf *elf_open_read(const char *name, int flags); argument
109 struct section *elf_create_section(struct elf *elf, const char *name,
111 struct section *elf_create_section_pair(struct elf *elf, const char *name,
115 struct symbol *elf_create_prefix_symbol(struct elf *elf, struct symbol *orig, long size);
117 struct reloc *elf_init_reloc_text_sym(struct elf *elf, struct section *sec,
123 struct reloc *elf_init_reloc_data_sym(struct elf *elf, struct section *sec,
129 int elf_write_insn(struct elf *elf, struct section *sec,
132 int elf_write(struct elf *elf);
[all …]
Dendianness.h15 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); \
/linux-6.6.21/arch/arm64/kvm/hyp/nvhe/
Dgen-hyprel.c137 } elf; variable
164 elf.path, ## __VA_ARGS__); \
172 elf.path, strerror(errno)); \
198 #define elf_ptr(type, off) ((type *)(elf.begin + (off)))
202 for (var = elf.sh_table; var < elf.sh_table + elf16toh(elf.ehdr->e_shnum); ++var)
218 return elf.sh_string + elf32toh(shdr->sh_name); in section_name()
238 return &elf.sh_table[idx]; in section_by_idx()
251 elf.path = path; in init_elf()
266 elf.begin = mmap(0, stat.st_size, PROT_READ, MAP_PRIVATE, fd, 0); in init_elf()
267 if (elf.begin == MAP_FAILED) { in init_elf()
[all …]
/linux-6.6.21/tools/perf/util/
Dsymbol-elf.c67 static int elf_getphdrnum(Elf *elf, size_t *dst) in elf_getphdrnum() argument
72 ehdr = gelf_getehdr(elf, &gehdr); in elf_getphdrnum()
83 static int elf_getshdrstrndx(Elf *elf __maybe_unused, size_t *dst __maybe_unused) in elf_getshdrstrndx()
180 static size_t elf_addr_to_index(Elf *elf, GElf_Addr addr) in elf_addr_to_index() argument
186 while ((sec = elf_nextscn(elf, sec)) != NULL) { in elf_addr_to_index()
199 Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep, in elf_section_by_name() argument
206 if (!elf_rawdata(elf_getscn(elf, ep->e_shstrndx), NULL)) in elf_section_by_name()
209 while ((sec = elf_nextscn(elf, sec)) != NULL) { in elf_section_by_name()
213 str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name); in elf_section_by_name()
228 Elf *elf; in filename__has_section() local
[all …]
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-6.6.21/tools/lib/bpf/
Delf.c17 Elf *elf; in elf_open() local
30 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); in elf_open()
31 if (!elf) { in elf_open()
37 elf_fd->elf = elf; in elf_open()
45 elf_end(elf_fd->elf); in elf_close()
50 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
52 while ((scn = elf_nextscn(elf, scn)) != NULL) { in elf_find_next_scn_by_type()
70 Elf *elf; member
80 Elf *elf, const char *binary_path, in elf_sym_iter_new() argument
89 if (!gelf_getehdr(elf, &ehdr)) { in elf_sym_iter_new()
[all …]
Dusdt.c305 static int sanity_check_usdt_elf(Elf *elf, const char *path) in sanity_check_usdt_elf() argument
310 if (elf_kind(elf) != ELF_K_ELF) { in sanity_check_usdt_elf()
311 pr_warn("usdt: unrecognized ELF kind %d for '%s'\n", elf_kind(elf), path); in sanity_check_usdt_elf()
315 switch (gelf_getclass(elf)) { in sanity_check_usdt_elf()
333 if (!gelf_getehdr(elf, &ehdr)) in sanity_check_usdt_elf()
357 static int find_elf_sec_by_name(Elf *elf, const char *sec_name, GElf_Shdr *shdr, Elf_Scn **scn) in find_elf_sec_by_name() argument
362 if (elf_getshdrstrndx(elf, &shstrndx)) in find_elf_sec_by_name()
366 if (!elf_rawdata(elf_getscn(elf, shstrndx), NULL)) in find_elf_sec_by_name()
369 while ((sec = elf_nextscn(elf, sec)) != NULL) { in find_elf_sec_by_name()
375 name = elf_strptr(elf, shstrndx, shdr->sh_name); in find_elf_sec_by_name()
[all …]
/linux-6.6.21/scripts/mod/
Dmodpost.c711 static const char *sym_name(struct elf_info *elf, Elf_Sym *sym) in sym_name() argument
714 return elf->strtab + sym->st_name; in sym_name()
774 static void check_section(const char *modname, struct elf_info *elf, in check_section() argument
777 const char *sec = sech_name(elf, sechdr); in check_section()
1054 static inline int is_valid_name(struct elf_info *elf, Elf_Sym *sym) in is_valid_name() argument
1056 const char *name = elf->strtab + sym->st_name; in is_valid_name()
1064 static Elf_Sym *find_nearest_sym(struct elf_info *elf, Elf_Addr addr, in find_nearest_sym() argument
1071 bool is_arm = (elf->hdr->e_machine == EM_ARM); in find_nearest_sym()
1073 for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) { in find_nearest_sym()
1074 if (get_secindex(elf, sym) != secndx) in find_nearest_sym()
[all …]
/linux-6.6.21/arch/powerpc/platforms/powernv/
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-6.6.21/arch/alpha/boot/tools/
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-6.6.21/arch/mips/tools/
DMakefile2 hostprogs := elf-entry
3 PHONY += elf-entry
4 elf-entry: $(obj)/elf-entry
/linux-6.6.21/tools/bpf/resolve_btfids/
Dmain.c112 Elf *elf; member
295 static int compressed_section_fix(Elf *elf, Elf_Scn *scn, GElf_Shdr *sh) in compressed_section_fix() argument
297 int expected = gelf_getclass(elf) == ELFCLASS32 ? 4 : 8; in compressed_section_fix()
323 Elf *elf; in elf_collect() local
335 elf = elf_begin(fd, ELF_C_RDWR_MMAP, NULL); in elf_collect()
336 if (!elf) { in elf_collect()
344 obj->efile.elf = elf; in elf_collect()
346 elf_flagelf(elf, ELF_C_SET, ELF_F_LAYOUT); in elf_collect()
348 if (elf_getshdrstrndx(elf, &shdrstrndx) != 0) { in elf_collect()
357 while ((scn = elf_nextscn(elf, scn)) != NULL) { in elf_collect()
[all …]
/linux-6.6.21/tools/testing/selftests/bpf/
Dtrace_helpers.c276 Elf *elf = NULL; in read_build_id() local
289 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); in read_build_id()
290 if (!elf) in read_build_id()
292 if (elf_kind(elf) != ELF_K_ELF) in read_build_id()
294 if (!gelf_getehdr(elf, &ehdr)) in read_build_id()
301 phdr = gelf_getphdr(elf, i, &mem); in read_build_id()
306 data = elf_rawfile(elf, &max); in read_build_id()
317 if (elf) in read_build_id()
318 elf_end(elf); in read_build_id()
/linux-6.6.21/fs/
Dbinfmt_elf_fdpic.c1233 static inline void fill_elf_fdpic_header(struct elfhdr *elf, int segs) in fill_elf_fdpic_header() argument
1235 memcpy(elf->e_ident, ELFMAG, SELFMAG); in fill_elf_fdpic_header()
1236 elf->e_ident[EI_CLASS] = ELF_CLASS; in fill_elf_fdpic_header()
1237 elf->e_ident[EI_DATA] = ELF_DATA; in fill_elf_fdpic_header()
1238 elf->e_ident[EI_VERSION] = EV_CURRENT; in fill_elf_fdpic_header()
1239 elf->e_ident[EI_OSABI] = ELF_OSABI; in fill_elf_fdpic_header()
1240 memset(elf->e_ident+EI_PAD, 0, EI_NIDENT-EI_PAD); in fill_elf_fdpic_header()
1242 elf->e_type = ET_CORE; in fill_elf_fdpic_header()
1243 elf->e_machine = ELF_ARCH; in fill_elf_fdpic_header()
1244 elf->e_version = EV_CURRENT; in fill_elf_fdpic_header()
[all …]
Dbinfmt_elf.c539 struct file *elf, bool is_interp, in arch_elf_pt_proc() argument
1490 static void fill_elf_header(struct elfhdr *elf, int segs, in fill_elf_header() argument
1493 memset(elf, 0, sizeof(*elf)); in fill_elf_header()
1495 memcpy(elf->e_ident, ELFMAG, SELFMAG); in fill_elf_header()
1496 elf->e_ident[EI_CLASS] = ELF_CLASS; in fill_elf_header()
1497 elf->e_ident[EI_DATA] = ELF_DATA; in fill_elf_header()
1498 elf->e_ident[EI_VERSION] = EV_CURRENT; in fill_elf_header()
1499 elf->e_ident[EI_OSABI] = ELF_OSABI; in fill_elf_header()
1501 elf->e_type = ET_CORE; in fill_elf_header()
1502 elf->e_machine = machine; in fill_elf_header()
[all …]
/linux-6.6.21/arch/powerpc/kernel/
Dfadump.c966 struct elfhdr *elf; in fadump_init_elfcore_header() local
968 elf = (struct elfhdr *) bufp; in fadump_init_elfcore_header()
970 memcpy(elf->e_ident, ELFMAG, SELFMAG); in fadump_init_elfcore_header()
971 elf->e_ident[EI_CLASS] = ELF_CLASS; in fadump_init_elfcore_header()
972 elf->e_ident[EI_DATA] = ELF_DATA; in fadump_init_elfcore_header()
973 elf->e_ident[EI_VERSION] = EV_CURRENT; in fadump_init_elfcore_header()
974 elf->e_ident[EI_OSABI] = ELF_OSABI; in fadump_init_elfcore_header()
975 memset(elf->e_ident+EI_PAD, 0, EI_NIDENT-EI_PAD); in fadump_init_elfcore_header()
976 elf->e_type = ET_CORE; in fadump_init_elfcore_header()
977 elf->e_machine = ELF_ARCH; in fadump_init_elfcore_header()
[all …]
/linux-6.6.21/arch/x86/realmode/rm/
DMakefile53 LDFLAGS_realmode.elf := -m elf_i386 --emit-relocs -T
56 targets += realmode.elf
57 $(obj)/realmode.elf: $(obj)/realmode.lds $(REALMODE_OBJS) FORCE
63 $(obj)/realmode.bin: $(obj)/realmode.elf $(obj)/realmode.relocs FORCE
70 $(obj)/realmode.relocs: $(obj)/realmode.elf FORCE
/linux-6.6.21/tools/testing/selftests/sgx/
DMakefile21 TEST_FILES := $(OUTPUT)/test_encl.elf
23 all: $(TEST_CUSTOM_PROGS) $(OUTPUT)/test_encl.elf
48 $(OUTPUT)/test_encl.elf: test_encl.lds test_encl.c test_encl_bootstrap.S
52 $(OUTPUT)/test_encl.elf \
/linux-6.6.21/drivers/firmware/efi/libstub/
DMakefile.zboot55 LDFLAGS_vmlinuz.efi.elf := -T $(srctree)/drivers/firmware/efi/libstub/zboot.lds
56 $(obj)/vmlinuz.efi.elf: $(obj)/vmlinuz.o $(ZBOOT_DEPS) FORCE
60 $(obj)/vmlinuz.efi: $(obj)/vmlinuz.efi.elf FORCE
63 targets += zboot-header.o vmlinux.bin vmlinuz vmlinuz.o vmlinuz.efi.elf vmlinuz.efi
/linux-6.6.21/arch/xtensa/boot/
DMakefile25 Image: boot-elf
30 boot-elf boot-redboot: $(addprefix $(obj)/,$(subdir-y))
41 boot-elf: $(obj)/vmlinux.bin

1234