/linux-6.12.1/tools/objtool/ |
D | elf.c | 3 * elf.c - ELF access library 22 #include <objtool/elf.h> 30 #define __elf_table(name) (elf->name##_hash) 31 #define __elf_bits(name) (elf->name##_bits) 130 struct section *find_section_by_name(const struct elf *elf, const char *name) in find_section_by_name() argument 142 static struct section *find_section_by_index(struct elf *elf, in find_section_by_index() argument 155 static struct symbol *find_symbol_by_index(struct elf *elf, unsigned int idx) in find_symbol_by_index() argument 254 struct symbol *find_symbol_by_name(const struct elf *elf, const char *name) in find_symbol_by_name() argument 266 struct reloc *find_reloc_by_dest_range(const struct elf *elf, struct section *sec, in find_reloc_by_dest_range() argument 296 struct reloc *find_reloc_by_dest(const struct elf *elf, struct section *sec, unsigned long offset) in find_reloc_by_dest() argument [all …]
|
D | orc_dump.c | 21 Elf *elf; in orc_dump() local 27 struct elf dummy_elf = {}; in orc_dump() 40 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); in orc_dump() 41 if (!elf) { in orc_dump() 46 if (!elf64_getehdr(elf)) { in orc_dump() 50 memcpy(&dummy_elf.ehdr, elf64_getehdr(elf), sizeof(dummy_elf.ehdr)); in orc_dump() 52 if (elf_getshdrnum(elf, &nr_sections)) { in orc_dump() 57 if (elf_getshdrstrndx(elf, &shstrtab_idx)) { in orc_dump() 63 scn = elf_getscn(elf, i); in orc_dump() 74 name = elf_strptr(elf, shstrtab_idx, sh.sh_name); in orc_dump() [all …]
|
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 feature = bswap_if_needed(elf, 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()
|
/linux-6.12.1/tools/objtool/include/objtool/ |
D | elf.h | 15 #include <arch/elf.h> 83 struct elf { struct 84 Elf *elf; member 109 struct elf *elf_open_read(const char *name, int flags); argument 111 struct section *elf_create_section(struct elf *elf, const char *name, 113 struct section *elf_create_section_pair(struct elf *elf, const char *name, 117 struct symbol *elf_create_prefix_symbol(struct elf *elf, struct symbol *orig, long size); 119 struct reloc *elf_init_reloc_text_sym(struct elf *elf, struct section *sec, 125 struct reloc *elf_init_reloc_data_sym(struct elf *elf, struct section *sec, 131 int elf_write_insn(struct elf *elf, struct section *sec, [all …]
|
D | endianness.h | 7 #include <objtool/elf.h> 13 * to be written to a target native endianness ELF file. 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); \
|
/linux-6.12.1/scripts/mod/ |
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 …]
|
/linux-6.12.1/tools/lib/bpf/ |
D | elf.c | 29 Elf *elf; in elf_open() local 31 elf_fd->elf = NULL; in elf_open() 35 pr_warn("elf: failed to init libelf for %s\n", binary_path); in elf_open() 41 pr_warn("elf: failed to open %s: %s\n", binary_path, in elf_open() 45 elf = elf_begin(fd, ELF_C_READ_MMAP, NULL); in elf_open() 46 if (!elf) { in elf_open() 47 pr_warn("elf: could not read elf from %s: %s\n", binary_path, elf_errmsg(-1)); in elf_open() 52 elf_fd->elf = elf; in elf_open() 60 elf_end(elf_fd->elf); in elf_close() 64 /* Return next ELF section of sh_type after scn, or first of that type if scn is NULL. */ [all …]
|
D | linker.c | 16 #include <elf.h> 28 /* positional (not necessarily ELF) index in an array of sections */ 30 /* positional (not necessarily ELF) index of a matching section in a final object file */ 34 /* whether section is omitted from the final ELF file */ 36 /* whether section is an ephemeral section, not mapped to an ELF section */ 39 /* ELF info */ 52 Elf *elf; member 65 /* mapping of symbol indices from src to dst ELF */ 79 /* ELF symbol index */ 103 /* positional (not necessarily ELF) index in an array of sections */ [all …]
|
/linux-6.12.1/arch/arm64/kvm/hyp/nvhe/ |
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-6.12.1/tools/testing/selftests/vDSO/ |
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) macro 40 #define ELF_HASH_ENTRY ELF(Xword) 42 #define ELF_HASH_ENTRY ELF(Word) 54 ELF(Sym) *symtab; 60 ELF(Versym) *versym; 61 ELF(Verdef) *verdef; 65 * Straight from the ELF specification...and then tweaked slightly, in order to [all …]
|
/linux-6.12.1/tools/perf/util/ |
D | symbol-elf.c | 68 static int elf_getphdrnum(Elf *elf, size_t *dst) in elf_getphdrnum() argument 73 ehdr = gelf_getehdr(elf, &gehdr); in elf_getphdrnum() 84 static int elf_getshdrstrndx(Elf *elf __maybe_unused, size_t *dst __maybe_unused) in elf_getshdrstrndx() 181 static size_t elf_addr_to_index(Elf *elf, GElf_Addr addr) in elf_addr_to_index() argument 187 while ((sec = elf_nextscn(elf, sec)) != NULL) { in elf_addr_to_index() 200 Elf_Scn *elf_section_by_name(Elf *elf, GElf_Ehdr *ep, in elf_section_by_name() argument 206 /* ELF is corrupted/truncated, avoid calling elf_strptr. */ in elf_section_by_name() 207 if (!elf_rawdata(elf_getscn(elf, ep->e_shstrndx), NULL)) in elf_section_by_name() 210 while ((sec = elf_nextscn(elf, sec)) != NULL) { in elf_section_by_name() 214 str = elf_strptr(elf, ep->e_shstrndx, shp->sh_name); in elf_section_by_name() [all …]
|
/linux-6.12.1/tools/testing/selftests/kvm/lib/ |
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-6.12.1/fs/ |
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 …]
|
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> 149 * If the arch defines ELF_BASE_PLATFORM (in asm/elf.h), the value 223 /* Create the ELF interpreter info */ in create_elf_tables() 372 * total_size is the size of the ELF (interpreter) image. in elf_map() 375 * position with the ELF binary image. (since size < total_size) in elf_map() 377 * the end. (which unmap is needed for ELF images with holes.) in elf_map() 389 pr_info("%d (%s): Uhuuh, elf segment at %px requested but the memory is mapped already\n", in elf_map() 498 * load_elf_phdrs() - load ELF program headers [all …]
|
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() 483 * If the arch defines ELF_BASE_PLATFORM (in asm/elf.h), the value 605 /* Create the ELF interpreter info */ in create_elf_fdpic_tables() 905 printk("ELF FDPIC %s with invalid DYNAMIC section (inode=%lu)\n", in elf_fdpic_map_file() 965 /* map the ELF header address if in this segment */ in elf_fdpic_map_file_constdisp_on_uclinux() [all …]
|
/linux-6.12.1/kernel/ |
D | kexec_elf.c | 3 * 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-6.12.1/fs/proc/ |
D | vmcore.c | 14 #include <linux/elf.h> 38 /* Stores the pointer to the buffer containing kernel elf core headers. */ 181 * Architectures may override this function to allocate ELF header in 2nd kernel 195 * Architectures may override this function to read from ELF header 314 /* Read from the ELF header and then the crash dump. On error, negative value is 329 /* Read ELF core header */ in __read_vmcore() 342 /* Read ELF note segment */ in __read_vmcore() 346 /* We add device dumps before other elf notes because the in __read_vmcore() 347 * other elf notes may not fill the elf notes buffer in __read_vmcore() 349 * between the elf notes and the device dumps. Tools will in __read_vmcore() [all …]
|
/linux-6.12.1/arch/powerpc/platforms/powernv/ |
D | opal-core.c | 3 * 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-6.12.1/tools/bpf/resolve_btfids/ |
D | main.c | 4 * resolve_btfids scans ELF object for .BTF_ids section and resolves 121 Elf *elf; member 290 /* Older libelf.h and glibc elf.h might not yet define the ELF compression types. */ 305 static int compressed_section_fix(Elf *elf, Elf_Scn *scn, GElf_Shdr *sh) in compressed_section_fix() argument 307 int expected = gelf_getclass(elf) == ELFCLASS32 ? 4 : 8; in compressed_section_fix() 334 Elf *elf; in elf_collect() local 346 elf = elf_begin(fd, ELF_C_RDWR_MMAP, NULL); in elf_collect() 347 if (!elf) { in elf_collect() 349 pr_err("FAILED cannot create ELF descriptor: %s\n", in elf_collect() 355 obj->efile.elf = elf; in elf_collect() [all …]
|
/linux-6.12.1/include/linux/ |
D | elfnote.h | 5 * 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> 65 * Elf{32,64}_Nhdr, but includes the name and desc data. The size and 74 struct elf##size##_note _nhdr; \ 76 __attribute__((aligned(sizeof(Elf##size##_Word)))); \ 78 __attribute__((aligned(sizeof(Elf##size##_Word)))); \ 82 aligned(sizeof(Elf##size##_Word)), \
|
/linux-6.12.1/arch/alpha/boot/tools/ |
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-6.12.1/arch/mips/tools/ |
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()
|
/linux-6.12.1/kernel/module/ |
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-6.12.1/drivers/remoteproc/ |
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 */
|
/linux-6.12.1/include/uapi/linux/ |
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 */
|