Update bfd_h_get{short,long} to bfd_h_get{_16,_32} for basic type size
[deliverable/binutils-gdb.git] / bfd / libaout.h
CommitLineData
69ebee86
JG
1/* BFD back-end data structures for a.out (and similar) files.
2
3 We try to encapsulate the differences in a few routines, and otherwise
4 share large masses of code. This means we only have to fix bugs in
5 one place, most of the time. */
6
4a81b561
DHW
7/* Copyright (C) 1990, 1991 Free Software Foundation, Inc.
8
9This file is part of BFD, the Binary File Diddler.
10
11BFD is free software; you can redistribute it and/or modify
12it under the terms of the GNU General Public License as published by
13the Free Software Foundation; either version 1, or (at your option)
14any later version.
15
16BFD is distributed in the hope that it will be useful,
17but WITHOUT ANY WARRANTY; without even the implied warranty of
18MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19GNU General Public License for more details.
20
21You should have received a copy of the GNU General Public License
22along with BFD; see the file COPYING. If not, write to
23the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
24
25/* $Id$ */
26
69ebee86
JG
27#define adata(bfd) ((struct aoutdata *) ((bfd)->tdata))
28#define exec_hdr(bfd) (adata(bfd)->hdr)
29#define obj_textsec(bfd) (adata(bfd)->textsec)
30#define obj_datasec(bfd) (adata(bfd)->datasec)
31#define obj_bsssec(bfd) (adata(bfd)->bsssec)
32#define obj_sym_filepos(bfd) (adata(bfd)->sym_filepos)
33#define obj_str_filepos(bfd) (adata(bfd)->str_filepos)
4a81b561 34
69ebee86 35#define obj_reloc_entry_size(bfd) (adata(bfd)->reloc_entry_size)
4a81b561 36
69ebee86 37typedef struct aout_symbol {
4a81b561
DHW
38 asymbol symbol;
39 short desc;
69ebee86
JG
40 char other;
41 unsigned char type;
4a81b561
DHW
42} aout_symbol_type;
43
69ebee86 44struct aoutdata {
4a81b561
DHW
45 struct exec *hdr; /* exec file header */
46 aout_symbol_type *symbols; /* symtab for input bfd */
47
48
49 /* For ease, we do this */
50 asection *textsec;
51 asection *datasec;
52 asection *bsssec;
53
54 /* We remember these offsets so that after check_file_format, we have
55 no dependencies on the particular format of the exec_hdr. */
56 file_ptr sym_filepos;
57 file_ptr str_filepos;
4a81b561 58
69ebee86
JG
59 /* Size of a relocation entry */
60 unsigned reloc_entry_size;
61};
4a81b561 62
4a81b561 63
69ebee86 64#define obj_outsymbols(bfd) ((PTR)(((struct aoutdata *) ((bfd)->tdata))->outsymbols))
4a81b561
DHW
65
66
fc723380
JG
67/* We take the address of the first element of an asymbol to ensure that the
68 * macro is only ever applied to an asymbol */
4a81b561
DHW
69#define aout_symbol(asymbol) ((aout_symbol_type *)(&(asymbol)->the_bfd))
70
69ebee86
JG
71/*#define obj_symbols(bfd) ((((struct aoutdata *) ((bfd)->tdata))->symbols))*/
72#define obj_aout_symbols(bfd) ((((struct aoutdata *) (bfd)->tdata))->symbols)
73#define obj_arch_flags(bfd) ((((struct aoutdata *) (bfd)->tdata))->arch_flags)
74
75#define get_tdata(x) ((struct aoutdata *)((x)->tdata))
76
77/* Prototype declarations for functions defined in aout.c. */
78
79PROTO (boolean, aout_squirt_out_relocs,(bfd *abfd, asection *section));
80
81PROTO (bfd_target *, some_aout_object_p, (bfd *abfd,
82 bfd_target *(*callback)()));
83PROTO (boolean, aout_mkobject, (bfd *abfd));
84PROTO (enum machine_type, aout_machine_type, (enum bfd_architecture arch,
85 unsigned long machine));
86PROTO (boolean, aout_set_arch_mach, (bfd *abfd, enum bfd_architecture arch,
87 unsigned long machine));
88
89PROTO (boolean, aout_new_section_hook, (bfd *abfd, asection *newsect));
90PROTO (boolean, aout_set_section_contents, (bfd *abfd, sec_ptr section,
91 PTR location, file_ptr offset, int count));
92
93PROTO (asymbol *, aout_make_empty_symbol, (bfd *abfd));
94PROTO (boolean, aout_slurp_symbol_table, (bfd *abfd));
95PROTO (void, aout_write_syms, (bfd *abfd));
96PROTO (void, aout_reclaim_symbol_table, (bfd *abfd));
97PROTO (unsigned int, aout_get_symtab_upper_bound, (bfd *abfd));
98PROTO (unsigned int, aout_get_symtab, (bfd *abfd, asymbol **location));
99PROTO (boolean, aout_slurp_reloc_table, (bfd *abfd, sec_ptr asect,
100 asymbol **symbols));
101PROTO (unsigned int, aout_canonicalize_reloc, (bfd *abfd, sec_ptr section,
102 arelent **relptr, asymbol **symbols));
103PROTO (unsigned int, aout_get_reloc_upper_bound, (bfd *abfd, sec_ptr asect));
104PROTO (void, aout_reclaim_reloc, (bfd *ignore_abfd, sec_ptr ignore));
105PROTO (alent *, aout_get_lineno, (bfd *ignore_abfd, asymbol *ignore_symbol));
106PROTO (void, aout_print_symbol, (bfd *ignore_abfd, PTR file,
107 asymbol *symbol, bfd_print_symbol_enum_type how));
108PROTO (boolean, aout_close_and_cleanup, (bfd *abfd));
109PROTO (boolean, aout_find_nearest_line, (bfd *abfd, asection *section,
110 asymbol **symbols, bfd_vma offset, CONST char **filename_ptr,
111 CONST char **functionname_ptr, unsigned int *line_ptr));
112PROTO (int, aout_sizeof_headers, (bfd *ignore_abfd));
113
114/* Helper routines in aout.c. */
115
116PROTO (void, bfd_aout_swap_exec_header_in, (bfd *abfd,
117 unsigned char *raw_bytes, struct exec *execp));
118
119PROTO (void, bfd_aout_swap_exec_header_out,(bfd *abfd, struct exec *execp,
120 unsigned char *raw_bytes));
121
122/* A.out uses the generic versions of these routines... */
123
124#define aout_get_section_contents bfd_generic_get_section_contents
125#define aout_close_and_cleanup bfd_generic_close_and_cleanup
This page took 0.030437 seconds and 4 git commands to generate.