xref: /aosp_15_r20/external/elfutils/libelf/libelf.h (revision 7304104da70ce23c86437a01be71edd1a2d7f37e)
1*7304104dSAndroid Build Coastguard Worker /* Interface for libelf.
2*7304104dSAndroid Build Coastguard Worker    Copyright (C) 1998-2010, 2015 Red Hat, Inc.
3*7304104dSAndroid Build Coastguard Worker    This file is part of elfutils.
4*7304104dSAndroid Build Coastguard Worker 
5*7304104dSAndroid Build Coastguard Worker    This file is free software; you can redistribute it and/or modify
6*7304104dSAndroid Build Coastguard Worker    it under the terms of either
7*7304104dSAndroid Build Coastguard Worker 
8*7304104dSAndroid Build Coastguard Worker      * the GNU Lesser General Public License as published by the Free
9*7304104dSAndroid Build Coastguard Worker        Software Foundation; either version 3 of the License, or (at
10*7304104dSAndroid Build Coastguard Worker        your option) any later version
11*7304104dSAndroid Build Coastguard Worker 
12*7304104dSAndroid Build Coastguard Worker    or
13*7304104dSAndroid Build Coastguard Worker 
14*7304104dSAndroid Build Coastguard Worker      * the GNU General Public License as published by the Free
15*7304104dSAndroid Build Coastguard Worker        Software Foundation; either version 2 of the License, or (at
16*7304104dSAndroid Build Coastguard Worker        your option) any later version
17*7304104dSAndroid Build Coastguard Worker 
18*7304104dSAndroid Build Coastguard Worker    or both in parallel, as here.
19*7304104dSAndroid Build Coastguard Worker 
20*7304104dSAndroid Build Coastguard Worker    elfutils is distributed in the hope that it will be useful, but
21*7304104dSAndroid Build Coastguard Worker    WITHOUT ANY WARRANTY; without even the implied warranty of
22*7304104dSAndroid Build Coastguard Worker    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
23*7304104dSAndroid Build Coastguard Worker    General Public License for more details.
24*7304104dSAndroid Build Coastguard Worker 
25*7304104dSAndroid Build Coastguard Worker    You should have received copies of the GNU General Public License and
26*7304104dSAndroid Build Coastguard Worker    the GNU Lesser General Public License along with this program.  If
27*7304104dSAndroid Build Coastguard Worker    not, see <http://www.gnu.org/licenses/>.  */
28*7304104dSAndroid Build Coastguard Worker 
29*7304104dSAndroid Build Coastguard Worker #ifndef _LIBELF_H
30*7304104dSAndroid Build Coastguard Worker #define _LIBELF_H 1
31*7304104dSAndroid Build Coastguard Worker 
32*7304104dSAndroid Build Coastguard Worker #include <stdint.h>
33*7304104dSAndroid Build Coastguard Worker #include <sys/types.h>
34*7304104dSAndroid Build Coastguard Worker 
35*7304104dSAndroid Build Coastguard Worker /* Get the ELF types.  */
36*7304104dSAndroid Build Coastguard Worker #include <elf.h>
37*7304104dSAndroid Build Coastguard Worker 
38*7304104dSAndroid Build Coastguard Worker #ifndef SHF_COMPRESSED
39*7304104dSAndroid Build Coastguard Worker  /* Older glibc elf.h might not yet define the ELF compression types.  */
40*7304104dSAndroid Build Coastguard Worker  #define SHF_COMPRESSED      (1 << 11)  /* Section with compressed data. */
41*7304104dSAndroid Build Coastguard Worker 
42*7304104dSAndroid Build Coastguard Worker  /* Section compression header.  Used when SHF_COMPRESSED is set.  */
43*7304104dSAndroid Build Coastguard Worker 
44*7304104dSAndroid Build Coastguard Worker  typedef struct
45*7304104dSAndroid Build Coastguard Worker  {
46*7304104dSAndroid Build Coastguard Worker    Elf32_Word   ch_type;        /* Compression format.  */
47*7304104dSAndroid Build Coastguard Worker    Elf32_Word   ch_size;        /* Uncompressed data size.  */
48*7304104dSAndroid Build Coastguard Worker    Elf32_Word   ch_addralign;   /* Uncompressed data alignment.  */
49*7304104dSAndroid Build Coastguard Worker  } Elf32_Chdr;
50*7304104dSAndroid Build Coastguard Worker 
51*7304104dSAndroid Build Coastguard Worker  typedef struct
52*7304104dSAndroid Build Coastguard Worker  {
53*7304104dSAndroid Build Coastguard Worker    Elf64_Word   ch_type;        /* Compression format.  */
54*7304104dSAndroid Build Coastguard Worker    Elf64_Word   ch_reserved;
55*7304104dSAndroid Build Coastguard Worker    Elf64_Xword  ch_size;        /* Uncompressed data size.  */
56*7304104dSAndroid Build Coastguard Worker    Elf64_Xword  ch_addralign;   /* Uncompressed data alignment.  */
57*7304104dSAndroid Build Coastguard Worker  } Elf64_Chdr;
58*7304104dSAndroid Build Coastguard Worker 
59*7304104dSAndroid Build Coastguard Worker  /* Legal values for ch_type (compression algorithm).  */
60*7304104dSAndroid Build Coastguard Worker  #define ELFCOMPRESS_ZLIB       1          /* ZLIB/DEFLATE algorithm.  */
61*7304104dSAndroid Build Coastguard Worker  #define ELFCOMPRESS_LOOS       0x60000000 /* Start of OS-specific.  */
62*7304104dSAndroid Build Coastguard Worker  #define ELFCOMPRESS_HIOS       0x6fffffff /* End of OS-specific.  */
63*7304104dSAndroid Build Coastguard Worker  #define ELFCOMPRESS_LOPROC     0x70000000 /* Start of processor-specific.  */
64*7304104dSAndroid Build Coastguard Worker  #define ELFCOMPRESS_HIPROC     0x7fffffff /* End of processor-specific.  */
65*7304104dSAndroid Build Coastguard Worker #endif
66*7304104dSAndroid Build Coastguard Worker 
67*7304104dSAndroid Build Coastguard Worker #ifndef ELFCOMPRESS_ZSTD
68*7304104dSAndroid Build Coastguard Worker  /* So ZSTD compression can be used even with an old system elf.h.  */
69*7304104dSAndroid Build Coastguard Worker  #define ELFCOMPRESS_ZSTD       2          /* Zstandard algorithm.  */
70*7304104dSAndroid Build Coastguard Worker #endif
71*7304104dSAndroid Build Coastguard Worker 
72*7304104dSAndroid Build Coastguard Worker #ifndef SHT_RELR
73*7304104dSAndroid Build Coastguard Worker  /* So RELR defines/typedefs can be used even with an old system elf.h.  */
74*7304104dSAndroid Build Coastguard Worker  #define SHT_RELR       19      /* RELR relative relocations */
75*7304104dSAndroid Build Coastguard Worker 
76*7304104dSAndroid Build Coastguard Worker  /* RELR relocation table entry */
77*7304104dSAndroid Build Coastguard Worker  typedef Elf32_Word     Elf32_Relr;
78*7304104dSAndroid Build Coastguard Worker  typedef Elf64_Xword    Elf64_Relr;
79*7304104dSAndroid Build Coastguard Worker 
80*7304104dSAndroid Build Coastguard Worker  #define DT_RELRSZ      35      /* Total size of RELR relative relocations */
81*7304104dSAndroid Build Coastguard Worker  #define DT_RELR        36      /* Address of RELR relative relocations */
82*7304104dSAndroid Build Coastguard Worker  #define DT_RELRENT     37      /* Size of one RELR relative relocaction */
83*7304104dSAndroid Build Coastguard Worker #endif
84*7304104dSAndroid Build Coastguard Worker 
85*7304104dSAndroid Build Coastguard Worker #if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
86*7304104dSAndroid Build Coastguard Worker # define __nonnull_attribute__(...) __attribute__ ((__nonnull__ (__VA_ARGS__)))
87*7304104dSAndroid Build Coastguard Worker # define __deprecated_attribute__ __attribute__ ((__deprecated__))
88*7304104dSAndroid Build Coastguard Worker # define __pure_attribute__ __attribute__ ((__pure__))
89*7304104dSAndroid Build Coastguard Worker # define __const_attribute__ __attribute__ ((__const__))
90*7304104dSAndroid Build Coastguard Worker #else
91*7304104dSAndroid Build Coastguard Worker # define __nonnull_attribute__(...)
92*7304104dSAndroid Build Coastguard Worker # define __deprecated_attribute__
93*7304104dSAndroid Build Coastguard Worker # define __pure_attribute__
94*7304104dSAndroid Build Coastguard Worker # define __const_attribute__
95*7304104dSAndroid Build Coastguard Worker #endif
96*7304104dSAndroid Build Coastguard Worker 
97*7304104dSAndroid Build Coastguard Worker #if __GNUC__ < 4
98*7304104dSAndroid Build Coastguard Worker #define __noreturn_attribute__
99*7304104dSAndroid Build Coastguard Worker #else
100*7304104dSAndroid Build Coastguard Worker #define __noreturn_attribute__ __attribute__ ((noreturn))
101*7304104dSAndroid Build Coastguard Worker #endif
102*7304104dSAndroid Build Coastguard Worker 
103*7304104dSAndroid Build Coastguard Worker #ifdef __GNUC_STDC_INLINE__
104*7304104dSAndroid Build Coastguard Worker # define __libdw_extern_inline extern __inline __attribute__ ((__gnu_inline__))
105*7304104dSAndroid Build Coastguard Worker #else
106*7304104dSAndroid Build Coastguard Worker # define __libdw_extern_inline extern __inline
107*7304104dSAndroid Build Coastguard Worker #endif
108*7304104dSAndroid Build Coastguard Worker 
109*7304104dSAndroid Build Coastguard Worker /* Known translation types.  */
110*7304104dSAndroid Build Coastguard Worker typedef enum
111*7304104dSAndroid Build Coastguard Worker {
112*7304104dSAndroid Build Coastguard Worker   ELF_T_BYTE,                   /* unsigned char */
113*7304104dSAndroid Build Coastguard Worker   ELF_T_ADDR,                   /* Elf32_Addr, Elf64_Addr, ... */
114*7304104dSAndroid Build Coastguard Worker   ELF_T_DYN,                    /* Dynamic section record.  */
115*7304104dSAndroid Build Coastguard Worker   ELF_T_EHDR,                   /* ELF header.  */
116*7304104dSAndroid Build Coastguard Worker   ELF_T_HALF,                   /* Elf32_Half, Elf64_Half, ... */
117*7304104dSAndroid Build Coastguard Worker   ELF_T_OFF,                    /* Elf32_Off, Elf64_Off, ... */
118*7304104dSAndroid Build Coastguard Worker   ELF_T_PHDR,                   /* Program header.  */
119*7304104dSAndroid Build Coastguard Worker   ELF_T_RELA,                   /* Relocation entry with addend.  */
120*7304104dSAndroid Build Coastguard Worker   ELF_T_REL,                    /* Relocation entry.  */
121*7304104dSAndroid Build Coastguard Worker   ELF_T_SHDR,                   /* Section header.  */
122*7304104dSAndroid Build Coastguard Worker   ELF_T_SWORD,                  /* Elf32_Sword, Elf64_Sword, ... */
123*7304104dSAndroid Build Coastguard Worker   ELF_T_SYM,                    /* Symbol record.  */
124*7304104dSAndroid Build Coastguard Worker   ELF_T_WORD,                   /* Elf32_Word, Elf64_Word, ... */
125*7304104dSAndroid Build Coastguard Worker   ELF_T_XWORD,                  /* Elf32_Xword, Elf64_Xword, ... */
126*7304104dSAndroid Build Coastguard Worker   ELF_T_SXWORD,                 /* Elf32_Sxword, Elf64_Sxword, ... */
127*7304104dSAndroid Build Coastguard Worker   ELF_T_VDEF,                   /* Elf32_Verdef, Elf64_Verdef, ... */
128*7304104dSAndroid Build Coastguard Worker   ELF_T_VDAUX,                  /* Elf32_Verdaux, Elf64_Verdaux, ... */
129*7304104dSAndroid Build Coastguard Worker   ELF_T_VNEED,                  /* Elf32_Verneed, Elf64_Verneed, ... */
130*7304104dSAndroid Build Coastguard Worker   ELF_T_VNAUX,                  /* Elf32_Vernaux, Elf64_Vernaux, ... */
131*7304104dSAndroid Build Coastguard Worker   ELF_T_NHDR,                   /* Elf32_Nhdr, Elf64_Nhdr, ... */
132*7304104dSAndroid Build Coastguard Worker   ELF_T_SYMINFO,		/* Elf32_Syminfo, Elf64_Syminfo, ... */
133*7304104dSAndroid Build Coastguard Worker   ELF_T_MOVE,			/* Elf32_Move, Elf64_Move, ... */
134*7304104dSAndroid Build Coastguard Worker   ELF_T_LIB,			/* Elf32_Lib, Elf64_Lib, ... */
135*7304104dSAndroid Build Coastguard Worker   ELF_T_GNUHASH,		/* GNU-style hash section.  */
136*7304104dSAndroid Build Coastguard Worker   ELF_T_AUXV,			/* Elf32_auxv_t, Elf64_auxv_t, ... */
137*7304104dSAndroid Build Coastguard Worker   ELF_T_CHDR,			/* Compressed, Elf32_Chdr, Elf64_Chdr, ... */
138*7304104dSAndroid Build Coastguard Worker   ELF_T_NHDR8,			/* Special GNU Properties note.  Same as Nhdr,
139*7304104dSAndroid Build Coastguard Worker 				   except padding.  */
140*7304104dSAndroid Build Coastguard Worker   ELF_T_RELR,			/* Relative relocation entry.  */
141*7304104dSAndroid Build Coastguard Worker   /* Keep this the last entry.  */
142*7304104dSAndroid Build Coastguard Worker   ELF_T_NUM
143*7304104dSAndroid Build Coastguard Worker } Elf_Type;
144*7304104dSAndroid Build Coastguard Worker 
145*7304104dSAndroid Build Coastguard Worker /* Descriptor for data to be converted to or from memory format.  */
146*7304104dSAndroid Build Coastguard Worker typedef struct
147*7304104dSAndroid Build Coastguard Worker {
148*7304104dSAndroid Build Coastguard Worker   void *d_buf;			/* Pointer to the actual data.  */
149*7304104dSAndroid Build Coastguard Worker   Elf_Type d_type;		/* Type of this piece of data.  */
150*7304104dSAndroid Build Coastguard Worker   unsigned int d_version;	/* ELF version.  */
151*7304104dSAndroid Build Coastguard Worker   size_t d_size;		/* Size in bytes.  */
152*7304104dSAndroid Build Coastguard Worker   int64_t d_off;		/* Offset into section.  */
153*7304104dSAndroid Build Coastguard Worker   size_t d_align;		/* Alignment in section.  */
154*7304104dSAndroid Build Coastguard Worker } Elf_Data;
155*7304104dSAndroid Build Coastguard Worker 
156*7304104dSAndroid Build Coastguard Worker 
157*7304104dSAndroid Build Coastguard Worker /* Commands for `...'.  */
158*7304104dSAndroid Build Coastguard Worker typedef enum
159*7304104dSAndroid Build Coastguard Worker {
160*7304104dSAndroid Build Coastguard Worker   ELF_C_NULL,			/* Nothing, terminate, or compute only.  */
161*7304104dSAndroid Build Coastguard Worker   ELF_C_READ,			/* Read .. */
162*7304104dSAndroid Build Coastguard Worker   ELF_C_RDWR,			/* Read and write .. */
163*7304104dSAndroid Build Coastguard Worker   ELF_C_WRITE,			/* Write .. */
164*7304104dSAndroid Build Coastguard Worker   ELF_C_CLR,			/* Clear flag.  */
165*7304104dSAndroid Build Coastguard Worker   ELF_C_SET,			/* Set flag.  */
166*7304104dSAndroid Build Coastguard Worker   ELF_C_FDDONE,			/* Signal that file descriptor will not be
167*7304104dSAndroid Build Coastguard Worker 				   used anymore.  */
168*7304104dSAndroid Build Coastguard Worker   ELF_C_FDREAD,			/* Read rest of data so that file descriptor
169*7304104dSAndroid Build Coastguard Worker 				   is not used anymore.  */
170*7304104dSAndroid Build Coastguard Worker   /* The following are extensions.  */
171*7304104dSAndroid Build Coastguard Worker   ELF_C_READ_MMAP,		/* Read, but mmap the file if possible.  */
172*7304104dSAndroid Build Coastguard Worker   ELF_C_RDWR_MMAP,		/* Read and write, with mmap.  */
173*7304104dSAndroid Build Coastguard Worker   ELF_C_WRITE_MMAP,		/* Write, with mmap.  */
174*7304104dSAndroid Build Coastguard Worker   ELF_C_READ_MMAP_PRIVATE,	/* Read, but memory is writable, results are
175*7304104dSAndroid Build Coastguard Worker 				   not written to the file.  */
176*7304104dSAndroid Build Coastguard Worker   ELF_C_EMPTY,			/* Copy basic file data but not the content. */
177*7304104dSAndroid Build Coastguard Worker   /* Keep this the last entry.  */
178*7304104dSAndroid Build Coastguard Worker   ELF_C_NUM
179*7304104dSAndroid Build Coastguard Worker } Elf_Cmd;
180*7304104dSAndroid Build Coastguard Worker 
181*7304104dSAndroid Build Coastguard Worker 
182*7304104dSAndroid Build Coastguard Worker /* Flags for the ELF structures.  */
183*7304104dSAndroid Build Coastguard Worker enum
184*7304104dSAndroid Build Coastguard Worker {
185*7304104dSAndroid Build Coastguard Worker   ELF_F_DIRTY = 0x1,
186*7304104dSAndroid Build Coastguard Worker #define ELF_F_DIRTY		ELF_F_DIRTY
187*7304104dSAndroid Build Coastguard Worker   ELF_F_LAYOUT = 0x4,
188*7304104dSAndroid Build Coastguard Worker #define ELF_F_LAYOUT		ELF_F_LAYOUT
189*7304104dSAndroid Build Coastguard Worker   ELF_F_PERMISSIVE = 0x8
190*7304104dSAndroid Build Coastguard Worker #define ELF_F_PERMISSIVE	ELF_F_PERMISSIVE
191*7304104dSAndroid Build Coastguard Worker };
192*7304104dSAndroid Build Coastguard Worker 
193*7304104dSAndroid Build Coastguard Worker /* Flags for elf_compress[_gnu].  */
194*7304104dSAndroid Build Coastguard Worker enum
195*7304104dSAndroid Build Coastguard Worker {
196*7304104dSAndroid Build Coastguard Worker   ELF_CHF_FORCE = 0x1
197*7304104dSAndroid Build Coastguard Worker #define ELF_CHF_FORCE ELF_CHF_FORCE
198*7304104dSAndroid Build Coastguard Worker };
199*7304104dSAndroid Build Coastguard Worker 
200*7304104dSAndroid Build Coastguard Worker /* Identification values for recognized object files.  */
201*7304104dSAndroid Build Coastguard Worker typedef enum
202*7304104dSAndroid Build Coastguard Worker {
203*7304104dSAndroid Build Coastguard Worker   ELF_K_NONE,			/* Unknown.  */
204*7304104dSAndroid Build Coastguard Worker   ELF_K_AR,			/* Archive.  */
205*7304104dSAndroid Build Coastguard Worker   ELF_K_COFF,			/* Stupid old COFF.  */
206*7304104dSAndroid Build Coastguard Worker   ELF_K_ELF,			/* ELF file.  */
207*7304104dSAndroid Build Coastguard Worker   /* Keep this the last entry.  */
208*7304104dSAndroid Build Coastguard Worker   ELF_K_NUM
209*7304104dSAndroid Build Coastguard Worker } Elf_Kind;
210*7304104dSAndroid Build Coastguard Worker 
211*7304104dSAndroid Build Coastguard Worker 
212*7304104dSAndroid Build Coastguard Worker /* Archive member header.  */
213*7304104dSAndroid Build Coastguard Worker typedef struct
214*7304104dSAndroid Build Coastguard Worker {
215*7304104dSAndroid Build Coastguard Worker   char *ar_name;		/* Name of archive member.  */
216*7304104dSAndroid Build Coastguard Worker   time_t ar_date;		/* File date.  */
217*7304104dSAndroid Build Coastguard Worker   uid_t ar_uid;			/* User ID.  */
218*7304104dSAndroid Build Coastguard Worker   gid_t ar_gid;			/* Group ID.  */
219*7304104dSAndroid Build Coastguard Worker   mode_t ar_mode;		/* File mode.  */
220*7304104dSAndroid Build Coastguard Worker   int64_t ar_size;		/* File size.  */
221*7304104dSAndroid Build Coastguard Worker   char *ar_rawname;		/* Original name of archive member.  */
222*7304104dSAndroid Build Coastguard Worker } Elf_Arhdr;
223*7304104dSAndroid Build Coastguard Worker 
224*7304104dSAndroid Build Coastguard Worker 
225*7304104dSAndroid Build Coastguard Worker /* Archive symbol table entry.  */
226*7304104dSAndroid Build Coastguard Worker typedef struct
227*7304104dSAndroid Build Coastguard Worker {
228*7304104dSAndroid Build Coastguard Worker   char *as_name;		/* Symbol name.  */
229*7304104dSAndroid Build Coastguard Worker   size_t as_off;		/* Offset for this file in the archive.  */
230*7304104dSAndroid Build Coastguard Worker   unsigned long int as_hash;	/* Hash value of the name.  */
231*7304104dSAndroid Build Coastguard Worker } Elf_Arsym;
232*7304104dSAndroid Build Coastguard Worker 
233*7304104dSAndroid Build Coastguard Worker 
234*7304104dSAndroid Build Coastguard Worker /* Descriptor for the ELF file.  */
235*7304104dSAndroid Build Coastguard Worker typedef struct Elf Elf;
236*7304104dSAndroid Build Coastguard Worker 
237*7304104dSAndroid Build Coastguard Worker /* Descriptor for ELF file section.  */
238*7304104dSAndroid Build Coastguard Worker typedef struct Elf_Scn Elf_Scn;
239*7304104dSAndroid Build Coastguard Worker 
240*7304104dSAndroid Build Coastguard Worker 
241*7304104dSAndroid Build Coastguard Worker #ifdef __cplusplus
242*7304104dSAndroid Build Coastguard Worker extern "C" {
243*7304104dSAndroid Build Coastguard Worker #endif
244*7304104dSAndroid Build Coastguard Worker 
245*7304104dSAndroid Build Coastguard Worker /* Return descriptor for ELF file to work according to CMD.  */
246*7304104dSAndroid Build Coastguard Worker extern Elf *elf_begin (int __fildes, Elf_Cmd __cmd, Elf *__ref);
247*7304104dSAndroid Build Coastguard Worker 
248*7304104dSAndroid Build Coastguard Worker /* Create a clone of an existing ELF descriptor.  */
249*7304104dSAndroid Build Coastguard Worker   extern Elf *elf_clone (Elf *__elf, Elf_Cmd __cmd);
250*7304104dSAndroid Build Coastguard Worker 
251*7304104dSAndroid Build Coastguard Worker /* Create descriptor for memory region.  */
252*7304104dSAndroid Build Coastguard Worker extern Elf *elf_memory (char *__image, size_t __size);
253*7304104dSAndroid Build Coastguard Worker 
254*7304104dSAndroid Build Coastguard Worker /* Advance archive descriptor to next element.  */
255*7304104dSAndroid Build Coastguard Worker extern Elf_Cmd elf_next (Elf *__elf);
256*7304104dSAndroid Build Coastguard Worker 
257*7304104dSAndroid Build Coastguard Worker /* Free resources allocated for ELF.  */
258*7304104dSAndroid Build Coastguard Worker extern int elf_end (Elf *__elf);
259*7304104dSAndroid Build Coastguard Worker 
260*7304104dSAndroid Build Coastguard Worker /* Update ELF descriptor and write file to disk.  */
261*7304104dSAndroid Build Coastguard Worker extern int64_t elf_update (Elf *__elf, Elf_Cmd __cmd);
262*7304104dSAndroid Build Coastguard Worker 
263*7304104dSAndroid Build Coastguard Worker /* Determine what kind of file is associated with ELF.  */
264*7304104dSAndroid Build Coastguard Worker extern Elf_Kind elf_kind (Elf *__elf) __pure_attribute__;
265*7304104dSAndroid Build Coastguard Worker 
266*7304104dSAndroid Build Coastguard Worker /* Get the base offset for an object file.  */
267*7304104dSAndroid Build Coastguard Worker extern int64_t elf_getbase (Elf *__elf);
268*7304104dSAndroid Build Coastguard Worker 
269*7304104dSAndroid Build Coastguard Worker 
270*7304104dSAndroid Build Coastguard Worker /* Retrieve file identification data.  */
271*7304104dSAndroid Build Coastguard Worker extern char *elf_getident (Elf *__elf, size_t *__nbytes);
272*7304104dSAndroid Build Coastguard Worker 
273*7304104dSAndroid Build Coastguard Worker /* Retrieve class-dependent object file header.  */
274*7304104dSAndroid Build Coastguard Worker extern Elf32_Ehdr *elf32_getehdr (Elf *__elf);
275*7304104dSAndroid Build Coastguard Worker /* Similar but this time the binary calls is ELFCLASS64.  */
276*7304104dSAndroid Build Coastguard Worker extern Elf64_Ehdr *elf64_getehdr (Elf *__elf);
277*7304104dSAndroid Build Coastguard Worker 
278*7304104dSAndroid Build Coastguard Worker /* Create ELF header if none exists.  */
279*7304104dSAndroid Build Coastguard Worker extern Elf32_Ehdr *elf32_newehdr (Elf *__elf);
280*7304104dSAndroid Build Coastguard Worker /* Similar but this time the binary calls is ELFCLASS64.  */
281*7304104dSAndroid Build Coastguard Worker extern Elf64_Ehdr *elf64_newehdr (Elf *__elf);
282*7304104dSAndroid Build Coastguard Worker 
283*7304104dSAndroid Build Coastguard Worker /* Get the number of program headers in the ELF file.  If the file uses
284*7304104dSAndroid Build Coastguard Worker    more headers than can be represented in the e_phnum field of the ELF
285*7304104dSAndroid Build Coastguard Worker    header the information from the sh_info field in the zeroth section
286*7304104dSAndroid Build Coastguard Worker    header is used.  */
287*7304104dSAndroid Build Coastguard Worker extern int elf_getphdrnum (Elf *__elf, size_t *__dst);
288*7304104dSAndroid Build Coastguard Worker 
289*7304104dSAndroid Build Coastguard Worker /* Retrieve class-dependent program header table.  */
290*7304104dSAndroid Build Coastguard Worker extern Elf32_Phdr *elf32_getphdr (Elf *__elf);
291*7304104dSAndroid Build Coastguard Worker /* Similar but this time the binary calls is ELFCLASS64.  */
292*7304104dSAndroid Build Coastguard Worker extern Elf64_Phdr *elf64_getphdr (Elf *__elf);
293*7304104dSAndroid Build Coastguard Worker 
294*7304104dSAndroid Build Coastguard Worker /* Create ELF program header.  */
295*7304104dSAndroid Build Coastguard Worker extern Elf32_Phdr *elf32_newphdr (Elf *__elf, size_t __cnt);
296*7304104dSAndroid Build Coastguard Worker /* Similar but this time the binary calls is ELFCLASS64.  */
297*7304104dSAndroid Build Coastguard Worker extern Elf64_Phdr *elf64_newphdr (Elf *__elf, size_t __cnt);
298*7304104dSAndroid Build Coastguard Worker 
299*7304104dSAndroid Build Coastguard Worker 
300*7304104dSAndroid Build Coastguard Worker /* Get section at INDEX.  */
301*7304104dSAndroid Build Coastguard Worker extern Elf_Scn *elf_getscn (Elf *__elf, size_t __index);
302*7304104dSAndroid Build Coastguard Worker 
303*7304104dSAndroid Build Coastguard Worker /* Get section at OFFSET.  */
304*7304104dSAndroid Build Coastguard Worker extern Elf_Scn *elf32_offscn (Elf *__elf, Elf32_Off __offset);
305*7304104dSAndroid Build Coastguard Worker /* Similar but this time the binary calls is ELFCLASS64.  */
306*7304104dSAndroid Build Coastguard Worker extern Elf_Scn *elf64_offscn (Elf *__elf, Elf64_Off __offset);
307*7304104dSAndroid Build Coastguard Worker 
308*7304104dSAndroid Build Coastguard Worker /* Get index of section.  */
309*7304104dSAndroid Build Coastguard Worker extern size_t elf_ndxscn (Elf_Scn *__scn);
310*7304104dSAndroid Build Coastguard Worker 
311*7304104dSAndroid Build Coastguard Worker /* Get section with next section index.  */
312*7304104dSAndroid Build Coastguard Worker extern Elf_Scn *elf_nextscn (Elf *__elf, Elf_Scn *__scn);
313*7304104dSAndroid Build Coastguard Worker 
314*7304104dSAndroid Build Coastguard Worker /* Create a new section and append it at the end of the table.  */
315*7304104dSAndroid Build Coastguard Worker extern Elf_Scn *elf_newscn (Elf *__elf);
316*7304104dSAndroid Build Coastguard Worker 
317*7304104dSAndroid Build Coastguard Worker /* Get the section index of the extended section index table for the
318*7304104dSAndroid Build Coastguard Worker    given symbol table.  */
319*7304104dSAndroid Build Coastguard Worker extern int elf_scnshndx (Elf_Scn *__scn);
320*7304104dSAndroid Build Coastguard Worker 
321*7304104dSAndroid Build Coastguard Worker /* Get the number of sections in the ELF file.  If the file uses more
322*7304104dSAndroid Build Coastguard Worker    sections than can be represented in the e_shnum field of the ELF
323*7304104dSAndroid Build Coastguard Worker    header the information from the sh_size field in the zeroth section
324*7304104dSAndroid Build Coastguard Worker    header is used.  */
325*7304104dSAndroid Build Coastguard Worker extern int elf_getshdrnum (Elf *__elf, size_t *__dst);
326*7304104dSAndroid Build Coastguard Worker /* Sun messed up the implementation of 'elf_getshnum' in their implementation.
327*7304104dSAndroid Build Coastguard Worker    It was agreed to make the same functionality available under a different
328*7304104dSAndroid Build Coastguard Worker    name and obsolete the old name.  */
329*7304104dSAndroid Build Coastguard Worker extern int elf_getshnum (Elf *__elf, size_t *__dst)
330*7304104dSAndroid Build Coastguard Worker      __deprecated_attribute__;
331*7304104dSAndroid Build Coastguard Worker 
332*7304104dSAndroid Build Coastguard Worker 
333*7304104dSAndroid Build Coastguard Worker /* Get the section index of the section header string table in the ELF
334*7304104dSAndroid Build Coastguard Worker    file.  If the index cannot be represented in the e_shstrndx field of
335*7304104dSAndroid Build Coastguard Worker    the ELF header the information from the sh_link field in the zeroth
336*7304104dSAndroid Build Coastguard Worker    section header is used.  */
337*7304104dSAndroid Build Coastguard Worker extern int elf_getshdrstrndx (Elf *__elf, size_t *__dst);
338*7304104dSAndroid Build Coastguard Worker /* Sun messed up the implementation of 'elf_getshstrndx' in their
339*7304104dSAndroid Build Coastguard Worker    implementation.  It was agreed to make the same functionality available
340*7304104dSAndroid Build Coastguard Worker    under a different name and obsolete the old name.  */
341*7304104dSAndroid Build Coastguard Worker extern int elf_getshstrndx (Elf *__elf, size_t *__dst)
342*7304104dSAndroid Build Coastguard Worker      __deprecated_attribute__;
343*7304104dSAndroid Build Coastguard Worker 
344*7304104dSAndroid Build Coastguard Worker 
345*7304104dSAndroid Build Coastguard Worker /* Retrieve section header of ELFCLASS32 binary.  */
346*7304104dSAndroid Build Coastguard Worker extern Elf32_Shdr *elf32_getshdr (Elf_Scn *__scn);
347*7304104dSAndroid Build Coastguard Worker /* Similar for ELFCLASS64.  */
348*7304104dSAndroid Build Coastguard Worker extern Elf64_Shdr *elf64_getshdr (Elf_Scn *__scn);
349*7304104dSAndroid Build Coastguard Worker 
350*7304104dSAndroid Build Coastguard Worker /* Returns compression header for a section if section data is
351*7304104dSAndroid Build Coastguard Worker    compressed.  Returns NULL and sets elf_errno if the section isn't
352*7304104dSAndroid Build Coastguard Worker    compressed or an error occurred.  */
353*7304104dSAndroid Build Coastguard Worker extern Elf32_Chdr *elf32_getchdr (Elf_Scn *__scn);
354*7304104dSAndroid Build Coastguard Worker extern Elf64_Chdr *elf64_getchdr (Elf_Scn *__scn);
355*7304104dSAndroid Build Coastguard Worker 
356*7304104dSAndroid Build Coastguard Worker /* Compress or decompress the data of a section and adjust the section
357*7304104dSAndroid Build Coastguard Worker    header.
358*7304104dSAndroid Build Coastguard Worker 
359*7304104dSAndroid Build Coastguard Worker    elf_compress works by setting or clearing the SHF_COMPRESS flag
360*7304104dSAndroid Build Coastguard Worker    from the section Shdr and will encode or decode a Elf32_Chdr or
361*7304104dSAndroid Build Coastguard Worker    Elf64_Chdr at the start of the section data.  elf_compress_gnu will
362*7304104dSAndroid Build Coastguard Worker    encode or decode any section, but is traditionally only used for
363*7304104dSAndroid Build Coastguard Worker    sections that have a name starting with ".debug" when
364*7304104dSAndroid Build Coastguard Worker    uncompressed or ".zdebug" when compressed and stores just the
365*7304104dSAndroid Build Coastguard Worker    uncompressed size.  The GNU compression method is deprecated and
366*7304104dSAndroid Build Coastguard Worker    should only be used for legacy support.
367*7304104dSAndroid Build Coastguard Worker 
368*7304104dSAndroid Build Coastguard Worker    elf_compress takes a compression type that should be either zero to
369*7304104dSAndroid Build Coastguard Worker    decompress or an ELFCOMPRESS algorithm to use for compression.
370*7304104dSAndroid Build Coastguard Worker    Currently ELFCOMPRESS_ZLIB and ELFCOMPRESS_ZSTD are supported.
371*7304104dSAndroid Build Coastguard Worker    elf_compress_gnu will compress in the traditional GNU compression
372*7304104dSAndroid Build Coastguard Worker    format when compress is one and decompress the section data when
373*7304104dSAndroid Build Coastguard Worker    compress is zero.
374*7304104dSAndroid Build Coastguard Worker 
375*7304104dSAndroid Build Coastguard Worker    The FLAGS argument can be zero or ELF_CHF_FORCE.  If FLAGS contains
376*7304104dSAndroid Build Coastguard Worker    ELF_CHF_FORCE then it will always compress the section, even if
377*7304104dSAndroid Build Coastguard Worker    that would not reduce the size of the data section (including the
378*7304104dSAndroid Build Coastguard Worker    header).  Otherwise elf_compress and elf_compress_gnu will compress
379*7304104dSAndroid Build Coastguard Worker    the section only if the total data size is reduced.
380*7304104dSAndroid Build Coastguard Worker 
381*7304104dSAndroid Build Coastguard Worker    On successful compression or decompression the function returns
382*7304104dSAndroid Build Coastguard Worker    one.  If (not forced) compression is requested and the data section
383*7304104dSAndroid Build Coastguard Worker    would not actually reduce in size, the section is not actually
384*7304104dSAndroid Build Coastguard Worker    compressed and zero is returned.  Otherwise -1 is returned and
385*7304104dSAndroid Build Coastguard Worker    elf_errno is set.
386*7304104dSAndroid Build Coastguard Worker 
387*7304104dSAndroid Build Coastguard Worker    It is an error to request compression for a section that already
388*7304104dSAndroid Build Coastguard Worker    has SHF_COMPRESSED set, or (for elf_compress) to request
389*7304104dSAndroid Build Coastguard Worker    decompression for an section that doesn't have SHF_COMPRESSED set.
390*7304104dSAndroid Build Coastguard Worker    If a section has SHF_COMPRESSED set then calling elf_compress_gnu
391*7304104dSAndroid Build Coastguard Worker    will result in an error.  The section has to be decompressed first
392*7304104dSAndroid Build Coastguard Worker    using elf_compress.  Calling elf_compress on a section compressed
393*7304104dSAndroid Build Coastguard Worker    with elf_compress_gnu is fine, but probably useless.
394*7304104dSAndroid Build Coastguard Worker 
395*7304104dSAndroid Build Coastguard Worker    It is always an error to call these functions on SHT_NOBITS
396*7304104dSAndroid Build Coastguard Worker    sections or if the section has the SHF_ALLOC flag set.
397*7304104dSAndroid Build Coastguard Worker    elf_compress_gnu will not check whether the section name starts
398*7304104dSAndroid Build Coastguard Worker    with ".debug" or .zdebug".  It is the responsibility of the caller
399*7304104dSAndroid Build Coastguard Worker    to make sure the deprecated GNU compression method is only called
400*7304104dSAndroid Build Coastguard Worker    on correctly named sections (and to change the name of the section
401*7304104dSAndroid Build Coastguard Worker    when using elf_compress_gnu).
402*7304104dSAndroid Build Coastguard Worker 
403*7304104dSAndroid Build Coastguard Worker    All previous returned Shdrs and Elf_Data buffers are invalidated by
404*7304104dSAndroid Build Coastguard Worker    this call and should no longer be accessed.
405*7304104dSAndroid Build Coastguard Worker 
406*7304104dSAndroid Build Coastguard Worker    Note that although this changes the header and data returned it
407*7304104dSAndroid Build Coastguard Worker    doesn't mark the section as dirty.  To keep the changes when
408*7304104dSAndroid Build Coastguard Worker    calling elf_update the section has to be flagged ELF_F_DIRTY.  */
409*7304104dSAndroid Build Coastguard Worker extern int elf_compress (Elf_Scn *scn, int type, unsigned int flags);
410*7304104dSAndroid Build Coastguard Worker extern int elf_compress_gnu (Elf_Scn *scn, int compress, unsigned int flags);
411*7304104dSAndroid Build Coastguard Worker 
412*7304104dSAndroid Build Coastguard Worker /* Set or clear flags for ELF file.  */
413*7304104dSAndroid Build Coastguard Worker extern unsigned int elf_flagelf (Elf *__elf, Elf_Cmd __cmd,
414*7304104dSAndroid Build Coastguard Worker 				 unsigned int __flags);
415*7304104dSAndroid Build Coastguard Worker /* Similarly for the ELF header.  */
416*7304104dSAndroid Build Coastguard Worker extern unsigned int elf_flagehdr (Elf *__elf, Elf_Cmd __cmd,
417*7304104dSAndroid Build Coastguard Worker 				  unsigned int __flags);
418*7304104dSAndroid Build Coastguard Worker /* Similarly for the ELF program header.  */
419*7304104dSAndroid Build Coastguard Worker extern unsigned int elf_flagphdr (Elf *__elf, Elf_Cmd __cmd,
420*7304104dSAndroid Build Coastguard Worker 				  unsigned int __flags);
421*7304104dSAndroid Build Coastguard Worker /* Similarly for the given ELF section.  */
422*7304104dSAndroid Build Coastguard Worker extern unsigned int elf_flagscn (Elf_Scn *__scn, Elf_Cmd __cmd,
423*7304104dSAndroid Build Coastguard Worker 				 unsigned int __flags);
424*7304104dSAndroid Build Coastguard Worker /* Similarly for the given ELF data.  */
425*7304104dSAndroid Build Coastguard Worker extern unsigned int elf_flagdata (Elf_Data *__data, Elf_Cmd __cmd,
426*7304104dSAndroid Build Coastguard Worker 				  unsigned int __flags);
427*7304104dSAndroid Build Coastguard Worker /* Similarly for the given ELF section header.  */
428*7304104dSAndroid Build Coastguard Worker extern unsigned int elf_flagshdr (Elf_Scn *__scn, Elf_Cmd __cmd,
429*7304104dSAndroid Build Coastguard Worker 				  unsigned int __flags);
430*7304104dSAndroid Build Coastguard Worker 
431*7304104dSAndroid Build Coastguard Worker 
432*7304104dSAndroid Build Coastguard Worker /* Get data from section while translating from file representation to
433*7304104dSAndroid Build Coastguard Worker    memory representation.  The Elf_Data d_type is set based on the
434*7304104dSAndroid Build Coastguard Worker    section type if known.  Otherwise d_type is set to ELF_T_BYTE.  If
435*7304104dSAndroid Build Coastguard Worker    the section contains compressed data then d_type is always set to
436*7304104dSAndroid Build Coastguard Worker    ELF_T_CHDR.  */
437*7304104dSAndroid Build Coastguard Worker extern Elf_Data *elf_getdata (Elf_Scn *__scn, Elf_Data *__data);
438*7304104dSAndroid Build Coastguard Worker 
439*7304104dSAndroid Build Coastguard Worker /* Get uninterpreted section content.  */
440*7304104dSAndroid Build Coastguard Worker extern Elf_Data *elf_rawdata (Elf_Scn *__scn, Elf_Data *__data);
441*7304104dSAndroid Build Coastguard Worker 
442*7304104dSAndroid Build Coastguard Worker /* Create new data descriptor for section SCN.  */
443*7304104dSAndroid Build Coastguard Worker extern Elf_Data *elf_newdata (Elf_Scn *__scn);
444*7304104dSAndroid Build Coastguard Worker 
445*7304104dSAndroid Build Coastguard Worker /* Get data translated from a chunk of the file contents as section data
446*7304104dSAndroid Build Coastguard Worker    would be for TYPE.  The resulting Elf_Data pointer is valid until
447*7304104dSAndroid Build Coastguard Worker    elf_end (ELF) is called.  */
448*7304104dSAndroid Build Coastguard Worker extern Elf_Data *elf_getdata_rawchunk (Elf *__elf,
449*7304104dSAndroid Build Coastguard Worker 				       int64_t __offset, size_t __size,
450*7304104dSAndroid Build Coastguard Worker 				       Elf_Type __type);
451*7304104dSAndroid Build Coastguard Worker 
452*7304104dSAndroid Build Coastguard Worker 
453*7304104dSAndroid Build Coastguard Worker /* Return pointer to string at OFFSET in section INDEX.  */
454*7304104dSAndroid Build Coastguard Worker extern char *elf_strptr (Elf *__elf, size_t __index, size_t __offset);
455*7304104dSAndroid Build Coastguard Worker 
456*7304104dSAndroid Build Coastguard Worker 
457*7304104dSAndroid Build Coastguard Worker /* Return header of archive.  */
458*7304104dSAndroid Build Coastguard Worker extern Elf_Arhdr *elf_getarhdr (Elf *__elf);
459*7304104dSAndroid Build Coastguard Worker 
460*7304104dSAndroid Build Coastguard Worker /* Return offset in archive for current file ELF.  */
461*7304104dSAndroid Build Coastguard Worker extern int64_t elf_getaroff (Elf *__elf);
462*7304104dSAndroid Build Coastguard Worker 
463*7304104dSAndroid Build Coastguard Worker /* Select archive element at OFFSET.  */
464*7304104dSAndroid Build Coastguard Worker extern size_t elf_rand (Elf *__elf, size_t __offset);
465*7304104dSAndroid Build Coastguard Worker 
466*7304104dSAndroid Build Coastguard Worker /* Get symbol table of archive.  */
467*7304104dSAndroid Build Coastguard Worker extern Elf_Arsym *elf_getarsym (Elf *__elf, size_t *__narsyms);
468*7304104dSAndroid Build Coastguard Worker 
469*7304104dSAndroid Build Coastguard Worker 
470*7304104dSAndroid Build Coastguard Worker /* Control ELF descriptor.  */
471*7304104dSAndroid Build Coastguard Worker extern int elf_cntl (Elf *__elf, Elf_Cmd __cmd);
472*7304104dSAndroid Build Coastguard Worker 
473*7304104dSAndroid Build Coastguard Worker /* Retrieve uninterpreted file contents.  */
474*7304104dSAndroid Build Coastguard Worker extern char *elf_rawfile (Elf *__elf, size_t *__nbytes);
475*7304104dSAndroid Build Coastguard Worker 
476*7304104dSAndroid Build Coastguard Worker 
477*7304104dSAndroid Build Coastguard Worker /* Return size of array of COUNT elements of the type denoted by TYPE
478*7304104dSAndroid Build Coastguard Worker    in the external representation.  The binary class is taken from ELF.
479*7304104dSAndroid Build Coastguard Worker    The result is based on version VERSION of the ELF standard.  */
480*7304104dSAndroid Build Coastguard Worker extern size_t elf32_fsize (Elf_Type __type, size_t __count,
481*7304104dSAndroid Build Coastguard Worker 			   unsigned int __version)
482*7304104dSAndroid Build Coastguard Worker        __const_attribute__;
483*7304104dSAndroid Build Coastguard Worker /* Similar but this time the binary calls is ELFCLASS64.  */
484*7304104dSAndroid Build Coastguard Worker extern size_t elf64_fsize (Elf_Type __type, size_t __count,
485*7304104dSAndroid Build Coastguard Worker 			   unsigned int __version)
486*7304104dSAndroid Build Coastguard Worker        __const_attribute__;
487*7304104dSAndroid Build Coastguard Worker 
488*7304104dSAndroid Build Coastguard Worker 
489*7304104dSAndroid Build Coastguard Worker /* Convert data structure from the representation in the file represented
490*7304104dSAndroid Build Coastguard Worker    by ELF to their memory representation.  */
491*7304104dSAndroid Build Coastguard Worker extern Elf_Data *elf32_xlatetom (Elf_Data *__dest, const Elf_Data *__src,
492*7304104dSAndroid Build Coastguard Worker 				 unsigned int __encode);
493*7304104dSAndroid Build Coastguard Worker /* Same for 64 bit class.  */
494*7304104dSAndroid Build Coastguard Worker extern Elf_Data *elf64_xlatetom (Elf_Data *__dest, const Elf_Data *__src,
495*7304104dSAndroid Build Coastguard Worker 				 unsigned int __encode);
496*7304104dSAndroid Build Coastguard Worker 
497*7304104dSAndroid Build Coastguard Worker /* Convert data structure from to the representation in memory
498*7304104dSAndroid Build Coastguard Worker    represented by ELF file representation.  */
499*7304104dSAndroid Build Coastguard Worker extern Elf_Data *elf32_xlatetof (Elf_Data *__dest, const Elf_Data *__src,
500*7304104dSAndroid Build Coastguard Worker 				 unsigned int __encode);
501*7304104dSAndroid Build Coastguard Worker /* Same for 64 bit class.  */
502*7304104dSAndroid Build Coastguard Worker extern Elf_Data *elf64_xlatetof (Elf_Data *__dest, const Elf_Data *__src,
503*7304104dSAndroid Build Coastguard Worker 				 unsigned int __encode);
504*7304104dSAndroid Build Coastguard Worker 
505*7304104dSAndroid Build Coastguard Worker 
506*7304104dSAndroid Build Coastguard Worker /* Return error code of last failing function call.  This value is kept
507*7304104dSAndroid Build Coastguard Worker    separately for each thread.  */
508*7304104dSAndroid Build Coastguard Worker extern int elf_errno (void);
509*7304104dSAndroid Build Coastguard Worker 
510*7304104dSAndroid Build Coastguard Worker /* Return error string for ERROR.  If ERROR is zero, return error string
511*7304104dSAndroid Build Coastguard Worker    for most recent error or NULL is none occurred.  If ERROR is -1 the
512*7304104dSAndroid Build Coastguard Worker    behaviour is similar to the last case except that not NULL but a legal
513*7304104dSAndroid Build Coastguard Worker    string is returned.  */
514*7304104dSAndroid Build Coastguard Worker extern const char *elf_errmsg (int __error);
515*7304104dSAndroid Build Coastguard Worker 
516*7304104dSAndroid Build Coastguard Worker 
517*7304104dSAndroid Build Coastguard Worker /* Coordinate ELF library and application versions.  */
518*7304104dSAndroid Build Coastguard Worker extern unsigned int elf_version (unsigned int __version);
519*7304104dSAndroid Build Coastguard Worker 
520*7304104dSAndroid Build Coastguard Worker /* Set fill bytes used to fill holes in data structures.  */
521*7304104dSAndroid Build Coastguard Worker extern void elf_fill (int __fill);
522*7304104dSAndroid Build Coastguard Worker 
523*7304104dSAndroid Build Coastguard Worker /* Compute hash value.  */
524*7304104dSAndroid Build Coastguard Worker extern unsigned long int elf_hash (const char *__string)
525*7304104dSAndroid Build Coastguard Worker        __pure_attribute__;
526*7304104dSAndroid Build Coastguard Worker 
527*7304104dSAndroid Build Coastguard Worker /* Compute hash value using the GNU-specific hash function.  */
528*7304104dSAndroid Build Coastguard Worker extern unsigned long int elf_gnu_hash (const char *__string)
529*7304104dSAndroid Build Coastguard Worker        __pure_attribute__;
530*7304104dSAndroid Build Coastguard Worker 
531*7304104dSAndroid Build Coastguard Worker 
532*7304104dSAndroid Build Coastguard Worker /* Compute simple checksum from permanent parts of the ELF file.  */
533*7304104dSAndroid Build Coastguard Worker extern long int elf32_checksum (Elf *__elf);
534*7304104dSAndroid Build Coastguard Worker /* Similar but this time the binary calls is ELFCLASS64.  */
535*7304104dSAndroid Build Coastguard Worker extern long int elf64_checksum (Elf *__elf);
536*7304104dSAndroid Build Coastguard Worker 
537*7304104dSAndroid Build Coastguard Worker #ifdef __cplusplus
538*7304104dSAndroid Build Coastguard Worker }
539*7304104dSAndroid Build Coastguard Worker #endif
540*7304104dSAndroid Build Coastguard Worker 
541*7304104dSAndroid Build Coastguard Worker #endif  /* libelf.h */
542