OSDN Git Service

2002-04-04 Daniel Jacobowitz <drow@mvista.com>
[pf3gnuchains/pf3gnuchains4x.git] / bfd / nlm-target.h
1 /* Target definitions for 32/64-bit NLM (NetWare Loadable Module)
2    Copyright 1993, 1994, 1998, 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
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
20
21 #define nlm_core_file_p _bfd_dummy_target
22
23 #define nlm_get_symtab_upper_bound nlmNAME(get_symtab_upper_bound)
24 #define nlm_get_symtab nlmNAME(get_symtab)
25 #define nlm_make_empty_symbol nlmNAME(make_empty_symbol)
26 #define nlm_print_symbol nlmNAME(print_symbol)
27 #define nlm_get_symbol_info nlmNAME(get_symbol_info)
28 #define nlm_bfd_is_local_label_name bfd_generic_is_local_label_name
29 #define nlm_get_lineno _bfd_nosymbols_get_lineno
30 #define nlm_find_nearest_line _bfd_nosymbols_find_nearest_line
31 #define nlm_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
32 #define nlm_read_minisymbols _bfd_generic_read_minisymbols
33 #define nlm_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
34
35 #define nlm_get_reloc_upper_bound nlmNAME(get_reloc_upper_bound)
36 #define nlm_canonicalize_reloc nlmNAME(canonicalize_reloc)
37 #define nlm_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
38
39 #define nlm_set_section_contents nlmNAME(set_section_contents)
40
41 #define nlm_sizeof_headers _bfd_nolink_sizeof_headers
42 #define nlm_bfd_get_relocated_section_contents \
43   bfd_generic_get_relocated_section_contents
44 #define nlm_bfd_relax_section bfd_generic_relax_section
45 #define nlm_bfd_gc_sections bfd_generic_gc_sections
46 #define nlm_bfd_merge_sections bfd_generic_merge_sections
47 #define nlm_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
48 #define nlm_bfd_link_hash_table_free _bfd_generic_link_hash_table_free
49 #define nlm_bfd_link_add_symbols _bfd_generic_link_add_symbols
50 #define nlm_bfd_final_link _bfd_generic_final_link
51 #define nlm_bfd_link_split_section _bfd_generic_link_split_section
52
53 /* This structure contains everything that BFD knows about a target.
54    It includes things like its byte order, name, what routines to call
55    to do various operations, etc.  Every BFD points to a target structure
56    with its "xvec" member.
57
58    There are two such structures here:  one for big-endian machines and
59    one for little-endian machines.   */
60
61 /* Forward declaration for use when initialising alternative_target field.  */
62 #ifdef TARGET_LITTLE_SYM
63 extern const bfd_target TARGET_LITTLE_SYM;
64 #endif
65
66 #ifdef TARGET_BIG_SYM
67 const bfd_target TARGET_BIG_SYM =
68 {
69   /* name: identify kind of target */
70   TARGET_BIG_NAME,
71
72   /* flavour: general indication about file */
73   bfd_target_nlm_flavour,
74
75   /* byteorder: data is big endian */
76   BFD_ENDIAN_BIG,
77
78   /* header_byteorder: header is also big endian */
79   BFD_ENDIAN_BIG,
80
81   /* object_flags: mask of all file flags */
82   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
83    | WP_TEXT),
84
85   /* section_flags: mask of all section flags */
86   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
87    SEC_CODE | SEC_DATA),
88
89    /* leading_symbol_char: is the first char of a user symbol
90       predictable, and if so what is it */
91    0,
92
93   /* ar_pad_char: pad character for filenames within an archive header
94      FIXME:  this really has nothing to do with NLM, this is a characteristic
95      of the archiver and/or os and should be independently tunable */
96   '/',
97
98   /* ar_max_namelen: maximum number of characters in an archive header
99      FIXME:  this really has nothing to do with NLM, this is a characteristic
100      of the archiver and should be independently tunable.  This value is
101      a WAG (wild a** guess) */
102   15,
103
104   /* Routines to byte-swap various sized integers from the data sections */
105   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
106     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
107     bfd_getb16, bfd_getb_signed_16, bfd_putb16,
108
109   /* Routines to byte-swap various sized integers from the file headers */
110   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
111     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
112     bfd_getb16, bfd_getb_signed_16, bfd_putb16,
113
114   /* bfd_check_format: check the format of a file being read */
115   { _bfd_dummy_target,          /* unknown format */
116     nlmNAME(object_p),          /* assembler/linker output (object file) */
117     bfd_generic_archive_p,      /* an archive */
118     nlm_core_file_p             /* a core file */
119   },
120
121   /* bfd_set_format: set the format of a file being written */
122   { bfd_false,
123     nlm_mkobject,
124     _bfd_generic_mkarchive,
125     bfd_false
126   },
127
128   /* bfd_write_contents: write cached information into a file being written */
129   { bfd_false,
130     nlmNAME(write_object_contents),
131     _bfd_write_archive_contents,
132     bfd_false
133   },
134
135   /* Initialize a jump table with the standard macro.  All names start with
136      "nlm" */
137   BFD_JUMP_TABLE_GENERIC (_bfd_generic),
138   BFD_JUMP_TABLE_COPY (_bfd_generic),
139   BFD_JUMP_TABLE_CORE (_bfd_nocore),
140   BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
141   BFD_JUMP_TABLE_SYMBOLS (nlm),
142   BFD_JUMP_TABLE_RELOCS (nlm),
143   BFD_JUMP_TABLE_WRITE (nlm),
144   BFD_JUMP_TABLE_LINK (nlm),
145   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
146
147   /* Alternative endian target.  */
148 #ifdef TARGET_LITTLE_SYM
149   & TARGET_LITTLE_SYM,
150 #else
151   NULL,
152 #endif
153
154   /* backend_data: */
155   (PTR) TARGET_BACKEND_DATA
156 };
157 #endif
158
159 #ifdef TARGET_LITTLE_SYM
160 const bfd_target TARGET_LITTLE_SYM =
161 {
162   /* name: identify kind of target */
163   TARGET_LITTLE_NAME,
164
165   /* flavour: general indication about file */
166   bfd_target_nlm_flavour,
167
168   /* byteorder: data is little endian */
169   BFD_ENDIAN_LITTLE,
170
171   /* header_byteorder: header is also little endian */
172   BFD_ENDIAN_LITTLE,
173
174   /* object_flags: mask of all file flags */
175   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
176    | WP_TEXT),
177
178   /* section_flags: mask of all section flags */
179   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
180    SEC_DATA),
181
182    /* leading_symbol_char: is the first char of a user symbol
183       predictable, and if so what is it */
184    0,
185
186   /* ar_pad_char: pad character for filenames within an archive header
187      FIXME:  this really has nothing to do with NLM, this is a characteristic
188      of the archiver and/or os and should be independently tunable */
189   '/',
190
191   /* ar_max_namelen: maximum number of characters in an archive header
192      FIXME:  this really has nothing to do with NLM, this is a characteristic
193      of the archiver and should be independently tunable.  This value is
194      a WAG (wild a** guess) */
195   15,
196
197   /* Routines to byte-swap various sized integers from the data sections */
198   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
199     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
200     bfd_getl16, bfd_getl_signed_16, bfd_putl16,
201
202   /* Routines to byte-swap various sized integers from the file headers */
203   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
204     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
205     bfd_getl16, bfd_getl_signed_16, bfd_putl16,
206
207   /* bfd_check_format: check the format of a file being read */
208   { _bfd_dummy_target,          /* unknown format */
209     nlmNAME(object_p),          /* assembler/linker output (object file) */
210     bfd_generic_archive_p,      /* an archive */
211     nlm_core_file_p             /* a core file */
212   },
213
214   /* bfd_set_format: set the format of a file being written */
215   { bfd_false,
216     nlm_mkobject,
217     _bfd_generic_mkarchive,
218     bfd_false
219   },
220
221   /* bfd_write_contents: write cached information into a file being written */
222   { bfd_false,
223     nlmNAME(write_object_contents),
224     _bfd_write_archive_contents,
225     bfd_false
226   },
227
228   /* Initialize a jump table with the standard macro.  All names start with
229      "nlm" */
230   BFD_JUMP_TABLE_GENERIC (_bfd_generic),
231   BFD_JUMP_TABLE_COPY (_bfd_generic),
232   BFD_JUMP_TABLE_CORE (_bfd_nocore),
233   BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
234   BFD_JUMP_TABLE_SYMBOLS (nlm),
235   BFD_JUMP_TABLE_RELOCS (nlm),
236   BFD_JUMP_TABLE_WRITE (nlm),
237   BFD_JUMP_TABLE_LINK (nlm),
238   BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
239
240   /* Alternative endian target.  */
241 #ifdef TARGET_BIG_SYM
242   & TARGET_BIG_SYM,
243 #else
244   NULL,
245 #endif
246
247   /* backend_data: */
248   (PTR) TARGET_BACKEND_DATA
249 };
250 #endif