ELF32_GETSHDR(3ELF) ELF Library Functions ELF32_GETSHDR(3ELF)
elf32_getshdr, elf64_getshdr - retrieve class-dependent section
header
cc [ flag ... ] file ... -lelf [ library ... ]
#include <libelf.h>
Elf32_Shdr *elf32_getshdr(Elf_Scn *scn);
Elf64_Shdr *elf64_getshdr(Elf_Scn *scn);
For a 32-bit class file, elf32_getshdr() returns a pointer to a
section header for the section descriptor scn. Otherwise, the file is
not a 32-bit class file, scn was NULL, or an error occurred;
elf32_getshdr() then returns NULL.
The elf32_getshdr header includes the following members:
Elf32_Word sh_name;
Elf32_Word sh_type;
Elf32_Word sh_flags;
Elf32_Addr sh_addr;
Elf32_Off sh_offset;
Elf32_Word sh_size;
Elf32_Word sh_link;
Elf32_Word sh_info;
Elf32_Word sh_addralign;
Elf32_Word sh_entsize;
while the elf64_getshdr header includes the following members:
Elf64_Word sh_name;
Elf64_Word sh_type;
Elf64_Xword sh_flags;
Elf64_Addr sh_addr;
Elf64_Off sh_offset;
Elf64_Xword sh_size;
Elf64_Word sh_link;
Elf64_Word sh_info;
Elf64_Xword sh_addralign;
Elf64_Xword sh_entsize;
For the 64-bit class, replace 32 with 64 as appropriate.
If the program is building a new file, it is responsible for creating
the file's ELF header before creating sections.
See attributes(7) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Interface Stability | Stable |
+--------------------+-----------------+
|MT-Level | MT-Safe |
+--------------------+-----------------+
elf(3ELF), elf_flagdata(3ELF), elf_getscn(3ELF), elf_strptr(3ELF),
libelf(3LIB), attributes(7)
July 11, 2001 ELF32_GETSHDR(3ELF)
NAME
elf32_getshdr, elf64_getshdr - retrieve class-dependent section
header
SYNOPSIS
cc [ flag ... ] file ... -lelf [ library ... ]
#include <libelf.h>
Elf32_Shdr *elf32_getshdr(Elf_Scn *scn);
Elf64_Shdr *elf64_getshdr(Elf_Scn *scn);
DESCRIPTION
For a 32-bit class file, elf32_getshdr() returns a pointer to a
section header for the section descriptor scn. Otherwise, the file is
not a 32-bit class file, scn was NULL, or an error occurred;
elf32_getshdr() then returns NULL.
The elf32_getshdr header includes the following members:
Elf32_Word sh_name;
Elf32_Word sh_type;
Elf32_Word sh_flags;
Elf32_Addr sh_addr;
Elf32_Off sh_offset;
Elf32_Word sh_size;
Elf32_Word sh_link;
Elf32_Word sh_info;
Elf32_Word sh_addralign;
Elf32_Word sh_entsize;
while the elf64_getshdr header includes the following members:
Elf64_Word sh_name;
Elf64_Word sh_type;
Elf64_Xword sh_flags;
Elf64_Addr sh_addr;
Elf64_Off sh_offset;
Elf64_Xword sh_size;
Elf64_Word sh_link;
Elf64_Word sh_info;
Elf64_Xword sh_addralign;
Elf64_Xword sh_entsize;
For the 64-bit class, replace 32 with 64 as appropriate.
If the program is building a new file, it is responsible for creating
the file's ELF header before creating sections.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Interface Stability | Stable |
+--------------------+-----------------+
|MT-Level | MT-Safe |
+--------------------+-----------------+
SEE ALSO
elf(3ELF), elf_flagdata(3ELF), elf_getscn(3ELF), elf_strptr(3ELF),
libelf(3LIB), attributes(7)
July 11, 2001 ELF32_GETSHDR(3ELF)