ELF_GETDATA_RAWCHUNK(3) Libelf Programmer's Manual ELF_GETDATA_RAWCHUNK(3) NAME elf_getdata_rawchunk - create a raw data descriptor from a file offset SYNOPSIS #include Elf_Data * elf_getdata_rawchunk("Elf *elf", int64_t offset , size_t size , Elf_Type type ); DESCRIPTION The elf_getdata_rawchunk() function returns an Elf_Data descriptor that refers to a raw region of the ELF file, starting at the given file offset and spanning size bytes. This is used to access arbitrary byte ranges in the ELF file that may not correspond to any section or segment. The returned Elf_Data d_buf will be properly aligned for the requested type. If the file's byte order matches the host, and alignment permits, the raw data is returned as-is. If the file's byte order differs, the buffer is converted into native byte order and aligned for direct access. This behaves like elf_getdata(), and not elf_rawdata(). The contents of the return value's d_buf are a decoded representation. The returned data is not associated with any section or update mechanism. It will not be included in any output written by elf_update(3). It is also owned by libelf and is valid until elf_end() is called on elf. PARAMETERS elf A pointer to an Elf descriptor representing the ELF file. offset The starting file offset in bytes. This must lie within the bounds of the file. size The number of bytes to include in the data chunk, starting at offset. type An Elf_Type enumeration value indicating the intended interpretation of the data. Values include: ELF_T_BYTE Raw bytes. ELF_T_ADDR, ELF_T_OFF, ELF_T_HALF, ELF_T_WORD, ELF_T_XWORD, ELF_T_SWORD, ELF_T_SXWORD Integer and pointer types. ELF_T_EHDR, ELF_T_SHDR, ELF_T_PHDR ELF file, section, and program headers. ELF_T_SYM, ELF_T_DYN, ELF_T_REL, ELF_T_RELA, ELF_T_RELR Symbols and relocations. ELF_T_NHDR, ELF_T_CHDR, ELF_T_NHDR8 ELF note headers and compressed data headers. ELF_T_VDEF, ELF_T_VDAUX, ELF_T_VNEED, ELF_T_VNAUX Versioning structures. ELF_T_SYMINFO, ELF_T_MOVE, ELF_T_LIB Other ELF metadata. ELF_T_GNUHASH GNU-style hash table. ELF_T_AUXV Auxiliary vectors. RETURN VALUE Returns a pointer to an Elf_Data descriptor on success. Returns NULL if any arguments are invalid, or if memory allocation or file reading fails. An error code is set which can be retrieved with elf_errmsg(). The result is cached and shared between repeated calls using the same arguments. SEE ALSO elf(3), elf_errmsg(3), elf_getdata(3), elf_getscn(3), elf_rawdata(3), libelf(3), elf(5) ATTRIBUTES +--------------------------------------------+---------------+---------+ |Interface | Attribute | Value | +--------------------------------------------+---------------+---------+ |elf_getdata_rawchunk () | Thread safety | MT-Safe | +--------------------------------------------+---------------+---------+ REPORTING BUGS Report bugs to or https://sourceware.org/bugzilla/. HISTORY elf_getdata_rawchunk first appeared in elfutils 0.130. This function is a elfutils libelf extension and may not be available in other libelf implementations. Libelf 2025-06-30 ELF_GETDATA_RAWCHUNK(3)