Report a bug
		
				If you spot a problem with this page, click here to create a Bugzilla issue.
		
			Improve this page
		
			Quickly fork, edit online, and submit a pull request for this page.
			Requires a signed-in GitHub account. This works well for small changes.
			If you'd like to make larger changes you may want to consider using
			a local clone.
		
	core.internal.elf.io
Provides (read-only) memory-mapped I/O for ELF files.
Reference http://www.dwarfstd.org/
License: 
Authors: 
Yazan Dabain, Martin Kinkelin
Source core/internal/elf/io.d
- templateElfIO(Elf_Ehdr, Elf_Shdr, ubyte ELFCLASS)
- File-based memory-mapped I/O (read-only). Only supports ELF files with a byte-order matching the target platform's.Parameters:Elf_Ehdr Expected type of the ELF header (Elf{32,64}Ehdr) Elf_Shdr Expected type of the ELF section header (Elf{32,64}Shdr) ELFCLASS Expected ELF class (ELFCLASS{32,64}) - structElfFile;
- ELF file (with memory-mapped ELF header).- static boolopen(const(char)*path, out ElfFilefile);
- Tries to open the specified file as ELF file matching the ElfIO template parameters.Returns:True on success.
- this(intfd);
- Constructs an instance based on the specified file descriptor. Doesn't validate the file header. The file is closed when destructing the instance.
- TypedMMapRegion!Elf_Ehdrehdr;
- Memory-mapped ELF header.
- boolisValid() const;
- Returns true if the ELF file header matches the ElfIO template parameters.
- NamedSectionsnamedSections() const;
- Returns a struct to iterate over the named sections.Examples:foreach (index, name, sectionHeader; elfFile.namedSections) ... 
- boolfindSectionHeaderByName(const(char)[]sectionName, out ElfSectionHeaderheader) const;
- Tries to find the header of the section with the specified name.Returns:True on success.
 
- structNamedSections;
- Enables iterating over an ELF file's (named) sections.- aliasCallback= int delegate(size_t index, const(char)[] name, ElfSectionHeader sectionHeader);
- name: null-terminated
- intopApply(scope Callbackdg);
 
- structElfSectionHeader;
- Memory-mapped ELF section header.- this(ref const ElfFilefile, size_tindex);
- Constructs a new instance based on the specified file and section index.
- TypedMMapRegion!Elf_Shdrshdr;
- Memory-mapped section header.
 
- structElfSection;
- Memory-mapped ELF section data.- this(ref const ElfFilefile, ref const ElfSectionHeadershdr);
- Constructs a new instance based on the specified file and section header.
- const(void)[]data() const;
- Returns the memory-mapped section data. The data is accessible as long as this ElfSection is alive.
 
 
- enum intELFCLASS32;
- ELF class for 32-bit ELF files.
- enum intELFCLASS64;
- ELF class for 64-bit ELF files.
- aliasElf_Ehdr= core.sys.elf.Elf64_Ehdr;
- Native ELF header type.
- aliasElf_Shdr= core.sys.elf.Elf64_Shdr;
- Native ELF section header type.
- aliasELFCLASS= ELFCLASS64;
- Native ELF class.
- aliasNativeElfIO= ElfIO!(Elf64_Ehdr, Elf64_Shdr, cast(ubyte)2u);
- aliasElfFile= ElfIO!(Elf64_Ehdr, Elf64_Shdr, cast(ubyte)2u).ElfFile;
- Native ELF file.
- aliasElfSectionHeader= ElfIO!(Elf64_Ehdr, Elf64_Shdr, cast(ubyte)2u).ElfSectionHeader;
- Native ELF section header.
- aliasElfSection= ElfIO!(Elf64_Ehdr, Elf64_Shdr, cast(ubyte)2u).ElfSection;
- Native ELF section.
- nothrow @nogc char*thisExePath();
- Returns the path to the process' executable as newly allocated C string (free() when done), or null on error.
Copyright © 1999-2025 by the D Language Foundation | Page generated by
Ddoc on Mon Mar 31 10:27:35 2025