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