1 .\" Copyright (c) 2006-2008,2018 Joseph Koshy. All rights reserved.
3 .\" Redistribution and use in source and binary forms, with or without
4 .\" modification, are permitted provided that the following conditions
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.
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
24 .\" $Id: elf_getscn.3 3639 2018-10-14 14:07:02Z jkoshy $
26 .Dd September 24, 2018
34 .Nd get/allocate section information for an ELF object
40 .Fn elf_getscn "Elf *elf" "size_t index"
42 .Fn elf_ndxscn "Elf_Scn *scn"
44 .Fn elf_newscn "Elf *elf"
46 .Fn elf_nextscn "Elf *elf" "Elf_Scn *scn"
48 These functions are used to iterate through the sections associated
49 with an ELF descriptor.
53 will return a section descriptor for the section at index
55 in the object denoted by ELF descriptor
57 An error will be signalled if the specified section does not
62 returns the section table index associated with section descriptor
67 creates a new section and appends it to the list of sections
68 associated with descriptor
70 The library will automatically increment the
72 field of the ELF header associated with descriptor
76 flag on the returned section descriptor.
77 For ELF descriptors opened for writing, the ELF library will
78 automatically create an empty section at index zero
85 takes a section descriptor
87 and returns a pointer to the section descriptor at the next higher
91 will never return a pointer to the empty section at index zero
95 is allowed to be NULL, in which case this function will return a
96 pointer to the section descriptor at index 1.
97 If no further sections are present, function
99 will return a NULL pointer.
106 return a valid pointer to a section descriptor if successful, or
107 NULL if an error occurs.
111 returns a valid section table index if successful, or
115 These functions may fail with the following errors:
116 .Bl -tag -width "[ELF_E_RESOURCE]"
117 .It Bq Er ELF_E_ARGUMENT
123 .It Bq Er ELF_E_ARGUMENT
126 exceeded the current number of sections in the ELF object.
127 .It Bq Er ELF_E_ARGUMENT
130 was not a descriptor for an ELF file.
131 .It Bq Er ELF_E_ARGUMENT
134 was not associated with ELF descriptor
136 .It Bq Er ELF_E_CLASS
139 was of an unknown ELF class.
140 .It Bq Er ELF_E_SECTION
143 specified extended section numbering in the ELF header with the section header at