2 .\" Copyright 1989 AT&T Copyright (c) 2001, Sun Microsystems, Inc. All Rights Reserved
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH ELF32_GETPHDR 3ELF "Jul 11, 2001"
8 elf32_getphdr, elf32_newphdr, elf64_getphdr, elf64_newphdr \- retrieve
9 class-dependent program header table
13 cc [ \fIflag\fR ... ] \fIfile\fR... \fB-lelf\fR [ \fIlibrary\fR ... ]
16 \fBElf32_Phdr *\fR\fBelf32_getphdr\fR(\fBElf *\fR\fIelf\fR);
21 \fBElf32_Phdr *\fR\fBelf32_newphdr\fR(\fBElf *\fR\fIelf\fR, \fBsize_t\fR \fIcount\fR);
26 \fBElf64_Phdr *\fR\fBelf64_getphdr\fR(\fBElf *\fR\fIelf\fR);
31 \fBElf64_Phdr *\fR\fBelf64_newphdr\fR(\fBElf *\fR\fIelf\fR, \fBsize_t\fR \fIcount\fR);
37 For a 32-bit class file, \fBelf32_getphdr()\fR returns a pointer to the program
38 execution header table, if one is available for the \fBELF\fR descriptor
42 \fBelf32_newphdr()\fR allocates a new table with \fIcount\fR entries,
43 regardless of whether one existed previously, and sets the \fBELF_F_DIRTY\fR
44 bit for the table. See \fBelf_flagdata\fR(3ELF). Specifying a zero \fIcount\fR
45 deletes an existing table. Note this behavior differs from that of
46 \fBelf32_newehdr()\fR allowing a program to replace or delete the program
47 header table, changing its size if necessary. See \fBelf32_getehdr\fR(3ELF).
50 If no program header table exists, the file is not a 32-bit class file, an
51 error occurs, or \fIelf\fR is \fINULL,\fR both functions return a null pointer.
52 Additionally, \fBelf32_newphdr()\fR returns a null pointer if \fIcount\fR is
56 The table is an array of \fBElf32_Phdr\fR structures, each of which includes
57 the following members:
68 Elf32_Word p_align;\fR
74 The \fBElf64_Phdr\fR structures include the following members:
85 Elf64_Xword p_align;\fR
91 For the 64\(mibit class, replace 32 with 64 as appropriate.
94 The \fBELF\fR header's \fBe_phnum\fR member tells how many entries the program
95 header table has. See \fBelf32_getehdr\fR(3ELF). A program may inspect this
96 value to determine the size of an existing table; \fBelf32_newphdr()\fR
97 automatically sets the member's value to \fIcount\fR. If the program is
98 building a new file, it is responsible for creating the file's \fBELF\fR header
99 before creating the program header table.
103 See \fBattributes\fR(5) for descriptions of the following attributes:
111 ATTRIBUTE TYPE ATTRIBUTE VALUE
113 Interface Stability Stable
121 \fBelf\fR(3ELF), \fBelf32_getehdr\fR(3ELF), \fBelf_begin\fR(3ELF),
122 \fBelf_flagdata\fR(3ELF), \fBlibelf\fR(3LIB), \fBattributes\fR(5)