Commit | Line | Data |
---|---|---|
252b5132 | 1 | /* BFD back-end for TMS320C30 a.out binaries. |
82704155 | 2 | Copyright (C) 1998-2019 Free Software Foundation, Inc. |
252b5132 RH |
3 | Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au) |
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 | |
cd123cb7 | 9 | the Free Software Foundation; either version 3 of the License, or |
252b5132 RH |
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 | |
3e110533 | 19 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA |
53e09e0a | 20 | 02110-1301, USA. */ |
252b5132 RH |
21 | |
22 | #define TARGET_IS_BIG_ENDIAN_P | |
7920ce38 | 23 | #define N_HEADER_IN_TEXT(x) 1 |
07d6d2b8 AM |
24 | #define TEXT_START_ADDR 1024 |
25 | #define TARGET_PAGE_SIZE 128 | |
26 | #define SEGMENT_SIZE TARGET_PAGE_SIZE | |
27 | #define DEFAULT_ARCH bfd_arch_tic30 | |
252b5132 RH |
28 | #define ARCH_SIZE 32 |
29 | ||
e43d48cc AM |
30 | /* Do not "beautify" the CONCAT* macro args. Traditional C will not |
31 | remove whitespace added here, and thus will fail to concatenate | |
32 | the tokens. */ | |
33 | #define MY(OP) CONCAT2 (tic30_aout_,OP) | |
252b5132 | 34 | #define TARGETNAME "a.out-tic30" |
e43d48cc | 35 | #define NAME(x,y) CONCAT3 (tic30_aout,_32_,y) |
252b5132 | 36 | |
252b5132 | 37 | #include "sysdep.h" |
3db64b00 | 38 | #include "bfd.h" |
252b5132 | 39 | #include "libaout.h" |
252b5132 RH |
40 | #include "aout/aout64.h" |
41 | #include "aout/stab_gnu.h" | |
42 | #include "aout/ar.h" | |
43 | ||
7920ce38 NC |
44 | #define MY_reloc_howto(BFD, REL, IN, EX, PC) tic30_aout_reloc_howto (BFD, REL, & IN, & EX, & PC) |
45 | ||
07d6d2b8 AM |
46 | #define MY_final_link_relocate tic30_aout_final_link_relocate |
47 | #define MY_object_p tic30_aout_object_p | |
48 | #define MY_mkobject NAME (aout,mkobject) | |
7920ce38 | 49 | #define MY_write_object_contents tic30_aout_write_object_contents |
07d6d2b8 | 50 | #define MY_set_sizes tic30_aout_set_sizes |
252b5132 RH |
51 | |
52 | #ifndef MY_exec_hdr_flags | |
53 | #define MY_exec_hdr_flags 1 | |
54 | #endif | |
55 | ||
56 | #ifndef MY_backend_data | |
57 | ||
58 | #ifndef MY_zmagic_contiguous | |
59 | #define MY_zmagic_contiguous 0 | |
60 | #endif | |
61 | #ifndef MY_text_includes_header | |
62 | #define MY_text_includes_header 0 | |
63 | #endif | |
64 | #ifndef MY_entry_is_text_address | |
65 | #define MY_entry_is_text_address 0 | |
66 | #endif | |
67 | #ifndef MY_exec_header_not_counted | |
68 | #define MY_exec_header_not_counted 1 | |
69 | #endif | |
70 | #ifndef MY_add_dynamic_symbols | |
71 | #define MY_add_dynamic_symbols 0 | |
72 | #endif | |
73 | #ifndef MY_add_one_symbol | |
74 | #define MY_add_one_symbol 0 | |
75 | #endif | |
76 | #ifndef MY_link_dynamic_object | |
77 | #define MY_link_dynamic_object 0 | |
78 | #endif | |
79 | #ifndef MY_write_dynamic_symbol | |
80 | #define MY_write_dynamic_symbol 0 | |
81 | #endif | |
82 | #ifndef MY_check_dynamic_reloc | |
83 | #define MY_check_dynamic_reloc 0 | |
84 | #endif | |
85 | #ifndef MY_finish_dynamic_link | |
86 | #define MY_finish_dynamic_link 0 | |
87 | #endif | |
88 | ||
7920ce38 NC |
89 | static bfd_boolean |
90 | tic30_aout_set_sizes (bfd *abfd) | |
91 | { | |
92 | adata (abfd).page_size = TARGET_PAGE_SIZE; | |
93 | ||
94 | #ifdef SEGMENT_SIZE | |
95 | adata (abfd).segment_size = SEGMENT_SIZE; | |
96 | #else | |
97 | adata (abfd).segment_size = TARGET_PAGE_SIZE; | |
98 | #endif | |
99 | ||
100 | #ifdef ZMAGIC_DISK_BLOCK_SIZE | |
101 | adata (abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE; | |
102 | #else | |
103 | adata (abfd).zmagic_disk_block_size = TARGET_PAGE_SIZE; | |
104 | #endif | |
105 | ||
106 | adata (abfd).exec_bytes_size = EXEC_BYTES_SIZE; | |
107 | ||
108 | return TRUE; | |
109 | } | |
110 | ||
dc810e39 | 111 | static const struct aout_backend_data tic30_aout_backend_data = |
252b5132 RH |
112 | { |
113 | MY_zmagic_contiguous, | |
114 | MY_text_includes_header, | |
115 | MY_entry_is_text_address, | |
116 | MY_exec_hdr_flags, | |
7920ce38 | 117 | 0, /* Text vma? */ |
252b5132 RH |
118 | MY_set_sizes, |
119 | MY_exec_header_not_counted, | |
120 | MY_add_dynamic_symbols, | |
121 | MY_add_one_symbol, | |
122 | MY_link_dynamic_object, | |
123 | MY_write_dynamic_symbol, | |
124 | MY_check_dynamic_reloc, | |
125 | MY_finish_dynamic_link | |
126 | }; | |
127 | #define MY_backend_data &tic30_aout_backend_data | |
128 | #endif | |
129 | ||
7920ce38 NC |
130 | static reloc_howto_type * |
131 | tic30_aout_reloc_howto (bfd *, struct reloc_std_external *, int *, int *, int *); | |
132 | static bfd_reloc_status_type | |
133 | tic30_aout_final_link_relocate | |
134 | (reloc_howto_type *, bfd *, asection *, bfd_byte *, bfd_vma, bfd_vma, bfd_vma); | |
135 | ||
252b5132 RH |
136 | /* FIXME: This is wrong. aoutx.h should really only be included by |
137 | aout32.c. */ | |
138 | ||
139 | #include "aoutx.h" | |
140 | ||
7920ce38 NC |
141 | /* This function is used to work out pc-relative offsets for the |
142 | TMS320C30. The data already placed by md_pcrel_from within gas is | |
143 | useless for a relocation, so we just get the offset value and place | |
144 | a version of this within the object code. | |
145 | tic30_aout_final_link_relocate will then calculate the required | |
146 | relocation to add on to the value in the object code. */ | |
252b5132 | 147 | |
7920ce38 NC |
148 | static bfd_reloc_status_type |
149 | tic30_aout_fix_pcrel_16 (bfd *abfd, | |
150 | arelent *reloc_entry, | |
151 | asymbol *symbol ATTRIBUTE_UNUSED, | |
152 | void * data, | |
153 | asection *input_section ATTRIBUTE_UNUSED, | |
154 | bfd *output_bfd ATTRIBUTE_UNUSED, | |
155 | char **error_message ATTRIBUTE_UNUSED) | |
252b5132 | 156 | { |
7920ce38 NC |
157 | bfd_vma relocation = 1; |
158 | bfd_byte offset_data = bfd_get_8 (abfd, (bfd_byte *) data + reloc_entry->address - 1); | |
252b5132 | 159 | |
7920ce38 NC |
160 | /* The byte before the location of the fix contains bits 23-16 of |
161 | the pcrel instruction. Bit 21 is set for a delayed instruction | |
162 | which requires on offset of 3 instead of 1. */ | |
163 | if (offset_data & 0x20) | |
164 | relocation -= 3; | |
252b5132 | 165 | else |
7920ce38 NC |
166 | relocation -= 1; |
167 | bfd_put_16 (abfd, relocation, (bfd_byte *) data + reloc_entry->address); | |
168 | return bfd_reloc_ok; | |
252b5132 RH |
169 | } |
170 | ||
171 | /* This function is used as a callback for 16-bit relocs. This is | |
172 | required for relocations between segments. A line in aoutx.h | |
173 | requires that any relocations for the data section should point to | |
174 | the end of the aligned text section, plus an offset. By default, | |
175 | this does not happen, therefore this function takes care of | |
c4dfa77f | 176 | that. */ |
252b5132 RH |
177 | |
178 | static bfd_reloc_status_type | |
7920ce38 NC |
179 | tic30_aout_fix_16 (bfd *abfd, |
180 | arelent *reloc_entry, | |
181 | asymbol *symbol, | |
182 | void * data, | |
183 | asection *input_section ATTRIBUTE_UNUSED, | |
184 | bfd *output_bfd, | |
185 | char **error_message ATTRIBUTE_UNUSED) | |
252b5132 RH |
186 | { |
187 | bfd_vma relocation; | |
188 | ||
c4dfa77f | 189 | /* Make sure that the symbol's section is defined. */ |
45dfa85a | 190 | if (bfd_is_und_section (symbol->section) && (symbol->flags & BSF_WEAK) == 0) |
252b5132 RH |
191 | return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined; |
192 | /* Get the size of the input section and turn it into the TMS320C30 | |
c4dfa77f | 193 | 32-bit address format. */ |
252b5132 RH |
194 | relocation = (symbol->section->vma >> 2); |
195 | relocation += bfd_get_16 (abfd, (bfd_byte *) data + reloc_entry->address); | |
196 | bfd_put_16 (abfd, relocation, (bfd_byte *) data + reloc_entry->address); | |
197 | return bfd_reloc_ok; | |
198 | } | |
199 | ||
200 | /* This function does the same thing as tic30_aout_fix_16 except for 32 | |
c4dfa77f | 201 | bit relocations. */ |
252b5132 RH |
202 | |
203 | static bfd_reloc_status_type | |
7920ce38 NC |
204 | tic30_aout_fix_32 (bfd *abfd, |
205 | arelent *reloc_entry, | |
206 | asymbol *symbol, | |
207 | void * data, | |
208 | asection *input_section ATTRIBUTE_UNUSED, | |
209 | bfd *output_bfd, | |
210 | char **error_message ATTRIBUTE_UNUSED) | |
252b5132 RH |
211 | { |
212 | bfd_vma relocation; | |
213 | ||
c4dfa77f | 214 | /* Make sure that the symbol's section is defined. */ |
45dfa85a | 215 | if (bfd_is_und_section (symbol->section) && (symbol->flags & BSF_WEAK) == 0) |
252b5132 RH |
216 | return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined; |
217 | /* Get the size of the input section and turn it into the TMS320C30 | |
c4dfa77f | 218 | 32-bit address format. */ |
252b5132 RH |
219 | relocation = (symbol->section->vma >> 2); |
220 | relocation += bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address); | |
221 | bfd_put_32 (abfd, relocation, (bfd_byte *) data + reloc_entry->address); | |
222 | return bfd_reloc_ok; | |
223 | } | |
224 | ||
7920ce38 NC |
225 | /* This table lists the relocation types for the TMS320C30. There are |
226 | only a few relocations required, and all must be divided by 4 (>> | |
227 | 2) to get the 32-bit addresses in the format the TMS320C30 likes | |
228 | it. */ | |
229 | reloc_howto_type tic30_aout_howto_table[] = | |
230 | { | |
231 | EMPTY_HOWTO (-1), | |
232 | HOWTO (1, 2, 1, 16, FALSE, 0, 0, tic30_aout_fix_16, | |
233 | "16", FALSE, 0x0000FFFF, 0x0000FFFF, FALSE), | |
234 | HOWTO (2, 2, 2, 24, FALSE, 0, complain_overflow_bitfield, NULL, | |
235 | "24", FALSE, 0x00FFFFFF, 0x00FFFFFF, FALSE), | |
236 | HOWTO (3, 18, 3, 24, FALSE, 0, complain_overflow_bitfield, NULL, | |
237 | "LDP", FALSE, 0x00FF0000, 0x000000FF, FALSE), | |
238 | HOWTO (4, 2, 4, 32, FALSE, 0, complain_overflow_bitfield, tic30_aout_fix_32, | |
239 | "32", FALSE, 0xFFFFFFFF, 0xFFFFFFFF, FALSE), | |
240 | HOWTO (5, 2, 1, 16, TRUE, 0, complain_overflow_signed, | |
241 | tic30_aout_fix_pcrel_16, "PCREL", TRUE, 0x0000FFFF, 0x0000FFFF, TRUE), | |
242 | EMPTY_HOWTO (-1), | |
243 | EMPTY_HOWTO (-1), | |
244 | EMPTY_HOWTO (-1), | |
245 | EMPTY_HOWTO (-1), | |
246 | EMPTY_HOWTO (-1) | |
247 | }; | |
252b5132 | 248 | |
7920ce38 NC |
249 | |
250 | static reloc_howto_type * | |
251 | tic30_aout_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, | |
252 | bfd_reloc_code_real_type code) | |
252b5132 | 253 | { |
7920ce38 NC |
254 | switch (code) |
255 | { | |
256 | case BFD_RELOC_8: | |
257 | case BFD_RELOC_TIC30_LDP: | |
258 | return &tic30_aout_howto_table[3]; | |
259 | case BFD_RELOC_16: | |
260 | return &tic30_aout_howto_table[1]; | |
261 | case BFD_RELOC_24: | |
262 | return &tic30_aout_howto_table[2]; | |
263 | case BFD_RELOC_16_PCREL: | |
264 | return &tic30_aout_howto_table[5]; | |
265 | case BFD_RELOC_32: | |
266 | return &tic30_aout_howto_table[4]; | |
267 | default: | |
268 | return NULL; | |
269 | } | |
270 | } | |
252b5132 | 271 | |
157090f7 AM |
272 | static reloc_howto_type * |
273 | tic30_aout_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, | |
274 | const char *r_name) | |
275 | { | |
276 | unsigned int i; | |
277 | ||
278 | for (i = 0; | |
279 | i < (sizeof (tic30_aout_howto_table) | |
280 | / sizeof (tic30_aout_howto_table[0])); | |
281 | i++) | |
282 | if (tic30_aout_howto_table[i].name != NULL | |
283 | && strcasecmp (tic30_aout_howto_table[i].name, r_name) == 0) | |
284 | return &tic30_aout_howto_table[i]; | |
285 | ||
286 | return NULL; | |
287 | } | |
288 | ||
7920ce38 NC |
289 | static reloc_howto_type * |
290 | tic30_aout_reloc_howto (bfd *abfd, | |
291 | struct reloc_std_external *relocs, | |
292 | int *r_index, | |
293 | int *r_extern, | |
294 | int *r_pcrel) | |
295 | { | |
296 | unsigned int r_length; | |
297 | unsigned int r_pcrel_done; | |
91d6fa6a | 298 | int howto_index; |
7920ce38 NC |
299 | |
300 | *r_pcrel = 0; | |
301 | if (bfd_header_big_endian (abfd)) | |
302 | { | |
303 | *r_index = ((relocs->r_index[0] << 16) | (relocs->r_index[1] << 8) | relocs->r_index[2]); | |
304 | *r_extern = (0 != (relocs->r_type[0] & RELOC_STD_BITS_EXTERN_BIG)); | |
305 | r_pcrel_done = (0 != (relocs->r_type[0] & RELOC_STD_BITS_PCREL_BIG)); | |
306 | r_length = ((relocs->r_type[0] & RELOC_STD_BITS_LENGTH_BIG) >> RELOC_STD_BITS_LENGTH_SH_BIG); | |
307 | } | |
252b5132 | 308 | else |
7920ce38 NC |
309 | { |
310 | *r_index = ((relocs->r_index[2] << 16) | (relocs->r_index[1] << 8) | relocs->r_index[0]); | |
311 | *r_extern = (0 != (relocs->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE)); | |
312 | r_pcrel_done = (0 != (relocs->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE)); | |
313 | r_length = ((relocs->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE) >> RELOC_STD_BITS_LENGTH_SH_LITTLE); | |
314 | } | |
91d6fa6a NC |
315 | howto_index = r_length + 4 * r_pcrel_done; |
316 | return tic30_aout_howto_table + howto_index; | |
252b5132 RH |
317 | } |
318 | ||
319 | /* These macros will get 24-bit values from the bfd definition. | |
c4dfa77f | 320 | Big-endian only. */ |
beb0d161 KH |
321 | #define bfd_getb_24(BFD,ADDR) \ |
322 | (bfd_get_8 (BFD, ADDR ) << 16) | \ | |
323 | (bfd_get_8 (BFD, ADDR + 1) << 8) | \ | |
324 | (bfd_get_8 (BFD, ADDR + 2) ) | |
325 | ||
326 | #define bfd_putb_24(BFD,DATA,ADDR) \ | |
07d6d2b8 | 327 | bfd_put_8 (BFD, (bfd_byte) ((DATA >> 16) & 0xFF), ADDR ); \ |
beb0d161 | 328 | bfd_put_8 (BFD, (bfd_byte) ((DATA >> 8) & 0xFF), ADDR + 1); \ |
07d6d2b8 | 329 | bfd_put_8 (BFD, (bfd_byte) ( DATA & 0xFF), ADDR + 2) |
252b5132 RH |
330 | |
331 | /* Set parameters about this a.out file that are machine-dependent. | |
332 | This routine is called from some_aout_object_p just before it returns. */ | |
333 | ||
334 | static const bfd_target * | |
7920ce38 | 335 | tic30_aout_callback (bfd *abfd) |
252b5132 RH |
336 | { |
337 | struct internal_exec *execp = exec_hdr (abfd); | |
338 | unsigned int arch_align_power; | |
339 | unsigned long arch_align; | |
340 | ||
1725a96e | 341 | /* Calculate the file positions of the parts of a newly read aout header. */ |
bbb1afc8 | 342 | obj_textsec (abfd)->size = N_TXTSIZE (execp); |
252b5132 | 343 | |
1725a96e | 344 | /* The virtual memory addresses of the sections. */ |
bbb1afc8 AM |
345 | obj_textsec (abfd)->vma = N_TXTADDR (execp); |
346 | obj_datasec (abfd)->vma = N_DATADDR (execp); | |
347 | obj_bsssec (abfd)->vma = N_BSSADDR (execp); | |
252b5132 RH |
348 | |
349 | obj_textsec (abfd)->lma = obj_textsec (abfd)->vma; | |
350 | obj_datasec (abfd)->lma = obj_datasec (abfd)->vma; | |
351 | obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma; | |
352 | ||
1725a96e | 353 | /* The file offsets of the sections. */ |
bbb1afc8 AM |
354 | obj_textsec (abfd)->filepos = N_TXTOFF (execp); |
355 | obj_datasec (abfd)->filepos = N_DATOFF (execp); | |
252b5132 | 356 | |
1725a96e | 357 | /* The file offsets of the relocation info. */ |
bbb1afc8 AM |
358 | obj_textsec (abfd)->rel_filepos = N_TRELOFF (execp); |
359 | obj_datasec (abfd)->rel_filepos = N_DRELOFF (execp); | |
252b5132 RH |
360 | |
361 | /* The file offsets of the string table and symbol table. */ | |
bbb1afc8 AM |
362 | obj_sym_filepos (abfd) = N_SYMOFF (execp); |
363 | obj_str_filepos (abfd) = N_STROFF (execp); | |
252b5132 RH |
364 | |
365 | /* Determine the architecture and machine type of the object file. */ | |
366 | #ifdef SET_ARCH_MACH | |
bbb1afc8 | 367 | SET_ARCH_MACH (abfd, execp); |
252b5132 | 368 | #else |
dc810e39 | 369 | bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0L); |
252b5132 RH |
370 | #endif |
371 | ||
372 | /* Now that we know the architecture, set the alignments of the | |
7920ce38 | 373 | sections. This is normally done by NAME (aout,new_section_hook), |
252b5132 RH |
374 | but when the initial sections were created the architecture had |
375 | not yet been set. However, for backward compatibility, we don't | |
376 | set the alignment power any higher than as required by the size | |
377 | of the section. */ | |
378 | arch_align_power = bfd_get_arch_info (abfd)->section_align_power; | |
379 | arch_align = 1 << arch_align_power; | |
eea6121a AM |
380 | if ((BFD_ALIGN (obj_textsec (abfd)->size, arch_align) |
381 | == obj_textsec (abfd)->size) | |
382 | && (BFD_ALIGN (obj_datasec (abfd)->size, arch_align) | |
383 | == obj_datasec (abfd)->size) | |
384 | && (BFD_ALIGN (obj_bsssec (abfd)->size, arch_align) | |
385 | == obj_bsssec (abfd)->size)) | |
252b5132 RH |
386 | { |
387 | obj_textsec (abfd)->alignment_power = arch_align_power; | |
388 | obj_datasec (abfd)->alignment_power = arch_align_power; | |
389 | obj_bsssec (abfd)->alignment_power = arch_align_power; | |
390 | } | |
391 | return abfd->xvec; | |
392 | } | |
393 | ||
394 | static bfd_reloc_status_type | |
7920ce38 NC |
395 | tic30_aout_relocate_contents (reloc_howto_type *howto, |
396 | bfd *input_bfd, | |
397 | bfd_vma relocation, | |
398 | bfd_byte *location) | |
252b5132 RH |
399 | { |
400 | bfd_vma x; | |
b34976b6 | 401 | bfd_boolean overflow; |
252b5132 RH |
402 | |
403 | if (howto->size < 0) | |
404 | relocation = -relocation; | |
405 | ||
406 | switch (howto->size) | |
407 | { | |
408 | default: | |
409 | case 0: | |
410 | abort (); | |
411 | break; | |
412 | case 1: | |
413 | x = bfd_get_16 (input_bfd, location); | |
414 | break; | |
415 | case 2: | |
416 | x = bfd_getb_24 (input_bfd, location); | |
417 | break; | |
418 | case 3: | |
419 | x = bfd_get_8 (input_bfd, location); | |
420 | break; | |
421 | case 4: | |
422 | x = bfd_get_32 (input_bfd, location); | |
423 | break; | |
424 | } | |
1725a96e | 425 | |
b34976b6 | 426 | overflow = FALSE; |
1725a96e | 427 | |
252b5132 RH |
428 | if (howto->complain_on_overflow != complain_overflow_dont) |
429 | { | |
430 | bfd_vma check; | |
431 | bfd_signed_vma signed_check; | |
432 | bfd_vma add; | |
433 | bfd_signed_vma signed_add; | |
434 | ||
435 | if (howto->rightshift == 0) | |
436 | { | |
437 | check = relocation; | |
438 | signed_check = (bfd_signed_vma) relocation; | |
439 | } | |
440 | else | |
441 | { | |
442 | check = relocation >> howto->rightshift; | |
443 | if ((bfd_signed_vma) relocation >= 0) | |
444 | signed_check = check; | |
445 | else | |
446 | signed_check = (check | ((bfd_vma) - 1 & ~((bfd_vma) - 1 >> howto->rightshift))); | |
447 | } | |
448 | add = x & howto->src_mask; | |
449 | signed_add = add; | |
450 | if ((add & (((~howto->src_mask) >> 1) & howto->src_mask)) != 0) | |
451 | signed_add -= (((~howto->src_mask) >> 1) & howto->src_mask) << 1; | |
452 | if (howto->bitpos == 0) | |
453 | { | |
454 | check += add; | |
455 | signed_check += signed_add; | |
456 | } | |
457 | else | |
458 | { | |
459 | check += add >> howto->bitpos; | |
460 | if (signed_add >= 0) | |
461 | signed_check += add >> howto->bitpos; | |
462 | else | |
463 | signed_check += ((add >> howto->bitpos) | ((bfd_vma) - 1 & ~((bfd_vma) - 1 >> howto->bitpos))); | |
464 | } | |
465 | switch (howto->complain_on_overflow) | |
466 | { | |
467 | case complain_overflow_signed: | |
468 | { | |
469 | bfd_signed_vma reloc_signed_max = (1 << (howto->bitsize - 1)) - 1; | |
470 | bfd_signed_vma reloc_signed_min = ~reloc_signed_max; | |
7920ce38 | 471 | |
252b5132 | 472 | if (signed_check > reloc_signed_max || signed_check < reloc_signed_min) |
b34976b6 | 473 | overflow = TRUE; |
252b5132 RH |
474 | } |
475 | break; | |
476 | case complain_overflow_unsigned: | |
477 | { | |
478 | bfd_vma reloc_unsigned_max = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; | |
7920ce38 | 479 | |
252b5132 | 480 | if (check > reloc_unsigned_max) |
b34976b6 | 481 | overflow = TRUE; |
252b5132 RH |
482 | } |
483 | break; | |
484 | case complain_overflow_bitfield: | |
485 | { | |
486 | bfd_vma reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1; | |
7920ce38 | 487 | |
dc810e39 AM |
488 | if ((check & ~reloc_bits) != 0 |
489 | && (((bfd_vma) signed_check & ~reloc_bits) | |
490 | != ((bfd_vma) -1 & ~reloc_bits))) | |
b34976b6 | 491 | overflow = TRUE; |
252b5132 RH |
492 | } |
493 | break; | |
494 | default: | |
495 | abort (); | |
496 | } | |
497 | } | |
498 | relocation >>= (bfd_vma) howto->rightshift; | |
499 | relocation <<= (bfd_vma) howto->bitpos; | |
500 | x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + relocation) & howto->dst_mask)); | |
501 | switch (howto->size) | |
502 | { | |
503 | default: | |
504 | case 0: | |
505 | abort (); | |
506 | break; | |
507 | case 1: | |
508 | bfd_put_16 (input_bfd, x, location); | |
509 | break; | |
510 | case 2: | |
511 | bfd_putb_24 (input_bfd, x, location); | |
512 | break; | |
513 | case 3: | |
514 | bfd_put_8 (input_bfd, x, location); | |
515 | break; | |
516 | case 4: | |
517 | bfd_put_32 (input_bfd, x, location); | |
518 | break; | |
519 | } | |
520 | return overflow ? bfd_reloc_overflow : bfd_reloc_ok; | |
521 | } | |
522 | ||
7920ce38 NC |
523 | static bfd_reloc_status_type |
524 | tic30_aout_final_link_relocate (reloc_howto_type *howto, | |
525 | bfd *input_bfd, | |
526 | asection *input_section, | |
527 | bfd_byte *contents, | |
528 | bfd_vma address, | |
529 | bfd_vma value, | |
530 | bfd_vma addend) | |
531 | { | |
532 | bfd_vma relocation; | |
533 | ||
534 | if (address > bfd_get_section_limit (input_bfd, input_section)) | |
535 | return bfd_reloc_outofrange; | |
536 | ||
537 | relocation = value + addend; | |
538 | if (howto->pc_relative) | |
539 | { | |
540 | relocation -= (input_section->output_section->vma + input_section->output_offset); | |
541 | if (howto->pcrel_offset) | |
542 | relocation -= address; | |
543 | } | |
544 | return tic30_aout_relocate_contents (howto, input_bfd, relocation, | |
545 | contents + address); | |
546 | } | |
547 | ||
1725a96e | 548 | /* Finish up the reading of an a.out file header. */ |
252b5132 RH |
549 | |
550 | static const bfd_target * | |
7920ce38 | 551 | tic30_aout_object_p (bfd *abfd) |
252b5132 | 552 | { |
1725a96e | 553 | struct external_exec exec_bytes; /* Raw exec header from file. */ |
7920ce38 | 554 | struct internal_exec exec; /* Cleaned-up exec header. */ |
252b5132 | 555 | const bfd_target *target; |
dc810e39 | 556 | bfd_size_type amt = EXEC_BYTES_SIZE; |
252b5132 | 557 | |
7920ce38 | 558 | if (bfd_bread (& exec_bytes, amt, abfd) != amt) |
252b5132 RH |
559 | { |
560 | if (bfd_get_error () != bfd_error_system_call) | |
561 | bfd_set_error (bfd_error_wrong_format); | |
562 | return 0; | |
563 | } | |
564 | ||
565 | #ifdef SWAP_MAGIC | |
566 | exec.a_info = SWAP_MAGIC (exec_bytes.e_info); | |
567 | #else | |
dc810e39 | 568 | exec.a_info = H_GET_32 (abfd, exec_bytes.e_info); |
252b5132 RH |
569 | #endif /* SWAP_MAGIC */ |
570 | ||
bbb1afc8 | 571 | if (N_BADMAG (&exec)) |
252b5132 RH |
572 | return 0; |
573 | #ifdef MACHTYPE_OK | |
bbb1afc8 | 574 | if (!(MACHTYPE_OK (N_MACHTYPE (&exec)))) |
252b5132 RH |
575 | return 0; |
576 | #endif | |
577 | ||
578 | NAME (aout, swap_exec_header_in) (abfd, &exec_bytes, &exec); | |
579 | ||
580 | #ifdef SWAP_MAGIC | |
7920ce38 | 581 | /* Swap_exec_header_in read in a_info with the wrong byte order. */ |
252b5132 | 582 | exec.a_info = SWAP_MAGIC (exec_bytes.e_info); |
7920ce38 | 583 | #endif |
252b5132 RH |
584 | |
585 | target = NAME (aout, some_aout_object_p) (abfd, &exec, tic30_aout_callback); | |
586 | ||
587 | #ifdef ENTRY_CAN_BE_ZERO | |
588 | /* The NEWSOS3 entry-point is/was 0, which (amongst other lossage) | |
1725a96e NC |
589 | means that it isn't obvious if EXEC_P should be set. |
590 | All of the following must be true for an executable: | |
591 | There must be no relocations, the bfd can be neither an | |
592 | archive nor an archive element, and the file must be executable. */ | |
252b5132 RH |
593 | |
594 | if (exec.a_trsize + exec.a_drsize == 0 | |
595 | && bfd_get_format (abfd) == bfd_object && abfd->my_archive == NULL) | |
596 | { | |
597 | struct stat buf; | |
598 | #ifndef S_IXUSR | |
599 | #define S_IXUSR 0100 /* Execute by owner. */ | |
600 | #endif | |
601 | if (stat (abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR)) | |
602 | abfd->flags |= EXEC_P; | |
603 | } | |
7920ce38 | 604 | #endif |
252b5132 RH |
605 | |
606 | return target; | |
607 | } | |
608 | ||
609 | /* Copy private section data. This actually does nothing with the | |
610 | sections. It copies the subformat field. We copy it here, because | |
611 | we need to know whether this is a QMAGIC file before we set the | |
612 | section contents, and copy_private_bfd_data is not called until | |
613 | after the section contents have been set. */ | |
614 | ||
b34976b6 | 615 | static bfd_boolean |
7920ce38 NC |
616 | MY_bfd_copy_private_section_data (bfd *ibfd, |
617 | asection *isec ATTRIBUTE_UNUSED, | |
618 | bfd *obfd, | |
619 | asection *osec ATTRIBUTE_UNUSED) | |
252b5132 RH |
620 | { |
621 | if (bfd_get_flavour (obfd) == bfd_target_aout_flavour) | |
622 | obj_aout_subformat (obfd) = obj_aout_subformat (ibfd); | |
b34976b6 | 623 | return TRUE; |
252b5132 RH |
624 | } |
625 | ||
626 | /* Write an object file. | |
627 | Section contents have already been written. We write the | |
628 | file header, symbols, and relocation. */ | |
629 | ||
b34976b6 | 630 | static bfd_boolean |
7920ce38 | 631 | tic30_aout_write_object_contents (bfd *abfd) |
252b5132 RH |
632 | { |
633 | struct external_exec exec_bytes; | |
634 | struct internal_exec *execp = exec_hdr (abfd); | |
635 | ||
252b5132 | 636 | obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; |
8ba8a462 | 637 | |
252b5132 | 638 | { |
252b5132 | 639 | if (adata (abfd).magic == undecided_magic) |
3a8c4a5b | 640 | NAME (aout, adjust_sizes_and_vmas) (abfd); |
252b5132 RH |
641 | |
642 | execp->a_syms = bfd_get_symcount (abfd) * EXTERNAL_NLIST_SIZE; | |
643 | execp->a_entry = bfd_get_start_address (abfd); | |
644 | ||
645 | execp->a_trsize = ((obj_textsec (abfd)->reloc_count) * obj_reloc_entry_size (abfd)); | |
646 | execp->a_drsize = ((obj_datasec (abfd)->reloc_count) * obj_reloc_entry_size (abfd)); | |
647 | NAME (aout, swap_exec_header_out) (abfd, execp, &exec_bytes); | |
648 | ||
649 | if (adata (abfd).exec_bytes_size > 0) | |
650 | { | |
dc810e39 | 651 | bfd_size_type amt; |
7920ce38 | 652 | |
252b5132 | 653 | if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0) |
b34976b6 | 654 | return FALSE; |
dc810e39 | 655 | amt = adata (abfd).exec_bytes_size; |
7920ce38 | 656 | if (bfd_bwrite (& exec_bytes, amt, abfd) != amt) |
b34976b6 | 657 | return FALSE; |
252b5132 | 658 | } |
252b5132 | 659 | |
1725a96e | 660 | /* Now write out reloc info, followed by syms and strings. */ |
252b5132 RH |
661 | if (bfd_get_outsymbols (abfd) != (asymbol **) NULL |
662 | && bfd_get_symcount (abfd) != 0) | |
663 | { | |
bbb1afc8 | 664 | if (bfd_seek (abfd, (file_ptr) (N_SYMOFF (execp)), SEEK_SET) != 0) |
b34976b6 | 665 | return FALSE; |
252b5132 RH |
666 | |
667 | if (!NAME (aout, write_syms) (abfd)) | |
b34976b6 | 668 | return FALSE; |
252b5132 RH |
669 | } |
670 | ||
bbb1afc8 | 671 | if (bfd_seek (abfd, (file_ptr) (N_TRELOFF (execp)), SEEK_SET) != 0) |
b34976b6 | 672 | return FALSE; |
252b5132 | 673 | if (!NAME (aout, squirt_out_relocs) (abfd, obj_textsec (abfd))) |
b34976b6 | 674 | return FALSE; |
252b5132 | 675 | |
bbb1afc8 | 676 | if (bfd_seek (abfd, (file_ptr) (N_DRELOFF (execp)), SEEK_SET) != 0) |
b34976b6 | 677 | return FALSE; |
252b5132 | 678 | if (!NAME (aout, squirt_out_relocs) (abfd, obj_datasec (abfd))) |
b34976b6 | 679 | return FALSE; |
252b5132 RH |
680 | } |
681 | ||
b34976b6 | 682 | return TRUE; |
252b5132 RH |
683 | } |
684 | ||
252b5132 RH |
685 | #ifndef MY_final_link_callback |
686 | ||
687 | /* Callback for the final_link routine to set the section offsets. */ | |
688 | ||
252b5132 | 689 | static void |
7920ce38 NC |
690 | MY_final_link_callback (bfd *abfd, |
691 | file_ptr *ptreloff, | |
692 | file_ptr *pdreloff, | |
693 | file_ptr *psymoff) | |
252b5132 RH |
694 | { |
695 | struct internal_exec *execp = exec_hdr (abfd); | |
696 | ||
697 | *ptreloff = obj_datasec (abfd)->filepos + execp->a_data; | |
698 | *pdreloff = *ptreloff + execp->a_trsize; | |
5bb3703f | 699 | *psymoff = *pdreloff + execp->a_drsize; |
252b5132 RH |
700 | } |
701 | ||
702 | #endif | |
703 | ||
704 | #ifndef MY_bfd_final_link | |
705 | ||
706 | /* Final link routine. We need to use a call back to get the correct | |
707 | offsets in the output file. */ | |
708 | ||
b34976b6 | 709 | static bfd_boolean |
7920ce38 | 710 | MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info) |
252b5132 RH |
711 | { |
712 | struct internal_exec *execp = exec_hdr (abfd); | |
a7b34aba | 713 | asection *objsym_section; |
252b5132 RH |
714 | file_ptr pos; |
715 | bfd_vma vma = 0; | |
252b5132 RH |
716 | |
717 | /* Set the executable header size to 0, as we don't want one for an | |
a7b34aba AM |
718 | output. FIXME: Really? tic30_aout_object_p doesn't accept such |
719 | an executable! */ | |
252b5132 | 720 | adata (abfd).exec_bytes_size = 0; |
a7b34aba | 721 | |
252b5132 | 722 | pos = adata (abfd).exec_bytes_size; |
a7b34aba AM |
723 | /* ??? Why are we looking at create_object_symbols_section? */ |
724 | objsym_section = info->create_object_symbols_section; | |
725 | if (objsym_section != NULL) | |
726 | vma = objsym_section->vma; | |
727 | ||
252b5132 | 728 | /* Text. */ |
a7b34aba AM |
729 | if (obj_textsec (abfd) != NULL) |
730 | { | |
731 | pos += vma; | |
732 | obj_textsec (abfd)->filepos = pos; | |
733 | obj_textsec (abfd)->vma = vma; | |
734 | obj_textsec (abfd)->user_set_vma = 1; | |
735 | execp->a_text = obj_textsec (abfd)->size; | |
736 | pos += obj_textsec (abfd)->size; | |
737 | vma += obj_textsec (abfd)->size; | |
738 | } | |
252b5132 RH |
739 | |
740 | /* Data. */ | |
a7b34aba | 741 | if (obj_datasec (abfd) != NULL) |
252b5132 | 742 | { |
a7b34aba AM |
743 | if (abfd->flags & D_PAGED) |
744 | { | |
745 | if (objsym_section != NULL | |
746 | && objsym_section->next != NULL | |
747 | && objsym_section->next->vma != 0) | |
748 | obj_datasec (abfd)->vma = objsym_section->next->vma; | |
749 | else | |
750 | obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size); | |
751 | } | |
252b5132 | 752 | else |
a7b34aba | 753 | obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4); |
1725a96e | 754 | |
a7b34aba AM |
755 | if (obj_datasec (abfd)->vma < vma) |
756 | obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4); | |
1725a96e | 757 | |
a7b34aba AM |
758 | pos += obj_datasec (abfd)->vma - vma; |
759 | obj_datasec (abfd)->filepos = pos; | |
760 | obj_datasec (abfd)->user_set_vma = 1; | |
761 | ||
762 | vma = obj_datasec (abfd)->vma; | |
763 | if (obj_textsec (abfd) != NULL) | |
764 | { | |
765 | execp->a_text = vma - obj_textsec (abfd)->vma; | |
766 | obj_textsec (abfd)->size = execp->a_text; | |
767 | } | |
768 | execp->a_data = obj_datasec (abfd)->size; | |
769 | vma += obj_datasec (abfd)->size; | |
770 | } | |
252b5132 RH |
771 | |
772 | /* Since BSS follows data immediately, see if it needs alignment. */ | |
a7b34aba AM |
773 | if (obj_bsssec (abfd) != NULL) |
774 | { | |
775 | int pad; | |
776 | ||
777 | pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma; | |
778 | if (obj_datasec (abfd) != NULL) | |
779 | { | |
780 | obj_datasec (abfd)->size += pad; | |
781 | execp->a_data += pad; | |
782 | } | |
783 | else if (obj_textsec (abfd) != NULL) | |
784 | { | |
785 | obj_textsec (abfd)->size += pad; | |
786 | execp->a_text += pad; | |
787 | } | |
788 | ||
789 | /* BSS. */ | |
790 | vma += pad; | |
791 | obj_bsssec (abfd)->vma = vma; | |
792 | obj_bsssec (abfd)->user_set_vma = 1; | |
793 | } | |
252b5132 | 794 | |
c4dfa77f | 795 | /* We are fully resized, so don't readjust in final_link. */ |
252b5132 RH |
796 | adata (abfd).magic = z_magic; |
797 | ||
798 | return NAME (aout, final_link) (abfd, info, MY_final_link_callback); | |
799 | } | |
800 | ||
801 | #endif | |
802 | ||
7920ce38 NC |
803 | static enum machine_type |
804 | tic30_aout_machine_type (enum bfd_architecture arch, | |
805 | unsigned long machine ATTRIBUTE_UNUSED, | |
806 | bfd_boolean *unknown) | |
252b5132 RH |
807 | { |
808 | enum machine_type arch_flags; | |
809 | ||
810 | arch_flags = M_UNKNOWN; | |
b34976b6 | 811 | *unknown = TRUE; |
252b5132 RH |
812 | |
813 | switch (arch) | |
814 | { | |
815 | case bfd_arch_tic30: | |
b34976b6 | 816 | *unknown = FALSE; |
252b5132 RH |
817 | break; |
818 | default: | |
819 | arch_flags = M_UNKNOWN; | |
820 | } | |
821 | if (arch_flags != M_UNKNOWN) | |
b34976b6 | 822 | *unknown = FALSE; |
252b5132 RH |
823 | return arch_flags; |
824 | } | |
825 | ||
7920ce38 NC |
826 | static bfd_boolean |
827 | tic30_aout_set_arch_mach (bfd *abfd, | |
828 | enum bfd_architecture arch, | |
829 | unsigned long machine) | |
252b5132 RH |
830 | { |
831 | if (!bfd_default_set_arch_mach (abfd, arch, machine)) | |
b34976b6 | 832 | return FALSE; |
252b5132 RH |
833 | if (arch != bfd_arch_unknown) |
834 | { | |
b34976b6 | 835 | bfd_boolean unknown; |
252b5132 RH |
836 | tic30_aout_machine_type (arch, machine, &unknown); |
837 | if (unknown) | |
b34976b6 | 838 | return FALSE; |
252b5132 RH |
839 | } |
840 | obj_reloc_entry_size (abfd) = RELOC_STD_SIZE; | |
841 | return (*aout_backend_info (abfd)->set_sizes) (abfd); | |
842 | } | |
843 | ||
844 | /* We assume BFD generic archive files. */ | |
845 | #ifndef MY_openr_next_archived_file | |
846 | #define MY_openr_next_archived_file bfd_generic_openr_next_archived_file | |
847 | #endif | |
848 | #ifndef MY_get_elt_at_index | |
849 | #define MY_get_elt_at_index _bfd_generic_get_elt_at_index | |
850 | #endif | |
851 | #ifndef MY_generic_stat_arch_elt | |
852 | #define MY_generic_stat_arch_elt bfd_generic_stat_arch_elt | |
853 | #endif | |
854 | #ifndef MY_slurp_armap | |
855 | #define MY_slurp_armap bfd_slurp_bsd_armap | |
856 | #endif | |
857 | #ifndef MY_slurp_extended_name_table | |
858 | #define MY_slurp_extended_name_table _bfd_slurp_extended_name_table | |
859 | #endif | |
860 | #ifndef MY_construct_extended_name_table | |
861 | #define MY_construct_extended_name_table \ | |
862 | _bfd_archive_bsd_construct_extended_name_table | |
863 | #endif | |
864 | #ifndef MY_write_armap | |
7ec22e0f | 865 | #define MY_write_armap _bfd_bsd_write_armap |
252b5132 RH |
866 | #endif |
867 | #ifndef MY_read_ar_hdr | |
7920ce38 | 868 | #define MY_read_ar_hdr _bfd_generic_read_ar_hdr |
252b5132 | 869 | #endif |
8f95b6e4 TG |
870 | #ifndef MY_write_ar_hdr |
871 | #define MY_write_ar_hdr _bfd_generic_write_ar_hdr | |
872 | #endif | |
252b5132 RH |
873 | #ifndef MY_truncate_arname |
874 | #define MY_truncate_arname bfd_bsd_truncate_arname | |
875 | #endif | |
876 | #ifndef MY_update_armap_timestamp | |
07d6d2b8 | 877 | #define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp |
252b5132 RH |
878 | #endif |
879 | ||
880 | /* No core file defined here -- configure in trad-core.c separately. */ | |
881 | #ifndef MY_core_file_failing_command | |
07d6d2b8 | 882 | #define MY_core_file_failing_command _bfd_nocore_core_file_failing_command |
252b5132 RH |
883 | #endif |
884 | #ifndef MY_core_file_failing_signal | |
885 | #define MY_core_file_failing_signal _bfd_nocore_core_file_failing_signal | |
886 | #endif | |
887 | #ifndef MY_core_file_matches_executable_p | |
888 | #define MY_core_file_matches_executable_p \ | |
889 | _bfd_nocore_core_file_matches_executable_p | |
890 | #endif | |
261b8d08 | 891 | #ifndef MY_core_file_pid |
07d6d2b8 | 892 | #define MY_core_file_pid _bfd_nocore_core_file_pid |
261b8d08 | 893 | #endif |
252b5132 | 894 | #ifndef MY_core_file_p |
7920ce38 | 895 | #define MY_core_file_p _bfd_dummy_target |
252b5132 RH |
896 | #endif |
897 | ||
898 | #ifndef MY_bfd_debug_info_start | |
d00dd7dc | 899 | #define MY_bfd_debug_info_start _bfd_void_bfd |
252b5132 RH |
900 | #endif |
901 | #ifndef MY_bfd_debug_info_end | |
d00dd7dc | 902 | #define MY_bfd_debug_info_end _bfd_void_bfd |
252b5132 RH |
903 | #endif |
904 | #ifndef MY_bfd_debug_info_accumulate | |
d00dd7dc | 905 | #define MY_bfd_debug_info_accumulate _bfd_void_bfd_asection |
252b5132 RH |
906 | #endif |
907 | ||
908 | #ifndef MY_core_file_failing_command | |
7920ce38 | 909 | #define MY_core_file_failing_command NAME (aout, core_file_failing_command) |
252b5132 RH |
910 | #endif |
911 | #ifndef MY_core_file_failing_signal | |
7920ce38 | 912 | #define MY_core_file_failing_signal NAME (aout, core_file_failing_signal) |
252b5132 RH |
913 | #endif |
914 | #ifndef MY_core_file_matches_executable_p | |
7920ce38 | 915 | #define MY_core_file_matches_executable_p NAME (aout, core_file_matches_executable_p) |
252b5132 RH |
916 | #endif |
917 | #ifndef MY_set_section_contents | |
7920ce38 | 918 | #define MY_set_section_contents NAME (aout, set_section_contents) |
252b5132 RH |
919 | #endif |
920 | #ifndef MY_get_section_contents | |
921 | #define MY_get_section_contents aout_32_get_section_contents | |
922 | #endif | |
923 | #ifndef MY_get_section_contents_in_window | |
924 | #define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window | |
925 | #endif | |
926 | #ifndef MY_new_section_hook | |
7920ce38 | 927 | #define MY_new_section_hook NAME (aout, new_section_hook) |
252b5132 RH |
928 | #endif |
929 | #ifndef MY_get_symtab_upper_bound | |
7920ce38 | 930 | #define MY_get_symtab_upper_bound NAME (aout, get_symtab_upper_bound) |
252b5132 | 931 | #endif |
6cee3f79 | 932 | #ifndef MY_canonicalize_symtab |
7920ce38 | 933 | #define MY_canonicalize_symtab NAME (aout, canonicalize_symtab) |
252b5132 RH |
934 | #endif |
935 | #ifndef MY_get_reloc_upper_bound | |
7920ce38 | 936 | #define MY_get_reloc_upper_bound NAME (aout, get_reloc_upper_bound) |
252b5132 RH |
937 | #endif |
938 | #ifndef MY_canonicalize_reloc | |
7920ce38 | 939 | #define MY_canonicalize_reloc NAME (aout, canonicalize_reloc) |
252b5132 | 940 | #endif |
23186865 JM |
941 | #ifndef MY_set_reloc |
942 | #define MY_set_reloc _bfd_generic_set_reloc | |
943 | #endif | |
252b5132 | 944 | #ifndef MY_make_empty_symbol |
7920ce38 | 945 | #define MY_make_empty_symbol NAME (aout, make_empty_symbol) |
252b5132 RH |
946 | #endif |
947 | #ifndef MY_print_symbol | |
7920ce38 | 948 | #define MY_print_symbol NAME (aout, print_symbol) |
252b5132 RH |
949 | #endif |
950 | #ifndef MY_get_symbol_info | |
7920ce38 | 951 | #define MY_get_symbol_info NAME (aout, get_symbol_info) |
252b5132 | 952 | #endif |
60bb06bc L |
953 | #ifndef MY_get_symbol_version_string |
954 | #define MY_get_symbol_version_string \ | |
955 | _bfd_nosymbols_get_symbol_version_string | |
956 | #endif | |
252b5132 | 957 | #ifndef MY_get_lineno |
7920ce38 | 958 | #define MY_get_lineno NAME (aout, get_lineno) |
252b5132 RH |
959 | #endif |
960 | #ifndef MY_set_arch_mach | |
961 | #define MY_set_arch_mach tic30_aout_set_arch_mach | |
962 | #endif | |
963 | #ifndef MY_find_nearest_line | |
7920ce38 | 964 | #define MY_find_nearest_line NAME (aout, find_nearest_line) |
252b5132 | 965 | #endif |
9c461f7d AM |
966 | #ifndef MY_find_line |
967 | #define MY_find_line _bfd_nosymbols_find_line | |
968 | #endif | |
4ab527b0 FF |
969 | #ifndef MY_find_inliner_info |
970 | #define MY_find_inliner_info _bfd_nosymbols_find_inliner_info | |
971 | #endif | |
252b5132 | 972 | #ifndef MY_sizeof_headers |
7920ce38 | 973 | #define MY_sizeof_headers NAME (aout, sizeof_headers) |
252b5132 RH |
974 | #endif |
975 | #ifndef MY_bfd_get_relocated_section_contents | |
976 | #define MY_bfd_get_relocated_section_contents \ | |
977 | bfd_generic_get_relocated_section_contents | |
978 | #endif | |
979 | #ifndef MY_bfd_relax_section | |
980 | #define MY_bfd_relax_section bfd_generic_relax_section | |
981 | #endif | |
982 | #ifndef MY_bfd_gc_sections | |
983 | #define MY_bfd_gc_sections bfd_generic_gc_sections | |
984 | #endif | |
ae17ab41 CM |
985 | #ifndef MY_bfd_lookup_section_flags |
986 | #define MY_bfd_lookup_section_flags bfd_generic_lookup_section_flags | |
987 | #endif | |
8550eb6e JJ |
988 | #ifndef MY_bfd_merge_sections |
989 | #define MY_bfd_merge_sections bfd_generic_merge_sections | |
990 | #endif | |
72adc230 AM |
991 | #ifndef MY_bfd_is_group_section |
992 | #define MY_bfd_is_group_section bfd_generic_is_group_section | |
993 | #endif | |
cb7f4b29 AM |
994 | #ifndef MY_bfd_group_name |
995 | #define MY_bfd_group_name bfd_generic_group_name | |
996 | #endif | |
e61463e1 AM |
997 | #ifndef MY_bfd_discard_group |
998 | #define MY_bfd_discard_group bfd_generic_discard_group | |
999 | #endif | |
082b7297 L |
1000 | #ifndef MY_section_already_linked |
1001 | #define MY_section_already_linked \ | |
1002 | _bfd_generic_section_already_linked | |
1003 | #endif | |
3023e3f6 RS |
1004 | #ifndef MY_bfd_define_common_symbol |
1005 | #define MY_bfd_define_common_symbol bfd_generic_define_common_symbol | |
1006 | #endif | |
34a87bb0 L |
1007 | #ifndef MY_bfd_link_hide_symbol |
1008 | #define MY_bfd_link_hide_symbol _bfd_generic_link_hide_symbol | |
1009 | #endif | |
7dba9362 AM |
1010 | #ifndef MY_bfd_define_start_stop |
1011 | #define MY_bfd_define_start_stop bfd_generic_define_start_stop | |
1012 | #endif | |
252b5132 RH |
1013 | #ifndef MY_bfd_reloc_type_lookup |
1014 | #define MY_bfd_reloc_type_lookup tic30_aout_reloc_type_lookup | |
1015 | #endif | |
157090f7 AM |
1016 | #ifndef MY_bfd_reloc_name_lookup |
1017 | #define MY_bfd_reloc_name_lookup tic30_aout_reloc_name_lookup | |
1018 | #endif | |
252b5132 RH |
1019 | #ifndef MY_bfd_make_debug_symbol |
1020 | #define MY_bfd_make_debug_symbol 0 | |
1021 | #endif | |
1022 | #ifndef MY_read_minisymbols | |
7920ce38 | 1023 | #define MY_read_minisymbols NAME (aout, read_minisymbols) |
252b5132 RH |
1024 | #endif |
1025 | #ifndef MY_minisymbol_to_symbol | |
7920ce38 | 1026 | #define MY_minisymbol_to_symbol NAME (aout, minisymbol_to_symbol) |
252b5132 RH |
1027 | #endif |
1028 | #ifndef MY_bfd_link_hash_table_create | |
7920ce38 | 1029 | #define MY_bfd_link_hash_table_create NAME (aout, link_hash_table_create) |
252b5132 RH |
1030 | #endif |
1031 | #ifndef MY_bfd_link_add_symbols | |
7920ce38 | 1032 | #define MY_bfd_link_add_symbols NAME (aout, link_add_symbols) |
252b5132 | 1033 | #endif |
2d653fc7 AM |
1034 | #ifndef MY_bfd_link_just_syms |
1035 | #define MY_bfd_link_just_syms _bfd_generic_link_just_syms | |
1036 | #endif | |
1338dd10 PB |
1037 | #ifndef MY_bfd_copy_link_hash_symbol_type |
1038 | #define MY_bfd_copy_link_hash_symbol_type \ | |
1039 | _bfd_generic_copy_link_hash_symbol_type | |
1040 | #endif | |
252b5132 RH |
1041 | #ifndef MY_bfd_link_split_section |
1042 | #define MY_bfd_link_split_section _bfd_generic_link_split_section | |
1043 | #endif | |
1044 | ||
4f3b23b3 NC |
1045 | #ifndef MY_bfd_link_check_relocs |
1046 | #define MY_bfd_link_check_relocs _bfd_generic_link_check_relocs | |
1047 | #endif | |
1048 | ||
252b5132 RH |
1049 | #ifndef MY_bfd_copy_private_bfd_data |
1050 | #define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data | |
1051 | #endif | |
1052 | ||
1053 | #ifndef MY_bfd_merge_private_bfd_data | |
1054 | #define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data | |
1055 | #endif | |
1056 | ||
1057 | #ifndef MY_bfd_copy_private_symbol_data | |
1058 | #define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data | |
1059 | #endif | |
1060 | ||
80fccad2 BW |
1061 | #ifndef MY_bfd_copy_private_header_data |
1062 | #define MY_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data | |
1063 | #endif | |
1064 | ||
252b5132 RH |
1065 | #ifndef MY_bfd_print_private_bfd_data |
1066 | #define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data | |
1067 | #endif | |
1068 | ||
1069 | #ifndef MY_bfd_set_private_flags | |
1070 | #define MY_bfd_set_private_flags _bfd_generic_bfd_set_private_flags | |
1071 | #endif | |
1072 | ||
1073 | #ifndef MY_bfd_is_local_label_name | |
1074 | #define MY_bfd_is_local_label_name bfd_generic_is_local_label_name | |
1075 | #endif | |
1076 | ||
3c9458e9 | 1077 | #ifndef MY_bfd_is_target_special_symbol |
d00dd7dc | 1078 | #define MY_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false |
3c9458e9 NC |
1079 | #endif |
1080 | ||
252b5132 | 1081 | #ifndef MY_bfd_free_cached_info |
7920ce38 | 1082 | #define MY_bfd_free_cached_info NAME (aout, bfd_free_cached_info) |
252b5132 RH |
1083 | #endif |
1084 | ||
1085 | #ifndef MY_close_and_cleanup | |
1086 | #define MY_close_and_cleanup MY_bfd_free_cached_info | |
1087 | #endif | |
1088 | ||
1089 | #ifndef MY_get_dynamic_symtab_upper_bound | |
1090 | #define MY_get_dynamic_symtab_upper_bound \ | |
1091 | _bfd_nodynamic_get_dynamic_symtab_upper_bound | |
1092 | #endif | |
1093 | #ifndef MY_canonicalize_dynamic_symtab | |
1094 | #define MY_canonicalize_dynamic_symtab \ | |
1095 | _bfd_nodynamic_canonicalize_dynamic_symtab | |
1096 | #endif | |
4c45e5c9 JJ |
1097 | #ifndef MY_get_synthetic_symtab |
1098 | #define MY_get_synthetic_symtab \ | |
1099 | _bfd_nodynamic_get_synthetic_symtab | |
1100 | #endif | |
252b5132 RH |
1101 | #ifndef MY_get_dynamic_reloc_upper_bound |
1102 | #define MY_get_dynamic_reloc_upper_bound \ | |
1103 | _bfd_nodynamic_get_dynamic_reloc_upper_bound | |
1104 | #endif | |
1105 | #ifndef MY_canonicalize_dynamic_reloc | |
1106 | #define MY_canonicalize_dynamic_reloc \ | |
1107 | _bfd_nodynamic_canonicalize_dynamic_reloc | |
1108 | #endif | |
1109 | ||
7920ce38 | 1110 | /* Aout symbols normally have leading underscores. */ |
252b5132 RH |
1111 | #ifndef MY_symbol_leading_char |
1112 | #define MY_symbol_leading_char '_' | |
1113 | #endif | |
1114 | ||
7920ce38 | 1115 | /* Aout archives normally use spaces for padding. */ |
252b5132 RH |
1116 | #ifndef AR_PAD_CHAR |
1117 | #define AR_PAD_CHAR ' ' | |
1118 | #endif | |
1119 | ||
1120 | #ifndef MY_BFD_TARGET | |
1121 | const bfd_target tic30_aout_vec = | |
1122 | { | |
7920ce38 | 1123 | TARGETNAME, /* Name. */ |
252b5132 | 1124 | bfd_target_aout_flavour, |
7920ce38 NC |
1125 | BFD_ENDIAN_BIG, /* Target byte order (big). */ |
1126 | BFD_ENDIAN_BIG, /* Target headers byte order (big). */ | |
1127 | (HAS_RELOC | /* Object flags. */ | |
252b5132 | 1128 | HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED), |
7920ce38 | 1129 | (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC), /* Section flags. */ |
252b5132 | 1130 | MY_symbol_leading_char, |
7920ce38 NC |
1131 | AR_PAD_CHAR, /* AR_pad_char. */ |
1132 | 15, /* AR_max_namelen. */ | |
0aabe54e | 1133 | 0, /* match priority. */ |
252b5132 RH |
1134 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, |
1135 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, | |
7920ce38 | 1136 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */ |
252b5132 RH |
1137 | bfd_getb64, bfd_getb_signed_64, bfd_putb64, |
1138 | bfd_getb32, bfd_getb_signed_32, bfd_putb32, | |
7920ce38 | 1139 | bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */ |
d00dd7dc AM |
1140 | { /* bfd_check_format. */ |
1141 | _bfd_dummy_target, | |
1142 | MY_object_p, | |
1143 | bfd_generic_archive_p, | |
1144 | MY_core_file_p | |
1145 | }, | |
1146 | { /* bfd_set_format. */ | |
1147 | _bfd_bool_bfd_false_error, | |
1148 | MY_mkobject, | |
1149 | _bfd_generic_mkarchive, | |
1150 | _bfd_bool_bfd_false_error | |
1151 | }, | |
1152 | { /* bfd_write_contents. */ | |
1153 | _bfd_bool_bfd_false_error, | |
1154 | MY_write_object_contents, | |
1155 | _bfd_write_archive_contents, | |
1156 | _bfd_bool_bfd_false_error | |
1157 | }, | |
252b5132 RH |
1158 | |
1159 | BFD_JUMP_TABLE_GENERIC (MY), | |
1160 | BFD_JUMP_TABLE_COPY (MY), | |
1161 | BFD_JUMP_TABLE_CORE (MY), | |
1162 | BFD_JUMP_TABLE_ARCHIVE (MY), | |
1163 | BFD_JUMP_TABLE_SYMBOLS (MY), | |
1164 | BFD_JUMP_TABLE_RELOCS (MY), | |
1165 | BFD_JUMP_TABLE_WRITE (MY), | |
1166 | BFD_JUMP_TABLE_LINK (MY), | |
1167 | BFD_JUMP_TABLE_DYNAMIC (MY), | |
1168 | ||
c3c89269 | 1169 | NULL, |
c4dfa77f | 1170 | |
7920ce38 | 1171 | MY_backend_data |
252b5132 RH |
1172 | }; |
1173 | #endif /* MY_BFD_TARGET */ |