Commit | Line | Data |
---|---|---|
8696b2db | 1 | /* evax-alpha.c -- BFD back-end for ALPHA EVAX (openVMS/Alpha) files. |
b35711c4 | 2 | Copyright 1996, 1997, 1998 Free Software Foundation, Inc. |
8696b2db | 3 | Written by Klaus K"ampf (kkaempf@progis.de) |
c3d8e071 ILT |
4 | of proGIS Softwareentwicklung, Aachen, Germany |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2 of the License, or | |
9 | (at your option) any later version. | |
10 | ||
11 | This program is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with this program; if not, write to the Free Software | |
18 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
19 | ||
20 | ||
21 | #include <stdio.h> | |
22 | ||
23 | #include "bfd.h" | |
24 | #include "sysdep.h" | |
25 | #include "bfdlink.h" | |
26 | #include "libbfd.h" | |
27 | ||
28 | #include "evax.h" | |
29 | ||
30 | static boolean evax_initialize PARAMS ((bfd *)); | |
31 | static boolean fill_section_ptr PARAMS ((struct bfd_hash_entry *, PTR)); | |
32 | static boolean evax_fixup_sections PARAMS ((bfd *)); | |
33 | static boolean copy_symbols PARAMS ((struct bfd_hash_entry *, PTR)); | |
34 | static bfd_reloc_status_type reloc_nil | |
35 | PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); | |
36 | static const struct bfd_target *evax_object_p PARAMS ((bfd *abfd)); | |
37 | static const struct bfd_target *evax_archive_p PARAMS ((bfd *abfd)); | |
38 | static boolean evax_mkobject PARAMS ((bfd *abfd)); | |
39 | static boolean evax_write_object_contents PARAMS ((bfd *abfd)); | |
40 | static boolean evax_close_and_cleanup PARAMS ((bfd *abfd)); | |
41 | static boolean evax_bfd_free_cached_info PARAMS ((bfd *abfd)); | |
42 | static boolean evax_new_section_hook PARAMS ((bfd *abfd, asection *section)); | |
43 | static boolean evax_get_section_contents | |
44 | PARAMS ((bfd *abfd, asection *section, PTR x1, file_ptr x2, | |
45 | bfd_size_type x3)); | |
46 | static boolean evax_get_section_contents_in_window | |
47 | PARAMS ((bfd *abfd, asection *section, bfd_window *w, file_ptr offset, | |
48 | bfd_size_type count)); | |
49 | static boolean evax_bfd_copy_private_bfd_data PARAMS ((bfd *src, bfd *dest)); | |
50 | static boolean evax_bfd_copy_private_section_data | |
51 | PARAMS ((bfd *srcbfd, asection *srcsec, bfd *dstbfd, asection *dstsec)); | |
52 | static boolean evax_bfd_copy_private_symbol_data | |
53 | PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym)); | |
54 | static boolean evax_bfd_print_private_bfd_data | |
55 | PARAMS ((bfd *abfd, void *file)); | |
56 | static char *evax_core_file_failing_command PARAMS ((bfd *abfd)); | |
57 | static int evax_core_file_failing_signal PARAMS ((bfd *abfd)); | |
58 | static boolean evax_core_file_matches_executable_p | |
59 | PARAMS ((bfd *abfd, bfd *bbfd)); | |
60 | static boolean evax_slurp_armap PARAMS ((bfd *abfd)); | |
61 | static boolean evax_slurp_extended_name_table PARAMS ((bfd *abfd)); | |
62 | static boolean evax_construct_extended_name_table | |
63 | PARAMS ((bfd *abfd, char **tabloc, bfd_size_type *tablen, | |
64 | const char **name)); | |
65 | static void evax_truncate_arname | |
66 | PARAMS ((bfd *abfd, CONST char *pathname, char *arhdr)); | |
67 | static boolean evax_write_armap | |
68 | PARAMS ((bfd *arch, unsigned int elength, struct orl *map, | |
69 | unsigned int orl_count, int stridx)); | |
70 | static PTR evax_read_ar_hdr PARAMS ((bfd *abfd)); | |
71 | static bfd *evax_get_elt_at_index PARAMS ((bfd *abfd, symindex index)); | |
72 | static bfd *evax_openr_next_archived_file PARAMS ((bfd *arch, bfd *prev)); | |
73 | static boolean evax_update_armap_timestamp PARAMS ((bfd *abfd)); | |
74 | static int evax_generic_stat_arch_elt PARAMS ((bfd *abfd, struct stat *stat)); | |
75 | static long evax_get_symtab_upper_bound PARAMS ((bfd *abfd)); | |
76 | static long evax_get_symtab PARAMS ((bfd *abfd, asymbol **symbols)); | |
77 | static void evax_print_symbol | |
78 | PARAMS ((bfd *abfd, PTR file, asymbol *symbol, bfd_print_symbol_type how)); | |
79 | static void evax_get_symbol_info | |
80 | PARAMS ((bfd *abfd, asymbol *symbol, symbol_info *ret)); | |
35a3e78e | 81 | static boolean evax_bfd_is_local_label_name PARAMS ((bfd *abfd, const char *)); |
c3d8e071 ILT |
82 | static alent *evax_get_lineno PARAMS ((bfd *abfd, asymbol *symbol)); |
83 | static boolean evax_find_nearest_line | |
84 | PARAMS ((bfd *abfd, asection *section, asymbol **symbols, bfd_vma offset, | |
85 | const char **file, const char **func, unsigned int *line)); | |
86 | static asymbol *evax_bfd_make_debug_symbol | |
87 | PARAMS ((bfd *abfd, void *ptr, unsigned long size)); | |
88 | static long evax_read_minisymbols | |
89 | PARAMS ((bfd *abfd, boolean dynamic, PTR *minisymsp, unsigned int *sizep)); | |
90 | static asymbol *evax_minisymbol_to_symbol | |
91 | PARAMS ((bfd *abfd, boolean dynamic, const PTR minisym, asymbol *sym)); | |
92 | static long evax_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect)); | |
93 | static long evax_canonicalize_reloc | |
94 | PARAMS ((bfd *abfd, asection *srcsec, arelent **location, | |
95 | asymbol **symbols)); | |
96 | static const struct reloc_howto_struct *evax_bfd_reloc_type_lookup | |
97 | PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); | |
98 | static boolean evax_set_arch_mach | |
99 | PARAMS ((bfd *abfd, enum bfd_architecture arch, unsigned long mach)); | |
100 | static boolean evax_set_section_contents | |
101 | PARAMS ((bfd *abfd, asection *section, PTR location, file_ptr offset, | |
102 | bfd_size_type count)); | |
103 | static int evax_sizeof_headers PARAMS ((bfd *abfd, boolean reloc)); | |
104 | static bfd_byte *evax_bfd_get_relocated_section_contents | |
105 | PARAMS ((bfd *abfd, struct bfd_link_info *link_info, | |
106 | struct bfd_link_order *link_order, bfd_byte *data, | |
107 | boolean relocateable, asymbol **symbols)); | |
108 | static boolean evax_bfd_relax_section | |
109 | PARAMS ((bfd *abfd, asection *section, struct bfd_link_info *link_info, | |
110 | boolean *again)); | |
111 | static struct bfd_link_hash_table *evax_bfd_link_hash_table_create | |
112 | PARAMS ((bfd *abfd)); | |
113 | static boolean evax_bfd_link_add_symbols | |
114 | PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); | |
115 | static boolean evax_bfd_final_link | |
116 | PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); | |
117 | static boolean evax_bfd_link_split_section | |
118 | PARAMS ((bfd *abfd, asection *section)); | |
119 | static long evax_get_dynamic_symtab_upper_bound PARAMS ((bfd *abfd)); | |
120 | static long evax_canonicalize_dynamic_symtab | |
121 | PARAMS ((bfd *abfd, asymbol **symbols)); | |
122 | static long evax_get_dynamic_reloc_upper_bound PARAMS ((bfd *abfd)); | |
123 | static long evax_canonicalize_dynamic_reloc | |
124 | PARAMS ((bfd *abfd, arelent **arel, asymbol **symbols)); | |
125 | static boolean evax_bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd)); | |
126 | static boolean evax_bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags)); | |
127 | ||
128 | #define evax_make_empty_symbol _bfd_evax_make_empty_symbol | |
129 | \f | |
130 | /*===========================================================================*/ | |
131 | ||
132 | const bfd_target evax_alpha_vec = | |
133 | { | |
134 | ||
135 | "evax-alpha", /* name */ | |
136 | bfd_target_evax_flavour, | |
137 | false, /* data byte order is little */ | |
138 | false, /* header byte order is little */ | |
139 | ||
8612a388 ILT |
140 | (HAS_RELOC | HAS_SYMS |
141 | | WP_TEXT | D_PAGED), /* object flags */ | |
142 | (SEC_ALLOC | SEC_LOAD | SEC_RELOC | |
143 | | SEC_READONLY | SEC_CODE | SEC_DATA | |
144 | | SEC_HAS_CONTENTS | SEC_IN_MEMORY), /* sect flags */ | |
c3d8e071 ILT |
145 | 0, /* symbol_leading_char */ |
146 | ' ', /* ar_pad_char */ | |
147 | 15, /* ar_max_namelen */ | |
8612a388 ILT |
148 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, |
149 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
150 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, | |
151 | bfd_getl64, bfd_getl_signed_64, bfd_putl64, | |
152 | bfd_getl32, bfd_getl_signed_32, bfd_putl32, | |
153 | bfd_getl16, bfd_getl_signed_16, bfd_putl16, | |
c3d8e071 ILT |
154 | |
155 | {_bfd_dummy_target, evax_object_p, /* bfd_check_format */ | |
156 | evax_archive_p, _bfd_dummy_target}, | |
157 | {bfd_false, evax_mkobject, /* bfd_set_format */ | |
158 | _bfd_generic_mkarchive, bfd_false}, | |
159 | {bfd_false, evax_write_object_contents, /* bfd_write_contents */ | |
160 | _bfd_write_archive_contents, bfd_false}, | |
161 | ||
162 | BFD_JUMP_TABLE_GENERIC (evax), | |
163 | BFD_JUMP_TABLE_COPY (evax), | |
164 | BFD_JUMP_TABLE_CORE (evax), | |
165 | BFD_JUMP_TABLE_ARCHIVE (evax), | |
166 | BFD_JUMP_TABLE_SYMBOLS (evax), | |
167 | BFD_JUMP_TABLE_RELOCS (evax), | |
168 | BFD_JUMP_TABLE_WRITE (evax), | |
169 | BFD_JUMP_TABLE_LINK (evax), | |
170 | BFD_JUMP_TABLE_DYNAMIC (evax), | |
171 | ||
172 | (PTR) 0 | |
173 | }; | |
174 | ||
175 | \f | |
176 | /*===========================================================================*/ | |
177 | ||
178 | /* Initialize private data */ | |
179 | ||
180 | static boolean | |
181 | evax_initialize (abfd) | |
182 | bfd *abfd; | |
183 | { | |
184 | int i; | |
185 | ||
186 | if (abfd->tdata.any != 0) | |
187 | return true; | |
188 | ||
189 | bfd_set_start_address (abfd, (bfd_vma)-1); | |
190 | ||
191 | abfd->tdata.any = ((struct evax_private_data_struct*) | |
192 | bfd_malloc (sizeof (struct evax_private_data_struct))); | |
193 | if (abfd->tdata.any == 0) | |
194 | return false; | |
195 | PRIV(evax_buf) = 0; | |
196 | PRIV(buf_size) = 0; | |
197 | PRIV(rec_length) = 0; | |
198 | PRIV(file_format) = FF_UNKNOWN; | |
c3d8e071 ILT |
199 | PRIV(fixup_done) = false; |
200 | PRIV(sections) = NULL; | |
201 | ||
202 | PRIV(stack) = ((struct stack_struct *) | |
203 | bfd_malloc (sizeof (struct stack_struct) * STACKSIZE)); | |
204 | if (PRIV(stack) == 0) | |
205 | { | |
206 | evax_init_no_mem1: | |
207 | free (abfd->tdata.any); | |
208 | abfd->tdata.any = 0; | |
209 | return false; | |
210 | } | |
211 | PRIV(stackptr) = 0; | |
212 | ||
213 | PRIV(evax_symbol_table) = ((struct bfd_hash_table *) | |
214 | bfd_malloc (sizeof (struct bfd_hash_table))); | |
215 | if (PRIV(evax_symbol_table) == 0) | |
216 | { | |
217 | evax_init_no_mem2: | |
218 | free (PRIV(stack)); | |
219 | PRIV(stack) = 0; | |
220 | goto evax_init_no_mem1; | |
221 | } | |
222 | ||
223 | if (!bfd_hash_table_init (PRIV(evax_symbol_table), _bfd_evax_hash_newfunc)) | |
224 | return false; | |
225 | ||
226 | PRIV(location_stack) = ((struct location_struct *) | |
227 | bfd_malloc (sizeof (struct location_struct) | |
228 | * LOCATION_SAVE_SIZE)); | |
229 | if (PRIV(location_stack) == 0) | |
230 | { | |
231 | evax_init_no_mem3: | |
232 | free (PRIV(evax_symbol_table)); | |
233 | PRIV(evax_symbol_table) = 0; | |
234 | goto evax_init_no_mem2; | |
235 | } | |
236 | ||
8612a388 ILT |
237 | for (i = 0; i < EVAX_SECTION_COUNT; i++) |
238 | PRIV(evax_section_table)[i] = NULL; | |
c3d8e071 ILT |
239 | |
240 | PRIV(output_buf) = (unsigned char *) malloc (MAX_OUTREC_SIZE); | |
241 | if (PRIV(output_buf) == 0) | |
242 | { | |
243 | free (PRIV(location_stack)); | |
244 | PRIV(location_stack) = 0; | |
245 | goto evax_init_no_mem3; | |
246 | } | |
247 | PRIV(push_level) = 0; | |
248 | PRIV(pushed_size) = 0; | |
249 | PRIV(length_pos) = 2; | |
250 | PRIV(output_size) = 0; | |
251 | PRIV(output_alignment) = 1; | |
252 | ||
253 | return true; | |
254 | } | |
255 | ||
256 | ||
257 | /* Fill symbol->section with section ptr | |
258 | symbol->section is filled with the section index for defined symbols | |
259 | during reading the EGSD section. But we need the pointer to the | |
260 | bfd section later. | |
261 | ||
262 | It has the correct value for referenced (undefined section) symbols | |
263 | ||
264 | called from bfd_hash_traverse in evax_fixup_sections */ | |
265 | ||
266 | static boolean | |
267 | fill_section_ptr (entry, sections) | |
268 | struct bfd_hash_entry *entry; | |
269 | PTR sections; | |
270 | { | |
271 | asection *sec; | |
272 | asymbol *sym; | |
273 | ||
274 | sym = ((evax_symbol_entry *)entry)->symbol; | |
275 | sec = sym->section; | |
276 | ||
277 | if (!bfd_is_und_section (sec)) | |
278 | { | |
279 | sec = ((evax_symbol_entry *)entry)->symbol->section = | |
280 | ((asection **)sections)[(int)sec]; | |
281 | } | |
282 | ||
283 | if (strcmp (sym->name, sec->name) == 0) | |
284 | sym->flags |= BSF_SECTION_SYM; | |
285 | ||
286 | return true; | |
287 | } | |
288 | ||
289 | ||
290 | /* Fixup sections | |
291 | set up all pointers and arrays, counters and sizes are fixed now | |
292 | ||
293 | we build a private sections vector for easy access since sections | |
294 | are always referenced by an index number. | |
295 | ||
296 | alloc PRIV(sections) according to abfd->section_count | |
297 | copy abfd->sections to PRIV(sections) */ | |
298 | ||
299 | static boolean | |
300 | evax_fixup_sections (abfd) | |
301 | bfd *abfd; | |
302 | { | |
303 | asection *s; | |
304 | ||
305 | if (PRIV(fixup_done)) | |
306 | return true; | |
307 | ||
308 | PRIV(sections) = ((asection **) | |
309 | bfd_malloc (abfd->section_count * sizeof (asection *))); | |
310 | if (PRIV(sections) == 0) | |
311 | return false; | |
312 | PRIV(egsd_sec_count) = abfd->section_count; | |
313 | s = abfd->sections; | |
314 | while (s) | |
315 | { | |
316 | PRIV(sections)[s->index] = s; | |
317 | s = s->next; | |
318 | } | |
319 | ||
320 | /* | |
321 | * traverse symbol table and fill in all section pointers | |
322 | */ | |
323 | ||
324 | bfd_hash_traverse (PRIV(evax_symbol_table), fill_section_ptr, | |
325 | (PTR)(PRIV(sections))); | |
326 | ||
327 | PRIV(fixup_done) = true; | |
328 | ||
329 | return true; | |
330 | } | |
331 | ||
332 | /*===========================================================================*/ | |
333 | ||
334 | /* Check the format for a file being read. | |
335 | Return a (bfd_target *) if it's an object file or zero if not. */ | |
336 | ||
337 | static const struct bfd_target * | |
338 | evax_object_p (abfd) | |
339 | bfd *abfd; | |
340 | { | |
341 | int err = 0; | |
342 | int prev_type; | |
343 | #if EVAX_DEBUG | |
344 | evax_debug (1, "evax_object_p(%p)\n", abfd); | |
345 | #endif | |
346 | if (bfd_seek (abfd, 0L, SEEK_SET)) | |
347 | { | |
348 | bfd_set_error (bfd_error_file_truncated); | |
349 | return 0; | |
350 | } | |
351 | ||
352 | prev_type = -1; | |
353 | ||
354 | do | |
355 | { | |
356 | #if EVAX_DEBUG | |
357 | evax_debug (3, "reading at %08lx\n", bfd_tell(abfd)); | |
358 | #endif | |
359 | if (_bfd_evax_next_record (abfd) < 0) | |
360 | { | |
361 | #if EVAX_DEBUG | |
362 | evax_debug (2, "next_record failed\n"); | |
363 | #endif | |
364 | bfd_set_error (bfd_error_wrong_format); | |
365 | return 0; | |
366 | } | |
367 | ||
368 | if ((prev_type == EOBJ_S_C_EGSD) && (PRIV(rec_type) != EOBJ_S_C_EGSD)) | |
369 | { | |
370 | if (evax_fixup_sections (abfd) == false) | |
371 | { | |
372 | #if EVAX_DEBUG | |
373 | evax_debug (2, "evax_fixup_sections failed\n"); | |
374 | #endif | |
375 | bfd_set_error (bfd_error_wrong_format); | |
376 | return 0; | |
377 | } | |
378 | } | |
379 | ||
380 | prev_type = PRIV(rec_type); | |
381 | ||
382 | switch (PRIV(rec_type)) | |
383 | { | |
384 | case EOBJ_S_C_EMH: | |
385 | err = _bfd_evax_slurp_emh (abfd); | |
386 | break; | |
387 | case EOBJ_S_C_EEOM: | |
388 | err = _bfd_evax_slurp_eeom (abfd); | |
389 | break; | |
390 | case EOBJ_S_C_EGSD: | |
391 | err = _bfd_evax_slurp_egsd (abfd); | |
392 | break; | |
393 | case EOBJ_S_C_ETIR: | |
394 | err = _bfd_evax_slurp_etir (abfd); | |
395 | break; | |
396 | case EOBJ_S_C_EDBG: | |
397 | err = _bfd_evax_slurp_edbg (abfd); | |
398 | break; | |
399 | case EOBJ_S_C_ETBT: | |
400 | err = _bfd_evax_slurp_etbt (abfd); | |
401 | break; | |
402 | default: | |
403 | err = -1; | |
404 | } | |
405 | if (err != 0) | |
406 | { | |
407 | #if EVAX_DEBUG | |
408 | evax_debug (2, "slurp type %d failed with %d\n", PRIV(rec_type), err); | |
409 | #endif | |
410 | bfd_set_error (bfd_error_wrong_format); | |
411 | return 0; | |
412 | } | |
413 | } | |
414 | while (prev_type != EOBJ_S_C_EEOM); | |
415 | ||
416 | /* set arch_info to alpha */ | |
417 | ||
418 | { | |
419 | const bfd_arch_info_type *arch = bfd_scan_arch ("alpha"); | |
420 | if (arch == 0) | |
421 | { | |
422 | #if EVAX_DEBUG | |
423 | evax_debug (2, "arch not found\n"); | |
424 | #endif | |
425 | bfd_set_error (bfd_error_wrong_format); | |
426 | return 0; | |
427 | } | |
428 | abfd->arch_info = arch; | |
429 | } | |
430 | ||
431 | return &evax_alpha_vec; | |
432 | } | |
433 | ||
434 | ||
435 | /* Check the format for a file being read. | |
436 | Return a (bfd_target *) if it's an archive file or zero. */ | |
437 | ||
438 | static const struct bfd_target * | |
439 | evax_archive_p (abfd) | |
440 | bfd *abfd; | |
441 | { | |
442 | #if EVAX_DEBUG | |
443 | evax_debug (1, "evax_archive_p(%p)\n", abfd); | |
444 | #endif | |
445 | ||
446 | if (!evax_initialize (abfd)) | |
447 | return 0; | |
448 | ||
449 | return 0; | |
450 | } | |
451 | ||
452 | ||
453 | /* Set the format of a file being written. */ | |
454 | ||
455 | static boolean | |
456 | evax_mkobject (abfd) | |
457 | bfd *abfd; | |
458 | { | |
459 | #if EVAX_DEBUG | |
460 | evax_debug (1, "evax_mkobject(%p)\n", abfd); | |
461 | #endif | |
462 | ||
463 | if (!evax_initialize (abfd)) | |
464 | return 0; | |
465 | ||
466 | { | |
467 | const bfd_arch_info_type *arch = bfd_scan_arch ("alpha"); | |
468 | if (arch == 0) | |
469 | { | |
470 | bfd_set_error(bfd_error_wrong_format); | |
471 | return 0; | |
472 | } | |
473 | abfd->arch_info = arch; | |
474 | } | |
475 | ||
476 | return true; | |
477 | } | |
478 | ||
479 | ||
480 | /* Write cached information into a file being written, at bfd_close. */ | |
481 | ||
482 | static boolean | |
483 | evax_write_object_contents (abfd) | |
484 | bfd *abfd; | |
485 | { | |
486 | #if EVAX_DEBUG | |
487 | evax_debug (1, "evax_write_object_contents(%p)\n", abfd); | |
488 | #endif | |
489 | ||
490 | if (abfd->section_count > 0) /* we have sections */ | |
491 | { | |
492 | if (_bfd_evax_write_emh (abfd) != 0) | |
493 | return false; | |
494 | if (_bfd_evax_write_egsd (abfd) != 0) | |
495 | return false; | |
496 | if (_bfd_evax_write_etir (abfd) != 0) | |
497 | return false; | |
498 | if (_bfd_evax_write_etbt (abfd) != 0) | |
499 | return false; | |
500 | if (_bfd_evax_write_eeom (abfd) != 0) | |
501 | return false; | |
502 | } | |
503 | return true; | |
504 | } | |
505 | ||
506 | /*-- 4.1, generic -----------------------------------------------------------*/ | |
507 | ||
508 | /* Called when the BFD is being closed to do any necessary cleanup. */ | |
509 | ||
510 | static boolean | |
511 | evax_close_and_cleanup (abfd) | |
512 | bfd *abfd; | |
513 | { | |
514 | asection *sec; | |
515 | evax_section *es, *es1; | |
c3d8e071 ILT |
516 | int i; |
517 | ||
518 | #if EVAX_DEBUG | |
519 | evax_debug (1, "evax_close_and_cleanup(%p)\n", abfd); | |
520 | #endif | |
521 | if (abfd == 0) | |
522 | return true; | |
523 | ||
524 | if (PRIV(evax_buf) != NULL) | |
525 | { | |
526 | free (PRIV(evax_buf)); | |
527 | PRIV(evax_buf) = NULL; | |
528 | } | |
529 | PRIV(buf_size) = 0; | |
530 | ||
c3d8e071 ILT |
531 | if (PRIV(output_buf) != 0) |
532 | { | |
533 | free (PRIV(output_buf)); | |
534 | PRIV(output_buf) = 0; | |
535 | } | |
536 | ||
537 | sec = abfd->sections; | |
538 | while (sec != NULL) | |
539 | { | |
540 | if (sec->contents) | |
541 | free (sec->contents); | |
542 | sec = sec->next; | |
543 | } | |
544 | ||
545 | if (PRIV(sections) != NULL) | |
546 | { | |
547 | free (PRIV(sections)); | |
548 | PRIV(sections) = NULL; | |
549 | } | |
550 | ||
551 | if (PRIV(evax_symbol_table)) | |
552 | { | |
553 | bfd_hash_table_free (PRIV(evax_symbol_table)); | |
554 | PRIV(evax_symbol_table) = 0; | |
555 | } | |
556 | ||
557 | if (PRIV(stack)) | |
558 | { | |
559 | free (PRIV(stack)); | |
560 | PRIV(stack) = 0; | |
561 | } | |
562 | ||
563 | if (PRIV(location_stack)) | |
564 | { | |
565 | free (PRIV(location_stack)); | |
566 | PRIV(location_stack) = 0; | |
567 | } | |
568 | ||
569 | for (i = 0; i < EVAX_SECTION_COUNT; i++) | |
570 | { | |
571 | es = PRIV(evax_section_table)[i]; | |
572 | while (es != NULL) | |
573 | { | |
574 | es1 = es->next; | |
575 | free (es); | |
576 | es = es1; | |
577 | } | |
578 | PRIV(evax_section_table)[i] = NULL; | |
c3d8e071 ILT |
579 | } |
580 | ||
581 | free (abfd->tdata.any); | |
582 | abfd->tdata.any = NULL; | |
583 | ||
584 | return true; | |
585 | } | |
586 | ||
587 | ||
588 | /* Ask the BFD to free all cached information. */ | |
589 | static boolean | |
590 | evax_bfd_free_cached_info (abfd) | |
591 | bfd *abfd; | |
592 | { | |
593 | #if EVAX_DEBUG | |
594 | evax_debug (1, "evax_bfd_free_cached_info(%p)\n", abfd); | |
595 | #endif | |
596 | return true; | |
597 | } | |
598 | ||
599 | ||
600 | /* Called when a new section is created. */ | |
601 | ||
602 | static boolean | |
603 | evax_new_section_hook (abfd, section) | |
604 | bfd *abfd; | |
605 | asection *section; | |
606 | { | |
607 | #if EVAX_DEBUG | |
608 | evax_debug (1, "evax_new_section_hook(%p, %s)\n", abfd, section->name); | |
609 | #endif | |
610 | bfd_set_section_alignment(abfd, section, 4); | |
611 | return true; | |
612 | } | |
613 | ||
614 | ||
615 | /* Read the contents of a section. | |
616 | buf points to a buffer of buf_size bytes to be filled with | |
617 | section data (starting at offset into section) */ | |
618 | ||
619 | static boolean | |
620 | evax_get_section_contents (abfd, section, buf, offset, buf_size) | |
621 | bfd *abfd; | |
622 | asection *section; | |
623 | PTR buf; | |
624 | file_ptr offset; | |
625 | bfd_size_type buf_size; | |
626 | { | |
627 | #if EVAX_DEBUG | |
628 | evax_debug (1, "evax_get_section_contents(%p, %s, %p, off %ld, size %d)\n", | |
629 | abfd, section->name, buf, offset, (int)buf_size); | |
630 | #endif | |
631 | ||
632 | /* shouldn't be called, since all sections are IN_MEMORY */ | |
633 | ||
634 | return false; | |
635 | } | |
636 | ||
637 | /* Read the contents of a section. | |
638 | buf points to a buffer of buf_size bytes to be filled with | |
639 | section data (starting at offset into section) */ | |
640 | ||
641 | static boolean | |
642 | evax_get_section_contents_in_window (abfd, section, w, offset, count) | |
643 | bfd *abfd; | |
644 | asection *section; | |
645 | bfd_window *w; | |
646 | file_ptr offset; | |
647 | bfd_size_type count; | |
648 | { | |
649 | #if EVAX_DEBUG | |
650 | evax_debug (1, "evax_get_section_contents_in_window(%p, %s, %p, off %ld, count %d)\n", | |
651 | abfd, section->name, w, offset, (int)count); | |
652 | #endif | |
653 | ||
654 | /* shouldn't be called, since all sections are IN_MEMORY */ | |
655 | ||
656 | return false; | |
657 | } | |
658 | ||
659 | /*-- Part 4.2, copy private data --------------------------------------------*/ | |
660 | ||
661 | /* Called to copy BFD general private data from one object file | |
662 | to another. */ | |
663 | ||
664 | static boolean | |
665 | evax_bfd_copy_private_bfd_data (src, dest) | |
666 | bfd *src; | |
667 | bfd *dest; | |
668 | { | |
669 | #if EVAX_DEBUG | |
670 | evax_debug (1, "evax_bfd_copy_private_bfd_data(%p, %p)\n", src, dest); | |
671 | #endif | |
672 | return true; | |
673 | } | |
674 | ||
675 | ||
676 | /* Merge private BFD information from the BFD @var{ibfd} to the | |
677 | the output file BFD @var{obfd} when linking. Return <<true>> | |
678 | on success, <<false>> on error. Possible error returns are: | |
679 | ||
680 | o <<bfd_error_no_memory>> - | |
681 | Not enough memory exists to create private data for @var{obfd}. */ | |
682 | ||
683 | static boolean | |
684 | evax_bfd_merge_private_bfd_data (ibfd, obfd) | |
685 | bfd *ibfd; | |
686 | bfd *obfd; | |
687 | { | |
688 | #if EVAX_DEBUG | |
689 | evax_debug (1,"evax_bfd_merge_private_bfd_data(%p, %p)\n", ibfd, obfd); | |
690 | #endif | |
691 | return true; | |
692 | } | |
693 | ||
694 | ||
695 | /* Set private BFD flag information in the BFD @var{abfd}. | |
696 | Return <<true>> on success, <<false>> on error. Possible error | |
697 | returns are: | |
698 | ||
699 | o <<bfd_error_no_memory>> - | |
700 | Not enough memory exists to create private data for @var{obfd}. */ | |
701 | ||
702 | static boolean | |
703 | evax_bfd_set_private_flags (abfd, flags) | |
704 | bfd *abfd; | |
705 | flagword flags; | |
706 | { | |
707 | #if EVAX_DEBUG | |
708 | evax_debug (1,"evax_bfd_set_private_flags(%p, %lx)\n", abfd, (long)flags); | |
709 | #endif | |
710 | return true; | |
711 | } | |
712 | ||
713 | ||
714 | /* Called to copy BFD private section data from one object file | |
715 | to another. */ | |
716 | ||
717 | static boolean | |
718 | evax_bfd_copy_private_section_data (srcbfd, srcsec, dstbfd, dstsec) | |
719 | bfd *srcbfd; | |
720 | asection *srcsec; | |
721 | bfd *dstbfd; | |
722 | asection *dstsec; | |
723 | { | |
724 | #if EVAX_DEBUG | |
725 | evax_debug (1, "evax_bfd_copy_private_section_data(%p, %s, %p, %s)\n", | |
726 | srcbfd, srcsec->name, dstbfd, dstsec->name); | |
727 | #endif | |
728 | return true; | |
729 | } | |
730 | ||
731 | /* Called to copy BFD private symbol data from one object file | |
732 | to another. */ | |
733 | ||
734 | static boolean | |
735 | evax_bfd_copy_private_symbol_data (ibfd, isym, obfd, osym) | |
736 | bfd *ibfd; | |
737 | asymbol *isym; | |
738 | bfd *obfd; | |
739 | asymbol *osym; | |
740 | { | |
741 | #if EVAX_DEBUG | |
742 | evax_debug (1, "evax_bfd_copy_private_symbol_data(%p, %s, %p, %s)\n", | |
743 | ibfd, isym->name, obfd, osym->name); | |
744 | #endif | |
745 | return true; | |
746 | } | |
747 | ||
748 | /*-- Part 4.3, core file ----------------------------------------------------*/ | |
749 | ||
750 | /* Return a read-only string explaining which program was running | |
751 | when it failed and produced the core file abfd. */ | |
752 | ||
753 | static char * | |
754 | evax_core_file_failing_command (abfd) | |
755 | bfd *abfd; | |
756 | { | |
757 | #if EVAX_DEBUG | |
758 | evax_debug (1, "evax_core_file_failing_command(%p)\n", abfd); | |
759 | #endif | |
760 | return 0; | |
761 | } | |
762 | ||
763 | ||
764 | /* Returns the signal number which caused the core dump which | |
765 | generated the file the BFD abfd is attached to. */ | |
766 | ||
767 | static int | |
768 | evax_core_file_failing_signal (abfd) | |
769 | bfd *abfd; | |
770 | { | |
771 | #if EVAX_DEBUG | |
772 | evax_debug (1, "evax_core_file_failing_signal(%p)\n", abfd); | |
773 | #endif | |
774 | return 0; | |
775 | } | |
776 | ||
777 | ||
778 | /* Return true if the core file attached to core_bfd was generated | |
779 | by a run of the executable file attached to exec_bfd, false otherwise. */ | |
780 | ||
781 | static boolean | |
782 | evax_core_file_matches_executable_p (abfd, bbfd) | |
783 | bfd *abfd; | |
784 | bfd *bbfd; | |
785 | { | |
786 | #if EVAX_DEBUG | |
787 | evax_debug (1, "evax_core_file_matches_executable_p(%p, %p)\n", abfd, bbfd); | |
788 | #endif | |
789 | return false; | |
790 | } | |
791 | ||
792 | /*-- Part 4.4, archive ------------------------------------------------------*/ | |
793 | ||
794 | /* ??? do something with an archive map. | |
795 | Return false on error, true otherwise. */ | |
796 | ||
797 | static boolean | |
798 | evax_slurp_armap (abfd) | |
799 | bfd *abfd; | |
800 | { | |
801 | #if EVAX_DEBUG | |
802 | evax_debug (1, "evax_slurp_armap(%p)\n", abfd); | |
803 | #endif | |
804 | return false; | |
805 | } | |
806 | ||
807 | ||
808 | /* ??? do something with an extended name table. | |
809 | Return false on error, true otherwise. */ | |
810 | ||
811 | static boolean | |
812 | evax_slurp_extended_name_table (abfd) | |
813 | bfd *abfd; | |
814 | { | |
815 | #if EVAX_DEBUG | |
816 | evax_debug (1, "evax_slurp_extended_name_table(%p)\n", abfd); | |
817 | #endif | |
818 | return false; | |
819 | } | |
820 | ||
821 | ||
822 | /* ??? do something with an extended name table. | |
823 | Return false on error, true otherwise. */ | |
824 | ||
825 | static boolean | |
826 | evax_construct_extended_name_table (abfd, tabloc, tablen, name) | |
827 | bfd *abfd; | |
828 | char **tabloc; | |
829 | bfd_size_type *tablen; | |
830 | const char **name; | |
831 | { | |
832 | #if EVAX_DEBUG | |
833 | evax_debug (1, "evax_construct_extended_name_table(%p)\n", abfd); | |
834 | #endif | |
835 | return false; | |
836 | } | |
837 | ||
838 | ||
839 | /* Truncate the name of an archive to match system-dependent restrictions */ | |
840 | ||
841 | static void | |
842 | evax_truncate_arname (abfd, pathname, arhdr) | |
843 | bfd *abfd; | |
844 | CONST char *pathname; | |
845 | char *arhdr; | |
846 | { | |
847 | #if EVAX_DEBUG | |
848 | evax_debug (1, "evax_truncate_arname(%p, %s, %s)\n", abfd, pathname, arhdr); | |
849 | #endif | |
850 | return; | |
851 | } | |
852 | ||
853 | ||
854 | /* ??? write archive map */ | |
855 | ||
856 | static boolean | |
857 | evax_write_armap (arch, elength, map, orl_count, stridx) | |
858 | bfd *arch; | |
859 | unsigned int elength; | |
860 | struct orl *map; | |
861 | unsigned int orl_count; | |
862 | int stridx; | |
863 | { | |
864 | #if EVAX_DEBUG | |
865 | evax_debug (1, "evax_write_armap(%p, %d, %p, %d %d)\n", | |
866 | arch, elength, map, orl_count, stridx); | |
867 | #endif | |
868 | return true; | |
869 | } | |
870 | ||
871 | /* Read archive header ??? */ | |
872 | ||
873 | static PTR | |
874 | evax_read_ar_hdr (abfd) | |
875 | bfd * abfd; | |
876 | { | |
877 | #if EVAX_DEBUG | |
878 | evax_debug (1, "evax_read_ar_hdr(%p)\n", abfd); | |
879 | #endif | |
880 | return (PTR)0; | |
881 | } | |
882 | ||
883 | ||
884 | /* Provided a BFD, @var{archive}, containing an archive and NULL, open | |
885 | an input BFD on the first contained element and returns that. | |
886 | Subsequent calls should pass the archive and the previous return value | |
887 | to return a created BFD to the next contained element. | |
888 | NULL is returned when there are no more. */ | |
889 | ||
890 | static bfd * | |
891 | evax_openr_next_archived_file (arch, prev) | |
892 | bfd *arch; | |
893 | bfd *prev; | |
894 | { | |
895 | #if EVAX_DEBUG | |
896 | evax_debug (1, "evax_openr_next_archived_file(%p, %p)\n", arch, prev); | |
897 | #endif | |
898 | return false; | |
899 | } | |
900 | ||
901 | ||
902 | /* Return the BFD which is referenced by the symbol in ABFD indexed by | |
903 | INDEX. INDEX should have been returned by bfd_get_next_mapent. */ | |
904 | ||
905 | static bfd * | |
906 | evax_get_elt_at_index (abfd, index) | |
907 | bfd *abfd; | |
908 | symindex index; | |
909 | { | |
910 | #if EVAX_DEBUG | |
911 | evax_debug (1, "evax_get_elt_at_index(%p, %p)\n", abfd, index); | |
912 | #endif | |
913 | return _bfd_generic_get_elt_at_index(abfd, index); | |
914 | } | |
915 | ||
916 | ||
917 | /* ??? | |
918 | -> bfd_generic_stat_arch_elt */ | |
919 | ||
920 | static int | |
921 | evax_generic_stat_arch_elt (abfd, stat) | |
922 | bfd *abfd; | |
923 | struct stat *stat; | |
924 | { | |
925 | #if EVAX_DEBUG | |
926 | evax_debug (1, "evax_generic_stat_arch_elt(%p, %p)\n", abfd, stat); | |
927 | #endif | |
928 | return bfd_generic_stat_arch_elt(abfd, stat); | |
929 | } | |
930 | ||
931 | ||
932 | /* This is a new function in bfd 2.5 */ | |
933 | ||
934 | static boolean | |
935 | evax_update_armap_timestamp (abfd) | |
936 | bfd *abfd; | |
937 | { | |
938 | #if EVAX_DEBUG | |
939 | evax_debug (1, "evax_update_armap_timestamp(%p)\n", abfd); | |
940 | #endif | |
941 | return true; | |
942 | } | |
943 | ||
944 | /*-- Part 4.5, symbols --------------------------------------------------------*/ | |
945 | ||
946 | /* Return the number of bytes required to store a vector of pointers | |
947 | to asymbols for all the symbols in the BFD abfd, including a | |
948 | terminal NULL pointer. If there are no symbols in the BFD, | |
949 | then return 0. If an error occurs, return -1. */ | |
950 | ||
951 | static long | |
952 | evax_get_symtab_upper_bound (abfd) | |
953 | bfd *abfd; | |
954 | { | |
955 | #if EVAX_DEBUG | |
956 | evax_debug (1, "evax_get_symtab_upper_bound(%p), %d symbols\n", abfd, PRIV(egsd_sym_count)); | |
957 | #endif | |
958 | return (PRIV(egsd_sym_count)+1) * sizeof(asymbol *); | |
959 | } | |
960 | ||
961 | ||
962 | /* Copy symbols from hash table to symbol vector | |
963 | ||
964 | called from bfd_hash_traverse in evax_get_symtab | |
965 | init counter to 0 if entry == 0 */ | |
966 | ||
967 | static boolean | |
968 | copy_symbols (entry, arg) | |
969 | struct bfd_hash_entry *entry; | |
970 | PTR arg; | |
971 | { | |
972 | bfd *abfd = (bfd *) arg; | |
973 | ||
974 | if (entry == NULL) /* init counter */ | |
975 | PRIV(symnum) = 0; | |
976 | else /* fill vector, inc counter */ | |
977 | PRIV(symcache)[PRIV(symnum)++] = ((evax_symbol_entry *)entry)->symbol; | |
978 | ||
979 | return true; | |
980 | } | |
981 | ||
982 | ||
983 | /* Read the symbols from the BFD abfd, and fills in the vector | |
984 | location with pointers to the symbols and a trailing NULL. | |
985 | ||
986 | return # of symbols read */ | |
987 | ||
988 | static long | |
989 | evax_get_symtab (abfd, symbols) | |
990 | bfd *abfd; | |
991 | asymbol **symbols; | |
992 | { | |
993 | #if EVAX_DEBUG | |
994 | evax_debug (1, "evax_get_symtab(%p, <ret>)\n", abfd); | |
995 | #endif | |
996 | ||
997 | /* init counter */ | |
998 | (void)copy_symbols((struct bfd_hash_entry *)0, abfd); | |
999 | ||
1000 | /* traverse table and fill symbols vector */ | |
1001 | ||
1002 | PRIV(symcache) = symbols; | |
1003 | bfd_hash_traverse(PRIV(evax_symbol_table), copy_symbols, (PTR)abfd); | |
1004 | ||
bf53bd9f | 1005 | symbols[PRIV(egsd_sym_count)] = NULL; |
c3d8e071 | 1006 | |
bf53bd9f | 1007 | return PRIV(egsd_sym_count); |
c3d8e071 ILT |
1008 | } |
1009 | ||
1010 | ||
1011 | /* Create a new asymbol structure for the BFD abfd and return a pointer | |
1012 | to it. | |
1013 | This routine is necessary because each back end has private information | |
1014 | surrounding the asymbol. Building your own asymbol and pointing to it | |
1015 | will not create the private information, and will cause problems later on. */ | |
1016 | ||
1017 | asymbol * | |
1018 | _bfd_evax_make_empty_symbol (abfd) | |
1019 | bfd *abfd; | |
1020 | { | |
1021 | asymbol *symbol = (asymbol *)bfd_zalloc(abfd, sizeof(asymbol)); | |
1022 | ||
1023 | #if EVAX_DEBUG | |
1024 | evax_debug (1, "_bfd_evax_make_empty_symbol(%p)\n", abfd); | |
1025 | #endif | |
1026 | ||
1027 | if (symbol == 0) | |
1028 | { | |
1029 | bfd_set_error (bfd_error_no_memory); | |
1030 | return 0; | |
1031 | } | |
1032 | symbol->the_bfd = abfd; | |
1033 | ||
1034 | return symbol; | |
1035 | } | |
1036 | ||
1037 | ||
1038 | /* Print symbol to file according to how. how is one of | |
1039 | bfd_print_symbol_name just print the name | |
1040 | bfd_print_symbol_more print more (???) | |
1041 | bfd_print_symbol_all print all we know, which is not much right now :-) */ | |
1042 | ||
1043 | static void | |
1044 | evax_print_symbol (abfd, file, symbol, how) | |
1045 | bfd *abfd; | |
1046 | PTR file; | |
1047 | asymbol *symbol; | |
1048 | bfd_print_symbol_type how; | |
1049 | { | |
1050 | #if EVAX_DEBUG | |
1051 | evax_debug (1, "evax_print_symbol(%p, %p, %p, %d)\n", abfd, file, symbol, how); | |
1052 | #endif | |
1053 | ||
1054 | switch (how) | |
1055 | { | |
1056 | case bfd_print_symbol_name: | |
1057 | case bfd_print_symbol_more: | |
1058 | fprintf((FILE *)file," %s", symbol->name); | |
1059 | break; | |
1060 | ||
1061 | break; | |
1062 | ||
1063 | case bfd_print_symbol_all: | |
1064 | { | |
1065 | CONST char *section_name = symbol->section->name; | |
1066 | ||
1067 | bfd_print_symbol_vandf((PTR)file,symbol); | |
1068 | ||
1069 | fprintf((FILE *)file," %-8s %s", section_name, symbol->name); | |
1070 | } | |
1071 | break; | |
1072 | } | |
1073 | return; | |
1074 | } | |
1075 | ||
1076 | ||
1077 | /* Return information about symbol in ret. | |
1078 | ||
1079 | fill type, value and name | |
1080 | type: | |
1081 | A absolute | |
1082 | B bss segment symbol | |
1083 | C common symbol | |
1084 | D data segment symbol | |
1085 | f filename | |
1086 | t a static function symbol | |
1087 | T text segment symbol | |
1088 | U undefined | |
1089 | - debug */ | |
1090 | ||
1091 | static void | |
1092 | evax_get_symbol_info (abfd, symbol, ret) | |
1093 | bfd *abfd; | |
1094 | asymbol *symbol; | |
1095 | symbol_info *ret; | |
1096 | { | |
1097 | asection *sec; | |
1098 | ||
1099 | #if EVAX_DEBUG | |
1100 | evax_debug (1, "evax_get_symbol_info(%p, %p, <ret>)\n", abfd, symbol); | |
1101 | #endif | |
1102 | ||
1103 | sec = symbol->section; | |
1104 | ||
1105 | if (bfd_is_com_section (sec)) | |
1106 | ret->type = 'C'; | |
1107 | else if (bfd_is_abs_section (sec)) | |
1108 | ret->type = 'A'; | |
1109 | else if (bfd_is_und_section (sec)) | |
1110 | ret->type = 'U'; | |
c3d8e071 ILT |
1111 | else if (bfd_is_ind_section (sec)) |
1112 | ret->type = 'I'; | |
1113 | else if (bfd_get_section_flags (abfd, sec) & SEC_CODE) | |
1114 | ret->type = 'T'; | |
1115 | else if (bfd_get_section_flags (abfd, sec) & SEC_DATA) | |
1116 | ret->type = 'D'; | |
1117 | else if (bfd_get_section_flags (abfd, sec) & SEC_ALLOC) | |
1118 | ret->type = 'B'; | |
1119 | else | |
1120 | ret->type = '-'; | |
1121 | ||
1122 | if (ret->type != 'U') | |
1123 | ret->value = symbol->value + symbol->section->vma; | |
1124 | else | |
1125 | ret->value = 0; | |
1126 | ret->name = symbol->name; | |
1127 | ||
1128 | return; | |
1129 | } | |
1130 | ||
1131 | ||
1132 | /* Return true if the given symbol sym in the BFD abfd is | |
1133 | a compiler generated local label, else return false. */ | |
1134 | ||
1135 | static boolean | |
35a3e78e | 1136 | evax_bfd_is_local_label_name (abfd, name) |
c3d8e071 | 1137 | bfd *abfd; |
35a3e78e | 1138 | const char *name; |
c3d8e071 ILT |
1139 | { |
1140 | #if EVAX_DEBUG | |
35a3e78e | 1141 | evax_debug (1, "evax_bfd_is_local_label_name(%p, %s)\n", abfd, name); |
c3d8e071 | 1142 | #endif |
af4dffff | 1143 | return name[0] == '$'; |
c3d8e071 ILT |
1144 | } |
1145 | ||
1146 | ||
1147 | /* Get source line number for symbol */ | |
1148 | ||
1149 | static alent * | |
1150 | evax_get_lineno (abfd, symbol) | |
1151 | bfd *abfd; | |
1152 | asymbol *symbol; | |
1153 | { | |
1154 | #if EVAX_DEBUG | |
1155 | evax_debug (1, "evax_get_lineno(%p, %p)\n", abfd, symbol); | |
1156 | #endif | |
1157 | return 0; | |
1158 | } | |
1159 | ||
1160 | ||
1161 | /* Provided a BFD, a section and an offset into the section, calculate and | |
1162 | return the name of the source file and the line nearest to the wanted | |
1163 | location. */ | |
1164 | ||
1165 | static boolean | |
1166 | evax_find_nearest_line (abfd, section, symbols, offset, file, func, line) | |
1167 | bfd *abfd; | |
1168 | asection *section; | |
1169 | asymbol **symbols; | |
1170 | bfd_vma offset; | |
1171 | CONST char **file; | |
1172 | CONST char **func; | |
1173 | unsigned int *line; | |
1174 | { | |
1175 | #if EVAX_DEBUG | |
1176 | evax_debug (1, "evax_find_nearest_line(%p, %s, %p, %ld, <ret>, <ret>, <ret>)\n", | |
1177 | abfd, section->name, symbols, (long int)offset); | |
1178 | #endif | |
1179 | return false; | |
1180 | } | |
1181 | ||
1182 | ||
1183 | /* Back-door to allow format-aware applications to create debug symbols | |
1184 | while using BFD for everything else. Currently used by the assembler | |
1185 | when creating COFF files. */ | |
1186 | ||
1187 | static asymbol * | |
1188 | evax_bfd_make_debug_symbol (abfd, ptr, size) | |
1189 | bfd *abfd; | |
1190 | void *ptr; | |
1191 | unsigned long size; | |
1192 | { | |
1193 | #if EVAX_DEBUG | |
1194 | evax_debug (1, "evax_bfd_make_debug_symbol(%p, %p, %ld)\n", abfd, ptr, size); | |
1195 | #endif | |
1196 | return 0; | |
1197 | } | |
1198 | ||
1199 | ||
1200 | /* Read minisymbols. For minisymbols, we use the unmodified a.out | |
1201 | symbols. The minisymbol_to_symbol function translates these into | |
1202 | BFD asymbol structures. */ | |
1203 | ||
1204 | static long | |
1205 | evax_read_minisymbols (abfd, dynamic, minisymsp, sizep) | |
1206 | bfd *abfd; | |
1207 | boolean dynamic; | |
1208 | PTR *minisymsp; | |
1209 | unsigned int *sizep; | |
1210 | { | |
1211 | #if EVAX_DEBUG | |
1212 | evax_debug (1, "evax_read_minisymbols(%p, %d, %p, %d)\n", abfd, dynamic, minisymsp, *sizep); | |
1213 | #endif | |
1214 | return _bfd_generic_read_minisymbols (abfd, dynamic, minisymsp, sizep); | |
1215 | } | |
1216 | ||
1217 | /* Convert a minisymbol to a BFD asymbol. A minisymbol is just an | |
1218 | unmodified a.out symbol. The SYM argument is a structure returned | |
1219 | by bfd_make_empty_symbol, which we fill in here. */ | |
1220 | ||
1221 | static asymbol * | |
1222 | evax_minisymbol_to_symbol (abfd, dynamic, minisym, sym) | |
1223 | bfd *abfd; | |
1224 | boolean dynamic; | |
1225 | const PTR minisym; | |
1226 | asymbol *sym; | |
1227 | { | |
1228 | #if EVAX_DEBUG | |
1229 | evax_debug (1, "evax_minisymbol_to_symbol(%p, %d, %p, %p)\n", abfd, dynamic, minisym, sym); | |
1230 | #endif | |
1231 | return _bfd_generic_minisymbol_to_symbol (abfd, dynamic, minisym, sym); | |
1232 | } | |
1233 | ||
1234 | /*-- Part 4.6, relocations --------------------------------------------------*/ | |
1235 | ||
1236 | /* Return the number of bytes required to store the relocation information | |
1237 | associated with section sect attached to bfd abfd. | |
1238 | If an error occurs, return -1. */ | |
1239 | ||
1240 | static long | |
1241 | evax_get_reloc_upper_bound (abfd, section) | |
1242 | bfd *abfd; | |
1243 | asection *section; | |
1244 | { | |
1245 | #if EVAX_DEBUG | |
1246 | evax_debug (1, "evax_get_reloc_upper_bound(%p, %s)\n", abfd, section->name); | |
1247 | #endif | |
1248 | return -1L; | |
1249 | } | |
1250 | ||
1251 | ||
1252 | /* Call the back end associated with the open BFD abfd and translate the | |
1253 | external form of the relocation information attached to sec into the | |
1254 | internal canonical form. Place the table into memory at loc, which has | |
1255 | been preallocated, usually by a call to bfd_get_reloc_upper_bound. | |
1256 | Returns the number of relocs, or -1 on error. */ | |
1257 | ||
1258 | static long | |
1259 | evax_canonicalize_reloc (abfd, section, location, symbols) | |
1260 | bfd *abfd; | |
1261 | asection *section; | |
1262 | arelent **location; | |
1263 | asymbol **symbols; | |
1264 | { | |
1265 | #if EVAX_DEBUG | |
1266 | evax_debug (1, "evax_canonicalize_reloc(%p, %s, <ret>, <ret>)\n", abfd, section->name); | |
1267 | #endif | |
1268 | return false; | |
1269 | } | |
1270 | ||
1271 | /*---------------------------------------------------------------------------*/ | |
1272 | /* this is just copied from ecoff-alpha, needs to be fixed probably */ | |
1273 | ||
1274 | /* How to process the various reloc types. */ | |
1275 | ||
1276 | static bfd_reloc_status_type | |
1277 | reloc_nil (abfd, reloc, sym, data, sec, output_bfd, error_message) | |
1278 | bfd *abfd; | |
1279 | arelent *reloc; | |
1280 | asymbol *sym; | |
1281 | PTR data; | |
1282 | asection *sec; | |
1283 | bfd *output_bfd; | |
1284 | char **error_message; | |
1285 | { | |
c3d8e071 ILT |
1286 | #if EVAX_DEBUG |
1287 | evax_debug (1, "reloc_nil(abfd %p, output_bfd %p)\n", abfd, output_bfd); | |
1288 | evax_debug (2, "In section %s, symbol %s\n", | |
1289 | sec->name, sym->name); | |
1290 | evax_debug (2, "reloc sym %s, addr %08lx, addend %08lx, reloc is a %s\n", | |
1291 | reloc->sym_ptr_ptr[0]->name, | |
1292 | (unsigned long)reloc->address, | |
1293 | (unsigned long)reloc->addend, reloc->howto->name); | |
1294 | evax_debug (2, "data at %p\n", data); | |
1295 | /* _bfd_hexdump (2, data, bfd_get_reloc_size(reloc->howto),0); */ | |
1296 | #endif | |
1297 | ||
c3d8e071 ILT |
1298 | return bfd_reloc_ok; |
1299 | } | |
1300 | ||
1301 | /* In case we're on a 32-bit machine, construct a 64-bit "-1" value | |
1302 | from smaller values. Start with zero, widen, *then* decrement. */ | |
1303 | #define MINUS_ONE (((bfd_vma)0) - 1) | |
1304 | ||
1305 | static reloc_howto_type alpha_howto_table[] = | |
1306 | { | |
1307 | HOWTO (ALPHA_R_IGNORE, /* type */ | |
1308 | 0, /* rightshift */ | |
1309 | 0, /* size (0 = byte, 1 = short, 2 = long) */ | |
1310 | 8, /* bitsize */ | |
1311 | true, /* pc_relative */ | |
1312 | 0, /* bitpos */ | |
1313 | complain_overflow_dont, /* complain_on_overflow */ | |
1314 | reloc_nil, /* special_function */ | |
1315 | "IGNORE", /* name */ | |
1316 | true, /* partial_inplace */ | |
1317 | 0, /* src_mask */ | |
1318 | 0, /* dst_mask */ | |
1319 | true), /* pcrel_offset */ | |
1320 | ||
1321 | /* A 64 bit reference to a symbol. */ | |
1322 | HOWTO (ALPHA_R_REFQUAD, /* type */ | |
1323 | 0, /* rightshift */ | |
1324 | 4, /* size (0 = byte, 1 = short, 2 = long) */ | |
1325 | 64, /* bitsize */ | |
1326 | false, /* pc_relative */ | |
1327 | 0, /* bitpos */ | |
1328 | complain_overflow_bitfield, /* complain_on_overflow */ | |
1329 | reloc_nil, /* special_function */ | |
1330 | "REFQUAD", /* name */ | |
1331 | true, /* partial_inplace */ | |
1332 | MINUS_ONE, /* src_mask */ | |
1333 | MINUS_ONE, /* dst_mask */ | |
1334 | false), /* pcrel_offset */ | |
1335 | ||
1336 | /* A 21 bit branch. The native assembler generates these for | |
1337 | branches within the text segment, and also fills in the PC | |
1338 | relative offset in the instruction. */ | |
1339 | HOWTO (ALPHA_R_BRADDR, /* type */ | |
1340 | 2, /* rightshift */ | |
1341 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
1342 | 21, /* bitsize */ | |
1343 | true, /* pc_relative */ | |
1344 | 0, /* bitpos */ | |
1345 | complain_overflow_signed, /* complain_on_overflow */ | |
1346 | reloc_nil, /* special_function */ | |
1347 | "BRADDR", /* name */ | |
1348 | true, /* partial_inplace */ | |
1349 | 0x1fffff, /* src_mask */ | |
1350 | 0x1fffff, /* dst_mask */ | |
1351 | false), /* pcrel_offset */ | |
1352 | ||
1353 | /* A hint for a jump to a register. */ | |
1354 | HOWTO (ALPHA_R_HINT, /* type */ | |
1355 | 2, /* rightshift */ | |
1356 | 1, /* size (0 = byte, 1 = short, 2 = long) */ | |
1357 | 14, /* bitsize */ | |
1358 | true, /* pc_relative */ | |
1359 | 0, /* bitpos */ | |
1360 | complain_overflow_dont, /* complain_on_overflow */ | |
1361 | reloc_nil, /* special_function */ | |
1362 | "HINT", /* name */ | |
1363 | true, /* partial_inplace */ | |
1364 | 0x3fff, /* src_mask */ | |
1365 | 0x3fff, /* dst_mask */ | |
1366 | false), /* pcrel_offset */ | |
1367 | ||
1368 | /* 16 bit PC relative offset. */ | |
1369 | HOWTO (ALPHA_R_SREL16, /* type */ | |
1370 | 0, /* rightshift */ | |
1371 | 1, /* size (0 = byte, 1 = short, 2 = long) */ | |
1372 | 16, /* bitsize */ | |
1373 | true, /* pc_relative */ | |
1374 | 0, /* bitpos */ | |
1375 | complain_overflow_signed, /* complain_on_overflow */ | |
1376 | reloc_nil, /* special_function */ | |
1377 | "SREL16", /* name */ | |
1378 | true, /* partial_inplace */ | |
1379 | 0xffff, /* src_mask */ | |
1380 | 0xffff, /* dst_mask */ | |
1381 | false), /* pcrel_offset */ | |
1382 | ||
1383 | /* 32 bit PC relative offset. */ | |
1384 | HOWTO (ALPHA_R_SREL32, /* type */ | |
1385 | 0, /* rightshift */ | |
1386 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
1387 | 32, /* bitsize */ | |
1388 | true, /* pc_relative */ | |
1389 | 0, /* bitpos */ | |
1390 | complain_overflow_signed, /* complain_on_overflow */ | |
1391 | reloc_nil, /* special_function */ | |
1392 | "SREL32", /* name */ | |
1393 | true, /* partial_inplace */ | |
1394 | 0xffffffff, /* src_mask */ | |
1395 | 0xffffffff, /* dst_mask */ | |
1396 | false), /* pcrel_offset */ | |
1397 | ||
1398 | /* A 64 bit PC relative offset. */ | |
1399 | HOWTO (ALPHA_R_SREL64, /* type */ | |
1400 | 0, /* rightshift */ | |
1401 | 4, /* size (0 = byte, 1 = short, 2 = long) */ | |
1402 | 64, /* bitsize */ | |
1403 | true, /* pc_relative */ | |
1404 | 0, /* bitpos */ | |
1405 | complain_overflow_signed, /* complain_on_overflow */ | |
1406 | reloc_nil, /* special_function */ | |
1407 | "SREL64", /* name */ | |
1408 | true, /* partial_inplace */ | |
1409 | MINUS_ONE, /* src_mask */ | |
1410 | MINUS_ONE, /* dst_mask */ | |
1411 | false), /* pcrel_offset */ | |
1412 | ||
1413 | /* Push a value on the reloc evaluation stack. */ | |
1414 | HOWTO (ALPHA_R_OP_PUSH, /* type */ | |
1415 | 0, /* rightshift */ | |
1416 | 0, /* size (0 = byte, 1 = short, 2 = long) */ | |
1417 | 0, /* bitsize */ | |
1418 | false, /* pc_relative */ | |
1419 | 0, /* bitpos */ | |
1420 | complain_overflow_dont, /* complain_on_overflow */ | |
1421 | reloc_nil, /* special_function */ | |
1422 | "OP_PUSH", /* name */ | |
1423 | false, /* partial_inplace */ | |
1424 | 0, /* src_mask */ | |
1425 | 0, /* dst_mask */ | |
1426 | false), /* pcrel_offset */ | |
1427 | ||
1428 | /* Store the value from the stack at the given address. Store it in | |
1429 | a bitfield of size r_size starting at bit position r_offset. */ | |
1430 | HOWTO (ALPHA_R_OP_STORE, /* type */ | |
1431 | 0, /* rightshift */ | |
1432 | 4, /* size (0 = byte, 1 = short, 2 = long) */ | |
1433 | 64, /* bitsize */ | |
1434 | false, /* pc_relative */ | |
1435 | 0, /* bitpos */ | |
1436 | complain_overflow_dont, /* complain_on_overflow */ | |
1437 | reloc_nil, /* special_function */ | |
1438 | "OP_STORE", /* name */ | |
1439 | false, /* partial_inplace */ | |
1440 | 0, /* src_mask */ | |
1441 | MINUS_ONE, /* dst_mask */ | |
1442 | false), /* pcrel_offset */ | |
1443 | ||
1444 | /* Subtract the reloc address from the value on the top of the | |
1445 | relocation stack. */ | |
1446 | HOWTO (ALPHA_R_OP_PSUB, /* type */ | |
1447 | 0, /* rightshift */ | |
1448 | 0, /* size (0 = byte, 1 = short, 2 = long) */ | |
1449 | 0, /* bitsize */ | |
1450 | false, /* pc_relative */ | |
1451 | 0, /* bitpos */ | |
1452 | complain_overflow_dont, /* complain_on_overflow */ | |
1453 | reloc_nil, /* special_function */ | |
1454 | "OP_PSUB", /* name */ | |
1455 | false, /* partial_inplace */ | |
1456 | 0, /* src_mask */ | |
1457 | 0, /* dst_mask */ | |
1458 | false), /* pcrel_offset */ | |
1459 | ||
1460 | /* Shift the value on the top of the relocation stack right by the | |
1461 | given value. */ | |
1462 | HOWTO (ALPHA_R_OP_PRSHIFT, /* type */ | |
1463 | 0, /* rightshift */ | |
1464 | 0, /* size (0 = byte, 1 = short, 2 = long) */ | |
1465 | 0, /* bitsize */ | |
1466 | false, /* pc_relative */ | |
1467 | 0, /* bitpos */ | |
1468 | complain_overflow_dont, /* complain_on_overflow */ | |
1469 | reloc_nil, /* special_function */ | |
1470 | "OP_PRSHIFT", /* name */ | |
1471 | false, /* partial_inplace */ | |
1472 | 0, /* src_mask */ | |
1473 | 0, /* dst_mask */ | |
1474 | false), /* pcrel_offset */ | |
1475 | ||
1476 | /* Hack. Linkage is done by linker. */ | |
1477 | HOWTO (ALPHA_R_LINKAGE, /* type */ | |
1478 | 0, /* rightshift */ | |
1479 | 8, /* size (0 = byte, 1 = short, 2 = long) */ | |
1480 | 256, /* bitsize */ | |
1481 | false, /* pc_relative */ | |
1482 | 0, /* bitpos */ | |
1483 | complain_overflow_dont, /* complain_on_overflow */ | |
1484 | reloc_nil, /* special_function */ | |
1485 | "LINKAGE", /* name */ | |
1486 | false, /* partial_inplace */ | |
1487 | 0, /* src_mask */ | |
1488 | 0, /* dst_mask */ | |
1489 | false), /* pcrel_offset */ | |
1490 | ||
c3d8e071 ILT |
1491 | /* A 32 bit reference to a symbol. */ |
1492 | HOWTO (ALPHA_R_REFLONG, /* type */ | |
1493 | 0, /* rightshift */ | |
1494 | 2, /* size (0 = byte, 1 = short, 2 = long) */ | |
1495 | 32, /* bitsize */ | |
1496 | false, /* pc_relative */ | |
1497 | 0, /* bitpos */ | |
1498 | complain_overflow_bitfield, /* complain_on_overflow */ | |
1499 | reloc_nil, /* special_function */ | |
1500 | "REFLONG", /* name */ | |
1501 | true, /* partial_inplace */ | |
1502 | 0xffffffff, /* src_mask */ | |
1503 | 0xffffffff, /* dst_mask */ | |
1504 | false), /* pcrel_offset */ | |
1505 | ||
8696b2db ILT |
1506 | /* A 64 bit reference to a procedure, written as 32 bit value. */ |
1507 | HOWTO (ALPHA_R_CODEADDR, /* type */ | |
1508 | 0, /* rightshift */ | |
1509 | 4, /* size (0 = byte, 1 = short, 2 = long) */ | |
1510 | 64, /* bitsize */ | |
1511 | false, /* pc_relative */ | |
1512 | 0, /* bitpos */ | |
1513 | complain_overflow_signed,/* complain_on_overflow */ | |
1514 | reloc_nil, /* special_function */ | |
1515 | "CODEADDR", /* name */ | |
1516 | false, /* partial_inplace */ | |
1517 | 0xffffffff, /* src_mask */ | |
1518 | 0xffffffff, /* dst_mask */ | |
1519 | false), /* pcrel_offset */ | |
1520 | ||
c3d8e071 ILT |
1521 | }; |
1522 | ||
1523 | /* Return a pointer to a howto structure which, when invoked, will perform | |
1524 | the relocation code on data from the architecture noted. */ | |
1525 | ||
1526 | static const struct reloc_howto_struct * | |
1527 | evax_bfd_reloc_type_lookup (abfd, code) | |
1528 | bfd *abfd; | |
1529 | bfd_reloc_code_real_type code; | |
1530 | { | |
1531 | int alpha_type; | |
1532 | ||
1533 | #if EVAX_DEBUG | |
1534 | evax_debug (1, "evax_bfd_reloc_type_lookup(%p, %d)\t", abfd, code); | |
1535 | #endif | |
1536 | ||
1537 | switch (code) | |
1538 | { | |
1539 | case BFD_RELOC_16: alpha_type = ALPHA_R_SREL16; break; | |
1540 | case BFD_RELOC_32: alpha_type = ALPHA_R_REFLONG; break; | |
1541 | case BFD_RELOC_64: alpha_type = ALPHA_R_REFQUAD; break; | |
1542 | case BFD_RELOC_CTOR: alpha_type = ALPHA_R_REFQUAD; break; | |
1543 | case BFD_RELOC_23_PCREL_S2: alpha_type = ALPHA_R_BRADDR; break; | |
1544 | case BFD_RELOC_ALPHA_HINT: alpha_type = ALPHA_R_HINT; break; | |
1545 | case BFD_RELOC_16_PCREL: alpha_type = ALPHA_R_SREL16; break; | |
1546 | case BFD_RELOC_32_PCREL: alpha_type = ALPHA_R_SREL32; break; | |
1547 | case BFD_RELOC_64_PCREL: alpha_type = ALPHA_R_SREL64; break; | |
1548 | case BFD_RELOC_ALPHA_LINKAGE: alpha_type = ALPHA_R_LINKAGE; break; | |
8696b2db | 1549 | case BFD_RELOC_ALPHA_CODEADDR: alpha_type = ALPHA_R_CODEADDR; break; |
c3d8e071 ILT |
1550 | default: |
1551 | (*_bfd_error_handler) ("reloc (%d) is *UNKNOWN*", code); | |
1552 | return (const struct reloc_howto_struct *) NULL; | |
1553 | } | |
1554 | #if EVAX_DEBUG | |
1555 | evax_debug (2, "reloc is %s\n", alpha_howto_table[alpha_type].name); | |
1556 | #endif | |
1557 | return &alpha_howto_table[alpha_type]; | |
1558 | } | |
1559 | ||
1560 | ||
1561 | /*-- Part 4.7, writing an object file ---------------------------------------*/ | |
1562 | ||
1563 | /* Set the architecture and machine type in BFD abfd to arch and mach. | |
1564 | Find the correct pointer to a structure and insert it into the arch_info | |
1565 | pointer. */ | |
1566 | ||
1567 | static boolean | |
1568 | evax_set_arch_mach (abfd, arch, mach) | |
1569 | bfd *abfd; | |
1570 | enum bfd_architecture arch; | |
1571 | unsigned long mach; | |
1572 | { | |
1573 | #if EVAX_DEBUG | |
1574 | evax_debug (1, "evax_set_arch_mach(%p, %d, %ld)\n", abfd, arch, mach); | |
1575 | #endif | |
b35711c4 ILT |
1576 | if (arch != bfd_arch_alpha |
1577 | && arch != bfd_arch_unknown) | |
1578 | return false; | |
c3d8e071 | 1579 | |
b35711c4 | 1580 | return bfd_default_set_arch_mach (abfd, arch, mach); |
c3d8e071 ILT |
1581 | } |
1582 | ||
1583 | ||
1584 | /* Sets the contents of the section section in BFD abfd to the data starting | |
1585 | in memory at data. The data is written to the output section starting at | |
1586 | offset offset for count bytes. | |
1587 | ||
1588 | Normally true is returned, else false. Possible error returns are: | |
1589 | o bfd_error_no_contents - The output section does not have the | |
1590 | SEC_HAS_CONTENTS attribute, so nothing can be written to it. | |
1591 | o and some more too */ | |
1592 | ||
1593 | static boolean | |
1594 | evax_set_section_contents (abfd, section, location, offset, count) | |
1595 | bfd *abfd; | |
1596 | asection *section; | |
1597 | PTR location; | |
1598 | file_ptr offset; | |
1599 | bfd_size_type count; | |
1600 | { | |
1601 | #if EVAX_DEBUG | |
1602 | evax_debug (1, "evax_set_section_contents(%p, sec %s, loc %p, off %ld, count %d)\n", | |
1603 | abfd, section->name, location, (long int)offset, (int)count); | |
8612a388 | 1604 | evax_debug (2, "secraw %d, seccooked %d\n", (int)section->_raw_size, (int)section->_cooked_size); |
c3d8e071 ILT |
1605 | #endif |
1606 | return _bfd_save_evax_section(abfd, section, location, offset, count); | |
1607 | } | |
1608 | ||
1609 | ||
1610 | /*-- Part 4.8, linker -------------------------------------------------------*/ | |
1611 | ||
1612 | /* Get the size of the section headers. */ | |
1613 | ||
1614 | static int | |
1615 | evax_sizeof_headers (abfd, reloc) | |
1616 | bfd *abfd; | |
1617 | boolean reloc; | |
1618 | { | |
1619 | #if EVAX_DEBUG | |
1620 | evax_debug (1, "evax_sizeof_headers(%p, %s)\n", abfd, (reloc)?"True":"False"); | |
1621 | #endif | |
1622 | return 0; | |
1623 | } | |
1624 | ||
1625 | ||
1626 | /* Provides default handling of relocation effort for back ends | |
1627 | which can't be bothered to do it efficiently. */ | |
1628 | ||
1629 | static bfd_byte * | |
1630 | evax_bfd_get_relocated_section_contents (abfd, link_info, link_order, data, | |
1631 | relocateable, symbols) | |
1632 | bfd *abfd; | |
1633 | struct bfd_link_info *link_info; | |
1634 | struct bfd_link_order *link_order; | |
1635 | bfd_byte *data; | |
1636 | boolean relocateable; | |
1637 | asymbol **symbols; | |
1638 | { | |
1639 | #if EVAX_DEBUG | |
1640 | evax_debug (1, "evax_bfd_get_relocated_section_contents(%p, %p, %p, %p, %s, %p)\n", | |
1641 | abfd, link_info, link_order, data, (relocateable)?"True":"False", symbols); | |
1642 | #endif | |
1643 | return 0; | |
1644 | } | |
1645 | ||
1646 | ||
1647 | /* ??? */ | |
1648 | ||
1649 | static boolean | |
1650 | evax_bfd_relax_section (abfd, section, link_info, again) | |
1651 | bfd *abfd; | |
1652 | asection *section; | |
1653 | struct bfd_link_info *link_info; | |
1654 | boolean *again; | |
1655 | { | |
1656 | #if EVAX_DEBUG | |
1657 | evax_debug (1, "evax_bfd_relax_section(%p, %s, %p, <ret>)\n", | |
1658 | abfd, section->name, link_info); | |
1659 | #endif | |
1660 | return true; | |
1661 | } | |
1662 | ||
1663 | ||
1664 | /* Create a hash table for the linker. Different backends store | |
1665 | different information in this table. */ | |
1666 | ||
1667 | static struct bfd_link_hash_table * | |
1668 | evax_bfd_link_hash_table_create (abfd) | |
1669 | bfd *abfd; | |
1670 | { | |
1671 | #if EVAX_DEBUG | |
1672 | evax_debug (1, "evax_bfd_link_hash_table_create(%p)\n", abfd); | |
1673 | #endif | |
1674 | return 0; | |
1675 | } | |
1676 | ||
1677 | ||
1678 | /* Add symbols from this object file into the hash table. */ | |
1679 | ||
1680 | static boolean | |
1681 | evax_bfd_link_add_symbols (abfd, link_info) | |
1682 | bfd *abfd; | |
1683 | struct bfd_link_info *link_info; | |
1684 | { | |
1685 | #if EVAX_DEBUG | |
1686 | evax_debug (1, "evax_bfd_link_add_symbols(%p, %p)\n", abfd, link_info); | |
1687 | #endif | |
1688 | return false; | |
1689 | } | |
1690 | ||
1691 | ||
1692 | /* Do a link based on the link_order structures attached to each | |
1693 | section of the BFD. */ | |
1694 | ||
1695 | static boolean | |
1696 | evax_bfd_final_link (abfd, link_info) | |
1697 | bfd *abfd; | |
1698 | struct bfd_link_info *link_info; | |
1699 | { | |
1700 | #if EVAX_DEBUG | |
1701 | evax_debug (1, "evax_bfd_final_link(%p, %p)\n", abfd, link_info); | |
1702 | #endif | |
1703 | return true; | |
1704 | } | |
1705 | ||
1706 | /* Should this section be split up into smaller pieces during linking. */ | |
1707 | ||
1708 | static boolean | |
1709 | evax_bfd_link_split_section (abfd, section) | |
1710 | bfd *abfd; | |
1711 | asection *section; | |
1712 | { | |
1713 | #if EVAX_DEBUG | |
1714 | evax_debug (1, "evax_bfd_link_split_section(%p, %s)\n", abfd, section->name); | |
1715 | #endif | |
1716 | return false; | |
1717 | } | |
1718 | ||
1719 | /*-- Part 4.9, dynamic symbols and relocations ------------------------------*/ | |
1720 | ||
1721 | /* Get the amount of memory required to hold the dynamic symbols. */ | |
1722 | ||
1723 | static long | |
1724 | evax_get_dynamic_symtab_upper_bound (abfd) | |
1725 | bfd *abfd; | |
1726 | { | |
1727 | #if EVAX_DEBUG | |
1728 | evax_debug (1, "evax_get_dynamic_symtab_upper_bound(%p)\n", abfd); | |
1729 | #endif | |
1730 | return 0; | |
1731 | } | |
1732 | ||
1733 | static boolean | |
1734 | evax_bfd_print_private_bfd_data (abfd, file) | |
1735 | bfd *abfd; | |
1736 | void *file; | |
1737 | { | |
1738 | #if EVAX_DEBUG | |
1739 | evax_debug (1, "evax_bfd_print_private_bfd_data(%p)\n", abfd); | |
1740 | #endif | |
1741 | return 0; | |
1742 | } | |
1743 | ||
1744 | ||
1745 | /* Read in the dynamic symbols. */ | |
1746 | ||
1747 | static long | |
1748 | evax_canonicalize_dynamic_symtab (abfd, symbols) | |
1749 | bfd *abfd; | |
1750 | asymbol **symbols; | |
1751 | { | |
1752 | #if EVAX_DEBUG | |
1753 | evax_debug (1, "evax_canonicalize_dynamic_symtab(%p, <ret>)\n", abfd); | |
1754 | #endif | |
1755 | return 0L; | |
1756 | } | |
1757 | ||
1758 | ||
1759 | /* Get the amount of memory required to hold the dynamic relocs. */ | |
1760 | ||
1761 | static long | |
1762 | evax_get_dynamic_reloc_upper_bound (abfd) | |
1763 | bfd *abfd; | |
1764 | { | |
1765 | #if EVAX_DEBUG | |
1766 | evax_debug (1, "evax_get_dynamic_reloc_upper_bound(%p)\n", abfd); | |
1767 | #endif | |
1768 | return 0L; | |
1769 | } | |
1770 | ||
1771 | ||
1772 | /* Read in the dynamic relocs. */ | |
1773 | ||
1774 | static long | |
1775 | evax_canonicalize_dynamic_reloc (abfd, arel, symbols) | |
1776 | bfd *abfd; | |
1777 | arelent **arel; | |
1778 | asymbol **symbols; | |
1779 | { | |
1780 | #if EVAX_DEBUG | |
1781 | evax_debug (1, "evax_canonicalize_dynamic_reloc(%p)\n", abfd); | |
1782 | #endif | |
1783 | return 0L; | |
1784 | } |