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