1 .\" $NetBSD: elf_getscn.3,v 1.2 2014/03/09 16:58:04 christos Exp $
3 .\" Copyright (c) 2006-2008 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_getscn.3 189 2008-07-20 10:38:08Z jkoshy
36 .Nd get/allocate section information for an ELF object
42 .Fn elf_getscn "Elf *elf" "size_t index"
44 .Fn elf_ndxscn "Elf_Scn *scn"
46 .Fn elf_newscn "Elf *elf"
48 .Fn elf_nextscn "Elf *elf" "Elf_Scn *scn"
50 These functions are used to iterate through the sections associated
51 with an ELF descriptor.
55 will return a section descriptor for the section at index
57 in the object denoted by ELF descriptor
59 An error will be signalled if the specified section does not
64 returns the section table index associated with section descriptor
69 creates a new section and appends it to the list of sections
70 associated with descriptor
72 The library will automatically increment the
74 field of the ELF header associated with descriptor
78 flag on the returned section descriptor.
79 For ELF descriptors opened for writing, the ELF library will
80 automatically create an empty section at index zero
87 takes a section descriptor
89 and returns a pointer to the section descriptor at the next higher
93 is allowed to be NULL, in which case this function will return a
94 pointer to the section descriptor at index 1.
95 If no further sections are present, function
97 will return a NULL pointer.
104 return a valid pointer to a section descriptor if successful, or
105 NULL if an error occurs.
109 returns a valid section table index if successful, or
113 These functions may fail with the following errors:
114 .Bl -tag -width "[ELF_E_RESOURCE]"
115 .It Bq Er ELF_E_ARGUMENT
121 .It Bq Er ELF_E_ARGUMENT
124 exceeded the current number of sections in the ELF object.
125 .It Bq Er ELF_E_ARGUMENT
128 was not a descriptor for an ELF file.
129 .It Bq Er ELF_E_ARGUMENT
132 was not associated with ELF descriptor
134 .It Bq Er ELF_E_CLASS
137 was of an unknown ELF class.
138 .It Bq Er ELF_E_SECTION
141 specified extended section numbering in the ELF header with the section header at