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 3743 2019-06-12 19:36:30Z jkoshy $
37 .Nd manipulate flags associated with ELF 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
75 should have been returned by a prior call to
80 should have been returned by a prior call to one of
88 should have been allocated by a prior call to one of
95 should have been returned by a prior call to one of
101 These values are allowed to be NULL to simplify error handling in
106 may have the following values:
107 .Bl -tag -width ELF_C_SET
111 specifies the flags to be cleared.
115 specifies the flags to be set.
120 is allowed to have the following flags set:
121 .Bl -tag -width ELF_F_ARCHIVE_SYSV
123 This flag is only valid with the
126 It informs the library that the application desires to create an
131 should have been opened for writing using the
135 .It Dv ELF_F_ARCHIVE_SYSV
136 This flag is used in conjunction with the
138 flag to indicate that library should create archives that conform
139 to System V layout rules.
140 The default is to create BSD style archives.
142 Mark the associated data structure as needing to be written back
143 to the underlying file.
146 will resynchronize the library's internal data structures.
148 This flag is only valid with the
151 It informs the library that the application will take
152 responsibility for the layout of the file and that the library is
153 not to insert any padding in between sections.
156 Marking a given data structure as
158 affects all of its contained elements.
159 Thus marking an ELF descriptor
162 .Fn elf_flagelf "elf" "ELF_C_SET" "ELF_F_DIRTY"
163 means that the entire contents of the descriptor are
166 Using a value of zero for argument
168 will return the current set of flags for the data structure being
171 These functions return the updated flags if successful, or zero if
172 an error is detected.
179 .Dv ELF_F_ARCHIVE_SYSV
180 flags are an extension to the
184 These functions may fail with the following errors:
185 .Bl -tag -width "[ELF_E_RESOURCE]"
186 .It Bq Er ELF_E_ARGUMENT
187 An unsupported value was used for the
190 .It Bq Er ELF_E_ARGUMENT
193 had unsupported flags set.
194 .It Bq Er ELF_E_ARGUMENT
197 was not a descriptor for an ELF object.
201 flag was used with an ELF descriptor that had not been opened for writing.
202 .It Bq Er ELF_E_SEQUENCE
205 was called without an executable header being allocated.
206 .It Bq Er ELF_E_SEQUENCE
209 was called without a program header being allocated.
213 .Xr elf32_newehdr 3 ,
214 .Xr elf32_newphdr 3 ,
215 .Xr elf64_newehdr 3 ,
216 .Xr elf64_newphdr 3 ,
222 .Xr gelf_update_dyn 3 ,
223 .Xr gelf_update_move 3 ,
224 .Xr gelf_update_rel 3 ,
225 .Xr gelf_update_rela 3 ,
226 .Xr gelf_update_sym 3 ,
227 .Xr gelf_update_syminfo 3