1elf_flagdata(3ELF)           ELF Library Functions          elf_flagdata(3ELF)
2
3
4

NAME

6       elf_flagdata,  elf_flagehdr,  elf_flagelf,  elf_flagphdr,  elf_flagscn,
7       elf_flagshdr - manipulate flags
8

SYNOPSIS

10       cc [ flag ... ] file ... -lelf [ library ... ]
11       #include <libelf.h>
12
13       unsigned elf_flagdata(Elf_Data *data, Elf_Cmd cmd, unsigned flags);
14
15
16       unsigned elf_flagehdr(Elf *elf, Elf_Cmd cmd, unsigned flags);
17
18
19       unsigned elf_flagelf(Elf *elf, Elf_Cmd cmd, unsigned flags);
20
21
22       unsigned elf_flagphdr(Elf *elf, Elf_Cmd cmd, unsigned flags);
23
24
25       unsigned elf_flagscn(Elf_Scn *scn, Elf_Cmd cmd, unsigned flags);
26
27
28       unsigned elf_flagshdr(Elf_Scn *scn, Elf_Cmd cmd, unsigned flags);
29
30

DESCRIPTION

32       These functions manipulate the flags associated with various structures
33       of  an  ELF  file.  Given  an  ELF  descriptor (elf), a data descriptor
34       (data), or a section descriptor (scn), the functions may set  or  clear
35       the associated status bits, returning the updated bits. A null descrip‐
36       tor is allowed, to simplify error handling; all functions return 0  for
37       this degenerate case.
38
39
40       cmd may have the following values:
41
42       ELF_C_CLR    The  functions  clear the bits that are asserted in flags.
43                    Only the non-zero bits in flags are cleared; zero bits  do
44                    not change the status of the descriptor.
45
46
47       ELF_C_SET    The  functions  set  the  bits that are asserted in flags.
48                    Only the non-zero bits in flags are set; zero bits do  not
49                    change the status of the descriptor.
50
51
52
53       Descriptions of the defined flags bits appear below:
54
55       ELF_F_DIRTY     When  the  program  intends  to write an ELF file, this
56                       flag asserts the associated  information  needs  to  be
57                       written  to the file. Thus, for example, a program that
58                       wished to update the ELF header  of  an  existing  file
59                       would  call  elf_flagehdr()  with this bit set in flags
60                       and  cmd  equal  to  ELF_C_SET.   A   later   call   to
61                       elf_update() would write the marked header to the file.
62
63
64       ELF_F_LAYOUT    Normally,  the library decides how to arrange an output
65                       file. That is, it automatically decides where to  place
66                       sections,  how  to align them in the file, etc. If this
67                       bit is set for an ELF descriptor, the  program  assumes
68                       responsibility for determining all file positions. This
69                       bit is meaningful only for elf_flagelf() and applies to
70                       the entire file associated with the descriptor.
71
72
73
74       When  a  flag  bit  is  set for an item, it affects all the subitems as
75       well. Thus, for example, if the program sets the ELF_F_DIRTY  bit  with
76       elf_flagelf(), the entire logical file is ``dirty.''
77

EXAMPLES

79       Example 1 A sample display of calling the elf_flagdata() function.
80
81
82       The  following  fragment  shows how one might mark the ELF header to be
83       written to the output file:
84
85
86         /* dirty ehdr ... */
87         ehdr = elf32_getehdr(elf);
88         elf_flagehdr(elf, ELF_C_SET, ELF_F_DIRTY);
89
90

ATTRIBUTES

92       See attributes(5) for descriptions of the following attributes:
93
94
95
96
97       ┌─────────────────────────────┬─────────────────────────────┐
98       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
99       ├─────────────────────────────┼─────────────────────────────┤
100       │Interface Stability          │Stable                       │
101       ├─────────────────────────────┼─────────────────────────────┤
102       │MT-Level                     │MT-Safe                      │
103       └─────────────────────────────┴─────────────────────────────┘
104

SEE ALSO

106       elf(3ELF),  elf32_getehdr(3ELF),  elf_getdata(3ELF),  elf_update(3ELF),
107       attributes(5)
108
109
110
111SunOS 5.11                        11 Jul 2001               elf_flagdata(3ELF)
Impressum