Manipulate flags
cc [flag...]
file... -lelf
[library]...
#include <libelf.h>
unsigned elf_flagdata(elf_Data * data, elf_Cmd cmd, unsigned flags);
unsigned elf_flagehdr(Elf * elf, elf_Cmd cmd, unsigned flags);
unsigned elf_flagelf(Elf * elf, elf_Cmd cmd, unsigned flags);
unsigned elf_flagphdr(Elf * elf, elf_Cmd cmd, unsigned flags);
unsigned elf_flagscn(elf_Scn * scn, elf_Cmd cmd, unsigned flags);
unsigned elf_flagshdr(elf_Scn * scn, elf_Cmd cmd, unsigned flags);
These functions manipulate the flags associated with various structures of an ELF file. Given an ELF descriptor elf, a data descriptor data, or a section descriptor scn, the functions may set or clear the associated status bits, returning the updated bits. A null descriptor is allowed, to simplify error handling; all functions return zero for this degenerate case.
When a flag bit is set for an item, it affects all the sub-items as well. Thus, for example, if the program sets the ELF_F_DIRTY bit with elf_flagelf, the entire logical file is dirty.
The following code fragment shows how to mark the ELF header is it is written to the output file.
ehdr = elf32_getehdr(elf); /* dirty ehdr...*/ elf_flagehdr(elf, ELF_C_SET, ELF_F_DIRTY);
The elf_end subroutine, elf_getdata subroutine, elf32_getehdr subroutine, elf64_getehdr subroutine, elf_update subroutine.
Introduction to ELF Subroutines.