]> Git Repo - binutils.git/blob - bfd/som.h
Fri Jan 7 10:34:47 1994 Stan Shebs ([email protected])
[binutils.git] / bfd / som.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 ([email protected]).
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 #ifndef _SOM_H
24 #define _SOM_H
25
26 #include "../bfd/sysdep.h"
27
28 #include <a.out.h>
29
30
31 #ifdef HOST_HPPABSD
32 /* BSD uses a completely different scheme for object file identification.
33    so for now, define _PA_RISC_ID to accept any random value for a model
34    number.  */
35 #undef _PA_RISC_ID
36 #define _PA_RISC_ID(__m_num) 1
37 #endif /* HOST_HPPABSD */
38
39 #define FILE_HDR_SIZE sizeof(struct header)
40 #define AUX_HDR_SIZE sizeof(struct som_exec_auxhdr)
41
42 typedef struct som_symbol
43   {
44     asymbol symbol;
45     short desc;
46     char other;
47     unsigned char type;
48     unsigned int som_type;
49
50     /* Structured like the ELF tc_data union.  Allows more code sharing
51        in GAS this way.  */
52     union
53       {
54         unsigned int hppa_arg_reloc;
55         PTR any;
56       }
57     tc_data;
58
59     /* Index of this symbol in the symbol table.  Only used when
60        building relocation streams for incomplete objects.  */
61     int index;
62
63     /* How many times this symbol is used in a relocation.  By sorting
64        the symbols from most used to least used we can significantly
65        reduce the size of the relocation stream for incomplete objects.  */
66     int reloc_count;
67
68     /* The unwind descriptor bits associated with R_ENTRY relocations
69        for functions (not enough room in a BFD reloc to store all the
70        information, so we tack it onto the symbol associated with the
71        function.  */
72     char *unwind;
73   }
74 som_symbol_type;
75
76 struct somdata
77   {
78     struct header *file_hdr;
79     som_symbol_type *symtab;
80     char *stringtab;
81
82     /* We remember these offsets so that after check_file_format, we have
83        no dependencies on the particular format of the exec_hdr.  */
84
85     file_ptr sym_filepos;
86     file_ptr str_filepos;
87     file_ptr reloc_filepos;
88
89     unsigned stringtab_size;
90   };
91
92 struct som_data_struct
93   {
94     struct somdata a;
95   };
96
97 /* Used to keep extra SOM specific information for a given section.
98
99    reloc_size holds the size of the relocation stream, note this
100    is very different from the number of relocations as SOM relocations
101    are variable length. 
102
103    reloc_stream is the actual stream of relocation entries.
104
105    The BFD section index may not exactly match a SOM subspace index,
106    for this reason we keep track of the original SOM subspace index
107    when a subspace is turned into a BFD section.  */
108
109 struct som_section_data_struct
110   {
111     unsigned int reloc_size;
112     char *reloc_stream;
113     unsigned int subspace_index;
114     asection *containing_space;
115     int is_space;
116     struct space_dictionary_record space_dict;
117     int is_subspace;
118     struct subspace_dictionary_record subspace_dict;
119   };
120
121 #define somdata(bfd)                    ((bfd)->tdata.som_data->a)
122 #define obj_som_file_hdr(bfd)           (somdata(bfd).file_hdr)
123 #define obj_som_symtab(bfd)             (somdata(bfd).symtab)
124 #define obj_som_stringtab(bfd)          (somdata(bfd).stringtab)
125 #define obj_som_sym_filepos(bfd)        (somdata(bfd).sym_filepos)
126 #define obj_som_str_filepos(bfd)        (somdata(bfd).str_filepos)
127 #define obj_som_stringtab_size(bfd)     (somdata(bfd).stringtab_size)
128 #define obj_som_reloc_filepos(bfd)      (somdata(bfd).reloc_filepos)
129 #define som_section_data(sec) \
130   ((struct som_section_data_struct *)sec->used_by_bfd)
131 #define som_symbol_data(symbol) \
132   (((som_symbol_type **) symbol->udata))
133
134
135 /* Defines groups of basic relocations.  FIXME:  These should
136    be the only basic relocations created by GAS.  The rest
137    should be internal to the BFD backend.
138
139    The idea is both SOM and ELF define these basic relocation
140    types so they map into a SOM or ELF specific reloation as
141    appropriate.  This allows GAS to share much more code 
142    between the two object formats.  */
143
144 #define R_HPPA_NONE                     R_NO_RELOCATION
145 #define R_HPPA                          R_CODE_ONE_SYMBOL
146 #define R_HPPA_ABS_CALL                 R_ABS_CALL
147 #define R_HPPA_PCREL_CALL               R_PCREL_CALL
148 #define R_HPPA_GOTOFF                   R_DP_RELATIVE
149 #define R_HPPA_COMPLEX                  R_COMP1
150 #define R_HPPA_COMPLEX_PCREL_CALL       R_COMP2
151 #define R_HPPA_COMPLEX_ABS_CALL         R_COMP3
152 #define R_HPPA_ENTRY                    R_ENTRY
153 #define R_HPPA_EXIT                     R_EXIT
154
155 #endif /* _SOM_H */
This page took 0.031971 seconds and 4 git commands to generate.