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