summaryrefslogtreecommitdiffstats
path: root/rtemstoolkit/elftoolchain/libelf/gelf_getshdr.3
blob: cef1dc39f973225951ecaba3ff2cfaeb5e5f5fb9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
.\" Copyright (c) 2006,2008 Joseph Koshy.  All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\"    notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\"    notice, this list of conditions and the following disclaimer in the
.\"    documentation and/or other materials provided with the distribution.
.\"
.\" This software is provided by Joseph Koshy ``as is'' and
.\" any express or implied warranties, including, but not limited to, the
.\" implied warranties of merchantability and fitness for a particular purpose
.\" are disclaimed.  in no event shall Joseph Koshy be liable
.\" for any direct, indirect, incidental, special, exemplary, or consequential
.\" damages (including, but not limited to, procurement of substitute goods
.\" or services; loss of use, data, or profits; or business interruption)
.\" however caused and on any theory of liability, whether in contract, strict
.\" liability, or tort (including negligence or otherwise) arising in any way
.\" out of the use of this software, even if advised of the possibility of
.\" such damage.
.\"
.\" $Id$
.\"
.Dd August 27, 2006
.Os
.Dt GELF_GETSHDR 3
.Sh NAME
.Nm elf32_getshdr ,
.Nm elf64_getshdr ,
.Nm gelf_getshdr
.Nd retrieve the class-dependent section header
.Sh LIBRARY
.Lb libelf
.Sh SYNOPSIS
.In libelf.h
.Ft "Elf32_Shdr *"
.Fn elf32_getshdr "Elf_Scn *scn"
.Ft "Elf64_Shdr *"
.Fn elf64_getshdr "Elf_Scn *scn"
.In gelf.h
.Ft "GElf_Shdr *"
.Fn gelf_getshdr "Elf_Scn *scn" "GElf_Shdr *shdr"
.Sh DESCRIPTION
These functions return a pointer to the ELF Section Header data
structure associated with section descriptor
.Ar scn .
.Pp
Function
.Fn elf32_getshdr
retrieves a pointer to an
.Vt Elf32_Shdr
structure.
Section descriptor
.Ar scn
must be associated with an ELF descriptor of class
.Dv ELFCLASS32 .
.Pp
Function
.Fn elf64_getshdr
retrieves a pointer to an
.Vt Elf64_Shdr
structure.
Section descriptor
.Ar scn
must be associated with an ELF descriptor of class
.Dv ELFCLASS64 .
.Pp
Function
.Fn gelf_getshdr
copies the values in the section header associated with argument
.Ar scn
to the structure pointed to be argument
.Ar dst .
The
.Vt GElf_Shdr
data structure is described in
.Xr gelf 3 .
.Sh RETURN VALUES
Functions
.Fn elf32_getshdr
and
.Fn elf64_getshdr
return a valid pointer to the appropriate section header on success
or NULL if an error was encountered.
.Pp
Function
.Fn gelf_getshdr
returns argument
.Ar dst
if successful, or NULL if an error was encountered.
.Sh ERRORS
These functions may fail with the following errors:
.Bl -tag -width "[ELF_E_RESOURCE]"
.It Bq Er ELF_E_ARGUMENT
Arguments
.Ar scn
or
.Ar shdr
were NULL.
.It Bq Er ELF_E_ARGUMENT
Argument
.Ar scn
was not associated a descriptor for an ELF object.
.It Bq Er ELF_E_CLASS
The ELF class associated with the section descriptor
.Ar scn
did not match the class expected by the API.
.El
.Sh SEE ALSO
.Xr elf 3 ,
.Xr elf_getscn 3 ,
.Xr gelf 3 ,
.Xr gelf_update_shdr 3