ELF Library Functions elfflagdata(3ELF)
NAME
elfflagdata, elfflagehdr, elfflagelf, elfflagphdr,
elfflagscn, elfflagshdr - manipulate flags
SYNOPSIS
cc [ flag ... ] file ... -lelf [ library ... ]
#include
unsigned elfflagdata(ElfData *data, ElfCmd cmd, unsigned flags);
unsigned elfflagehdr(Elf *elf, ElfCmd cmd, unsigned flags);
unsigned elfflagelf(Elf *elf, ElfCmd cmd, unsigned flags);
unsigned elfflagphdr(Elf *elf, ElfCmd cmd, unsigned flags);
unsigned elfflagscn(ElfScn *scn, ElfCmd cmd, unsigned flags);
unsigned elfflagshdr(ElfScn *scn, ElfCmd cmd, unsigned flags);
DESCRIPTION
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 0 for this
degenerate case.
cmd may have the following values:
ELFCLR The functions clear the bits that are asserted
in flags. Only the non-zero bits in flags are
cleared; zero bits do not change the status of
the descriptor.
ELFCSET The functions set the bits that are asserted in
flags. Only the non-zero bits in flags are set;
zero bits do not change the status of the
descriptor.
SunOS 5.11 Last change: 11 Jul 2001 1
ELF Library Functions elfflagdata(3ELF)
Descriptions of the defined flags bits appear below:
ELFDIRTY When the program intends to write an ELF
file, this flag asserts the associated
information needs to be written to the file.
Thus, for example, a program that wished to
update the ELF header of an existing file
would call elfflagehdr() with this bit set
in flags and cmd equal to ELFCSET. A later
call to elfupdate() would write the marked
header to the file.
ELFLAYOUT Normally, the library decides how to arrange
an output file. That is, it automatically
decides where to place sections, how to
align them in the file, etc. If this bit is
set for an ELF descriptor, the program
assumes responsibility for determining all
file positions. This bit is meaningful only
for elfflagelf() and applies to the entire
file associated with the descriptor.
When a flag bit is set for an item, it affects all the subi-
tems as well. Thus, for example, if the program sets the
ELFDIRTY bit with elfflagelf(), the entire logical file
is ``dirty.''
EXAMPLES
Example 1 A sample display of calling the elfflagdata()
function.
The following fragment shows how one might mark the ELF
header to be written to the output file:
/* dirty ehdr ... */
ehdr = elf32getehdr(elf);
elfflagehdr(elf, ELFCSET, ELFDIRTY);
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
SunOS 5.11 Last change: 11 Jul 2001 2
ELF Library Functions elfflagdata(3ELF)
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Stable
MT-Level MT-Safe
SEE ALSO
elf(3ELF), elf32getehdr(3ELF), elfgetdata(3ELF),
elfupdate(3ELF), attributes(5)
SunOS 5.11 Last change: 11 Jul 2001 3
|