Home
last modified time | relevance | path

Searched full:elf (Results 1 – 25 of 747) sorted by relevance

12345678910>>...30

/linux/tools/objtool/
H A Delf.c3 * elf.c - ELF access library
25 #include <objtool/elf.h>
40 #define __elf_table(name) (elf->name##_hash)
41 #define __elf_bits(name) (elf->name##_bits)
140 struct section *find_section_by_name(const struct elf *elf, const char *name) in find_section_by_name()
152 static struct section *find_section_by_index(struct elf *elf, in find_section_by_index()
165 static struct symbol *find_symbol_by_index(struct elf *el in find_symbol_by_index()
133 find_section_by_name(const struct elf * elf,const char * name) find_section_by_name() argument
145 find_section_by_index(struct elf * elf,unsigned int idx) find_section_by_index() argument
158 find_symbol_by_index(struct elf * elf,unsigned int idx) find_symbol_by_index() argument
277 find_symbol_by_name(const struct elf * elf,const char * name) find_symbol_by_name() argument
290 find_local_symbol_by_file_and_name(const struct elf * elf,struct symbol * file,const char * name) find_local_symbol_by_file_and_name() argument
306 find_global_symbol_by_name(const struct elf * elf,const char * name) find_global_symbol_by_name() argument
318 find_reloc_by_dest_range(const struct elf * elf,struct section * sec,unsigned long offset,unsigned int len) find_reloc_by_dest_range() argument
348 find_reloc_by_dest(const struct elf * elf,struct section * sec,unsigned long offset) find_reloc_by_dest() argument
358 read_sections(struct elf * elf) read_sections() argument
474 elf_add_symbol(struct elf * elf,struct symbol * sym) elf_add_symbol() argument
539 read_symbols(struct elf * elf) read_symbols() argument
682 mark_group_syms(struct elf * elf) mark_group_syms() argument
713 elf_update_sym_relocs(struct elf * elf,struct symbol * sym) elf_update_sym_relocs() argument
731 elf_update_symbol(struct elf * elf,struct section * symtab,struct section * symtab_shndx,struct symbol * sym) elf_update_symbol() argument
860 elf_create_symbol(struct elf * elf,const char * name,struct section * sec,unsigned int bind,unsigned int type,unsigned long offset,size_t size) elf_create_symbol() argument
966 elf_create_section_symbol(struct elf * elf,struct section * sec) elf_create_section_symbol() argument
979 elf_init_reloc(struct elf * elf,struct section * rsec,unsigned int reloc_idx,unsigned long offset,struct symbol * sym,s64 addend,unsigned int type) elf_init_reloc() argument
1014 elf_init_reloc_text_sym(struct elf * elf,struct section * sec,unsigned long offset,unsigned int reloc_idx,struct section * insn_sec,unsigned long insn_off) elf_init_reloc_text_sym() argument
1044 elf_init_reloc_data_sym(struct elf * elf,struct section * sec,unsigned long offset,unsigned int reloc_idx,struct symbol * sym,s64 addend) elf_init_reloc_data_sym() argument
1059 read_relocs(struct elf * elf) read_relocs() argument
1124 struct elf *elf; elf_open_read() local
1193 struct elf *elf; elf_create_file() local
1305 elf_add_string(struct elf * elf,struct section * strtab,const char * str) elf_add_string() argument
1329 elf_add_data(struct elf * elf,struct section * sec,const void * data,size_t size) elf_add_data() argument
1371 elf_create_section(struct elf * elf,const char * name,size_t size,size_t entsize,unsigned int type,unsigned int align,unsigned int flags) elf_create_section() argument
1464 elf_alloc_reloc(struct elf * elf,struct section * rsec) elf_alloc_reloc() argument
1572 elf_create_rela_section(struct elf * elf,struct section * sec,unsigned int nr_relocs) elf_create_rela_section() argument
1613 elf_create_reloc(struct elf * elf,struct section * sec,unsigned long offset,struct symbol * sym,s64 addend,unsigned int type) elf_create_reloc() argument
1640 elf_create_section_pair(struct elf * elf,const char * name,size_t entsize,unsigned int nr,unsigned int nr_relocs) elf_create_section_pair() argument
1657 elf_write_insn(struct elf * elf,struct section * sec,unsigned long offset,unsigned int len,const char * insn) elf_write_insn() argument
1684 elf_truncate_section(struct elf * elf,struct section * sec) elf_truncate_section() argument
1728 elf_write(struct elf * elf) elf_write() argument
1769 elf_close(struct elf * elf) elf_close() 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 *el argument
474 find_sympos(struct elf * elf,struct symbol * sym) find_sympos() argument
534 __clone_symbol(struct elf * elf,struct symbol * patched_sym,bool data_too) __clone_symbol() argument
868 convert_reloc_sym_to_secsym(struct elf * elf,struct reloc * reloc) convert_reloc_sym_to_secsym() argument
882 convert_reloc_secsym_to_sym(struct elf * elf,struct reloc * reloc) convert_reloc_secsym_to_sym() argument
913 convert_reloc_sym(struct elf * elf,struct reloc * reloc) convert_reloc_sym() argument
1184 create_fake_symbol(struct elf * elf,struct section * sec,unsigned long offset,size_t size) create_fake_symbol() argument
1239 create_fake_symbols(struct elf * elf) create_fake_symbols() argument
1314 should_keep_special_sym(struct elf * elf,struct symbol * sym) should_keep_special_sym() 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()
/linux/tools/objtool/include/objtool/
H A Delf.h19 #include <arch/elf.h>
24 #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, cons
123 symbol_hashelf global() argument
124 symbol_name_hashelf global() argument
125 section_hashelf global() argument
126 section_name_hashelf global() argument
127 reloc_hashelf global() argument
201 has_multiple_files(struct elf * elf) has_multiple_files() argument
206 elf_addr_size(struct elf * elf) elf_addr_size() argument
211 elf_rela_size(struct elf * elf) elf_rela_size() argument
216 elf_data_rela_type(struct elf * elf) elf_data_rela_type() argument
221 elf_text_rela_type(struct elf * elf) elf_text_rela_type() argument
301 mark_sec_changed(struct elf * elf,struct section * sec,bool changed) mark_sec_changed() argument
361 set_reloc_offset(struct elf * elf,struct reloc * reloc,u64 offset) set_reloc_offset() argument
372 set_reloc_addend(struct elf * elf,struct reloc * reloc,s64 addend) set_reloc_addend() argument
397 set_reloc_sym(struct elf * elf,struct reloc * reloc,unsigned int sym) set_reloc_sym() argument
407 set_reloc_type(struct elf * elf,struct reloc * reloc,unsigned int type) set_reloc_type() argument
418 annotype(struct elf * elf,struct section * sec,struct reloc * reloc) annotype() argument
452 for_each_sec(elf,sec) global() argument
462 for_each_sym(elf,sym) global() argument
465 for_each_sym_continue(elf,sym) global() argument
481 sym_for_each_reloc(elf,sym,reloc) global() argument
[all...]
/linux/scripts/mod/
H A Dsymsearch.c4 * Helper functions for finding the symbol in an ELF which is "nearest"
50 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()
63 * Be slightly paranoid here. The ELF file is mmap'd and could
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()
[all …]
H A Dmodpost.c15 #include <elf.h>
429 /* Is this a valid ELF file? */ in parse_elf()
434 /* Not an ELF file - silently ignore it */ in parse_elf()
449 /* Fix endianness in ELF header */ in parse_elf()
711 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()
[all …]
/linux/tools/lib/bpf/
H A Delf.c27 Elf *elf; in elf_open() local
29 elf_fd->elf = NULL; in elf_open()
33 pr_warn("elf: failed to init libelf for %s\n", binary_path); in elf_open()
39 pr_warn("elf: failed to open %s: %s\n", binary_path, errstr(ret)); in elf_open()
42 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); in elf_open()
43 if (!elf) { in elf_open()
44 pr_warn("elf: could not read elf from %s: %s\n", binary_path, elf_errmsg(-1)); in elf_open()
49 elf_fd->elf = elf; in elf_open()
57 elf_end(elf_fd->elf); in elf_close()
61 /* Return next ELF section of sh_type after scn, or first of that type if scn is NULL. */
[all …]
H A Dlinker.c20 #include <elf.h>
33 /* positional (not necessarily ELF) index in an array of sections */
35 /* positional (not necessarily ELF) index of a matching section in a final object file */
39 /* whether section is omitted from the final ELF file */
41 /* whether section is an ephemeral section, not mapped to an ELF section */
44 /* ELF info */
57 Elf *elf; member
70 /* mapping of symbol indices from src to dst ELF */
84 /* ELF symbol index */
108 /* positional (not necessarily ELF) index in an array of sections */
[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
192 /* ELF is corrupted/truncated, avoid calling elf_strptr. */ in elf_section_by_name()
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()
[all …]
/linux/arch/arm64/kvm/hyp/nvhe/
H A Dgen-hyprel.c14 * The input of this program is the relocatable ELF object containing
27 #include <elf.h>
132 /* Global state of the processed ELF. */
140 } elf; variable
167 elf.path, ## __VA_ARGS__); \
175 elf.path, strerror(errno)); \
199 * the beginning of the ELF file.
201 #define elf_ptr(type, off) ((type *)(elf.begin + (off)))
203 /* Iterate over all sections in the ELF. */
205 for (var = elf.sh_table; var < elf.sh_table + elf16toh(elf.ehdr->e_shnum); ++var)
[all …]
/linux/tools/testing/selftests/vDSO/
H A Dparse_vdso.c10 * The vDSO is a regular ELF DSO that the kernel maps into user space when
22 #include <elf.h>
35 #define ELF_BITS_XFORM2(bits, x) Elf##bits##_##x
37 #define ELF(x) ELF_BITS_XFORM(ELF_BITS, x)
40 #define ELF_HASH_ENTRY ELF(Xword)
42 #define ELF_HASH_ENTRY ELF(Word)
54 ELF(Sym) *symtab;
56 ELF(Word) *gnu_hash, *gnu_bucket;
61 ELF(Versym) *versym;
62 ELF(Verde
38 #define ELF(x) ELF_BITS_XFORM(ELF_ global() macro
[all...]
/linux/tools/testing/selftests/kvm/lib/
H A Delf.c3 * tools/testing/selftests/kvm/lib/elf.c
11 #include <linux/elf.h>
19 /* Open the ELF file. */ in elfhdr_get()
22 TEST_ASSERT(fd >= 0, "Failed to open ELF file,\n" in elfhdr_get()
26 /* Read in and validate ELF Identification Record. in elfhdr_get()
27 * The ELF Identification record is the first 16 (EI_NIDENT) bytes in elfhdr_get()
28 * of the ELF header, which is at the beginning of the ELF file. in elfhdr_get()
31 * the real size of the ELF header. in elfhdr_get()
37 "ELF MAGIC Mismatch,\n" in elfhdr_get()
56 "cases where the host and ELF file endianness\n" in elfhdr_get()
[all …]
/linux/fs/
H A DKconfig.binfmt6 bool "Kernel support for ELF binaries"
11 ELF (Executable and Linkable Format) is a format for libraries and
13 systems. Saying Y here will enable your kernel to run ELF binaries
14 and enlarge it by about 13 KB. ELF support under Linux has now all
19 executables are distributed solely in ELF format. You definitely
22 Information about ELF is contained in the ELF HOWTO available from
26 here, you still can't run any ELF binaries (they just crash), then
27 you'll have to install the newest ELF runtime libraries, including
32 bool "Build KUnit tests for ELF binary support" if !KUNIT_ALL_TESTS
36 This builds the ELF loader KUnit tests, which try to gather
[all …]
H A Dbinfmt_elf.c5 * These are the functions used to load ELF format executables as used
36 #include <linux/elf.h>
37 #include <linux/elf-randomize.h>
158 * If the arch defines ELF_BASE_PLATFORM (in asm/elf.h), the value
232 /* Create the ELF interpreter info */ in create_elf_tables()
387 * total_size is the size of the ELF (interpreter) image. in elf_map()
390 * position with the ELF binary image. (since size < total_size) in elf_map()
392 * the end. (which unmap is needed for ELF images with holes.) in elf_map()
404 pr_info("%d (%s): Uhuuh, elf segment at %px requested but the memory is mapped already\n", in elf_map()
513 * load_elf_phdrs() - load ELF program headers
[all …]
H A Dbinfmt_elf_fdpic.c2 /* binfmt_elf_fdpic.c: FDPIC ELF binary format
33 #include <linux/elf.h>
34 #include <linux/elf-fdpic.h>
214 /* binfmt_elf handles non-fdpic elf except on nommu */ in load_elf_fdpic_binary()
217 /* nommu can only load ET_DYN (PIE) ELF */ in load_elf_fdpic_binary()
259 kdebug("Using ELF interpreter %s", interpreter_name); in load_elf_fdpic_binary()
486 * If the arch defines ELF_BASE_PLATFORM (in asm/elf.h), the value
614 /* Create the ELF interpreter info */ in create_elf_fdpic_tables()
920 printk("ELF FDPIC %s with invalid DYNAMIC section (inode=%llu)\n", in elf_fdpic_map_file()
980 /* map the ELF header address if in this segment */ in elf_fdpic_map_file_constdisp_on_uclinux()
[all …]
/linux/kernel/
H A Dkexec_elf.c3 * Load ELF vmlinux file for the kexec_file_load syscall.
11 * Based on kexec-tools' kexec-elf-exec.c and kexec-elf-ppc64.c.
18 #include <linux/elf.h>
60 * elf_is_ehdr_sane - check that it is safe to use the ELF header
61 * @buf_len: size of the buffer in which the ELF file is loaded.
74 pr_debug("Unknown ELF version.\n"); in elf_is_ehdr_sane()
124 pr_debug("Buffer is too small to hold ELF header.\n"); in elf_read_ehdr()
131 pr_debug("No ELF header magic.\n"); in elf_read_ehdr()
136 pr_debug("Not a supported ELF class.\n"); in elf_read_ehdr()
140 pr_debug("Not a supported ELF data format.\n"); in elf_read_ehdr()
[all …]
/linux/fs/proc/
H A Dvmcore.c16 #include <linux/elf.h>
40 /* Stores the pointer to the buffer containing kernel elf core headers. */
209 * Architectures may override this function to allocate ELF header in 2nd kernel
223 * Architectures may override this function to read from ELF header
330 /* Read from the ELF header and then the crash dump. On error, negative value is
345 /* Read ELF core header */ in __read_vmcore()
358 /* Read ELF note segment */ in __read_vmcore()
362 /* We add device dumps before other elf notes because the in __read_vmcore()
363 * other elf notes may not fill the elf notes buffer in __read_vmcore()
365 * between the elf notes and the device dumps. Tools will in __read_vmcore()
[all …]
/linux/arch/powerpc/platforms/powernv/
H A Dopal-core.c3 * Interface for exporting the OPAL ELF core.
14 #include <linux/elf.h>
49 /* Pointer to the first PT_LOAD in the ELF core file */
55 /* Buffer for all the ELF core headers and the PT_NOTE */
158 * Read from the ELF header and then the crash dump.
180 /* Read ELF core header and/or PT_NOTE segment */ in read_opalcore()
215 * Read CPU state dump data and convert it into ELF notes.
308 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()
[all …]
/linux/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/
H A Dgh100.c7 #include <linux/elf.h>
169 /* The sh_flags value for the binary blobs in the ELF image */
175 /* The FMC ELF header must be exactly this */
191 * elf_validate_sections - validate each section in the FMC ELF image
192 * @elf: ELF image
193 * @length: size of the entire ELF image
196 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()
[all …]
/linux/include/linux/
H A Delfnote.h5 * Helper macros to generate ELF Note structures, which are put into a
28 * See the ELF specification for more detail about ELF notes.
33 * Generate a structure with the same shape as Elf{32,64}_Nhdr (which
62 #include <uapi/linux/elf.h>
66 * Elf{32,64}_Nhdr, but includes the name and desc data. The size and
72 struct elf##size##_note _nhdr; \
74 __attribute__((aligned(sizeof(Elf##size##_Word)))); \
76 __attribute__((aligned(sizeof(Elf##size##_Word)))); \
80 aligned(sizeof(Elf##size##_Word)), \
/linux/arch/alpha/boot/tools/
H A Dobjstrip.c5 * Strip the object file headers/trailers from an executable (ELF or ECOFF).
10 * Converts an ECOFF or ELF object file into a bootable file. The
30 # include <linux/elf.h>
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()
153 fprintf(stderr, "%s: %s is not an ELF executable\n", in main()
157 if (!elf_check_arch(elf)) { in main()
159 prog_name, elf->e_machine); in main()
[all …]
/linux/arch/mips/tools/
H A Delf-entry.c3 #include <elf.h>
43 die("Usage: elf-entry <elf-file>\n"); in main()
60 die("Input is not an ELF\n"); in main()
74 die("Invalid ELF encoding\n"); in main()
91 die("Invalid ELF encoding\n"); in main()
97 die("Invalid ELF class\n"); in main()
/linux/tools/bpf/resolve_btfids/
H A Dmain.c4 * resolve_btfids scans ELF object for .BTF_ids section and resolves
133 Elf *elf; member
389 Elf *elf; in elf_collect() local
401 elf = elf_begin(fd, ELF_C_READ_MMAP_PRIVATE, NULL); in elf_collect()
402 if (!elf) { in elf_collect()
404 pr_err("FAILED cannot create ELF descriptor: %s\n", in elf_collect()
410 obj->efile.elf = elf; in elf_collect()
412 elf_flagelf(elf, ELF_C_SET, ELF_F_LAYOUT); in elf_collect()
414 if (elf_getshdrstrndx(elf, &shdrstrndx) != 0) { in elf_collect()
419 if (gelf_getehdr(obj->efile.elf, &ehdr) == NULL) { in elf_collect()
[all …]

12345678910>>...30