9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #ifndef _ELF_READ_H
27 #define _ELF_READ_H
28
29 #pragma ident "%Z%%M% %I% %E% SMI"
30
31 #define BUFSZ 128
32 typedef struct Elf_Info {
33 boolean_t dynamic; /* dymanically linked? */
34 unsigned core_type; /* core? what type of core? */
35 unsigned stripped; /* symtab, debug info */
36 unsigned flags; /* e_flags */
37 unsigned machine; /* e_machine */
38 unsigned type; /* e_type */
39 int elffd; /* fd of file being processed */
40 char fname[PRFNSZ]; /* name of process that dumped core */
41 char cap_str[BUFSZ]; /* hw/sw capabilities */
42 char *file; /* file being processed */
43 } Elf_Info;
44
45 /* values for Elf_Info.stripped */
46 #define E_DBGINF 0x01
47 #define E_SYMTAB 0x02
48 #define E_NOSTRIP 0x03
49
50 /* values for Elf_Info.core_type; */
51 #define EC_NOTCORE 0x0
52 #define EC_OLDCORE 0x1
53 #define EC_NEWCORE 0x2
54
55 /* elf file processing errors */
56 #define ELF_ERR_ELFCAP1 gettext("%s: %s zero size or zero entry ELF " \
57 "section - ELF capabilities ignored\n")
58 #define ELF_ERR_ELFCAP2 gettext("%s: %s: can't read ELF capabilities " \
59 "data - ELF capabilities ignored\n")
60
61 extern int is_in_list(char *str);
62
63 /* return status for elf_read and its helper functions */
64 #define ELF_READ_OKAY 1
65 #define ELF_READ_FAIL 0
66
67 #if defined(_ELF64)
68
69 #define Elf_Ehdr Elf64_Ehdr
70 #define Elf_Shdr Elf64_Shdr
71 #define Elf_Phdr Elf64_Phdr
72 #define Elf_Cap Elf64_Cap
73 #define Elf_Nhdr Elf64_Nhdr
74 #define Elf_Word Elf64_Word
75
76 #define elf_read elf_read64
77 #define elf_xlatetom elf64_xlatetom
78 #define elf_fsize elf64_fsize
79 #define get_class get_class64
80 #define get_version get_version64
81 #define get_format get_format64
82
83 #else
84
85 #define Elf_Ehdr Elf32_Ehdr
86 #define Elf_Shdr Elf32_Shdr
87 #define Elf_Phdr Elf32_Phdr
88 #define Elf_Cap Elf32_Cap
89 #define Elf_Nhdr Elf32_Nhdr
90 #define Elf_Word Elf32_Word
91
92 #define elf_read elf_read32
93 #define elf_xlatetom elf32_xlatetom
94 #define elf_fsize elf32_fsize
95 #define get_class get_class32
96 #define get_version get_version32
97 #define get_format get_format32
98
99 #endif
100
101 /* so lint can understand elf_read64 is defined */
102 #ifdef lint
103 #define elf_read64 elf_read
104 #endif /* lint */
105
106 #endif /* _ELF_READ_H */
|
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #ifndef _ELF_READ_H
27 #define _ELF_READ_H
28
29 #define BUFSZ 128
30 typedef struct Elf_Info {
31 boolean_t dynamic; /* dymanically linked? */
32 unsigned core_type; /* core? what type of core? */
33 unsigned stripped; /* symtab, debug info */
34 unsigned flags; /* e_flags */
35 unsigned machine; /* e_machine */
36 unsigned type; /* e_type */
37 int elffd; /* fd of file being processed */
38 char fname[PRFNSZ]; /* name of process that dumped core */
39 char cap_str[BUFSZ]; /* hw/sw capabilities */
40 char *file; /* file being processed */
41 boolean_t kmod;
42 } Elf_Info;
43
44 /* values for Elf_Info.stripped */
45 #define E_DBGINF 0x01
46 #define E_SYMTAB 0x02
47 #define E_NOSTRIP 0x03
48
49 /* values for Elf_Info.core_type; */
50 #define EC_NOTCORE 0x0
51 #define EC_OLDCORE 0x1
52 #define EC_NEWCORE 0x2
53
54 /* elf file processing errors */
55 #define ELF_ERR_ELFCAP1 gettext("%s: %s zero size or zero entry ELF " \
56 "section - ELF capabilities ignored\n")
57 #define ELF_ERR_ELFCAP2 gettext("%s: %s: can't read ELF capabilities " \
58 "data - ELF capabilities ignored\n")
59 #define ELF_ERR_DYNAMIC1 gettext("%s: %s zero size or zero entry ELF " \
60 "section - ELF dynamic tags ignored\n")
61 #define ELF_ERR_DYNAMIC2 gettext("%s: %s: can't read ELF dynamic " \
62 "data - ELF dynamic tags ignored\n")
63
64 extern int is_in_list(char *str);
65
66 /* return status for elf_read and its helper functions */
67 #define ELF_READ_OKAY 1
68 #define ELF_READ_FAIL 0
69
70 #if defined(_ELF64)
71
72 #define Elf_Ehdr Elf64_Ehdr
73 #define Elf_Shdr Elf64_Shdr
74 #define Elf_Phdr Elf64_Phdr
75 #define Elf_Cap Elf64_Cap
76 #define Elf_Nhdr Elf64_Nhdr
77 #define Elf_Word Elf64_Word
78 #define Elf_Dyn Elf64_Dyn
79
80 #define elf_read elf_read64
81 #define elf_xlatetom elf64_xlatetom
82 #define elf_fsize elf64_fsize
83 #define get_class get_class64
84 #define get_version get_version64
85 #define get_format get_format64
86
87 #else
88
89 #define Elf_Ehdr Elf32_Ehdr
90 #define Elf_Shdr Elf32_Shdr
91 #define Elf_Phdr Elf32_Phdr
92 #define Elf_Cap Elf32_Cap
93 #define Elf_Nhdr Elf32_Nhdr
94 #define Elf_Word Elf32_Word
95 #define Elf_Dyn Elf32_Dyn
96
97 #define elf_read elf_read32
98 #define elf_xlatetom elf32_xlatetom
99 #define elf_fsize elf32_fsize
100 #define get_class get_class32
101 #define get_version get_version32
102 #define get_format get_format32
103
104 #endif
105
106 /* so lint can understand elf_read64 is defined */
107 #ifdef lint
108 #define elf_read64 elf_read
109 #endif /* lint */
110
111 #endif /* _ELF_READ_H */
|