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