]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - lib/libelf/elf_flagdata.3
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / lib / libelf / elf_flagdata.3
1 .\" Copyright (c) 2006,2007 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 .\" $FreeBSD$
25 .\"
26 .Dd October 22, 2007
27 .Dt ELF_FLAGDATA 3
28 .Os
29 .Sh NAME
30 .Nm elf_flagdata ,
31 .Nm elf_flagehdr ,
32 .Nm elf_flagelf ,
33 .Nm elf_flagphdr ,
34 .Nm elf_flagscn ,
35 .Nm elf_flagshdr
36 .Nd manipulate flags associated with ELF(3) data structures
37 .Sh LIBRARY
38 .Lb libelf
39 .Sh SYNOPSIS
40 .In libelf.h
41 .Ft "unsigned int"
42 .Fn elf_flagdata "Elf_Data *data" "Elf_Cmd cmd" "unsigned int flags"
43 .Ft "unsigned int"
44 .Fn elf_flagehdr "Elf *elf" "Elf_Cmd cmd" "unsigned int flags"
45 .Ft "unsigned int"
46 .Fn elf_flagelf "Elf *elf" "Elf_Cmd cmd" "unsigned int flags"
47 .Ft "unsigned int"
48 .Fn elf_flagphdr "Elf *elf" "Elf_Cmd cmd" "unsigned int flags"
49 .Ft "unsigned int"
50 .Fn elf_flagscn "Elf_Scn *scn" "Elf_Cmd cmd" "unsigned int flags"
51 .Ft "unsigned int"
52 .Fn elf_flagshdr "Elf_Scn *scn" "Elf_Cmd cmd" "unsigned int flags"
53 .Sh DESCRIPTION
54 These functions are used to query, set or reset flags on data
55 structures associated with an ELF file.
56 .Pp
57 Arguments
58 .Ar data ,
59 .Ar elf
60 and
61 .Ar scn
62 denote the data structures whose flags need to be changed.
63 These values are allowed to be NULL to simplify error handling in
64 application code.
65 .Pp
66 Argument
67 .Ar cmd
68 may have the following values:
69 .Bl -tag -width ELF_C_SET
70 .It Dv ELF_C_CLR
71 The argument
72 .Ar flags
73 specifies the flags to be cleared.
74 .It Dv ELF_C_SET
75 The argument
76 .Ar flags
77 specifies the flags to be set.
78 .El
79 .Pp
80 The argument
81 .Ar flags
82 is allowed to have the following flags set:
83 .Bl -tag -width ELF_F_LAYOUT
84 .It Dv ELF_F_DIRTY
85 Mark the associated data structure as needing to be written back
86 to the underlying file.
87 A subsequent call to
88 .Xr elf_update 3
89 will resynchronize the library's internal data structures.
90 .It Dv ELF_F_LAYOUT
91 This flag is only valid with the
92 .Fn elf_flagelf
93 API.
94 It informs the library that the application will take
95 responsibility for the layout of the file and that the library is
96 not to insert any padding in between sections.
97 .El
98 .Pp
99 Marking a given data structure as
100 .Dq dirty
101 affects all of its contained elements.
102 Thus marking an ELF descriptor
103 .Ar elf
104 with
105 .Fn elf_flagelf "elf" "ELF_C_SET" "ELF_F_DIRTY"
106 means that the entire contents of the descriptor are
107 .Dq dirty .
108 .Pp
109 Using a value of zero for argument
110 .Ar flags
111 will return the current set of flags for the data structure being
112 queried.
113 .Sh RETURN VALUES
114 These functions return the updated flags is successful, and zero if
115 an error is detected.
116 .Sh ERRORS
117 These functions may fail with the following errors:
118 .Bl -tag -width "[ELF_E_RESOURCE]"
119 .It Bq Er ELF_E_ARGUMENT
120 An unsupported value was used for the
121 .Ar cmd
122 argument.
123 .It Bq Er ELF_E_ARGUMENT
124 Argument
125 .Ar flags
126 had unsupported flags set.
127 .It Bq Er ELF_E_ARGUMENT
128 The argument
129 .Ar elf
130 was not a descriptor for an ELF object.
131 .It Bq Er ELF_E_SEQUENCE
132 Function
133 .Fn elf_flagehdr
134 was called without an executable header being allocated.
135 .It Bq Er ELF_E_SEQUENCE
136 Function
137 .Fn elf_flagphdr
138 was called without a program header being allocated.
139 .El
140 .Sh SEE ALSO
141 .Xr elf 3 ,
142 .Xr elf32_newehdr 3 ,
143 .Xr elf32_newphdr 3 ,
144 .Xr elf32_newshdr 3 ,
145 .Xr elf64_newehdr 3 ,
146 .Xr elf64_newphdr 3 ,
147 .Xr elf64_newshdr 3 ,
148 .Xr elf_newdata 3 ,
149 .Xr elf_update 3 ,
150 .Xr gelf 3 ,
151 .Xr gelf_newehdr 3 ,
152 .Xr gelf_newphdr 3 ,
153 .Xr gelf_newshdr 3 ,
154 .Xr gelf_update_dyn 3 ,
155 .Xr gelf_update_move 3 ,
156 .Xr gelf_update_rel 3 ,
157 .Xr gelf_update_rela 3 ,
158 .Xr gelf_update_sym 3 ,
159 .Xr gelf_update_syminfo 3