1 .\" $NetBSD: elf_flagdata.3,v 1.2 2014/03/09 16:58:04 christos Exp $
3 .\" Copyright (c) 2006-2008,2011 Joseph Koshy. All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" This software is provided by Joseph Koshy ``as is'' and
15 .\" any express or implied warranties, including, but not limited to, the
16 .\" implied warranties of merchantability and fitness for a particular purpose
17 .\" are disclaimed. in no event shall Joseph Koshy be liable
18 .\" for any direct, indirect, incidental, special, exemplary, or consequential
19 .\" damages (including, but not limited to, procurement of substitute goods
20 .\" or services; loss of use, data, or profits; or business interruption)
21 .\" however caused and on any theory of liability, whether in contract, strict
22 .\" liability, or tort (including negligence or otherwise) arising in any way
23 .\" out of the use of this software, even if advised of the possibility of
26 .\" Id: elf_flagdata.3 2884 2013-01-11 02:03:46Z jkoshy
39 .Nd manipulate flags associated with ELF(3) data structures
45 .Fn elf_flagarhdr "Elf_Arhdr *arhdr" "Elf_Cmd cmd" "unsigned int flags"
47 .Fn elf_flagdata "Elf_Data *data" "Elf_Cmd cmd" "unsigned int flags"
49 .Fn elf_flagehdr "Elf *elf" "Elf_Cmd cmd" "unsigned int flags"
51 .Fn elf_flagelf "Elf *elf" "Elf_Cmd cmd" "unsigned int flags"
53 .Fn elf_flagphdr "Elf *elf" "Elf_Cmd cmd" "unsigned int flags"
55 .Fn elf_flagscn "Elf_Scn *scn" "Elf_Cmd cmd" "unsigned int flags"
57 .Fn elf_flagshdr "Elf_Scn *scn" "Elf_Cmd cmd" "unsigned int flags"
59 These functions are used to query, set or reset flags on data
60 structures associated with an ELF file.
68 denote the data structures whose flags need to be changed.
69 These values should have been returned by prior calls to
70 functions in the ELF(3) API set:
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 ELF(3) API.
182 These functions may fail with the following errors:
183 .Bl -tag -width "[ELF_E_RESOURCE]"
184 .It Bq Er ELF_E_ARGUMENT
185 An unsupported value was used for the
188 .It Bq Er ELF_E_ARGUMENT
191 had unsupported flags set.
192 .It Bq Er ELF_E_ARGUMENT
195 was not a descriptor for an ELF object.
199 flag was used with an ELF descriptor that had not been opened for writing.
200 .It Bq Er ELF_E_SEQUENCE
203 was called without an executable header being allocated.
204 .It Bq Er ELF_E_SEQUENCE
207 was called without a program header being allocated.
211 .Xr elf32_newehdr 3 ,
212 .Xr elf32_newphdr 3 ,
213 .Xr elf32_newshdr 3 ,
214 .Xr elf64_newehdr 3 ,
215 .Xr elf64_newphdr 3 ,
216 .Xr elf64_newshdr 3 ,
223 .Xr gelf_update_dyn 3 ,
224 .Xr gelf_update_move 3 ,
225 .Xr gelf_update_rel 3 ,
226 .Xr gelf_update_rela 3 ,
227 .Xr gelf_update_sym 3 ,
228 .Xr gelf_update_syminfo 3