* hppa.c: Conditionalize on HOST_HPPAHPUX instead of hp9000s800.
[external/binutils.git] / bfd / libhppa.h
1 /* HP PA-RISC SOM object file format:  definitions internal to BFD.
2    Copyright (C) 1990-1991 Free Software Foundation, Inc.
3
4    Contributed by the Center for Software Science at the
5    University of Utah (pa-gdb-bugs@cs.utah.edu).
6
7 This file is part of BFD, the Binary File Descriptor library.
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
22
23 #include <sys/core.h>
24 #include <sys/utsname.h>
25
26 #define BYTES_IN_WORD 4
27
28 struct header;
29 struct som_exec_auxhdr;
30 struct subspace_dictionary;
31
32 #define FILE_HDR_SIZE sizeof(struct header)
33 #define AUX_HDR_SIZE sizeof(struct som_exec_auxhdr)
34
35 unsigned int millicode_start, millicode_end;
36
37 typedef struct hppa_symbol
38 {
39   asymbol symbol;
40   short desc;
41   char other;
42   unsigned char type;
43 } hppa_symbol_type;
44
45 struct hppadata
46 {
47   struct header *file_hdr;
48   struct som_exec_auxhdr *aux_hdr;
49   hppa_symbol_type *symbols;
50
51   /* For ease, we do this */
52   asection *textsec;
53   asection *datasec;
54   asection *bsssec;
55
56   /* We remember these offsets so that after check_file_format, we have
57      no dependencies on the particular format of the exec_hdr.  */
58   file_ptr dbx_sym_filepos;
59   file_ptr dbx_str_filepos;
60
61   file_ptr hp_sym_filepos;
62   file_ptr hp_str_filepos;
63
64   int dbx_sym_count;
65   int hp_sym_count;
66
67   unsigned dbx_stringtab_size;
68   unsigned hp_stringtab_size;
69
70   /* Size of a symbol table entry in external form */
71   unsigned dbx_symbol_entry_size;
72   unsigned hp_symbol_entry_size;
73 };
74
75 struct hppa_data_struct {
76   struct hppadata a;
77 };
78
79 #define padata(bfd)              ((bfd)->tdata.hppa_data->a)
80 #define obj_file_hdr(bfd)           (padata(bfd).file_hdr)
81 #define obj_aux_hdr(bfd)            (padata(bfd).aux_hdr)
82 #define obj_pa_symbols(bfd)   (padata(bfd).symbols)
83 #define obj_textsec(bfd)        (padata(bfd).textsec)
84 #define obj_datasec(bfd)        (padata(bfd).datasec)
85 #define obj_bsssec(bfd)         (padata(bfd).bsssec)
86 #define obj_dbx_sym_filepos(bfd)    (padata(bfd).dbx_sym_filepos)
87 #define obj_dbx_str_filepos(bfd)    (padata(bfd).dbx_str_filepos)
88 #define obj_hp_sym_filepos(bfd) (padata(bfd).hp_sym_filepos)
89 #define obj_hp_str_filepos(bfd) (padata(bfd).hp_str_filepos)
90 #define obj_dbx_sym_count(bfd)   (padata(bfd).dbx_sym_count)
91 #define obj_hp_sym_count(bfd)   (padata(bfd).hp_sym_count)
92 #define obj_dbx_stringtab_size(bfd)  (padata(bfd).dbx_stringtab_size)
93 #define obj_hp_stringtab_size(bfd)  (padata(bfd).hp_stringtab_size)
94 #define obj_dbx_symbol_entry_size(bfd)  (padata(bfd).dbx_symbol_entry_size)
95 #define obj_hp_symbol_entry_size(bfd)  (padata(bfd).hp_symbol_entry_size)
96
97 /* We take the address of the first element of an asymbol to ensure that the
98    macro is only ever applied to an asymbol */
99 #define hppa_symbol(asymbol) ((hppa_symbol_type *)(&(asymbol)->the_bfd))
100
101
102 /* These are stored in the bfd's tdata */
103
104 struct hppa_core_struct 
105 {
106   int sig;
107   char cmd[MAXCOMLEN + 1];
108   asection *data_section;
109   asection *stack_section;
110   asection *reg_section;
111 };
112
113 #define core_hdr(bfd) ((bfd)->tdata.hppa_core_data)
114 #define core_signal(bfd) (core_hdr(bfd)->sig)
115 #define core_command(bfd) (core_hdr(bfd)->cmd)
116 #define core_datasec(bfd) (core_hdr(bfd)->data_section)
117 #define core_stacksec(bfd) (core_hdr(bfd)->stack_section)
118 #define core_regsec(bfd) (core_hdr(bfd)->reg_section)