source: rtems-tools/rtemstoolkit/elftoolchain/libelf/elf_getscn.3 @ 6f48c91

5
Last change on this file since 6f48c91 was 6f48c91, checked in by Chris Johns <chrisj@…>, on 04/30/18 at 03:39:09

Revert "rtemstoolkit: Update elftoolchain to the latest code."

This reverts commit 0c5db2dd13b8270bb80c497d5f53ae2471f8a819.

  • Property mode set to 100644
File size: 4.1 KB
Line 
1.\" Copyright (c) 2006-2008 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.\" $Id: elf_getscn.3 189 2008-07-20 10:38:08Z jkoshy $
25.\"
26.Dd October 22, 2007
27.Os
28.Dt ELF_GETSCN 3
29.Sh NAME
30.Nm elf_getscn ,
31.Nm elf_ndxscn ,
32.Nm elf_newscn ,
33.Nm elf_nextscn
34.Nd get/allocate section information for an ELF object
35.Sh LIBRARY
36.Lb libelf
37.Sh SYNOPSIS
38.In libelf.h
39.Ft "Elf_Scn *"
40.Fn elf_getscn "Elf *elf" "size_t index"
41.Ft size_t
42.Fn elf_ndxscn "Elf_Scn *scn"
43.Ft "Elf_Scn *"
44.Fn elf_newscn "Elf *elf"
45.Ft "Elf_Scn *"
46.Fn elf_nextscn "Elf *elf" "Elf_Scn *scn"
47.Sh DESCRIPTION
48These functions are used to iterate through the sections associated
49with an ELF descriptor.
50.Pp
51Function
52.Fn elf_getscn
53will return a section descriptor for the section at index
54.Ar index
55in the object denoted by ELF descriptor
56.Ar elf .
57An error will be signalled if the specified section does not
58exist.
59.Pp
60Function
61.Fn elf_ndxscn
62returns the section table index associated with section descriptor
63.Ar scn .
64.Pp
65Function
66.Fn elf_newscn
67creates a new section and appends it to the list of sections
68associated with descriptor
69.Ar elf .
70The library will automatically increment the
71.Va e_shnum
72field of the ELF header associated with descriptor
73.Ar elf ,
74and will set the
75.Dv ELF_F_DIRTY
76flag on the returned section descriptor.
77For ELF descriptors opened for writing, the ELF library will
78automatically create an empty section at index zero
79.Dv ( SHN_UNDEF )
80on the first call to
81.Fn elf_newscn .
82.Pp
83Function
84.Fn elf_nextscn
85takes a section descriptor
86.Ar scn
87and returns a pointer to the section descriptor at the next higher
88index.
89Argument
90.Ar scn
91is allowed to be NULL, in which case this function will return a
92pointer to the section descriptor at index 1.
93If no further sections are present, function
94.Fn elf_nextscn
95will return a NULL pointer.
96.Sh RETURN VALUES
97Functions
98.Fn elf_getscn ,
99.Fn elf_newscn
100and
101.Fn elf_nextscn
102return a valid pointer to a section descriptor if successful, or
103NULL if an error occurs.
104.Pp
105Function
106.Fn elf_ndxscn
107returns a valid section table index if successful, or
108.Dv SHN_UNDEF
109if an error occurs.
110.Sh ERRORS
111These functions may fail with the following errors:
112.Bl -tag -width "[ELF_E_RESOURCE]"
113.It Bq Er ELF_E_ARGUMENT
114Arguments
115.Ar elf
116or
117.Ar scn
118were NULL.
119.It Bq Er ELF_E_ARGUMENT
120Argument
121.Ar index
122exceeded the current number of sections in the ELF object.
123.It Bq Er ELF_E_ARGUMENT
124Argument
125.Ar elf
126was not a descriptor for an ELF file.
127.It Bq Er ELF_E_ARGUMENT
128Section descriptor
129.Ar scn
130was not associated with ELF descriptor
131.Ar elf .
132.It Bq Er ELF_E_CLASS
133Descriptor
134.Ar elf
135was of an unknown ELF class.
136.It Bq Er ELF_E_SECTION
137Argument
138.Ar elf
139specified extended section numbering in the ELF header with the section header at
140index
141.Dv SHN_UNDEF
142not being of type
143.Dv SHT_NULL .
144.El
145.Sh SEE ALSO
146.Xr elf 3 ,
147.Xr elf_flagdata 3 ,
148.Xr elf_flagscn 3 ,
149.Xr elf_getdata 3 ,
150.Xr elf_getshdr 3 ,
151.Xr gelf 3
Note: See TracBrowser for help on using the repository browser.