bfd/ChangeLog:
[deliverable/binutils-gdb.git] / bfd / pef.h
1 /* PEF support for BFD.
2 Copyright 1999, 2000, 2001, 2002, 2005, 2007
3 Free Software Foundation, Inc.
4
5 This file is part of BFD, the Binary File Descriptor library.
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20 MA 02110-1301, USA. */
21
22 #include "sysdep.h"
23 #include "bfd.h"
24
25 #include <stdio.h>
26
27 struct bfd_pef_header
28 {
29 unsigned long tag1;
30 unsigned long tag2;
31 unsigned long architecture;
32 unsigned long format_version;
33 unsigned long timestamp;
34 unsigned long old_definition_version;
35 unsigned long old_implementation_version;
36 unsigned long current_version;
37 unsigned short section_count;
38 unsigned short instantiated_section_count;
39 unsigned long reserved;
40 };
41 typedef struct bfd_pef_header bfd_pef_header;
42
43 struct bfd_pef_loader_header
44 {
45 long main_section;
46 unsigned long main_offset;
47 long init_section;
48 unsigned long init_offset;
49 long term_section;
50 unsigned long term_offset;
51 unsigned long imported_library_count;
52 unsigned long total_imported_symbol_count;
53 unsigned long reloc_section_count;
54 unsigned long reloc_instr_offset;
55 unsigned long loader_strings_offset;
56 unsigned long export_hash_offset;
57 unsigned long export_hash_table_power;
58 unsigned long exported_symbol_count;
59 };
60 typedef struct bfd_pef_loader_header bfd_pef_loader_header;
61
62 struct bfd_pef_imported_library
63 {
64 unsigned long name_offset;
65 unsigned long old_implementation_version;
66 unsigned long current_version;
67 unsigned long imported_symbol_count;
68 unsigned long first_imported_symbol;
69 unsigned char options;
70 unsigned char reserved_a;
71 unsigned short reserved_b;
72 };
73 typedef struct bfd_pef_imported_library bfd_pef_imported_library;
74
75 enum bfd_pef_imported_library_options
76 {
77 BFD_PEF_WEAK_IMPORT_LIB = 0x40,
78 BFD_PEF_INIT_LIB_BEFORE = 0x80
79 };
80
81 struct bfd_pef_imported_symbol
82 {
83 unsigned char symbol_class;
84 unsigned long name;
85 };
86 typedef struct bfd_pef_imported_symbol bfd_pef_imported_symbol;
87
88 enum bfd_pef_imported_symbol_class
89 {
90 BFD_PEF_CODE_SYMBOL = 0x00,
91 BFD_PEF_DATA_SYMBOL = 0x01,
92 BFD_PEF_TVECTOR_SYMBOL = 0x02,
93 BFD_PEF_TOC_SYMBOL = 0x03,
94 BFD_PEF_GLUE_SYMBOL = 0x04,
95 BFD_PEF_UNDEFINED_SYMBOL = 0x0F,
96 BFD_PEF_WEAK_IMPORT_SYMBOL_MASK = 0x80
97 };
98
99 #define BFD_PEF_TAG1 0x4A6F7921 /* 'Joy!' */
100 #define BFD_PEF_TAG2 0x70656666 /* 'peff' */
101
102 #define BFD_PEF_VERSION 0x00000001
103
104 struct bfd_pef_section
105 {
106 long name_offset;
107 unsigned long header_offset;
108 unsigned long default_address;
109 unsigned long total_length;
110 unsigned long unpacked_length;
111 unsigned long container_length;
112 unsigned long container_offset;
113 unsigned char section_kind;
114 unsigned char share_kind;
115 unsigned char alignment;
116 unsigned char reserved;
117 asection *bfd_section;
118 };
119 typedef struct bfd_pef_section bfd_pef_section;
120
121 #define BFD_PEF_SECTION_CODE 0
122 #define BFD_PEF_SECTION_UNPACKED_DATA 1
123 #define BFD_PEF_SECTION_PACKED_DATA 2
124 #define BFD_PEF_SECTION_CONSTANT 3
125 #define BFD_PEF_SECTION_LOADER 4
126 #define BFD_PEF_SECTION_DEBUG 5
127 #define BFD_PEF_SECTION_EXEC_DATA 6
128 #define BFD_PEF_SECTION_EXCEPTION 7
129 #define BFD_PEF_SECTION_TRACEBACK 8
130
131 #define BFD_PEF_SHARE_PROCESS 1
132 #define BFD_PEF_SHARE_GLOBAL 4
133 #define BFD_PEF_SHARE_PROTECTED 5
134
135 struct bfd_pef_data_struct
136 {
137 bfd_pef_header header;
138 bfd_pef_section *sections;
139 bfd *ibfd;
140 };
141 typedef struct bfd_pef_data_struct bfd_pef_data_struct;
142
143 #define BFD_PEF_XLIB_TAG1 0xF04D6163 /* '?Mac' */
144 #define BFD_PEF_VLIB_TAG2 0x564C6962 /* 'VLib' */
145 #define BFD_PEF_BLIB_TAG2 0x424C6962 /* 'BLib' */
146
147 #define BFD_PEF_XLIB_VERSION 0x00000001
148
149 struct bfd_pef_xlib_header
150 {
151 unsigned long tag1;
152 unsigned long tag2;
153 unsigned long current_format;
154 unsigned long container_strings_offset;
155 unsigned long export_hash_offset;
156 unsigned long export_key_offset;
157 unsigned long export_symbol_offset;
158 unsigned long export_names_offset;
159 unsigned long export_hash_table_power;
160 unsigned long exported_symbol_count;
161
162 unsigned long frag_name_offset;
163 unsigned long frag_name_length;
164 unsigned long dylib_path_offset;
165 unsigned long dylib_path_length;
166 unsigned long cpu_family;
167 unsigned long cpu_model;
168 unsigned long date_time_stamp;
169 unsigned long current_version;
170 unsigned long old_definition_version;
171 unsigned long old_implementation_version;
172 };
173 typedef struct bfd_pef_xlib_header bfd_pef_xlib_header;
174
175 struct bfd_pef_xlib_data_struct
176 {
177 bfd_pef_xlib_header header;
178 };
179 typedef struct bfd_pef_xlib_data_struct bfd_pef_xlib_data_struct;
180
181 int bfd_pef_parse_loader_header (bfd *, unsigned char *, size_t, bfd_pef_loader_header *);
182 int bfd_pef_print_loader_section (bfd *, FILE *);
183 void bfd_pef_print_loader_header (bfd *, bfd_pef_loader_header *, FILE *);
184 int bfd_pef_parse_imported_library (bfd *, unsigned char *, size_t, bfd_pef_imported_library *);
185 int bfd_pef_parse_imported_symbol (bfd *, unsigned char *, size_t, bfd_pef_imported_symbol *);
186 int bfd_pef_scan_section (bfd *, bfd_pef_section *);
187 int bfd_pef_scan_start_address (bfd *);
188 int bfd_pef_scan (bfd *, bfd_pef_header *, bfd_pef_data_struct *);
This page took 0.036517 seconds and 4 git commands to generate.