1*0a6a1f1dSLionel Sambuc.\" $NetBSD: elf_update.3,v 1.2 2014/03/09 16:58:04 christos Exp $ 2*0a6a1f1dSLionel Sambuc.\" 3*0a6a1f1dSLionel Sambuc.\" Copyright (c) 2006-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_update.3 1729 2011-08-14 09:13:00Z jkoshy 27*0a6a1f1dSLionel Sambuc.\" 28*0a6a1f1dSLionel Sambuc.Dd August 14, 2011 29*0a6a1f1dSLionel Sambuc.Os 30*0a6a1f1dSLionel Sambuc.Dt ELF_UPDATE 3 31*0a6a1f1dSLionel Sambuc.Sh NAME 32*0a6a1f1dSLionel Sambuc.Nm elf_update 33*0a6a1f1dSLionel Sambuc.Nd update an ELF descriptor 34*0a6a1f1dSLionel Sambuc.Sh LIBRARY 35*0a6a1f1dSLionel Sambuc.Lb libelf 36*0a6a1f1dSLionel Sambuc.Sh SYNOPSIS 37*0a6a1f1dSLionel Sambuc.In libelf.h 38*0a6a1f1dSLionel Sambuc.Ft off_t 39*0a6a1f1dSLionel Sambuc.Fn elf_update "Elf *elf" "Elf_Cmd cmd" 40*0a6a1f1dSLionel Sambuc.Sh DESCRIPTION 41*0a6a1f1dSLionel SambucFunction 42*0a6a1f1dSLionel Sambuc.Fn elf_update 43*0a6a1f1dSLionel Sambuccauses the library to recalculate the structure of an ELF 44*0a6a1f1dSLionel Sambucobject and optionally write out the image of the object 45*0a6a1f1dSLionel Sambucto file. 46*0a6a1f1dSLionel Sambuc.Pp 47*0a6a1f1dSLionel SambucArgument 48*0a6a1f1dSLionel Sambuc.Ar elf 49*0a6a1f1dSLionel Sambucshould reference a valid ELF descriptor. 50*0a6a1f1dSLionel Sambuc.Pp 51*0a6a1f1dSLionel SambucArgument 52*0a6a1f1dSLionel Sambuc.Ar cmd 53*0a6a1f1dSLionel Sambuccan be one of the following values: 54*0a6a1f1dSLionel Sambuc.Bl -tag -width "Dv ELF_C_WRITE" 55*0a6a1f1dSLionel Sambuc.It Dv ELF_C_NULL 56*0a6a1f1dSLionel SambucThe library will recalculate structural information flagging 57*0a6a1f1dSLionel Sambucmodified structures with the 58*0a6a1f1dSLionel Sambuc.Dv ELF_F_DIRTY 59*0a6a1f1dSLionel Sambucflag, but will not write data to the underlying file image. 60*0a6a1f1dSLionel Sambuc.It Dv ELF_C_WRITE 61*0a6a1f1dSLionel SambucThe library will recalculate structural information and will 62*0a6a1f1dSLionel Sambucalso write the new image to the underlying file. 63*0a6a1f1dSLionel SambucThe ELF descriptor referenced by argument 64*0a6a1f1dSLionel Sambuc.Ar elf 65*0a6a1f1dSLionel Sambucshould permit the underlying ELF object to be written or updated 66*0a6a1f1dSLionel Sambuc(see 67*0a6a1f1dSLionel Sambuc.Xr elf_begin 3 ) . 68*0a6a1f1dSLionel Sambuc.El 69*0a6a1f1dSLionel Sambuc.Pp 70*0a6a1f1dSLionel SambucAll pointers to 71*0a6a1f1dSLionel Sambuc.Vt Elf_Scn 72*0a6a1f1dSLionel Sambucand 73*0a6a1f1dSLionel Sambuc.Vt Elf_Data 74*0a6a1f1dSLionel Sambucdescriptors associated with descriptor 75*0a6a1f1dSLionel Sambuc.Ar elf 76*0a6a1f1dSLionel Sambucshould be considered invalid after a call to 77*0a6a1f1dSLionel Sambuc.Fn elf_update . 78*0a6a1f1dSLionel Sambuc.Ss Specifying Object Layout 79*0a6a1f1dSLionel SambucThe 80*0a6a1f1dSLionel Sambuc.Lb libelf 81*0a6a1f1dSLionel Sambucsupports two layout modes. 82*0a6a1f1dSLionel Sambuc.Bl -tag -width indent 83*0a6a1f1dSLionel Sambuc.It "Library Layout" 84*0a6a1f1dSLionel SambucIf the 85*0a6a1f1dSLionel Sambuc.Dv ELF_F_LAYOUT 86*0a6a1f1dSLionel Sambucflag is not set on the ELF descriptor, the ELF library will lay out 87*0a6a1f1dSLionel Sambucthe ELF object according to the following scheme: 88*0a6a1f1dSLionel Sambuc.Bl -tag -compact -width "Section Data" 89*0a6a1f1dSLionel Sambuc.It Em EHDR 90*0a6a1f1dSLionel SambucThe ELF executable header will be placed at the start of the object. 91*0a6a1f1dSLionel Sambuc.It Em PHDR 92*0a6a1f1dSLionel SambucIf the ELF descriptor contains a program header table, it will be 93*0a6a1f1dSLionel Sambucplaced after the Executable Header. 94*0a6a1f1dSLionel Sambuc.It Em Section Data 95*0a6a1f1dSLionel SambucELF section data, if any, will be placed next, keeping each section's 96*0a6a1f1dSLionel Sambucalignment requirements in mind. 97*0a6a1f1dSLionel Sambuc.It Em SHDR 98*0a6a1f1dSLionel SambucThe ELF section header table, if any, will be placed last. 99*0a6a1f1dSLionel Sambuc.El 100*0a6a1f1dSLionel Sambuc.It "Application Controlled Layout" 101*0a6a1f1dSLionel SambucThe application can take full control of the layout of the ELF object 102*0a6a1f1dSLionel Sambucby setting the 103*0a6a1f1dSLionel Sambuc.Dv ELF_F_LAYOUT 104*0a6a1f1dSLionel Sambucflag on the ELF descriptor (see 105*0a6a1f1dSLionel Sambuc.Xr elf_flagelf 3 ) . 106*0a6a1f1dSLionel SambucIn this case the library will lay out the ELF object using 107*0a6a1f1dSLionel Sambucapplication-supplied information as below: 108*0a6a1f1dSLionel Sambuc.Pp 109*0a6a1f1dSLionel Sambuc.Bl -tag -compact -width "Section Data" 110*0a6a1f1dSLionel Sambuc.It Em EHDR 111*0a6a1f1dSLionel SambucThe ELF executable header will be placed at the start of the object. 112*0a6a1f1dSLionel Sambuc.It Em PHDR 113*0a6a1f1dSLionel SambucThe ELF program header table, if any, it will be placed at the offset 114*0a6a1f1dSLionel Sambucspecified in the 115*0a6a1f1dSLionel Sambuc.Va e_phoff 116*0a6a1f1dSLionel Sambucfield of the ELF executable header. 117*0a6a1f1dSLionel Sambuc.It Em Section Data 118*0a6a1f1dSLionel SambucThe data for each ELF section will be placed at the offset specified 119*0a6a1f1dSLionel Sambucby the 120*0a6a1f1dSLionel Sambuc.Va sh_offset 121*0a6a1f1dSLionel Sambucfield of the section's header. 122*0a6a1f1dSLionel SambucThe size of the section will be taken from the 123*0a6a1f1dSLionel Sambuc.Va sh_size 124*0a6a1f1dSLionel Sambucfield of the section header. 125*0a6a1f1dSLionel Sambuc.It Em SHDR 126*0a6a1f1dSLionel SambucThe ELF section header table, if any, will be placed at the offset 127*0a6a1f1dSLionel Sambucspecified by the 128*0a6a1f1dSLionel Sambuc.Va e_shoff 129*0a6a1f1dSLionel Sambucfield of the executable header. 130*0a6a1f1dSLionel Sambuc.El 131*0a6a1f1dSLionel Sambuc.El 132*0a6a1f1dSLionel Sambuc.Pp 133*0a6a1f1dSLionel SambucGaps in the coverage of the file's contents will be set to the fill value 134*0a6a1f1dSLionel Sambucspecified by 135*0a6a1f1dSLionel Sambuc.Xr elf_fill 3 . 136*0a6a1f1dSLionel Sambuc.Ss Application Supplied Information 137*0a6a1f1dSLionel SambucThe application needs to set the following fields in the data 138*0a6a1f1dSLionel Sambucstructures associated with the ELF descriptor prior to calling 139*0a6a1f1dSLionel Sambuc.Fn elf_update . 140*0a6a1f1dSLionel Sambuc.Bl -tag -width indent 141*0a6a1f1dSLionel Sambuc.It "Executable Header" 142*0a6a1f1dSLionel SambucThe fields of the ELF executable header that need to be set by the 143*0a6a1f1dSLionel Sambucapplication are: 144*0a6a1f1dSLionel Sambuc.Pp 145*0a6a1f1dSLionel Sambuc.Bl -tag -width "e_ident[EI_OSABI]" -compact 146*0a6a1f1dSLionel Sambuc.It Va e_entry 147*0a6a1f1dSLionel SambucTo be set to the desired entry address for executables. 148*0a6a1f1dSLionel Sambuc.It Va e_flags 149*0a6a1f1dSLionel SambucTo be set to the desired processor specific flags. 150*0a6a1f1dSLionel Sambuc.It Va "e_ident[EI_DATA]" 151*0a6a1f1dSLionel SambucMust be set to one of 152*0a6a1f1dSLionel Sambuc.Dv ELFDATA2LSB 153*0a6a1f1dSLionel Sambucor 154*0a6a1f1dSLionel Sambuc.Dv ELFDATA2MSB . 155*0a6a1f1dSLionel Sambuc.It Va "e_ident[EI_OSABI]" 156*0a6a1f1dSLionel SambucTo be set to the OS ABI desired. 157*0a6a1f1dSLionel SambucFor example, for 158*0a6a1f1dSLionel Sambuc.Fx 159*0a6a1f1dSLionel Sambucexecutables, this field should be set to 160*0a6a1f1dSLionel Sambuc.Dv ELFOSABI_FREEBSD . 161*0a6a1f1dSLionel Sambuc.It Va e_machine 162*0a6a1f1dSLionel SambucTo be set to the desired machine architecture, one of the 163*0a6a1f1dSLionel Sambuc.Dv EM_* 164*0a6a1f1dSLionel Sambucvalues in the header file 165*0a6a1f1dSLionel Sambuc.In elfdefinitions.h . 166*0a6a1f1dSLionel Sambuc.It Va e_phoff 167*0a6a1f1dSLionel SambucIf the application is managing the object's layout, it must 168*0a6a1f1dSLionel Sambucset this field to the file offset of the ELF program header table. 169*0a6a1f1dSLionel Sambuc.It Va e_shoff 170*0a6a1f1dSLionel SambucIf the application is managing the object's layout, it must 171*0a6a1f1dSLionel Sambucset this field to the file offset of the ELF section header table. 172*0a6a1f1dSLionel Sambuc.It Va e_shstrndx 173*0a6a1f1dSLionel SambucTo be set to the index of the string table containing 174*0a6a1f1dSLionel Sambucsection names. 175*0a6a1f1dSLionel Sambuc.It Va e_type 176*0a6a1f1dSLionel SambucTo be set to the type of the ELF object, one of the 177*0a6a1f1dSLionel Sambuc.Dv ET_* 178*0a6a1f1dSLionel Sambucvalues in the header file 179*0a6a1f1dSLionel Sambuc.In elfdefinitions.h . 180*0a6a1f1dSLionel Sambuc.It Va e_version 181*0a6a1f1dSLionel SambucTo be set to the desired version of the ELF object. 182*0a6a1f1dSLionel Sambuc.El 183*0a6a1f1dSLionel Sambuc.It "Program Header" 184*0a6a1f1dSLionel SambucAll fields of the entries in the program header table need to be 185*0a6a1f1dSLionel Sambucset by the application. 186*0a6a1f1dSLionel Sambuc.It "Section Header" 187*0a6a1f1dSLionel SambucThe fields of ELF section headers that need to be set by the 188*0a6a1f1dSLionel Sambucapplication are: 189*0a6a1f1dSLionel Sambuc.Pp 190*0a6a1f1dSLionel Sambuc.Bl -tag -width "sh_addralign" -compact 191*0a6a1f1dSLionel Sambuc.It Va sh_addr 192*0a6a1f1dSLionel SambucTo be set to the memory address where the section should reside. 193*0a6a1f1dSLionel Sambuc.It Va sh_addralign 194*0a6a1f1dSLionel SambucIf the application is managing the file layout, it must set this 195*0a6a1f1dSLionel Sambucfield to the desired alignment for the section's contents. 196*0a6a1f1dSLionel SambucThis value must be a power of two and must be at least as large as the 197*0a6a1f1dSLionel Sambuclargest alignment needed by any 198*0a6a1f1dSLionel Sambuc.Vt Elf_Data 199*0a6a1f1dSLionel Sambucdescriptor associated with the section. 200*0a6a1f1dSLionel Sambuc.It Va sh_entsize 201*0a6a1f1dSLionel SambucTo be set to the size of each entry, for sections containing fixed size 202*0a6a1f1dSLionel Sambucelements, or set to zero for sections without fixed size elements. 203*0a6a1f1dSLionel SambucIf the application is not managing file layout, it may leave this 204*0a6a1f1dSLionel Sambucfield as zero for those sections whose types are known to the library. 205*0a6a1f1dSLionel Sambuc.It Va sh_flags 206*0a6a1f1dSLionel SambucTo be set to the desired section flags. 207*0a6a1f1dSLionel Sambuc.It Va sh_info 208*0a6a1f1dSLionel SambucTo be set as described in 209*0a6a1f1dSLionel Sambuc.Xr elf 5 . 210*0a6a1f1dSLionel Sambuc.It Va sh_link 211*0a6a1f1dSLionel SambucTo be set as described in 212*0a6a1f1dSLionel Sambuc.Xr elf 5 . 213*0a6a1f1dSLionel Sambuc.It Va sh_name 214*0a6a1f1dSLionel SambucTo be set to the index of the section's name in the string table 215*0a6a1f1dSLionel Sambuccontaining section names. 216*0a6a1f1dSLionel Sambuc.It Va sh_offset 217*0a6a1f1dSLionel SambucIf the application is managing the file layout, it must set this 218*0a6a1f1dSLionel Sambucfield to the file offset of the section's contents. 219*0a6a1f1dSLionel Sambuc.It Va sh_size 220*0a6a1f1dSLionel SambucIf the application is managing the file layout, it must set this 221*0a6a1f1dSLionel Sambucfield to the file size of the section's contents. 222*0a6a1f1dSLionel Sambuc.It Va sh_type 223*0a6a1f1dSLionel SambucTo be set to the type of the section. 224*0a6a1f1dSLionel Sambuc.El 225*0a6a1f1dSLionel Sambuc.It "Section Data" 226*0a6a1f1dSLionel SambucThe 227*0a6a1f1dSLionel Sambuc.Vt Elf_Data 228*0a6a1f1dSLionel Sambucdescriptors associated with each section specify its contents 229*0a6a1f1dSLionel Sambuc(see 230*0a6a1f1dSLionel Sambuc.Xr elf_getdata 3 ) . 231*0a6a1f1dSLionel SambucWhile all the fields in these descriptors are under application 232*0a6a1f1dSLionel Sambuccontrol, the following fields influence object layout: 233*0a6a1f1dSLionel Sambuc.Bl -tag -width "Va d_align" -compact 234*0a6a1f1dSLionel Sambuc.It Va d_align 235*0a6a1f1dSLionel SambucTo be set to the desired alignment, within the containing section, of 236*0a6a1f1dSLionel Sambucthe descriptor's data. 237*0a6a1f1dSLionel Sambuc.It Va d_off 238*0a6a1f1dSLionel SambucIf the application is managing object layout, it must set this field 239*0a6a1f1dSLionel Sambucto the file offset, within the section, at which the descriptor's data 240*0a6a1f1dSLionel Sambucshould be placed. 241*0a6a1f1dSLionel Sambuc.It Va d_size 242*0a6a1f1dSLionel SambucTo be set to the size in bytes of the memory representation of the 243*0a6a1f1dSLionel Sambucdescriptor's data. 244*0a6a1f1dSLionel Sambuc.El 245*0a6a1f1dSLionel Sambuc.El 246*0a6a1f1dSLionel Sambuc.Sh RETURN VALUES 247*0a6a1f1dSLionel SambucFunction 248*0a6a1f1dSLionel Sambuc.Fn elf_update 249*0a6a1f1dSLionel Sambucreturns the total size of the file image if successful, or -1 if an 250*0a6a1f1dSLionel Sambucerror occurred. 251*0a6a1f1dSLionel Sambuc.Sh ERRORS 252*0a6a1f1dSLionel SambucThis function may fail with the following errors: 253*0a6a1f1dSLionel Sambuc.Bl -tag -width "[ELF_E_RESOURCE]" 254*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_ARGUMENT 255*0a6a1f1dSLionel SambucArgument 256*0a6a1f1dSLionel Sambuc.Ar elf 257*0a6a1f1dSLionel Sambucwas null. 258*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_ARGUMENT 259*0a6a1f1dSLionel SambucArgument 260*0a6a1f1dSLionel Sambuc.Ar cmd 261*0a6a1f1dSLionel Sambucwas not recognized. 262*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_ARGUMENT 263*0a6a1f1dSLionel SambucThe argument 264*0a6a1f1dSLionel Sambuc.Ar elf 265*0a6a1f1dSLionel Sambucwas not a descriptor for an ELF object. 266*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_CLASS 267*0a6a1f1dSLionel SambucThe 268*0a6a1f1dSLionel Sambuc.Va e_ident[EI_CLASS] 269*0a6a1f1dSLionel Sambucfield of the executable header of argument 270*0a6a1f1dSLionel Sambuc.Ar elf 271*0a6a1f1dSLionel Sambucdid not match the class of the file. 272*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_DATA 273*0a6a1f1dSLionel SambucAn 274*0a6a1f1dSLionel Sambuc.Vt Elf_Data 275*0a6a1f1dSLionel Sambucdescriptor contained in argument 276*0a6a1f1dSLionel Sambuc.Ar elf 277*0a6a1f1dSLionel Sambucspecified an unsupported type. 278*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_DATA 279*0a6a1f1dSLionel SambucAn 280*0a6a1f1dSLionel Sambuc.Vt Elf_Data 281*0a6a1f1dSLionel Sambucdescriptor specified an alignment that was zero or was not a power of 282*0a6a1f1dSLionel Sambuctwo. 283*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_HEADER 284*0a6a1f1dSLionel SambucThe ELF header in argument 285*0a6a1f1dSLionel Sambuc.Ar elf 286*0a6a1f1dSLionel Sambucrequested a different byte order from the byte order already 287*0a6a1f1dSLionel Sambucassociated with the file. 288*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_IO 289*0a6a1f1dSLionel SambucAn I/O error was encountered. 290*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_LAYOUT 291*0a6a1f1dSLionel SambucAn 292*0a6a1f1dSLionel Sambuc.Vt Elf_Data 293*0a6a1f1dSLionel Sambucdescriptor contained in argument 294*0a6a1f1dSLionel Sambuc.Ar elf 295*0a6a1f1dSLionel Sambucspecified an alignment incompatible with its containing section. 296*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_LAYOUT 297*0a6a1f1dSLionel SambucArgument 298*0a6a1f1dSLionel Sambuc.Ar elf 299*0a6a1f1dSLionel Sambuccontained section descriptors that overlapped in extent. 300*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_LAYOUT 301*0a6a1f1dSLionel SambucArgument 302*0a6a1f1dSLionel Sambuc.Ar elf 303*0a6a1f1dSLionel Sambuccontained section descriptors that were incorrectly aligned or were 304*0a6a1f1dSLionel Sambuctoo small for their data. 305*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_LAYOUT 306*0a6a1f1dSLionel SambucThe flag 307*0a6a1f1dSLionel Sambuc.Dv ELF_F_LAYOUT 308*0a6a1f1dSLionel Sambucwas set on the Elf descriptor and the executable header overlapped 309*0a6a1f1dSLionel Sambucwith the program header table. 310*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_LAYOUT 311*0a6a1f1dSLionel SambucThe flag 312*0a6a1f1dSLionel Sambuc.Dv ELF_F_LAYOUT 313*0a6a1f1dSLionel Sambucwas set on the Elf descriptor and the program header table was placed 314*0a6a1f1dSLionel Sambucat a misaligned file offset. 315*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_LAYOUT 316*0a6a1f1dSLionel SambucThe flag 317*0a6a1f1dSLionel Sambuc.Dv ELF_F_LAYOUT 318*0a6a1f1dSLionel Sambucwas set on the Elf descriptor and the section header table overlapped 319*0a6a1f1dSLionel Sambucan extent mapped by a section descriptor. 320*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_LAYOUT 321*0a6a1f1dSLionel SambucThe 322*0a6a1f1dSLionel Sambuc.Dv ELF_F_LAYOUT 323*0a6a1f1dSLionel Sambucflag was set on the Elf descriptor, and the 324*0a6a1f1dSLionel Sambuc.Va d_offset 325*0a6a1f1dSLionel Sambucfield in an 326*0a6a1f1dSLionel Sambuc.Vt Elf_Data 327*0a6a1f1dSLionel Sambucdescriptor contained a value that was not a multiple of the 328*0a6a1f1dSLionel Sambucdescriptor's specified alignment. 329*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_MODE 330*0a6a1f1dSLionel SambucAn 331*0a6a1f1dSLionel Sambuc.Dv ELF_C_WRITE 332*0a6a1f1dSLionel Sambucoperation was requested with an ELF descriptor that was not opened for 333*0a6a1f1dSLionel Sambucwriting or updating. 334*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_SECTION 335*0a6a1f1dSLionel SambucArgument 336*0a6a1f1dSLionel Sambuc.Ar elf 337*0a6a1f1dSLionel Sambuccontained a section with an unrecognized type. 338*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_SECTION 339*0a6a1f1dSLionel SambucThe section header at index 340*0a6a1f1dSLionel Sambuc.Dv SHN_UNDEF 341*0a6a1f1dSLionel Sambuchad an illegal section type. 342*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_SEQUENCE 343*0a6a1f1dSLionel SambucAn 344*0a6a1f1dSLionel Sambuc.Dv ELF_C_WRITE 345*0a6a1f1dSLionel Sambucoperation was requested after a prior call to 346*0a6a1f1dSLionel Sambuc.Fn elf_cntl elf ELF_C_FDDONE 347*0a6a1f1dSLionel Sambucdisassociated the ELF descriptor 348*0a6a1f1dSLionel Sambuc.Ar elf 349*0a6a1f1dSLionel Sambucfrom its underlying file. 350*0a6a1f1dSLionel Sambuc.It Bq Er ELF_E_VERSION 351*0a6a1f1dSLionel SambucArgument 352*0a6a1f1dSLionel Sambuc.Ar elf 353*0a6a1f1dSLionel Sambuchad an unsupported version or contained an 354*0a6a1f1dSLionel Sambuc.Vt Elf_Data 355*0a6a1f1dSLionel Sambucdescriptor with an unsupported version. 356*0a6a1f1dSLionel Sambuc.El 357*0a6a1f1dSLionel Sambuc.Sh SEE ALSO 358*0a6a1f1dSLionel Sambuc.Xr elf 3 , 359*0a6a1f1dSLionel Sambuc.Xr elf32_getehdr 3 , 360*0a6a1f1dSLionel Sambuc.Xr elf32_getphdr 3 , 361*0a6a1f1dSLionel Sambuc.Xr elf32_newehdr 3 , 362*0a6a1f1dSLionel Sambuc.Xr elf32_newphdr 3 , 363*0a6a1f1dSLionel Sambuc.Xr elf64_getehdr 3 , 364*0a6a1f1dSLionel Sambuc.Xr elf64_getphdr 3 , 365*0a6a1f1dSLionel Sambuc.Xr elf64_newehdr 3 , 366*0a6a1f1dSLionel Sambuc.Xr elf64_newphdr 3 , 367*0a6a1f1dSLionel Sambuc.Xr elf_begin 3 , 368*0a6a1f1dSLionel Sambuc.Xr elf_cntl 3 , 369*0a6a1f1dSLionel Sambuc.Xr elf_fill 3 , 370*0a6a1f1dSLionel Sambuc.Xr elf_flagehdr 3 , 371*0a6a1f1dSLionel Sambuc.Xr elf_flagelf 3 , 372*0a6a1f1dSLionel Sambuc.Xr elf_getdata 3 , 373*0a6a1f1dSLionel Sambuc.Xr elf_getscn 3 , 374*0a6a1f1dSLionel Sambuc.Xr elf_newdata 3 , 375*0a6a1f1dSLionel Sambuc.Xr elf_newscn 3 , 376*0a6a1f1dSLionel Sambuc.Xr elf_rawdata 3 , 377*0a6a1f1dSLionel Sambuc.Xr gelf 3 , 378*0a6a1f1dSLionel Sambuc.Xr gelf_newehdr 3 , 379*0a6a1f1dSLionel Sambuc.Xr gelf_newphdr 3 , 380*0a6a1f1dSLionel Sambuc.Xr elf 5 381