elf_flag(S-osr5)
elf_flag: elf_flagdata, elf_flagehdr, elf_flagelf, elf_flagphdr, elf_flagscn, elf_flagshdr --
manipulate flags
Syntax
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);
Description
elf_flagdata-
set or clear status bits for ELF data
elf_flagehdr-
set or clear status bits for an ELF header
elf_flagelf-
set or clear status bits for an ELF file
elf_flagphdr-
set or clear status bits for a program header
elf_flagscn-
set or clear status bits for a section
elf_flagshdr-
set or clear status bits for a section header
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.
cmd
may have the following values.
ELF_C_CLR-
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.
ELF_C_SET-
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.
Descriptions of the defined
flags
bits appear below.
ELF_F_DIRTY-
When the program needs to write an
ELF
file,
this flag says to write the associated information to the file.
For example, suppose that a program is going to update the
ELF
header of an existing file. The program calls
elf_flagehdr(S-osr5)
with this bit set in
flags
and with
cmd
equal to
ELF_C_SET.
A later call to
elf_update(S-osr5)
writes the marked header to the file.
ELF_F_LAYOUT-
Normally, the library controls how to arrange an output file.
That is, it automatically places sections, aligns them in the file, and so on.
If this bit is set for an
ELF
descriptor,
the program assumes responsibility for determining all file positions.
This bit is meaningful only for
elf_flagelf(S-osr5);
it applies to the entire file associated with the descriptor.
When a flag bit is set for an item, it affects all the subitems as well.
Thus, for example, if the program sets the
ELF_F_DIRTY
bit with
elf_flagelf(),
the entire logical file is ``dirty.''
Return values
These functions return updated descriptor status bits,
or zero if given a null descriptor.
Diagnostics
Error conditions are identified through the routine
elf_error(S-osr5).
Examples
The following fragment shows how you might mark the
ELF
header
to be written to the output file.
ehdr = elf32_getehdr(elf);
/* dirty ehdr . . . */
elf_flagehdr(elf, ELF_C_SET, ELF_F_DIRTY);
See also
elf(S-osr5),
elf_end(S-osr5),
elf_getdata(S-osr5),
elf_getehdr(S-osr5),
elf_update(S-osr5)
Standards conformance
elf_flagdata(S-osr5),
elf_flagehdr(S-osr5),
elf_flagelf(S-osr5),
elf_flagphdr(S-osr5),
elf_flagscn(S-osr5),
and
elf_flagshdr(S-osr5)
are not part of any currently supported standard;
they were developed by UNIX System Laboratories, Inc.
and are maintained by The SCO Group.
© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005