2020-06-15 14:18:57 +00:00
|
|
|
#ifndef COSMOPOLITAN_LIBC_ELF_STRUCT_SHDR_H_
|
|
|
|
#define COSMOPOLITAN_LIBC_ELF_STRUCT_SHDR_H_
|
|
|
|
#include "libc/elf/scalar.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Section header.
|
|
|
|
* @see https://docs.oracle.com/cd/E19683-01/816-1386/chapter6-94076/index.html
|
|
|
|
*/
|
|
|
|
typedef struct Elf64_Shdr {
|
2023-07-02 17:19:16 +00:00
|
|
|
|
2020-06-15 14:18:57 +00:00
|
|
|
Elf64_Word sh_name;
|
2023-07-02 17:19:16 +00:00
|
|
|
|
|
|
|
Elf64_Word sh_type; /* SHT_{PROGBITS,NOBITS,STRTAB,SYMTAB,RELA,...} */
|
|
|
|
|
2023-08-10 01:36:38 +00:00
|
|
|
Elf64_Xword sh_flags; /* SHF_{WRITE,ALLOC,EXECINSTR,TLS,MERGE,STRINGS,,...} */
|
2023-07-02 17:19:16 +00:00
|
|
|
|
2020-06-15 14:18:57 +00:00
|
|
|
Elf64_Addr sh_addr;
|
2023-07-02 17:19:16 +00:00
|
|
|
|
2020-06-15 14:18:57 +00:00
|
|
|
Elf64_Off sh_offset;
|
2023-07-02 17:19:16 +00:00
|
|
|
|
2020-06-15 14:18:57 +00:00
|
|
|
Elf64_Xword sh_size;
|
2023-07-02 17:19:16 +00:00
|
|
|
|
2020-06-15 14:18:57 +00:00
|
|
|
/*
|
2023-07-02 17:19:16 +00:00
|
|
|
* Index of linked section header.
|
|
|
|
*
|
|
|
|
* If `sh_type` is `SHT_RELA` then `sh_link` holds the section header
|
|
|
|
* index of the associated symbol table.
|
|
|
|
*
|
|
|
|
* If `sh_type` is `SHT_SYMTAB` then `sh_link` holds the section
|
|
|
|
* header index of the associated string table.
|
2020-06-15 14:18:57 +00:00
|
|
|
*/
|
|
|
|
Elf64_Word sh_link;
|
2023-07-02 17:19:16 +00:00
|
|
|
|
2020-06-15 14:18:57 +00:00
|
|
|
/*
|
2023-07-02 17:19:16 +00:00
|
|
|
* If `sh_type` is `SHT_RELA` then `sh_info` contains the index of the
|
|
|
|
* section to which relocations apply.
|
|
|
|
*
|
|
|
|
* If `sh_type` is `SHT_SYMTAB` or `SHT_DYNSYM` then `sh_info`
|
|
|
|
* contains an index that's one greater than symbol table index of
|
|
|
|
* last `STB_LOCAL` symbol.
|
2020-06-15 14:18:57 +00:00
|
|
|
*/
|
|
|
|
Elf64_Word sh_info;
|
2023-07-02 17:19:16 +00:00
|
|
|
|
2020-06-15 14:18:57 +00:00
|
|
|
Elf64_Xword sh_addralign;
|
2023-07-02 17:19:16 +00:00
|
|
|
|
2020-06-15 14:18:57 +00:00
|
|
|
Elf64_Xword sh_entsize;
|
2023-07-02 17:19:16 +00:00
|
|
|
|
2020-06-15 14:18:57 +00:00
|
|
|
} Elf64_Shdr;
|
|
|
|
|
|
|
|
#endif /* COSMOPOLITAN_LIBC_ELF_STRUCT_SHDR_H_ */
|