| /linux/tools/objtool/ |
| H A D | elf.c | 3 * 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() argument 152 static struct section *find_section_by_index(struct elf *elf, in find_section_by_index() argument 165 static struct symbol *find_symbol_by_index(struct elf *elf, unsigned int idx) in find_symbol_by_index() argument 284 struct symbol *find_symbol_by_name(const struct elf *elf, const char *name) in find_symbol_by_name() argument 297 static struct symbol *find_local_symbol_by_file_and_name(const struct elf *elf, in find_local_symbol_by_file_and_name() argument 313 struct symbol *find_global_symbol_by_name(const struct elf *elf, const char *name) in find_global_symbol_by_name() argument [all …]
|
| H A D | klp-diff.c | 27 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() 383 static int find_global_symbol_by_demangled_name(struct elf *elf, struct symbol *sym, in find_global_symbol_by_demangled_name() argument [all …]
|
| /linux/tools/objtool/include/objtool/ |
| H A D | elf.h | 19 #include <arch/elf.h> 24 #define bswap_if_needed(elf, val) __bswap_if_needed(&elf->ehdr, val) 106 struct elf { argument 107 Elf *elf; 133 struct elf *elf_open_read(const char *name, int flags); 134 struct elf *elf_create_file(GElf_Ehdr *ehdr, const char *name); 136 struct section *elf_create_section(struct elf *elf, cons 86 struct elf { global() struct 87 elfelf global() argument 102 symbol_hashelf global() argument 103 symbol_name_hashelf global() argument 104 section_hashelf global() argument 105 section_name_hashelf global() argument 112 symbol_dataelf global() argument 156 has_multiple_files(struct elf * elf) has_multiple_files() argument 161 elf_addr_size(struct elf * elf) elf_addr_size() argument 166 elf_rela_size(struct elf * elf) elf_rela_size() argument 171 elf_data_rela_type(struct elf * elf) elf_data_rela_type() argument 176 elf_text_rela_type(struct elf * elf) elf_text_rela_type() argument 191 mark_sec_changed(struct elf * elf,struct section * sec,bool changed) mark_sec_changed() argument 246 set_reloc_offset(struct elf * elf,struct reloc * reloc,u64 offset) set_reloc_offset() argument 257 set_reloc_addend(struct elf * elf,struct reloc * reloc,s64 addend) set_reloc_addend() argument 282 set_reloc_sym(struct elf * elf,struct reloc * reloc,unsigned int sym) set_reloc_sym() argument 292 set_reloc_type(struct elf * elf,struct reloc * reloc,unsigned int type) set_reloc_type() argument [all...] |
| H A D | endianness.h | 12 * to be written to a target native endianness ELF file. 15 need_bswap(struct elf * elf) need_bswap() argument 21 bswap_if_needed(elf,val) global() argument
|
| /linux/scripts/mod/ |
| H A D | symsearch.c | 4 * 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 D | modpost.c | 15 #include <elf.h> 434 /* Is this a valid ELF file? */ in parse_elf() 439 /* Not an ELF file - silently ignore it */ in parse_elf() 454 /* Fix endianness in ELF header */ in parse_elf() 716 static const char *sym_name(struct elf_info *elf, Elf_Sym *sym) in sym_name() argument 718 return sym ? elf->strtab + sym->st_name : ""; in sym_name() 776 static void check_section(const char *modname, struct elf_info *elf, in check_section() argument 779 const char *sec = sech_name(elf, sechdr); in check_section() 991 static Elf_Sym *find_fromsym(struct elf_info *elf, Elf_Addr addr, in find_fromsym() argument 994 return symsearch_find_nearest(elf, addr, secndx, false, ~0); in find_fromsym() [all …]
|
| /linux/tools/perf/util/ |
| H A D | symbol-elf.c | 54 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_Ehd argument 215 Elf *elf; filename__has_section() local 240 elf_read_program_header(Elf * elf,u64 vaddr,GElf_Phdr * phdr) elf_read_program_header() argument 335 get_ifunc_name(Elf * elf,struct dso * dso,GElf_Ehdr * ehdr,struct rel_info * ri,char * buf,size_t buf_sz) get_ifunc_name() argument 471 get_rela_dyn_info(Elf * elf,GElf_Ehdr * ehdr,struct rela_dyn_info * di,Elf_Scn * scn) get_rela_dyn_info() argument 565 dso__synthesize_plt_got_symbols(struct dso * dso,Elf * elf,GElf_Ehdr * ehdr,char * buf,size_t buf_sz) dso__synthesize_plt_got_symbols() argument 616 Elf *elf; dso__synthesize_plt_symbols() local 784 elf_read_build_id(Elf * elf,void * bf,size_t size) elf_read_build_id() argument 867 Elf *elf; read_build_id() local 988 Elf *elf; filename__read_debuglink() local 1068 read_gnu_debugdata(struct dso * dso,Elf * elf,const char * name,int * fd_ret) read_gnu_debugdata() argument 1147 Elf *elf; symsrc__init() local 1271 max_text_section(Elf * elf,GElf_Ehdr * ehdr) max_text_section() argument 1486 Elf *elf; dso__load_sym_internal() local 1810 elf_read_maps(Elf * elf,bool exe,mapfn_t mapfn,void * data) elf_read_maps() argument 1846 Elf *elf; file__read_maps() local 1866 Elf *elf; dso__type_fd() local 1938 Elf *elf; global() member 2278 kcore_copy__read_maps(struct kcore_copy_info * kci,Elf * elf) kcore_copy__read_maps() argument 2345 kcore_copy__calc_maps(struct kcore_copy_info * kci,const char * dir,Elf * elf) kcore_copy__calc_maps() argument 2675 populate_sdt_note(Elf ** elf,const char * data,size_t len,struct list_head * sdt_notes) populate_sdt_note() argument 2807 construct_sdt_notes_list(Elf * elf,struct list_head * sdt_notes) construct_sdt_notes_list() argument 2874 Elf *elf; get_sdt_note_list() local [all...] |
| H A D | unwind-libunwind-local.c | 19 #include <elf.h> 173 Elf *elf; in elf_section_address_and_offset() 178 elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); in elf_section_address_and_offset() 179 if (elf == NULL) in elf_section_address_and_offset() 182 if (gelf_getehdr(elf, &ehdr) == NULL) in elf_section_address_and_offset() 185 if (!elf_section_by_name(elf, &ehdr, &shdr, name, NULL)) in elf_section_address_and_offset() 192 elf_end(elf); in elf_section_address_and_offset() 210 Elf *elf in elf_base_address() 174 Elf *elf; elf_section_address_and_offset() local 211 Elf *elf = elf_begin(fd, PERF_ELF_C_READ_MMAP, NULL); elf_base_address() local 234 Elf *elf; elf_is_exec() local [all...] |
| /linux/arch/arm64/kvm/hyp/nvhe/ |
| H A D | gen-hyprel.c | 14 * 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 D | parse_vdso.c | 10 * 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 D | elf.c | 3 * 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 D | Kconfig.binfmt | 6 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 D | binfmt_elf.c | 5 * 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() 512 * load_elf_phdrs() - load ELF program headers [all …]
|
| H A D | binfmt_elf_fdpic.c | 2 /* 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/drivers/gpu/drm/nouveau/nvkm/subdev/gsp/ |
| H A D | gh100.c | 7 #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/arch/alpha/boot/tools/ |
| H A D | objstrip.c | 5 * 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 D | elf-entry.c | 3 #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()
|
| H A D | Makefile | 2 hostprogs := elf-entry 3 PHONY += elf-entry 4 elf-entry: $(obj)/elf-entry
|
| /linux/tools/lib/bpf/ |
| H A D | linker.c | 20 #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/bpf/resolve_btfids/ |
| H A D | main.c | 4 * 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 …]
|
| /linux/kernel/module/ |
| H A D | livepatch.c | 14 * Persist ELF information about a module. Copy the ELF header, 28 /* ELF header */ in copy_module_elf() 32 /* ELF section header table */ in copy_module_elf() 40 /* ELF section name string table */ in copy_module_elf() 48 /* ELF symbol section index */ in copy_module_elf()
|
| /linux/drivers/remoteproc/ |
| H A D | remoteproc_elf_helpers.h | 3 * Remote processor elf helpers defines 11 #include <linux/elf.h> 15 * fw_elf_get_class - Get elf class 16 * @fw: the ELF firmware image 19 * struct is the same for both elf class 21 * Return: elf class of the firmware 39 /* Generate getter and setter for a specific elf struct/field */
|
| H A D | remoteproc_elf_loader.c | 3 * Remote Processor Framework ELF loader 23 #include <linux/elf.h> 31 * @fw: the ELF firmware image 42 * ELF files are beginning with the same structure. Thus, to simplify 110 dev_dbg(dev, "Firmware is an elf%d file\n", 120 * @fw: the ELF firmware image 125 * Return: entry point address of the ELF image 137 * @fw: the ELF firmware image 174 /* go through the available ELF segments */ 263 /* First, get the section header according to the elf class */ [all …]
|
| /linux/scripts/gendwarfksyms/ |
| H A D | symbols.c | 203 Elf *elf; in elf_for_each_global() 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, sc in elf_for_each_global() 202 Elf *elf; elf_for_each_global() local [all...] |
| /linux/include/uapi/linux/ |
| H A D | elf-fdpic.h | 2 /* elf-fdpic.h: FDPIC ELF load map 16 #include <linux/elf.h> 20 /* segment mappings for ELF FDPIC libraries/executables/interpreters */ 35 /* segment mappings for ELF FDPIC libraries/executables/interpreters */
|