|
|
|||
File indexing completed on 2026-03-30 08:34:23
0001 /* Interface for libelf. 0002 Copyright (C) 1998-2010, 2015 Red Hat, Inc. 0003 This file is part of elfutils. 0004 0005 This file is free software; you can redistribute it and/or modify 0006 it under the terms of either 0007 0008 * the GNU Lesser General Public License as published by the Free 0009 Software Foundation; either version 3 of the License, or (at 0010 your option) any later version 0011 0012 or 0013 0014 * the GNU General Public License as published by the Free 0015 Software Foundation; either version 2 of the License, or (at 0016 your option) any later version 0017 0018 or both in parallel, as here. 0019 0020 elfutils is distributed in the hope that it will be useful, but 0021 WITHOUT ANY WARRANTY; without even the implied warranty of 0022 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0023 General Public License for more details. 0024 0025 You should have received copies of the GNU General Public License and 0026 the GNU Lesser General Public License along with this program. If 0027 not, see <http://www.gnu.org/licenses/>. */ 0028 0029 #ifndef _LIBELF_H 0030 #define _LIBELF_H 1 0031 0032 #include <stdint.h> 0033 #include <sys/types.h> 0034 0035 /* Get the ELF types. */ 0036 #include <elf.h> 0037 0038 #ifndef SHF_COMPRESSED 0039 /* Older glibc elf.h might not yet define the ELF compression types. */ 0040 #define SHF_COMPRESSED (1 << 11) /* Section with compressed data. */ 0041 0042 /* Section compression header. Used when SHF_COMPRESSED is set. */ 0043 0044 typedef struct 0045 { 0046 Elf32_Word ch_type; /* Compression format. */ 0047 Elf32_Word ch_size; /* Uncompressed data size. */ 0048 Elf32_Word ch_addralign; /* Uncompressed data alignment. */ 0049 } Elf32_Chdr; 0050 0051 typedef struct 0052 { 0053 Elf64_Word ch_type; /* Compression format. */ 0054 Elf64_Word ch_reserved; 0055 Elf64_Xword ch_size; /* Uncompressed data size. */ 0056 Elf64_Xword ch_addralign; /* Uncompressed data alignment. */ 0057 } Elf64_Chdr; 0058 0059 /* Legal values for ch_type (compression algorithm). */ 0060 #define ELFCOMPRESS_ZLIB 1 /* ZLIB/DEFLATE algorithm. */ 0061 #define ELFCOMPRESS_LOOS 0x60000000 /* Start of OS-specific. */ 0062 #define ELFCOMPRESS_HIOS 0x6fffffff /* End of OS-specific. */ 0063 #define ELFCOMPRESS_LOPROC 0x70000000 /* Start of processor-specific. */ 0064 #define ELFCOMPRESS_HIPROC 0x7fffffff /* End of processor-specific. */ 0065 #endif 0066 0067 #ifndef ELFCOMPRESS_ZSTD 0068 /* So ZSTD compression can be used even with an old system elf.h. */ 0069 #define ELFCOMPRESS_ZSTD 2 /* Zstandard algorithm. */ 0070 #endif 0071 0072 #ifndef SHT_RELR 0073 /* So RELR defines/typedefs can be used even with an old system elf.h. */ 0074 #define SHT_RELR 19 /* RELR relative relocations */ 0075 0076 /* RELR relocation table entry */ 0077 typedef Elf32_Word Elf32_Relr; 0078 typedef Elf64_Xword Elf64_Relr; 0079 0080 #define DT_RELRSZ 35 /* Total size of RELR relative relocations */ 0081 #define DT_RELR 36 /* Address of RELR relative relocations */ 0082 #define DT_RELRENT 37 /* Size of one RELR relative relocaction */ 0083 #endif 0084 0085 #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) 0086 # define __nonnull_attribute__(...) __attribute__ ((__nonnull__ (__VA_ARGS__))) 0087 # define __deprecated_attribute__ __attribute__ ((__deprecated__)) 0088 # define __pure_attribute__ __attribute__ ((__pure__)) 0089 # define __const_attribute__ __attribute__ ((__const__)) 0090 #else 0091 # define __nonnull_attribute__(...) 0092 # define __deprecated_attribute__ 0093 # define __pure_attribute__ 0094 # define __const_attribute__ 0095 #endif 0096 0097 #if __GNUC__ < 4 0098 #define __noreturn_attribute__ 0099 #else 0100 #define __noreturn_attribute__ __attribute__ ((noreturn)) 0101 #endif 0102 0103 #ifdef __GNUC_STDC_INLINE__ 0104 # define __libdw_extern_inline extern __inline __attribute__ ((__gnu_inline__)) 0105 #else 0106 # define __libdw_extern_inline extern __inline 0107 #endif 0108 0109 /* Known translation types. */ 0110 typedef enum 0111 { 0112 ELF_T_BYTE, /* unsigned char */ 0113 ELF_T_ADDR, /* Elf32_Addr, Elf64_Addr, ... */ 0114 ELF_T_DYN, /* Dynamic section record. */ 0115 ELF_T_EHDR, /* ELF header. */ 0116 ELF_T_HALF, /* Elf32_Half, Elf64_Half, ... */ 0117 ELF_T_OFF, /* Elf32_Off, Elf64_Off, ... */ 0118 ELF_T_PHDR, /* Program header. */ 0119 ELF_T_RELA, /* Relocation entry with addend. */ 0120 ELF_T_REL, /* Relocation entry. */ 0121 ELF_T_SHDR, /* Section header. */ 0122 ELF_T_SWORD, /* Elf32_Sword, Elf64_Sword, ... */ 0123 ELF_T_SYM, /* Symbol record. */ 0124 ELF_T_WORD, /* Elf32_Word, Elf64_Word, ... */ 0125 ELF_T_XWORD, /* Elf32_Xword, Elf64_Xword, ... */ 0126 ELF_T_SXWORD, /* Elf32_Sxword, Elf64_Sxword, ... */ 0127 ELF_T_VDEF, /* Elf32_Verdef, Elf64_Verdef, ... */ 0128 ELF_T_VDAUX, /* Elf32_Verdaux, Elf64_Verdaux, ... */ 0129 ELF_T_VNEED, /* Elf32_Verneed, Elf64_Verneed, ... */ 0130 ELF_T_VNAUX, /* Elf32_Vernaux, Elf64_Vernaux, ... */ 0131 ELF_T_NHDR, /* Elf32_Nhdr, Elf64_Nhdr, ... */ 0132 ELF_T_SYMINFO, /* Elf32_Syminfo, Elf64_Syminfo, ... */ 0133 ELF_T_MOVE, /* Elf32_Move, Elf64_Move, ... */ 0134 ELF_T_LIB, /* Elf32_Lib, Elf64_Lib, ... */ 0135 ELF_T_GNUHASH, /* GNU-style hash section. */ 0136 ELF_T_AUXV, /* Elf32_auxv_t, Elf64_auxv_t, ... */ 0137 ELF_T_CHDR, /* Compressed, Elf32_Chdr, Elf64_Chdr, ... */ 0138 ELF_T_NHDR8, /* Special GNU Properties note. Same as Nhdr, 0139 except padding. */ 0140 ELF_T_RELR, /* Relative relocation entry. */ 0141 /* Keep this the last entry. */ 0142 ELF_T_NUM 0143 } Elf_Type; 0144 0145 /* Descriptor for data to be converted to or from memory format. */ 0146 typedef struct 0147 { 0148 void *d_buf; /* Pointer to the actual data. */ 0149 Elf_Type d_type; /* Type of this piece of data. */ 0150 unsigned int d_version; /* ELF version. */ 0151 size_t d_size; /* Size in bytes. */ 0152 int64_t d_off; /* Offset into section. */ 0153 size_t d_align; /* Alignment in section. */ 0154 } Elf_Data; 0155 0156 0157 /* Commands for `...'. */ 0158 typedef enum 0159 { 0160 ELF_C_NULL, /* Nothing, terminate, or compute only. */ 0161 ELF_C_READ, /* Read .. */ 0162 ELF_C_RDWR, /* Read and write .. */ 0163 ELF_C_WRITE, /* Write .. */ 0164 ELF_C_CLR, /* Clear flag. */ 0165 ELF_C_SET, /* Set flag. */ 0166 ELF_C_FDDONE, /* Signal that file descriptor will not be 0167 used anymore. */ 0168 ELF_C_FDREAD, /* Read rest of data so that file descriptor 0169 is not used anymore. */ 0170 /* The following are extensions. */ 0171 ELF_C_READ_MMAP, /* Read, but mmap the file if possible. */ 0172 ELF_C_RDWR_MMAP, /* Read and write, with mmap. */ 0173 ELF_C_WRITE_MMAP, /* Write, with mmap. */ 0174 ELF_C_READ_MMAP_PRIVATE, /* Read, but memory is writable, results are 0175 not written to the file. */ 0176 ELF_C_EMPTY, /* Copy basic file data but not the content. */ 0177 /* Keep this the last entry. */ 0178 ELF_C_NUM 0179 } Elf_Cmd; 0180 0181 0182 /* Flags for the ELF structures. */ 0183 enum 0184 { 0185 ELF_F_DIRTY = 0x1, 0186 #define ELF_F_DIRTY ELF_F_DIRTY 0187 ELF_F_LAYOUT = 0x4, 0188 #define ELF_F_LAYOUT ELF_F_LAYOUT 0189 ELF_F_PERMISSIVE = 0x8 0190 #define ELF_F_PERMISSIVE ELF_F_PERMISSIVE 0191 }; 0192 0193 /* Flags for elf_compress[_gnu]. */ 0194 enum 0195 { 0196 ELF_CHF_FORCE = 0x1 0197 #define ELF_CHF_FORCE ELF_CHF_FORCE 0198 }; 0199 0200 /* Identification values for recognized object files. */ 0201 typedef enum 0202 { 0203 ELF_K_NONE, /* Unknown. */ 0204 ELF_K_AR, /* Archive. */ 0205 ELF_K_COFF, /* Stupid old COFF. */ 0206 ELF_K_ELF, /* ELF file. */ 0207 /* Keep this the last entry. */ 0208 ELF_K_NUM 0209 } Elf_Kind; 0210 0211 0212 /* Archive member header. */ 0213 typedef struct 0214 { 0215 char *ar_name; /* Name of archive member. */ 0216 time_t ar_date; /* File date. */ 0217 uid_t ar_uid; /* User ID. */ 0218 gid_t ar_gid; /* Group ID. */ 0219 mode_t ar_mode; /* File mode. */ 0220 int64_t ar_size; /* File size. */ 0221 char *ar_rawname; /* Original name of archive member. */ 0222 } Elf_Arhdr; 0223 0224 0225 /* Archive symbol table entry. */ 0226 typedef struct 0227 { 0228 char *as_name; /* Symbol name. */ 0229 size_t as_off; /* Offset for this file in the archive. */ 0230 unsigned long int as_hash; /* Hash value of the name. */ 0231 } Elf_Arsym; 0232 0233 0234 /* Descriptor for the ELF file. */ 0235 typedef struct Elf Elf; 0236 0237 /* Descriptor for ELF file section. */ 0238 typedef struct Elf_Scn Elf_Scn; 0239 0240 0241 #ifdef __cplusplus 0242 extern "C" { 0243 #endif 0244 0245 /* Return descriptor for ELF file to work according to CMD. */ 0246 extern Elf *elf_begin (int __fildes, Elf_Cmd __cmd, Elf *__ref); 0247 0248 /* Create a clone of an existing ELF descriptor. */ 0249 extern Elf *elf_clone (Elf *__elf, Elf_Cmd __cmd); 0250 0251 /* Create descriptor for memory region. */ 0252 extern Elf *elf_memory (char *__image, size_t __size); 0253 0254 /* Advance archive descriptor to next element. */ 0255 extern Elf_Cmd elf_next (Elf *__elf); 0256 0257 /* Free resources allocated for ELF. */ 0258 extern int elf_end (Elf *__elf); 0259 0260 /* Update ELF descriptor and write file to disk. */ 0261 extern int64_t elf_update (Elf *__elf, Elf_Cmd __cmd); 0262 0263 /* Determine what kind of file is associated with ELF. */ 0264 extern Elf_Kind elf_kind (Elf *__elf) __pure_attribute__; 0265 0266 /* Get the base offset for an object file. */ 0267 extern int64_t elf_getbase (Elf *__elf); 0268 0269 0270 /* Retrieve file identification data. */ 0271 extern char *elf_getident (Elf *__elf, size_t *__nbytes); 0272 0273 /* Retrieve class-dependent object file header. */ 0274 extern Elf32_Ehdr *elf32_getehdr (Elf *__elf); 0275 /* Similar but this time the binary calls is ELFCLASS64. */ 0276 extern Elf64_Ehdr *elf64_getehdr (Elf *__elf); 0277 0278 /* Create ELF header if none exists. */ 0279 extern Elf32_Ehdr *elf32_newehdr (Elf *__elf); 0280 /* Similar but this time the binary calls is ELFCLASS64. */ 0281 extern Elf64_Ehdr *elf64_newehdr (Elf *__elf); 0282 0283 /* Get the number of program headers in the ELF file. If the file uses 0284 more headers than can be represented in the e_phnum field of the ELF 0285 header the information from the sh_info field in the zeroth section 0286 header is used. */ 0287 extern int elf_getphdrnum (Elf *__elf, size_t *__dst); 0288 0289 /* Retrieve class-dependent program header table. */ 0290 extern Elf32_Phdr *elf32_getphdr (Elf *__elf); 0291 /* Similar but this time the binary calls is ELFCLASS64. */ 0292 extern Elf64_Phdr *elf64_getphdr (Elf *__elf); 0293 0294 /* Create ELF program header. */ 0295 extern Elf32_Phdr *elf32_newphdr (Elf *__elf, size_t __cnt); 0296 /* Similar but this time the binary calls is ELFCLASS64. */ 0297 extern Elf64_Phdr *elf64_newphdr (Elf *__elf, size_t __cnt); 0298 0299 0300 /* Get section at INDEX. */ 0301 extern Elf_Scn *elf_getscn (Elf *__elf, size_t __index); 0302 0303 /* Get section at OFFSET. */ 0304 extern Elf_Scn *elf32_offscn (Elf *__elf, Elf32_Off __offset); 0305 /* Similar but this time the binary calls is ELFCLASS64. */ 0306 extern Elf_Scn *elf64_offscn (Elf *__elf, Elf64_Off __offset); 0307 0308 /* Get index of section. */ 0309 extern size_t elf_ndxscn (Elf_Scn *__scn); 0310 0311 /* Get section with next section index. */ 0312 extern Elf_Scn *elf_nextscn (Elf *__elf, Elf_Scn *__scn); 0313 0314 /* Create a new section and append it at the end of the table. */ 0315 extern Elf_Scn *elf_newscn (Elf *__elf); 0316 0317 /* Get the section index of the extended section index table for the 0318 given symbol table. Returns -1 when the given Elf_Scn is NULL or 0319 if an error occurred during lookup, elf_errno will be set. Returns 0320 0 if the given Elf_Scn isn't a symbol table (sh_type is not 0321 SHT_SYMTAB) or no extended section index table could be 0322 found. Otherwise the section index of the extended section index 0323 table for the given Elf_Scn is returned. An extended index table 0324 has a sh_type of SHT_SYMTAB_SHNDX and a sh_link equal to the given 0325 symbol table section index. */ 0326 extern int elf_scnshndx (Elf_Scn *__scn); 0327 0328 /* Get the number of sections in the ELF file. If the file uses more 0329 sections than can be represented in the e_shnum field of the ELF 0330 header the information from the sh_size field in the zeroth section 0331 header is used. */ 0332 extern int elf_getshdrnum (Elf *__elf, size_t *__dst); 0333 /* Sun messed up the implementation of 'elf_getshnum' in their implementation. 0334 It was agreed to make the same functionality available under a different 0335 name and obsolete the old name. */ 0336 extern int elf_getshnum (Elf *__elf, size_t *__dst) 0337 __deprecated_attribute__; 0338 0339 0340 /* Get the section index of the section header string table in the ELF 0341 file. If the index cannot be represented in the e_shstrndx field of 0342 the ELF header the information from the sh_link field in the zeroth 0343 section header is used. */ 0344 extern int elf_getshdrstrndx (Elf *__elf, size_t *__dst); 0345 /* Sun messed up the implementation of 'elf_getshstrndx' in their 0346 implementation. It was agreed to make the same functionality available 0347 under a different name and obsolete the old name. */ 0348 extern int elf_getshstrndx (Elf *__elf, size_t *__dst) 0349 __deprecated_attribute__; 0350 0351 0352 /* Retrieve section header of ELFCLASS32 binary. */ 0353 extern Elf32_Shdr *elf32_getshdr (Elf_Scn *__scn); 0354 /* Similar for ELFCLASS64. */ 0355 extern Elf64_Shdr *elf64_getshdr (Elf_Scn *__scn); 0356 0357 /* Returns compression header for a section if section data is 0358 compressed. Returns NULL and sets elf_errno if the section isn't 0359 compressed or an error occurred. */ 0360 extern Elf32_Chdr *elf32_getchdr (Elf_Scn *__scn); 0361 extern Elf64_Chdr *elf64_getchdr (Elf_Scn *__scn); 0362 0363 /* Compress or decompress the data of a section and adjust the section 0364 header. 0365 0366 elf_compress works by setting or clearing the SHF_COMPRESS flag 0367 from the section Shdr and will encode or decode a Elf32_Chdr or 0368 Elf64_Chdr at the start of the section data. elf_compress_gnu will 0369 encode or decode any section, but is traditionally only used for 0370 sections that have a name starting with ".debug" when 0371 uncompressed or ".zdebug" when compressed and stores just the 0372 uncompressed size. The GNU compression method is deprecated and 0373 should only be used for legacy support. 0374 0375 elf_compress takes a compression type that should be either zero to 0376 decompress or an ELFCOMPRESS algorithm to use for compression. 0377 Currently ELFCOMPRESS_ZLIB and ELFCOMPRESS_ZSTD are supported. 0378 elf_compress_gnu will compress in the traditional GNU compression 0379 format when compress is one and decompress the section data when 0380 compress is zero. 0381 0382 The FLAGS argument can be zero or ELF_CHF_FORCE. If FLAGS contains 0383 ELF_CHF_FORCE then it will always compress the section, even if 0384 that would not reduce the size of the data section (including the 0385 header). Otherwise elf_compress and elf_compress_gnu will compress 0386 the section only if the total data size is reduced. 0387 0388 On successful compression or decompression the function returns 0389 one. If (not forced) compression is requested and the data section 0390 would not actually reduce in size, the section is not actually 0391 compressed and zero is returned. Otherwise -1 is returned and 0392 elf_errno is set. 0393 0394 It is an error to request compression for a section that already 0395 has SHF_COMPRESSED set, or (for elf_compress) to request 0396 decompression for an section that doesn't have SHF_COMPRESSED set. 0397 If a section has SHF_COMPRESSED set then calling elf_compress_gnu 0398 will result in an error. The section has to be decompressed first 0399 using elf_compress. Calling elf_compress on a section compressed 0400 with elf_compress_gnu is fine, but probably useless. 0401 0402 It is always an error to call these functions on SHT_NOBITS 0403 sections or if the section has the SHF_ALLOC flag set. 0404 elf_compress_gnu will not check whether the section name starts 0405 with ".debug" or .zdebug". It is the responsibility of the caller 0406 to make sure the deprecated GNU compression method is only called 0407 on correctly named sections (and to change the name of the section 0408 when using elf_compress_gnu). 0409 0410 All previous returned Shdrs and Elf_Data buffers are invalidated by 0411 this call and should no longer be accessed. 0412 0413 Note that although this changes the header and data returned it 0414 doesn't mark the section as dirty. To keep the changes when 0415 calling elf_update the section has to be flagged ELF_F_DIRTY. */ 0416 extern int elf_compress (Elf_Scn *scn, int type, unsigned int flags); 0417 extern int elf_compress_gnu (Elf_Scn *scn, int compress, unsigned int flags); 0418 0419 /* Set or clear flags for ELF file. */ 0420 extern unsigned int elf_flagelf (Elf *__elf, Elf_Cmd __cmd, 0421 unsigned int __flags); 0422 /* Similarly for the ELF header. */ 0423 extern unsigned int elf_flagehdr (Elf *__elf, Elf_Cmd __cmd, 0424 unsigned int __flags); 0425 /* Similarly for the ELF program header. */ 0426 extern unsigned int elf_flagphdr (Elf *__elf, Elf_Cmd __cmd, 0427 unsigned int __flags); 0428 /* Similarly for the given ELF section. */ 0429 extern unsigned int elf_flagscn (Elf_Scn *__scn, Elf_Cmd __cmd, 0430 unsigned int __flags); 0431 /* Similarly for the given ELF data. */ 0432 extern unsigned int elf_flagdata (Elf_Data *__data, Elf_Cmd __cmd, 0433 unsigned int __flags); 0434 /* Similarly for the given ELF section header. */ 0435 extern unsigned int elf_flagshdr (Elf_Scn *__scn, Elf_Cmd __cmd, 0436 unsigned int __flags); 0437 0438 0439 /* Get data from section while translating from file representation to 0440 memory representation. The Elf_Data d_type is set based on the 0441 section type if known. Otherwise d_type is set to ELF_T_BYTE. If 0442 the section contains compressed data then d_type is always set to 0443 ELF_T_CHDR. */ 0444 extern Elf_Data *elf_getdata (Elf_Scn *__scn, Elf_Data *__data); 0445 0446 /* Get uninterpreted section content. */ 0447 extern Elf_Data *elf_rawdata (Elf_Scn *__scn, Elf_Data *__data); 0448 0449 /* Create new data descriptor for section SCN. */ 0450 extern Elf_Data *elf_newdata (Elf_Scn *__scn); 0451 0452 /* Get data translated from a chunk of the file contents as section data 0453 would be for TYPE. The resulting Elf_Data pointer is valid until 0454 elf_end (ELF) is called. */ 0455 extern Elf_Data *elf_getdata_rawchunk (Elf *__elf, 0456 int64_t __offset, size_t __size, 0457 Elf_Type __type); 0458 0459 0460 /* Return pointer to string at OFFSET in section INDEX. */ 0461 extern char *elf_strptr (Elf *__elf, size_t __index, size_t __offset); 0462 0463 0464 /* Return header of archive. */ 0465 extern Elf_Arhdr *elf_getarhdr (Elf *__elf); 0466 0467 /* Return offset in archive for current file ELF. */ 0468 extern int64_t elf_getaroff (Elf *__elf); 0469 0470 /* Select archive element at OFFSET. */ 0471 extern size_t elf_rand (Elf *__elf, size_t __offset); 0472 0473 /* Get symbol table of archive. */ 0474 extern Elf_Arsym *elf_getarsym (Elf *__elf, size_t *__narsyms); 0475 0476 0477 /* Control ELF descriptor. */ 0478 extern int elf_cntl (Elf *__elf, Elf_Cmd __cmd); 0479 0480 /* Retrieve uninterpreted file contents. */ 0481 extern char *elf_rawfile (Elf *__elf, size_t *__nbytes); 0482 0483 0484 /* Return size of array of COUNT elements of the type denoted by TYPE 0485 in the external representation. The binary class is taken from ELF. 0486 The result is based on version VERSION of the ELF standard. */ 0487 extern size_t elf32_fsize (Elf_Type __type, size_t __count, 0488 unsigned int __version) 0489 __const_attribute__; 0490 /* Similar but this time the binary calls is ELFCLASS64. */ 0491 extern size_t elf64_fsize (Elf_Type __type, size_t __count, 0492 unsigned int __version) 0493 __const_attribute__; 0494 0495 0496 /* Convert data structure from the representation in the file represented 0497 by ELF to their memory representation. */ 0498 extern Elf_Data *elf32_xlatetom (Elf_Data *__dest, const Elf_Data *__src, 0499 unsigned int __encode); 0500 /* Same for 64 bit class. */ 0501 extern Elf_Data *elf64_xlatetom (Elf_Data *__dest, const Elf_Data *__src, 0502 unsigned int __encode); 0503 0504 /* Convert data structure from to the representation in memory 0505 represented by ELF file representation. */ 0506 extern Elf_Data *elf32_xlatetof (Elf_Data *__dest, const Elf_Data *__src, 0507 unsigned int __encode); 0508 /* Same for 64 bit class. */ 0509 extern Elf_Data *elf64_xlatetof (Elf_Data *__dest, const Elf_Data *__src, 0510 unsigned int __encode); 0511 0512 0513 /* Return error code of last failing function call. This value is kept 0514 separately for each thread. */ 0515 extern int elf_errno (void); 0516 0517 /* Return error string for ERROR. If ERROR is zero, return error string 0518 for most recent error or NULL is none occurred. If ERROR is -1 the 0519 behaviour is similar to the last case except that not NULL but a legal 0520 string is returned. */ 0521 extern const char *elf_errmsg (int __error); 0522 0523 0524 /* Coordinate ELF library and application versions. */ 0525 extern unsigned int elf_version (unsigned int __version); 0526 0527 /* Set fill bytes used to fill holes in data structures. */ 0528 extern void elf_fill (int __fill); 0529 0530 /* Compute hash value. */ 0531 extern unsigned long int elf_hash (const char *__string) 0532 __pure_attribute__; 0533 0534 /* Compute hash value using the GNU-specific hash function. */ 0535 extern unsigned long int elf_gnu_hash (const char *__string) 0536 __pure_attribute__; 0537 0538 0539 /* Compute simple checksum from permanent parts of the ELF file. */ 0540 extern long int elf32_checksum (Elf *__elf); 0541 /* Similar but this time the binary calls is ELFCLASS64. */ 0542 extern long int elf64_checksum (Elf *__elf); 0543 0544 #ifdef __cplusplus 0545 } 0546 #endif 0547 0548 #endif /* libelf.h */
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|