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 54These functions are used to query, set or reset flags on data 55structures associated with an ELF file. 56.Pp 57Arguments 58.Ar data , 59.Ar elf 60and 61.Ar scn 62denote the data structures whose flags need to be changed. 63These values are allowed to be NULL to simplify error handling in 64application code. 65.Pp 66Argument 67.Ar cmd 68may have the following values: 69.Bl -tag -width ELF_C_SET 70.It Dv ELF_C_CLR 71The argument 72.Ar flags 73specifies the flags to be cleared. 74.It Dv ELF_C_SET 75The argument 76.Ar flags 77specifies the flags to be set. 78.El 79.Pp 80The argument 81.Ar flags 82is allowed to have the following flags set: 83.Bl -tag -width ELF_F_LAYOUT 84.It Dv ELF_F_DIRTY 85Mark the associated data structure as needing to be written back 86to the underlying file. 87A subsequent call to 88.Xr elf_update 3 89will resynchronize the library's internal data structures. 90.It Dv ELF_F_LAYOUT 91This flag is only valid with the 92.Fn elf_flagelf 93API. 94It informs the library that the application will take 95responsibility for the layout of the file and that the library is 96not to insert any padding in between sections. 97.El 98.Pp 99Marking a given data structure as 100.Dq dirty 101affects all of its contained elements. 102Thus marking an ELF descriptor 103.Ar elf 104with 105.Fn elf_flagelf "elf" "ELF_C_SET" "ELF_F_DIRTY" 106means that the entire contents of the descriptor are 107.Dq dirty . 108.Pp 109Using a value of zero for argument 110.Ar flags 111will return the current set of flags for the data structure being 112queried. 113.Sh RETURN VALUES 114These functions return the updated flags is successful, and zero if 115an error is detected. 116.Sh ERRORS 117These functions may fail with the following errors: 118.Bl -tag -width "[ELF_E_RESOURCE]" 119.It Bq Er ELF_E_ARGUMENT 120An unsupported value was used for the 121.Ar cmd 122argument. 123.It Bq Er ELF_E_ARGUMENT 124Argument 125.Ar flags 126had unsupported flags set. 127.It Bq Er ELF_E_ARGUMENT 128The argument 129.Ar elf 130was not a descriptor for an ELF object. 131.It Bq Er ELF_E_SEQUENCE 132Function 133.Fn elf_flagehdr 134was called without an executable header being allocated. 135.It Bq Er ELF_E_SEQUENCE 136Function 137.Fn elf_flagphdr 138was 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 160