xref: /minix3/external/bsd/elftoolchain/dist/libelf/elf_flagdata.3 (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc.\"	$NetBSD: elf_flagdata.3,v 1.2 2014/03/09 16:58:04 christos Exp $
2*0a6a1f1dSLionel Sambuc.\"
3*0a6a1f1dSLionel Sambuc.\" Copyright (c) 2006-2008,2011 Joseph Koshy.  All rights reserved.
4*0a6a1f1dSLionel Sambuc.\"
5*0a6a1f1dSLionel Sambuc.\" Redistribution and use in source and binary forms, with or without
6*0a6a1f1dSLionel Sambuc.\" modification, are permitted provided that the following conditions
7*0a6a1f1dSLionel Sambuc.\" are met:
8*0a6a1f1dSLionel Sambuc.\" 1. Redistributions of source code must retain the above copyright
9*0a6a1f1dSLionel Sambuc.\"    notice, this list of conditions and the following disclaimer.
10*0a6a1f1dSLionel Sambuc.\" 2. Redistributions in binary form must reproduce the above copyright
11*0a6a1f1dSLionel Sambuc.\"    notice, this list of conditions and the following disclaimer in the
12*0a6a1f1dSLionel Sambuc.\"    documentation and/or other materials provided with the distribution.
13*0a6a1f1dSLionel Sambuc.\"
14*0a6a1f1dSLionel Sambuc.\" This software is provided by Joseph Koshy ``as is'' and
15*0a6a1f1dSLionel Sambuc.\" any express or implied warranties, including, but not limited to, the
16*0a6a1f1dSLionel Sambuc.\" implied warranties of merchantability and fitness for a particular purpose
17*0a6a1f1dSLionel Sambuc.\" are disclaimed.  in no event shall Joseph Koshy be liable
18*0a6a1f1dSLionel Sambuc.\" for any direct, indirect, incidental, special, exemplary, or consequential
19*0a6a1f1dSLionel Sambuc.\" damages (including, but not limited to, procurement of substitute goods
20*0a6a1f1dSLionel Sambuc.\" or services; loss of use, data, or profits; or business interruption)
21*0a6a1f1dSLionel Sambuc.\" however caused and on any theory of liability, whether in contract, strict
22*0a6a1f1dSLionel Sambuc.\" liability, or tort (including negligence or otherwise) arising in any way
23*0a6a1f1dSLionel Sambuc.\" out of the use of this software, even if advised of the possibility of
24*0a6a1f1dSLionel Sambuc.\" such damage.
25*0a6a1f1dSLionel Sambuc.\"
26*0a6a1f1dSLionel Sambuc.\" Id: elf_flagdata.3 2884 2013-01-11 02:03:46Z jkoshy
27*0a6a1f1dSLionel Sambuc.\"
28*0a6a1f1dSLionel Sambuc.Dd December 3, 2011
29*0a6a1f1dSLionel Sambuc.Os
30*0a6a1f1dSLionel Sambuc.Dt ELF_FLAGDATA 3
31*0a6a1f1dSLionel Sambuc.Sh NAME
32*0a6a1f1dSLionel Sambuc.Nm elf_flagarhdr ,
33*0a6a1f1dSLionel Sambuc.Nm elf_flagdata ,
34*0a6a1f1dSLionel Sambuc.Nm elf_flagehdr ,
35*0a6a1f1dSLionel Sambuc.Nm elf_flagelf ,
36*0a6a1f1dSLionel Sambuc.Nm elf_flagphdr ,
37*0a6a1f1dSLionel Sambuc.Nm elf_flagscn ,
38*0a6a1f1dSLionel Sambuc.Nm elf_flagshdr
39*0a6a1f1dSLionel Sambuc.Nd manipulate flags associated with ELF(3) data structures
40*0a6a1f1dSLionel Sambuc.Sh LIBRARY
41*0a6a1f1dSLionel Sambuc.Lb libelf
42*0a6a1f1dSLionel Sambuc.Sh SYNOPSIS
43*0a6a1f1dSLionel Sambuc.In libelf.h
44*0a6a1f1dSLionel Sambuc.Ft "unsigned int"
45*0a6a1f1dSLionel Sambuc.Fn elf_flagarhdr "Elf_Arhdr *arhdr" "Elf_Cmd cmd" "unsigned int flags"
46*0a6a1f1dSLionel Sambuc.Ft "unsigned int"
47*0a6a1f1dSLionel Sambuc.Fn elf_flagdata "Elf_Data *data" "Elf_Cmd cmd" "unsigned int flags"
48*0a6a1f1dSLionel Sambuc.Ft "unsigned int"
49*0a6a1f1dSLionel Sambuc.Fn elf_flagehdr "Elf *elf" "Elf_Cmd cmd" "unsigned int flags"
50*0a6a1f1dSLionel Sambuc.Ft "unsigned int"
51*0a6a1f1dSLionel Sambuc.Fn elf_flagelf "Elf *elf" "Elf_Cmd cmd" "unsigned int flags"
52*0a6a1f1dSLionel Sambuc.Ft "unsigned int"
53*0a6a1f1dSLionel Sambuc.Fn elf_flagphdr "Elf *elf" "Elf_Cmd cmd" "unsigned int flags"
54*0a6a1f1dSLionel Sambuc.Ft "unsigned int"
55*0a6a1f1dSLionel Sambuc.Fn elf_flagscn "Elf_Scn *scn" "Elf_Cmd cmd" "unsigned int flags"
56*0a6a1f1dSLionel Sambuc.Ft "unsigned int"
57*0a6a1f1dSLionel Sambuc.Fn elf_flagshdr "Elf_Scn *scn" "Elf_Cmd cmd" "unsigned int flags"
58*0a6a1f1dSLionel Sambuc.Sh DESCRIPTION
59*0a6a1f1dSLionel SambucThese functions are used to query, set or reset flags on data
60*0a6a1f1dSLionel Sambucstructures associated with an ELF file.
61*0a6a1f1dSLionel Sambuc.Pp
62*0a6a1f1dSLionel SambucArguments
63*0a6a1f1dSLionel Sambuc.Ar arhdr ,
64*0a6a1f1dSLionel Sambuc.Ar data ,
65*0a6a1f1dSLionel Sambuc.Ar elf
66*0a6a1f1dSLionel Sambucand
67*0a6a1f1dSLionel Sambuc.Ar scn
68*0a6a1f1dSLionel Sambucdenote the data structures whose flags need to be changed.
69*0a6a1f1dSLionel SambucThese values should have been returned by prior calls to
70*0a6a1f1dSLionel Sambucfunctions in the ELF(3) API set:
71*0a6a1f1dSLionel Sambuc.Bl -bullet -compact
72*0a6a1f1dSLionel Sambuc.It
73*0a6a1f1dSLionel SambucArgument
74*0a6a1f1dSLionel Sambuc.Ar arhdr
75*0a6a1f1dSLionel Sambucshould have been returned by a prior call to
76*0a6a1f1dSLionel Sambuc.Xr elf_getarhdr 3 .
77*0a6a1f1dSLionel Sambuc.It
78*0a6a1f1dSLionel SambucArgument
79*0a6a1f1dSLionel Sambuc.Ar data
80*0a6a1f1dSLionel Sambucshould have been returned by a prior call to one of
81*0a6a1f1dSLionel Sambuc.Xr elf_newdata 3 ,
82*0a6a1f1dSLionel Sambuc.Xr elf_getdata 3
83*0a6a1f1dSLionel Sambucor
84*0a6a1f1dSLionel Sambuc.Xr elf_rawdata 3 .
85*0a6a1f1dSLionel Sambuc.It
86*0a6a1f1dSLionel SambucArgument
87*0a6a1f1dSLionel Sambuc.Ar elf
88*0a6a1f1dSLionel Sambucshould have been allocated by a prior call to one of
89*0a6a1f1dSLionel Sambuc.Xr elf_begin 3
90*0a6a1f1dSLionel Sambucor
91*0a6a1f1dSLionel Sambuc.Xr elf_memory 3 .
92*0a6a1f1dSLionel Sambuc.It
93*0a6a1f1dSLionel SambucArgument
94*0a6a1f1dSLionel Sambuc.Ar scn
95*0a6a1f1dSLionel Sambucshould have been returned by a prior call to one of
96*0a6a1f1dSLionel Sambuc.Xr elf_getscn 3 ,
97*0a6a1f1dSLionel Sambuc.Xr elf_newscn 3
98*0a6a1f1dSLionel Sambucor
99*0a6a1f1dSLionel Sambuc.Xr elf_nextscn 3 .
100*0a6a1f1dSLionel Sambuc.El
101*0a6a1f1dSLionel SambucThese values are allowed to be NULL to simplify error handling in
102*0a6a1f1dSLionel Sambucapplication code.
103*0a6a1f1dSLionel Sambuc.Pp
104*0a6a1f1dSLionel SambucArgument
105*0a6a1f1dSLionel Sambuc.Ar cmd
106*0a6a1f1dSLionel Sambucmay have the following values:
107*0a6a1f1dSLionel Sambuc.Bl -tag -width ELF_C_SET
108*0a6a1f1dSLionel Sambuc.It Dv ELF_C_CLR
109*0a6a1f1dSLionel SambucThe argument
110*0a6a1f1dSLionel Sambuc.Ar flags
111*0a6a1f1dSLionel Sambucspecifies the flags to be cleared.
112*0a6a1f1dSLionel Sambuc.It Dv ELF_C_SET
113*0a6a1f1dSLionel SambucThe argument
114*0a6a1f1dSLionel Sambuc.Ar flags
115*0a6a1f1dSLionel Sambucspecifies the flags to be set.
116*0a6a1f1dSLionel Sambuc.El
117*0a6a1f1dSLionel Sambuc.Pp
118*0a6a1f1dSLionel SambucThe argument
119*0a6a1f1dSLionel Sambuc.Ar flags
120*0a6a1f1dSLionel Sambucis allowed to have the following flags set:
121*0a6a1f1dSLionel Sambuc.Bl -tag -width ELF_F_ARCHIVE_SYSV
122*0a6a1f1dSLionel Sambuc.It Dv ELF_F_ARCHIVE
123*0a6a1f1dSLionel SambucThis flag is only valid with the
124*0a6a1f1dSLionel Sambuc.Fn elf_flagelf
125*0a6a1f1dSLionel SambucAPI.
126*0a6a1f1dSLionel SambucIt informs the library that the application desires to create an
127*0a6a1f1dSLionel Sambuc.Xr ar 1
128*0a6a1f1dSLionel Sambucarchive.
129*0a6a1f1dSLionel SambucArgument
130*0a6a1f1dSLionel Sambuc.Ar elf
131*0a6a1f1dSLionel Sambucshould have been opened for writing using the
132*0a6a1f1dSLionel Sambuc.Dv ELF_C_WRITE
133*0a6a1f1dSLionel Sambuccommand to function
134*0a6a1f1dSLionel Sambuc.Fn elf_begin .
135*0a6a1f1dSLionel Sambuc.It Dv ELF_F_ARCHIVE_SYSV
136*0a6a1f1dSLionel SambucThis flag is used in conjunction with the
137*0a6a1f1dSLionel Sambuc.Dv ELF_F_ARCHIVE
138*0a6a1f1dSLionel Sambucflag to indicate that library should create archives that conform
139*0a6a1f1dSLionel Sambucto System V layout rules.
140*0a6a1f1dSLionel SambucThe default is to create BSD style archives.
141*0a6a1f1dSLionel Sambuc.It Dv ELF_F_DIRTY
142*0a6a1f1dSLionel SambucMark the associated data structure as needing to be written back
143*0a6a1f1dSLionel Sambucto the underlying file.
144*0a6a1f1dSLionel SambucA subsequent call to
145*0a6a1f1dSLionel Sambuc.Xr elf_update 3
146*0a6a1f1dSLionel Sambucwill resynchronize the library's internal data structures.
147*0a6a1f1dSLionel Sambuc.It Dv ELF_F_LAYOUT
148*0a6a1f1dSLionel SambucThis flag is only valid with the
149*0a6a1f1dSLionel Sambuc.Fn elf_flagelf
150*0a6a1f1dSLionel SambucAPI.
151*0a6a1f1dSLionel SambucIt informs the library that the application will take
152*0a6a1f1dSLionel Sambucresponsibility for the layout of the file and that the library is
153*0a6a1f1dSLionel Sambucnot to insert any padding in between sections.
154*0a6a1f1dSLionel Sambuc.El
155*0a6a1f1dSLionel Sambuc.Pp
156*0a6a1f1dSLionel SambucMarking a given data structure as
157*0a6a1f1dSLionel Sambuc.Dq dirty
158*0a6a1f1dSLionel Sambucaffects all of its contained elements.
159*0a6a1f1dSLionel SambucThus marking an ELF descriptor
160*0a6a1f1dSLionel Sambuc.Ar elf
161*0a6a1f1dSLionel Sambucwith
162*0a6a1f1dSLionel Sambuc.Fn elf_flagelf "elf" "ELF_C_SET" "ELF_F_DIRTY"
163*0a6a1f1dSLionel Sambucmeans that the entire contents of the descriptor are
164*0a6a1f1dSLionel Sambuc.Dq dirty .
165*0a6a1f1dSLionel Sambuc.Pp
166*0a6a1f1dSLionel SambucUsing a value of zero for argument
167*0a6a1f1dSLionel Sambuc.Ar flags
168*0a6a1f1dSLionel Sambucwill return the current set of flags for the data structure being
169*0a6a1f1dSLionel Sambucqueried.
170*0a6a1f1dSLionel Sambuc.Sh RETURN VALUES
171*0a6a1f1dSLionel SambucThese functions return the updated flags if successful, or zero if
172*0a6a1f1dSLionel Sambucan error is detected.
173*0a6a1f1dSLionel Sambuc.Sh COMPATIBILITY
174*0a6a1f1dSLionel SambucThe
175*0a6a1f1dSLionel Sambuc.Fn elf_flagarhdr
176*0a6a1f1dSLionel Sambucfunction and the
177*0a6a1f1dSLionel Sambuc.Dv ELF_F_ARCHIVE
178*0a6a1f1dSLionel Sambucand
179*0a6a1f1dSLionel Sambuc.Dv ELF_F_ARCHIVE_SYSV
180*0a6a1f1dSLionel Sambucflags are an extension to the ELF(3) API.
181*0a6a1f1dSLionel Sambuc.Sh ERRORS
182*0a6a1f1dSLionel SambucThese functions may fail with the following errors:
183*0a6a1f1dSLionel Sambuc.Bl -tag -width "[ELF_E_RESOURCE]"
184*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_ARGUMENT
185*0a6a1f1dSLionel SambucAn unsupported value was used for the
186*0a6a1f1dSLionel Sambuc.Ar cmd
187*0a6a1f1dSLionel Sambucargument.
188*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_ARGUMENT
189*0a6a1f1dSLionel SambucArgument
190*0a6a1f1dSLionel Sambuc.Ar flags
191*0a6a1f1dSLionel Sambuchad unsupported flags set.
192*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_ARGUMENT
193*0a6a1f1dSLionel SambucThe argument
194*0a6a1f1dSLionel Sambuc.Ar elf
195*0a6a1f1dSLionel Sambucwas not a descriptor for an ELF object.
196*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_MODE
197*0a6a1f1dSLionel SambucThe
198*0a6a1f1dSLionel Sambuc.Dv ELF_F_ARCHIVE
199*0a6a1f1dSLionel Sambucflag was used with an ELF descriptor that had not been opened for writing.
200*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_SEQUENCE
201*0a6a1f1dSLionel SambucFunction
202*0a6a1f1dSLionel Sambuc.Fn elf_flagehdr
203*0a6a1f1dSLionel Sambucwas called without an executable header being allocated.
204*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_SEQUENCE
205*0a6a1f1dSLionel SambucFunction
206*0a6a1f1dSLionel Sambuc.Fn elf_flagphdr
207*0a6a1f1dSLionel Sambucwas called without a program header being allocated.
208*0a6a1f1dSLionel Sambuc.El
209*0a6a1f1dSLionel Sambuc.Sh SEE ALSO
210*0a6a1f1dSLionel Sambuc.Xr elf 3 ,
211*0a6a1f1dSLionel Sambuc.Xr elf32_newehdr 3 ,
212*0a6a1f1dSLionel Sambuc.Xr elf32_newphdr 3 ,
213*0a6a1f1dSLionel Sambuc.Xr elf32_newshdr 3 ,
214*0a6a1f1dSLionel Sambuc.Xr elf64_newehdr 3 ,
215*0a6a1f1dSLionel Sambuc.Xr elf64_newphdr 3 ,
216*0a6a1f1dSLionel Sambuc.Xr elf64_newshdr 3 ,
217*0a6a1f1dSLionel Sambuc.Xr elf_newdata 3 ,
218*0a6a1f1dSLionel Sambuc.Xr elf_update 3 ,
219*0a6a1f1dSLionel Sambuc.Xr gelf 3 ,
220*0a6a1f1dSLionel Sambuc.Xr gelf_newehdr 3 ,
221*0a6a1f1dSLionel Sambuc.Xr gelf_newphdr 3 ,
222*0a6a1f1dSLionel Sambuc.Xr gelf_newshdr 3 ,
223*0a6a1f1dSLionel Sambuc.Xr gelf_update_dyn 3 ,
224*0a6a1f1dSLionel Sambuc.Xr gelf_update_move 3 ,
225*0a6a1f1dSLionel Sambuc.Xr gelf_update_rel 3 ,
226*0a6a1f1dSLionel Sambuc.Xr gelf_update_rela 3 ,
227*0a6a1f1dSLionel Sambuc.Xr gelf_update_sym 3 ,
228*0a6a1f1dSLionel Sambuc.Xr gelf_update_syminfo 3
229