1 | .\" Copyright (c) 2006-2008 Joseph Koshy. All rights reserved. |
---|
2 | .\" |
---|
3 | .\" Redistribution and use in source and binary forms, with or without |
---|
4 | .\" modification, are permitted provided that the following conditions |
---|
5 | .\" are met: |
---|
6 | .\" 1. Redistributions of source code must retain the above copyright |
---|
7 | .\" notice, this list of conditions and the following disclaimer. |
---|
8 | .\" 2. Redistributions in binary form must reproduce the above copyright |
---|
9 | .\" notice, this list of conditions and the following disclaimer in the |
---|
10 | .\" documentation and/or other materials provided with the distribution. |
---|
11 | .\" |
---|
12 | .\" This software is provided by Joseph Koshy ``as is'' and |
---|
13 | .\" any express or implied warranties, including, but not limited to, the |
---|
14 | .\" implied warranties of merchantability and fitness for a particular purpose |
---|
15 | .\" are disclaimed. in no event shall Joseph Koshy be liable |
---|
16 | .\" for any direct, indirect, incidental, special, exemplary, or consequential |
---|
17 | .\" damages (including, but not limited to, procurement of substitute goods |
---|
18 | .\" or services; loss of use, data, or profits; or business interruption) |
---|
19 | .\" however caused and on any theory of liability, whether in contract, strict |
---|
20 | .\" liability, or tort (including negligence or otherwise) arising in any way |
---|
21 | .\" out of the use of this software, even if advised of the possibility of |
---|
22 | .\" such damage. |
---|
23 | .\" |
---|
24 | .\" $Id$ |
---|
25 | .\" |
---|
26 | .Dd October 22, 2007 |
---|
27 | .Os |
---|
28 | .Dt ELF_FLAGDATA 3 |
---|
29 | .Sh NAME |
---|
30 | .Nm elf_flagarhdr , |
---|
31 | .Nm elf_flagdata , |
---|
32 | .Nm elf_flagehdr , |
---|
33 | .Nm elf_flagelf , |
---|
34 | .Nm elf_flagphdr , |
---|
35 | .Nm elf_flagscn , |
---|
36 | .Nm elf_flagshdr |
---|
37 | .Nd manipulate flags associated with ELF(3) data structures |
---|
38 | .Sh LIBRARY |
---|
39 | .Lb libelf |
---|
40 | .Sh SYNOPSIS |
---|
41 | .In libelf.h |
---|
42 | .Ft "unsigned int" |
---|
43 | .Fn elf_flagarhdr "Elf_Arhdr *arhdr" "Elf_Cmd cmd" "unsigned int flags" |
---|
44 | .Ft "unsigned int" |
---|
45 | .Fn elf_flagdata "Elf_Data *data" "Elf_Cmd cmd" "unsigned int flags" |
---|
46 | .Ft "unsigned int" |
---|
47 | .Fn elf_flagehdr "Elf *elf" "Elf_Cmd cmd" "unsigned int flags" |
---|
48 | .Ft "unsigned int" |
---|
49 | .Fn elf_flagelf "Elf *elf" "Elf_Cmd cmd" "unsigned int flags" |
---|
50 | .Ft "unsigned int" |
---|
51 | .Fn elf_flagphdr "Elf *elf" "Elf_Cmd cmd" "unsigned int flags" |
---|
52 | .Ft "unsigned int" |
---|
53 | .Fn elf_flagscn "Elf_Scn *scn" "Elf_Cmd cmd" "unsigned int flags" |
---|
54 | .Ft "unsigned int" |
---|
55 | .Fn elf_flagshdr "Elf_Scn *scn" "Elf_Cmd cmd" "unsigned int flags" |
---|
56 | .Sh DESCRIPTION |
---|
57 | These functions are used to query, set or reset flags on data |
---|
58 | structures associated with an ELF file. |
---|
59 | .Pp |
---|
60 | Arguments |
---|
61 | .Ar arhdr , |
---|
62 | .Ar data , |
---|
63 | .Ar elf |
---|
64 | and |
---|
65 | .Ar scn |
---|
66 | denote the data structures whose flags need to be changed. |
---|
67 | These values are allowed to be NULL to simplify error handling in |
---|
68 | application code. |
---|
69 | .Pp |
---|
70 | Argument |
---|
71 | .Ar cmd |
---|
72 | may have the following values: |
---|
73 | .Bl -tag -width ELF_C_SET |
---|
74 | .It Dv ELF_C_CLR |
---|
75 | The argument |
---|
76 | .Ar flags |
---|
77 | specifies the flags to be cleared. |
---|
78 | .It Dv ELF_C_SET |
---|
79 | The argument |
---|
80 | .Ar flags |
---|
81 | specifies the flags to be set. |
---|
82 | .El |
---|
83 | .Pp |
---|
84 | The argument |
---|
85 | .Ar flags |
---|
86 | is allowed to have the following flags set: |
---|
87 | .Bl -tag -width ELF_F_ARCHIVE_SYSV |
---|
88 | .It Dv ELF_F_ARCHIVE |
---|
89 | This flag is only valid with the |
---|
90 | .Fn elf_flagelf |
---|
91 | API. |
---|
92 | It informs the library that the application desires to create an |
---|
93 | .Xr ar 1 |
---|
94 | archive. |
---|
95 | Argument |
---|
96 | .Ar elf |
---|
97 | should have been opened for writing using the |
---|
98 | .Dv ELF_C_WRITE |
---|
99 | command to function |
---|
100 | .Fn elf_begin . |
---|
101 | .It Dv ELF_F_ARCHIVE_SYSV |
---|
102 | This flag is used in conjunction with the |
---|
103 | .Dv ELF_F_ARCHIVE |
---|
104 | flag to indicate that library should create archives that conform |
---|
105 | to System V layout rules. |
---|
106 | The default is to create BSD style archives. |
---|
107 | .It Dv ELF_F_DIRTY |
---|
108 | Mark the associated data structure as needing to be written back |
---|
109 | to the underlying file. |
---|
110 | A subsequent call to |
---|
111 | .Xr elf_update 3 |
---|
112 | will resynchronize the library's internal data structures. |
---|
113 | .It Dv ELF_F_LAYOUT |
---|
114 | This flag is only valid with the |
---|
115 | .Fn elf_flagelf |
---|
116 | API. |
---|
117 | It informs the library that the application will take |
---|
118 | responsibility for the layout of the file and that the library is |
---|
119 | not to insert any padding in between sections. |
---|
120 | .El |
---|
121 | .Pp |
---|
122 | Marking a given data structure as |
---|
123 | .Dq dirty |
---|
124 | affects all of its contained elements. |
---|
125 | Thus marking an ELF descriptor |
---|
126 | .Ar elf |
---|
127 | with |
---|
128 | .Fn elf_flagelf "elf" "ELF_C_SET" "ELF_F_DIRTY" |
---|
129 | means that the entire contents of the descriptor are |
---|
130 | .Dq dirty . |
---|
131 | .Pp |
---|
132 | Using a value of zero for argument |
---|
133 | .Ar flags |
---|
134 | will return the current set of flags for the data structure being |
---|
135 | queried. |
---|
136 | .Sh RETURN VALUES |
---|
137 | These functions return the updated flags is successful, and zero if |
---|
138 | an error is detected. |
---|
139 | .Sh COMPATIBILITY |
---|
140 | The |
---|
141 | .Fn elf_flagarhdr |
---|
142 | function and the |
---|
143 | .Dv ELF_F_ARCHIVE |
---|
144 | and |
---|
145 | .Dv ELF_F_ARCHIVE_SYSV |
---|
146 | flags are an extension to the ELF(3) API. |
---|
147 | .Sh ERRORS |
---|
148 | These functions may fail with the following errors: |
---|
149 | .Bl -tag -width "[ELF_E_RESOURCE]" |
---|
150 | .It Bq Er ELF_E_ARGUMENT |
---|
151 | An unsupported value was used for the |
---|
152 | .Ar cmd |
---|
153 | argument. |
---|
154 | .It Bq Er ELF_E_ARGUMENT |
---|
155 | Argument |
---|
156 | .Ar flags |
---|
157 | had unsupported flags set. |
---|
158 | .It Bq Er ELF_E_ARGUMENT |
---|
159 | The argument |
---|
160 | .Ar elf |
---|
161 | was not a descriptor for an ELF object. |
---|
162 | .It Bq Er ELF_E_MODE |
---|
163 | The |
---|
164 | .Dv ELF_F_ARCHIVE |
---|
165 | flag was used with an ELF descriptor that had not been opened for writing. |
---|
166 | .It Bq Er ELF_E_SEQUENCE |
---|
167 | Function |
---|
168 | .Fn elf_flagehdr |
---|
169 | was called without an executable header being allocated. |
---|
170 | .It Bq Er ELF_E_SEQUENCE |
---|
171 | Function |
---|
172 | .Fn elf_flagphdr |
---|
173 | was called without a program header being allocated. |
---|
174 | .El |
---|
175 | .Sh SEE ALSO |
---|
176 | .Xr elf 3 , |
---|
177 | .Xr elf32_newehdr 3 , |
---|
178 | .Xr elf32_newphdr 3 , |
---|
179 | .Xr elf32_newshdr 3 , |
---|
180 | .Xr elf64_newehdr 3 , |
---|
181 | .Xr elf64_newphdr 3 , |
---|
182 | .Xr elf64_newshdr 3 , |
---|
183 | .Xr elf_newdata 3 , |
---|
184 | .Xr elf_update 3 , |
---|
185 | .Xr gelf 3 , |
---|
186 | .Xr gelf_newehdr 3 , |
---|
187 | .Xr gelf_newphdr 3 , |
---|
188 | .Xr gelf_newshdr 3 , |
---|
189 | .Xr gelf_update_dyn 3 , |
---|
190 | .Xr gelf_update_move 3 , |
---|
191 | .Xr gelf_update_rel 3 , |
---|
192 | .Xr gelf_update_rela 3 , |
---|
193 | .Xr gelf_update_sym 3 , |
---|
194 | .Xr gelf_update_syminfo 3 |
---|