* elf.c (bfd_section_from_shdr): Treat invalid reloc sections as
[deliverable/binutils-gdb.git] / bfd / pef.h
CommitLineData
3af9a47b
NC
1/* PEF support for BFD.
2 Copyright 1999, 2000, 2001, 2002
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 2 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
e84d6fca 18 along with this program; if not, write to the Free Software
3e110533 19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */
3af9a47b
NC
20
21#include "bfd.h"
22
23#include <stdio.h>
24
25struct bfd_pef_header
26{
27 unsigned long tag1;
28 unsigned long tag2;
29 unsigned long architecture;
30 unsigned long format_version;
31 unsigned long timestamp;
32 unsigned long old_definition_version;
33 unsigned long old_implementation_version;
34 unsigned long current_version;
35 unsigned short section_count;
36 unsigned short instantiated_section_count;
37 unsigned long reserved;
38};
39typedef struct bfd_pef_header bfd_pef_header;
40
41struct bfd_pef_loader_header
42{
43 long main_section;
44 unsigned long main_offset;
45 long init_section;
e84d6fca 46 unsigned long init_offset;
3af9a47b
NC
47 long term_section;
48 unsigned long term_offset;
49 unsigned long imported_library_count;
50 unsigned long total_imported_symbol_count;
51 unsigned long reloc_section_count;
52 unsigned long reloc_instr_offset;
53 unsigned long loader_strings_offset;
54 unsigned long export_hash_offset;
55 unsigned long export_hash_table_power;
56 unsigned long exported_symbol_count;
57};
58typedef struct bfd_pef_loader_header bfd_pef_loader_header;
59
60struct bfd_pef_imported_library
61{
62 unsigned long name_offset;
63 unsigned long old_implementation_version;
64 unsigned long current_version;
65 unsigned long imported_symbol_count;
66 unsigned long first_imported_symbol;
67 unsigned char options;
68 unsigned char reserved_a;
69 unsigned short reserved_b;
70};
71typedef struct bfd_pef_imported_library bfd_pef_imported_library;
72
73enum bfd_pef_imported_library_options
74 {
75 BFD_PEF_WEAK_IMPORT_LIB = 0x40,
76 BFD_PEF_INIT_LIB_BEFORE = 0x80
77 };
78
79struct bfd_pef_imported_symbol
80{
81 unsigned char class;
82 unsigned long name;
83};
84typedef struct bfd_pef_imported_symbol bfd_pef_imported_symbol;
85
86enum bfd_pef_imported_symbol_class
87 {
88 BFD_PEF_CODE_SYMBOL = 0x00,
89 BFD_PEF_DATA_SYMBOL = 0x01,
90 BFD_PEF_TVECTOR_SYMBOL = 0x02,
91 BFD_PEF_TOC_SYMBOL = 0x03,
92 BFD_PEF_GLUE_SYMBOL = 0x04,
93 BFD_PEF_UNDEFINED_SYMBOL = 0x0F,
94 BFD_PEF_WEAK_IMPORT_SYMBOL_MASK = 0x80
95 };
96
97#define BFD_PEF_TAG1 0x4A6F7921 /* 'Joy!' */
98#define BFD_PEF_TAG2 0x70656666 /* 'peff' */
99
100#define BFD_PEF_VERSION 0x00000001
101
102struct bfd_pef_section
103{
104 long name_offset;
105 unsigned long header_offset;
106 unsigned long default_address;
107 unsigned long total_length;
108 unsigned long unpacked_length;
109 unsigned long container_length;
110 unsigned long container_offset;
111 unsigned char section_kind;
112 unsigned char share_kind;
113 unsigned char alignment;
114 unsigned char reserved;
115 asection *bfd_section;
116};
117typedef struct bfd_pef_section bfd_pef_section;
118
119#define BFD_PEF_SECTION_CODE 0
120#define BFD_PEF_SECTION_UNPACKED_DATA 1
121#define BFD_PEF_SECTION_PACKED_DATA 2
122#define BFD_PEF_SECTION_CONSTANT 3
123#define BFD_PEF_SECTION_LOADER 4
124#define BFD_PEF_SECTION_DEBUG 5
125#define BFD_PEF_SECTION_EXEC_DATA 6
126#define BFD_PEF_SECTION_EXCEPTION 7
127#define BFD_PEF_SECTION_TRACEBACK 8
128
129#define BFD_PEF_SHARE_PROCESS 1
130#define BFD_PEF_SHARE_GLOBAL 4
131#define BFD_PEF_SHARE_PROTECTED 5
132
133struct bfd_pef_data_struct
134{
135 bfd_pef_header header;
136 bfd_pef_section *sections;
137 bfd *ibfd;
138};
139typedef struct bfd_pef_data_struct bfd_pef_data_struct;
140
141#define BFD_PEF_XLIB_TAG1 0xF04D6163 /* '?Mac' */
142#define BFD_PEF_VLIB_TAG2 0x564C6962 /* 'VLib' */
143#define BFD_PEF_BLIB_TAG2 0x424C6962 /* 'BLib' */
144
145#define BFD_PEF_XLIB_VERSION 0x00000001
146
147struct bfd_pef_xlib_header
148{
149 unsigned long tag1;
150 unsigned long tag2;
151 unsigned long current_format;
152 unsigned long container_strings_offset;
153 unsigned long export_hash_offset;
154 unsigned long export_key_offset;
155 unsigned long export_symbol_offset;
156 unsigned long export_names_offset;
157 unsigned long export_hash_table_power;
158 unsigned long exported_symbol_count;
159
160 unsigned long frag_name_offset;
161 unsigned long frag_name_length;
162 unsigned long dylib_path_offset;
163 unsigned long dylib_path_length;
164 unsigned long cpu_family;
165 unsigned long cpu_model;
166 unsigned long date_time_stamp;
167 unsigned long current_version;
168 unsigned long old_definition_version;
169 unsigned long old_implementation_version;
170};
171typedef struct bfd_pef_xlib_header bfd_pef_xlib_header;
172
173struct bfd_pef_xlib_data_struct
174{
175 bfd_pef_xlib_header header;
176};
177typedef struct bfd_pef_xlib_data_struct bfd_pef_xlib_data_struct;
178
116c20d2
NC
179int bfd_pef_parse_loader_header (bfd *, unsigned char *, size_t, bfd_pef_loader_header *);
180int bfd_pef_print_loader_section (bfd *, FILE *);
181void bfd_pef_print_loader_header (bfd *, bfd_pef_loader_header *, FILE *);
182int bfd_pef_parse_imported_library (bfd *, unsigned char *, size_t, bfd_pef_imported_library *);
183int bfd_pef_parse_imported_symbol (bfd *, unsigned char *, size_t, bfd_pef_imported_symbol *);
184int bfd_pef_scan_section (bfd *, bfd_pef_section *);
185int bfd_pef_scan_start_address (bfd *);
186int bfd_pef_scan (bfd *, bfd_pef_header *, bfd_pef_data_struct *);
This page took 0.205538 seconds and 4 git commands to generate.