@@ -51,7 +51,6 @@ typedef int64_t elf64_sxword;
51
51
/** Unsigned long integer */
52
52
typedef uint64_t elf64_xword ;
53
53
54
-
55
54
/**
56
55
* @brief ELF identifier block
57
56
*
@@ -134,13 +133,13 @@ struct elf64_ehdr {
134
133
};
135
134
136
135
/** Relocatable (unlinked) ELF */
137
- #define ET_REL 1
136
+ #define ET_REL 1
138
137
139
138
/** Executable (without PIC/PIE) ELF */
140
139
#define ET_EXEC 2
141
140
142
141
/** Dynamic (executable with PIC/PIE or shared lib) ELF */
143
- #define ET_DYN 3
142
+ #define ET_DYN 3
144
143
145
144
/** Core Dump */
146
145
#define ET_CORE 4
@@ -198,26 +197,26 @@ struct elf64_shdr {
198
197
};
199
198
200
199
/** ELF section types */
201
- #define SHT_NULL 0x0 /**< Unused section */
202
- #define SHT_PROGBITS 0x1 /**< Program data */
203
- #define SHT_SYMTAB 0x2 /**< Symbol table */
204
- #define SHT_STRTAB 0x3 /**< String table */
205
- #define SHT_RELA 0x4 /**< Relocation entries with addends */
206
- #define SHT_NOBITS 0x8 /**< Program data with no file image */
207
- #define SHT_REL 0x9 /**< Relocation entries without addends */
208
- #define SHT_DYNSYM 0xB /**< Dynamic linking symbol table */
209
- #define SHT_INIT_ARRAY 0xe /**< Array of pointers to init functions */
210
- #define SHT_FINI_ARRAY 0xf /**< Array of pointers to termination functions */
211
- #define SHT_PREINIT_ARRAY 0x10 /**< Array of pointers to early init functions */
200
+ #define SHT_NULL 0x0 /**< Unused section */
201
+ #define SHT_PROGBITS 0x1 /**< Program data */
202
+ #define SHT_SYMTAB 0x2 /**< Symbol table */
203
+ #define SHT_STRTAB 0x3 /**< String table */
204
+ #define SHT_RELA 0x4 /**< Relocation entries with addends */
205
+ #define SHT_NOBITS 0x8 /**< Program data with no file image */
206
+ #define SHT_REL 0x9 /**< Relocation entries without addends */
207
+ #define SHT_DYNSYM 0xB /**< Dynamic linking symbol table */
208
+ #define SHT_INIT_ARRAY 0xe /**< Array of pointers to init functions */
209
+ #define SHT_FINI_ARRAY 0xf /**< Array of pointers to termination functions */
210
+ #define SHT_PREINIT_ARRAY 0x10 /**< Array of pointers to early init functions */
212
211
213
212
/** ELF section flags */
214
- #define SHF_WRITE 0x1 /**< Section is writable */
215
- #define SHF_ALLOC 0x2 /**< Section is present in memory */
216
- #define SHF_EXECINSTR 0x4 /**< Section contains executable instructions */
217
- #define SHF_MASKOS 0x0ff00000 /**< OS specific flags */
213
+ #define SHF_WRITE 0x1 /**< Section is writable */
214
+ #define SHF_ALLOC 0x2 /**< Section is present in memory */
215
+ #define SHF_EXECINSTR 0x4 /**< Section contains executable instructions */
216
+ #define SHF_MASKOS 0x0ff00000 /**< OS specific flags */
218
217
#define SHF_LLEXT_HAS_RELOCS 0x00100000 /**< Section is a target for relocations */
219
218
220
- #define SHF_BASIC_TYPE_MASK (SHF_WRITE | SHF_ALLOC | SHF_EXECINSTR)
219
+ #define SHF_BASIC_TYPE_MASK (SHF_WRITE | SHF_ALLOC | SHF_EXECINSTR)
221
220
222
221
/**
223
222
* @brief Symbol table entry(32-bit)
@@ -256,32 +255,32 @@ struct elf64_sym {
256
255
};
257
256
258
257
/** ELF section numbers */
259
- #define SHN_UNDEF 0 /**< Undefined section */
260
- #define SHN_LORESERVE 0xff00 /**< Start of reserved section numbers */
261
- #define SHN_ABS 0xfff1 /**< Special value for absolute symbols */
262
- #define SHN_COMMON 0xfff2 /**< Common block */
263
- #define SHN_HIRESERVE 0xffff /**< End of reserved section numbers */
258
+ #define SHN_UNDEF 0 /**< Undefined section */
259
+ #define SHN_LORESERVE 0xff00 /**< Start of reserved section numbers */
260
+ #define SHN_ABS 0xfff1 /**< Special value for absolute symbols */
261
+ #define SHN_COMMON 0xfff2 /**< Common block */
262
+ #define SHN_HIRESERVE 0xffff /**< End of reserved section numbers */
264
263
265
264
/** Symbol table entry types */
266
- #define STT_NOTYPE 0 /**< No type */
267
- #define STT_OBJECT 1 /**< Data or object */
268
- #define STT_FUNC 2 /**< Function */
269
- #define STT_SECTION 3 /**< Section */
270
- #define STT_FILE 4 /**< File name */
271
- #define STT_COMMON 5 /**< Common block */
272
- #define STT_LOOS 10 /**< Start of OS specific */
273
- #define STT_HIOS 12 /**< End of OS specific */
274
- #define STT_LOPROC 13 /**< Start of processor specific */
275
- #define STT_HIPROC 15 /**< End of processor specific */
265
+ #define STT_NOTYPE 0 /**< No type */
266
+ #define STT_OBJECT 1 /**< Data or object */
267
+ #define STT_FUNC 2 /**< Function */
268
+ #define STT_SECTION 3 /**< Section */
269
+ #define STT_FILE 4 /**< File name */
270
+ #define STT_COMMON 5 /**< Common block */
271
+ #define STT_LOOS 10 /**< Start of OS specific */
272
+ #define STT_HIOS 12 /**< End of OS specific */
273
+ #define STT_LOPROC 13 /**< Start of processor specific */
274
+ #define STT_HIPROC 15 /**< End of processor specific */
276
275
277
276
/** Symbol table entry bindings */
278
- #define STB_LOCAL 0 /**< Local symbol */
279
- #define STB_GLOBAL 1 /**< Global symbol */
280
- #define STB_WEAK 2 /**< Weak symbol */
281
- #define STB_LOOS 10 /**< Start of OS specific */
282
- #define STB_HIOS 12 /**< End of OS specific */
283
- #define STB_LOPROC 13 /**< Start of processor specific */
284
- #define STB_HIPROC 15 /**< End of processor specific */
277
+ #define STB_LOCAL 0 /**< Local symbol */
278
+ #define STB_GLOBAL 1 /**< Global symbol */
279
+ #define STB_WEAK 2 /**< Weak symbol */
280
+ #define STB_LOOS 10 /**< Start of OS specific */
281
+ #define STB_HIOS 12 /**< End of OS specific */
282
+ #define STB_LOPROC 13 /**< Start of processor specific */
283
+ #define STB_HIPROC 15 /**< End of processor specific */
285
284
286
285
/**
287
286
* @brief Symbol binding from 32bit st_info
@@ -304,7 +303,6 @@ struct elf64_sym {
304
303
*/
305
304
#define ELF64_ST_BIND (i ) ((i) >> 4)
306
305
307
-
308
306
/**
309
307
* @brief Symbol type from 32bit st_info
310
308
*
@@ -404,28 +402,28 @@ struct elf64_rela {
404
402
* @brief Program header(32-bit)
405
403
*/
406
404
struct elf32_phdr {
407
- elf32_word p_type ; /**< Type of segment */
408
- elf32_off p_offset ; /**< Offset in file */
409
- elf32_addr p_vaddr ; /**< Virtual address in memory */
410
- elf32_addr p_paddr ; /**< Physical address (usually reserved) */
411
- elf32_word p_filesz ; /**< Size of segment in file */
412
- elf32_word p_memsz ; /**< Size of segment in memory */
413
- elf32_word p_flags ; /**< Segment flags */
414
- elf32_word p_align ; /**< Alignment of segment */
405
+ elf32_word p_type ; /**< Type of segment */
406
+ elf32_off p_offset ; /**< Offset in file */
407
+ elf32_addr p_vaddr ; /**< Virtual address in memory */
408
+ elf32_addr p_paddr ; /**< Physical address (usually reserved) */
409
+ elf32_word p_filesz ; /**< Size of segment in file */
410
+ elf32_word p_memsz ; /**< Size of segment in memory */
411
+ elf32_word p_flags ; /**< Segment flags */
412
+ elf32_word p_align ; /**< Alignment of segment */
415
413
};
416
414
417
415
/**
418
416
* @brief Program header(64-bit)
419
417
*/
420
418
struct elf64_phdr {
421
- elf64_word p_type ; /**< Type of segment */
422
- elf64_off p_offset ; /**< Offset in file */
423
- elf64_addr p_vaddr ; /**< Virtual address in memory */
424
- elf64_addr p_paddr ; /**< Physical address (usually reserved) */
425
- elf64_xword p_filesz ; /**< Size of segment in file */
426
- elf64_xword p_memsz ; /**< Size of segment in memory */
427
- elf64_word p_flags ; /**< Segment flags */
428
- elf64_xword p_align ; /**< Alignment of segment */
419
+ elf64_word p_type ; /**< Type of segment */
420
+ elf64_off p_offset ; /**< Offset in file */
421
+ elf64_addr p_vaddr ; /**< Virtual address in memory */
422
+ elf64_addr p_paddr ; /**< Physical address (usually reserved) */
423
+ elf64_xword p_filesz ; /**< Size of segment in file */
424
+ elf64_xword p_memsz ; /**< Size of segment in memory */
425
+ elf64_word p_flags ; /**< Segment flags */
426
+ elf64_xword p_align ; /**< Alignment of segment */
429
427
};
430
428
431
429
/**
@@ -437,21 +435,21 @@ struct elf64_phdr {
437
435
* @brief Dynamic section entry(32-bit)
438
436
*/
439
437
struct elf32_dyn {
440
- elf32_sword d_tag ; /**< Entry tag */
438
+ elf32_sword d_tag ; /**< Entry tag */
441
439
union {
442
- elf32_word d_val ; /**< Integer value */
443
- elf32_addr d_ptr ; /**< Address value */
440
+ elf32_word d_val ; /**< Integer value */
441
+ elf32_addr d_ptr ; /**< Address value */
444
442
} d_un ;
445
443
};
446
444
447
445
/**
448
446
* @brief Dynamic section entry(64-bit)
449
447
*/
450
448
struct elf64_dyn {
451
- elf64_sxword d_tag ; /**< Entry tag */
449
+ elf64_sxword d_tag ; /**< Entry tag */
452
450
union {
453
- elf64_xword d_val ; /**< Integer value */
454
- elf64_addr d_ptr ; /**< Address value */
451
+ elf64_xword d_val ; /**< Integer value */
452
+ elf64_addr d_ptr ; /**< Address value */
455
453
} d_un ;
456
454
};
457
455
/** @endcond */
@@ -476,9 +474,9 @@ typedef struct elf64_rela elf_rela_t;
476
474
/** Machine sized symbol struct */
477
475
typedef struct elf64_sym elf_sym_t ;
478
476
/** Machine sized macro alias for obtaining a relocation symbol */
479
- #define ELF_R_SYM ELF64_R_SYM
477
+ #define ELF_R_SYM ELF64_R_SYM
480
478
/** Machine sized macro alias for obtaining a relocation type */
481
- #define ELF_R_TYPE ELF64_R_TYPE
479
+ #define ELF_R_TYPE ELF64_R_TYPE
482
480
/** Machine sized macro alias for obtaining a symbol bind */
483
481
#define ELF_ST_BIND ELF64_ST_BIND
484
482
/** Machine sized macro alias for obtaining a symbol type */
@@ -503,9 +501,9 @@ typedef struct elf32_rela elf_rela_t;
503
501
/** Machine sized symbol struct */
504
502
typedef struct elf32_sym elf_sym_t ;
505
503
/** Machine sized macro alias for obtaining a relocation symbol */
506
- #define ELF_R_SYM ELF32_R_SYM
504
+ #define ELF_R_SYM ELF32_R_SYM
507
505
/** Machine sized macro alias for obtaining a relocation type */
508
- #define ELF_R_TYPE ELF32_R_TYPE
506
+ #define ELF_R_TYPE ELF32_R_TYPE
509
507
/** Machine sized macro alias for obtaining a symbol bind */
510
508
#define ELF_ST_BIND ELF32_ST_BIND
511
509
/** Machine sized macro alias for obtaining a symbol type */
0 commit comments