1 .\" Copyright (c) 2006-2008,2011 Joseph Koshy. All rights reserved.
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
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.
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
24 .\" $Id: elf_flagdata.3 3479 2016-06-25 20:44:33Z jkoshy $
37 .Nd manipulate flags associated with ELF(3) data structures
43 .Fn elf_flagarhdr "Elf_Arhdr *arhdr" "Elf_Cmd cmd" "unsigned int flags"
45 .Fn elf_flagdata "Elf_Data *data" "Elf_Cmd cmd" "unsigned int flags"
47 .Fn elf_flagehdr "Elf *elf" "Elf_Cmd cmd" "unsigned int flags"
49 .Fn elf_flagelf "Elf *elf" "Elf_Cmd cmd" "unsigned int flags"
51 .Fn elf_flagphdr "Elf *elf" "Elf_Cmd cmd" "unsigned int flags"
53 .Fn elf_flagscn "Elf_Scn *scn" "Elf_Cmd cmd" "unsigned int flags"
55 .Fn elf_flagshdr "Elf_Scn *scn" "Elf_Cmd cmd" "unsigned int flags"
57 These functions are used to query, set or reset flags on data
58 structures associated with an ELF file.
66 denote the data structures whose flags need to be changed.
67 These values should have been returned by prior calls to
68 functions in the ELF(3) API set:
73 should have been returned by a prior call to
78 should have been returned by a prior call to one of
86 should have been allocated by a prior call to one of
93 should have been returned by a prior call to one of
99 These values are allowed to be NULL to simplify error handling in
104 may have the following values:
105 .Bl -tag -width ELF_C_SET
109 specifies the flags to be cleared.
113 specifies the flags to be set.
118 is allowed to have the following flags set:
119 .Bl -tag -width ELF_F_ARCHIVE_SYSV
121 This flag is only valid with the
124 It informs the library that the application desires to create an
129 should have been opened for writing using the
133 .It Dv ELF_F_ARCHIVE_SYSV
134 This flag is used in conjunction with the
136 flag to indicate that library should create archives that conform
137 to System V layout rules.
138 The default is to create BSD style archives.
140 Mark the associated data structure as needing to be written back
141 to the underlying file.
144 will resynchronize the library's internal data structures.
146 This flag is only valid with the
149 It informs the library that the application will take
150 responsibility for the layout of the file and that the library is
151 not to insert any padding in between sections.
154 Marking a given data structure as
156 affects all of its contained elements.
157 Thus marking an ELF descriptor
160 .Fn elf_flagelf "elf" "ELF_C_SET" "ELF_F_DIRTY"
161 means that the entire contents of the descriptor are
164 Using a value of zero for argument
166 will return the current set of flags for the data structure being
169 These functions return the updated flags if successful, or zero if
170 an error is detected.
177 .Dv ELF_F_ARCHIVE_SYSV
178 flags are an extension to the ELF(3) API.
180 These functions may fail with the following errors:
181 .Bl -tag -width "[ELF_E_RESOURCE]"
182 .It Bq Er ELF_E_ARGUMENT
183 An unsupported value was used for the
186 .It Bq Er ELF_E_ARGUMENT
189 had unsupported flags set.
190 .It Bq Er ELF_E_ARGUMENT
193 was not a descriptor for an ELF object.
197 flag was used with an ELF descriptor that had not been opened for writing.
198 .It Bq Er ELF_E_SEQUENCE
201 was called without an executable header being allocated.
202 .It Bq Er ELF_E_SEQUENCE
205 was called without a program header being allocated.
209 .Xr elf32_newehdr 3 ,
210 .Xr elf32_newphdr 3 ,
211 .Xr elf64_newehdr 3 ,
212 .Xr elf64_newphdr 3 ,
218 .Xr gelf_update_dyn 3 ,
219 .Xr gelf_update_move 3 ,
220 .Xr gelf_update_rel 3 ,
221 .Xr gelf_update_rela 3 ,
222 .Xr gelf_update_sym 3 ,
223 .Xr gelf_update_syminfo 3