]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/elftoolchain/libelf/gelf_getchdr.3
Upgrade to version 3.2.3
[FreeBSD/FreeBSD.git] / contrib / elftoolchain / libelf / gelf_getchdr.3
1 .\" SPDX-License-Identifier: BSD-2-Clause
2 .\"
3 .\" Copyright (c) 2020 The FreeBSD Foundation
4 .\"
5 .\" This document was written by Tiger Gao under sponsorship from
6 .\" the FreeBSD Foundation.
7 .\"
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions are
10 .\" met:
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\"    notice, this list of conditions and the following disclaimer in
15 .\"    the documentation and/or other materials provided with the distribution.
16 .\"
17 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 .\" SUCH DAMAGE.
28 .\"
29 .\" $Id: gelf_getchdr.3 3639 2020-10-20 16:07:02Z tig $
30 .\"
31 .Dd October 23, 2020
32 .Dt GELF_GETCHDR 3
33 .Os
34 .Sh NAME
35 .Nm elf32_getchdr ,
36 .Nm elf64_getchdr ,
37 .Nm gelf_getchdr
38 .Nd retrieve the compression header of a section
39 .Sh LIBRARY
40 .Lb libelf
41 .Sh SYNOPSIS
42 .In libelf.h
43 .Ft "Elf32_Chdr *"
44 .Fn elf32_getchdr "Elf_Scn *s"
45 .Ft "Elf64_Chdr *"
46 .Fn elf64_getchdr "Elf_Scn *s"
47 .In gelf.h
48 .Ft "GElf_Chdr *"
49 .Fn gelf_getchdr "Elf_Scn *scn" "GElf_Chdr *chdr"
50 .Sh DESCRIPTION
51 These functions return a pointer to the ELF Compression Header data
52 structure associated with section descriptor
53 .Ar scn .
54 .Pp
55 Function
56 .Fn elf32_getchdr
57 retrieves a pointer to an
58 .Vt Elf32_Chdr
59 structure.
60 Section descriptor
61 .Ar scn
62 must be associated with an ELF descriptor of class
63 .Dv ELFCLASS32 .
64 .Pp
65 Function
66 .Fn elf64_getchdr
67 retrieves a pointer to an
68 .Vt Elf64_Chdr
69 structure.
70 Section descriptor
71 .Ar scn
72 must be associated with an ELF descriptor of class
73 .Dv ELFCLASS64 .
74 .Pp
75 Function
76 .Fn gelf_getchdr
77 copies the values in the compression header associated with argument
78 .Ar scn
79 to the structure pointed to be argument
80 .Ar dst .
81 The
82 .Vt GElf_Chdr
83 data structure is described in
84 .Xr gelf 3 .
85 .Sh RETURN VALUES
86 Functions
87 .Fn elf32_getchdr
88 and
89 .Fn elf64_getchdr
90 return a valid pointer to the appropriate compression header on success
91 or NULL if an error was encountered.
92 .Pp
93 Function
94 .Fn gelf_getchdr
95 returns argument
96 .Ar dst
97 if successful, or NULL if an error was encountered.
98 .Sh ERRORS
99 These functions may fail with the following errors:
100 .Bl -tag -width "[ELF_E_RESOURCE]"
101 .It Bq Er ELF_E_INVALID_SECTION_FLAGS
102 Arguments
103 .Ar scn
104 has invalid flags.
105 .It Bq Er ELF_E_INVALID_SECTION_TYPE
106 Argument
107 .Ar scn
108 has invalid type.
109 .It Bq Er ELF_E_NOT_COMPRESSED
110 Argument
111 .Ar scn
112 is not compressed.
113 .El
114 .Sh SEE ALSO
115 .Xr elf 3 ,
116 .Xr elf_getscn 3 ,
117 .Xr gelf 3 ,