Commit | Line | Data |
---|---|---|
4a81b561 DHW |
1 | /* Copyright (C) 1990, 1991 Free Software Foundation, Inc. |
2 | ||
3 | This file is part of BFD, the Binary File Diddler. | |
4 | ||
5 | BFD is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 1, or (at your option) | |
8 | any later version. | |
9 | ||
10 | BFD is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with BFD; see the file COPYING. If not, write to | |
17 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |
18 | ||
19 | /* $Id$ */ | |
20 | ||
21 | /* BFD back-end data structures for a.out (and similar) files. | |
22 | ||
23 | We try to encapsulate the differences in a few routines, and otherwise | |
24 | share large masses of code. This means we only have to fix bugs in | |
25 | one place, most of the time. */ | |
26 | ||
27 | /** a.out files */ | |
28 | ||
29 | #define exec_hdr(bfd) (((struct sunexdata *) ((bfd)->tdata))->hdr) | |
30 | /*#define obj_symbols(bfd) ((((struct sunexdata *) ((bfd)->tdata))->symbols))*/ | |
31 | #define obj_textsec(bfd) (((struct sunexdata *) ((bfd)->tdata))->textsec) | |
32 | #define obj_datasec(bfd) (((struct sunexdata *) ((bfd)->tdata))->datasec) | |
33 | #define obj_bsssec(bfd) (((struct sunexdata *) ((bfd)->tdata))->bsssec) | |
34 | #define obj_sym_filepos(bfd) (((struct sunexdata *) ((bfd)->tdata))->sym_filepos) | |
35 | #define obj_str_filepos(bfd) (((struct sunexdata *) ((bfd)->tdata))->str_filepos) | |
36 | ||
37 | ||
38 | ||
39 | typedef struct { | |
40 | asymbol symbol; | |
41 | short desc; | |
42 | char other; | |
43 | unsigned char type; | |
44 | } aout_symbol_type; | |
45 | ||
46 | ||
47 | struct sunexdata { | |
48 | struct exec *hdr; /* exec file header */ | |
49 | aout_symbol_type *symbols; /* symtab for input bfd */ | |
50 | ||
51 | ||
52 | /* For ease, we do this */ | |
53 | asection *textsec; | |
54 | asection *datasec; | |
55 | asection *bsssec; | |
56 | ||
57 | /* We remember these offsets so that after check_file_format, we have | |
58 | no dependencies on the particular format of the exec_hdr. */ | |
59 | file_ptr sym_filepos; | |
60 | file_ptr str_filepos; | |
61 | }; | |
62 | ||
63 | ||
9846338e | 64 | #define obj_outsymbols(bfd) ((PTR)(((struct sunexdata *) ((bfd)->tdata))->outsymbols)) |
4a81b561 DHW |
65 | |
66 | ||
67 | ||
fc723380 JG |
68 | /* We take the address of the first element of an asymbol to ensure that the |
69 | * macro is only ever applied to an asymbol */ | |
4a81b561 DHW |
70 | #define aout_symbol(asymbol) ((aout_symbol_type *)(&(asymbol)->the_bfd)) |
71 | ||
72 | /*#define obj_symbols(bfd) ((((struct sunexdata *) ((bfd)->tdata))->symbols))*/ | |
73 | #define obj_aout_symbols(bfd) ((((struct sunexdata *) (bfd)->tdata))->symbols) | |
74 | #define obj_arch_flags(bfd) ((((struct sunexdata *) (bfd)->tdata))->arch_flags) | |
75 | ||
76 | #define get_tdata(x) ((struct sunexdata *)((x)->tdata)) |