1 |
/* vms.c -- BFD back-end for VAX (openVMS/VAX) and |
/* vms.c -- BFD back-end for VAX (openVMS/VAX) and |
2 |
EVAX (openVMS/Alpha) files. |
EVAX (openVMS/Alpha) files. |
3 |
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 |
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 |
4 |
Free Software Foundation, Inc. |
Free Software Foundation, Inc. |
5 |
|
|
6 |
Written by Klaus K"ampf (kkaempf@rmi.de) |
Written by Klaus K"ampf (kkaempf@rmi.de) |
26 |
|
|
27 |
#include "vms.h" |
#include "vms.h" |
28 |
|
|
29 |
static boolean vms_initialize PARAMS ((bfd *)); |
static bfd_boolean vms_initialize |
30 |
|
PARAMS ((bfd *)); |
31 |
static unsigned int priv_section_count; |
static unsigned int priv_section_count; |
32 |
static boolean fill_section_ptr PARAMS ((struct bfd_hash_entry *, PTR)); |
static bfd_boolean fill_section_ptr |
33 |
static boolean vms_fixup_sections PARAMS ((bfd *)); |
PARAMS ((struct bfd_hash_entry *, PTR)); |
34 |
static boolean copy_symbols PARAMS ((struct bfd_hash_entry *, PTR)); |
static bfd_boolean vms_fixup_sections |
35 |
|
PARAMS ((bfd *)); |
36 |
|
static bfd_boolean copy_symbols |
37 |
|
PARAMS ((struct bfd_hash_entry *, PTR)); |
38 |
static bfd_reloc_status_type reloc_nil |
static bfd_reloc_status_type reloc_nil |
39 |
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); |
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **)); |
40 |
static const struct bfd_target *vms_object_p PARAMS ((bfd *abfd)); |
static const struct bfd_target *vms_object_p |
41 |
static const struct bfd_target *vms_archive_p PARAMS ((bfd *abfd)); |
PARAMS ((bfd *abfd)); |
42 |
static boolean vms_mkobject PARAMS ((bfd *abfd)); |
static const struct bfd_target *vms_archive_p |
43 |
static boolean vms_write_object_contents PARAMS ((bfd *abfd)); |
PARAMS ((bfd *abfd)); |
44 |
static boolean vms_close_and_cleanup PARAMS ((bfd *abfd)); |
static bfd_boolean vms_mkobject |
45 |
static boolean vms_bfd_free_cached_info PARAMS ((bfd *abfd)); |
PARAMS ((bfd *abfd)); |
46 |
static boolean vms_new_section_hook PARAMS ((bfd *abfd, asection *section)); |
static bfd_boolean vms_write_object_contents |
47 |
static boolean vms_get_section_contents |
PARAMS ((bfd *abfd)); |
48 |
|
static bfd_boolean vms_close_and_cleanup |
49 |
|
PARAMS ((bfd *abfd)); |
50 |
|
static bfd_boolean vms_bfd_free_cached_info |
51 |
|
PARAMS ((bfd *abfd)); |
52 |
|
static bfd_boolean vms_new_section_hook |
53 |
|
PARAMS ((bfd *abfd, asection *section)); |
54 |
|
static bfd_boolean vms_get_section_contents |
55 |
PARAMS ((bfd *abfd, asection *section, PTR x1, file_ptr x2, |
PARAMS ((bfd *abfd, asection *section, PTR x1, file_ptr x2, |
56 |
bfd_size_type x3)); |
bfd_size_type x3)); |
57 |
static boolean vms_get_section_contents_in_window |
static bfd_boolean vms_get_section_contents_in_window |
58 |
PARAMS ((bfd *abfd, asection *section, bfd_window *w, file_ptr offset, |
PARAMS ((bfd *abfd, asection *section, bfd_window *w, file_ptr offset, |
59 |
bfd_size_type count)); |
bfd_size_type count)); |
60 |
static boolean vms_bfd_copy_private_bfd_data PARAMS ((bfd *src, bfd *dest)); |
static bfd_boolean vms_bfd_copy_private_bfd_data |
61 |
static boolean vms_bfd_copy_private_section_data |
PARAMS ((bfd *src, bfd *dest)); |
62 |
|
static bfd_boolean vms_bfd_copy_private_section_data |
63 |
PARAMS ((bfd *srcbfd, asection *srcsec, bfd *dstbfd, asection *dstsec)); |
PARAMS ((bfd *srcbfd, asection *srcsec, bfd *dstbfd, asection *dstsec)); |
64 |
static boolean vms_bfd_copy_private_symbol_data |
static bfd_boolean vms_bfd_copy_private_symbol_data |
65 |
PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym)); |
PARAMS ((bfd *ibfd, asymbol *isym, bfd *obfd, asymbol *osym)); |
66 |
static boolean vms_bfd_print_private_bfd_data |
static bfd_boolean vms_bfd_print_private_bfd_data |
67 |
PARAMS ((bfd *abfd, void *file)); |
PARAMS ((bfd *abfd, void *file)); |
68 |
static char *vms_core_file_failing_command PARAMS ((bfd *abfd)); |
static char *vms_core_file_failing_command |
69 |
static int vms_core_file_failing_signal PARAMS ((bfd *abfd)); |
PARAMS ((bfd *abfd)); |
70 |
static boolean vms_core_file_matches_executable_p |
static int vms_core_file_failing_signal |
71 |
|
PARAMS ((bfd *abfd)); |
72 |
|
static bfd_boolean vms_core_file_matches_executable_p |
73 |
PARAMS ((bfd *abfd, bfd *bbfd)); |
PARAMS ((bfd *abfd, bfd *bbfd)); |
74 |
static boolean vms_slurp_armap PARAMS ((bfd *abfd)); |
static bfd_boolean vms_slurp_armap |
75 |
static boolean vms_slurp_extended_name_table PARAMS ((bfd *abfd)); |
PARAMS ((bfd *abfd)); |
76 |
static boolean vms_construct_extended_name_table |
static bfd_boolean vms_slurp_extended_name_table |
77 |
|
PARAMS ((bfd *abfd)); |
78 |
|
static bfd_boolean vms_construct_extended_name_table |
79 |
PARAMS ((bfd *abfd, char **tabloc, bfd_size_type *tablen, |
PARAMS ((bfd *abfd, char **tabloc, bfd_size_type *tablen, |
80 |
const char **name)); |
const char **name)); |
81 |
static void vms_truncate_arname |
static void vms_truncate_arname |
82 |
PARAMS ((bfd *abfd, const char *pathname, char *arhdr)); |
PARAMS ((bfd *abfd, const char *pathname, char *arhdr)); |
83 |
static boolean vms_write_armap |
static bfd_boolean vms_write_armap |
84 |
PARAMS ((bfd *arch, unsigned int elength, struct orl *map, |
PARAMS ((bfd *arch, unsigned int elength, struct orl *map, |
85 |
unsigned int orl_count, int stridx)); |
unsigned int orl_count, int stridx)); |
86 |
static PTR vms_read_ar_hdr PARAMS ((bfd *abfd)); |
static PTR vms_read_ar_hdr |
87 |
static bfd *vms_get_elt_at_index PARAMS ((bfd *abfd, symindex index)); |
PARAMS ((bfd *abfd)); |
88 |
static bfd *vms_openr_next_archived_file PARAMS ((bfd *arch, bfd *prev)); |
static bfd *vms_get_elt_at_index |
89 |
static boolean vms_update_armap_timestamp PARAMS ((bfd *abfd)); |
PARAMS ((bfd *abfd, symindex index)); |
90 |
static int vms_generic_stat_arch_elt PARAMS ((bfd *, struct stat *)); |
static bfd *vms_openr_next_archived_file |
91 |
static long vms_get_symtab_upper_bound PARAMS ((bfd *abfd)); |
PARAMS ((bfd *arch, bfd *prev)); |
92 |
static long vms_get_symtab PARAMS ((bfd *abfd, asymbol **symbols)); |
static bfd_boolean vms_update_armap_timestamp |
93 |
|
PARAMS ((bfd *abfd)); |
94 |
|
static int vms_generic_stat_arch_elt |
95 |
|
PARAMS ((bfd *, struct stat *)); |
96 |
|
static long vms_get_symtab_upper_bound |
97 |
|
PARAMS ((bfd *abfd)); |
98 |
|
static long vms_canonicalize_symtab |
99 |
|
PARAMS ((bfd *abfd, asymbol **symbols)); |
100 |
static void vms_print_symbol |
static void vms_print_symbol |
101 |
PARAMS ((bfd *abfd, PTR file, asymbol *symbol, bfd_print_symbol_type how)); |
PARAMS ((bfd *abfd, PTR file, asymbol *symbol, bfd_print_symbol_type how)); |
102 |
static void vms_get_symbol_info |
static void vms_get_symbol_info |
103 |
PARAMS ((bfd *abfd, asymbol *symbol, symbol_info *ret)); |
PARAMS ((bfd *abfd, asymbol *symbol, symbol_info *ret)); |
104 |
static boolean vms_bfd_is_local_label_name PARAMS ((bfd *abfd, const char *)); |
static bfd_boolean vms_bfd_is_local_label_name |
105 |
static alent *vms_get_lineno PARAMS ((bfd *abfd, asymbol *symbol)); |
PARAMS ((bfd *abfd, const char *)); |
106 |
static boolean vms_find_nearest_line |
static alent *vms_get_lineno |
107 |
|
PARAMS ((bfd *abfd, asymbol *symbol)); |
108 |
|
static bfd_boolean vms_find_nearest_line |
109 |
PARAMS ((bfd *abfd, asection *section, asymbol **symbols, bfd_vma offset, |
PARAMS ((bfd *abfd, asection *section, asymbol **symbols, bfd_vma offset, |
110 |
const char **file, const char **func, unsigned int *line)); |
const char **file, const char **func, unsigned int *line)); |
111 |
static asymbol *vms_bfd_make_debug_symbol |
static asymbol *vms_bfd_make_debug_symbol |
112 |
PARAMS ((bfd *abfd, void *ptr, unsigned long size)); |
PARAMS ((bfd *abfd, void *ptr, unsigned long size)); |
113 |
static long vms_read_minisymbols |
static long vms_read_minisymbols |
114 |
PARAMS ((bfd *abfd, boolean dynamic, PTR *minisymsp, unsigned int *sizep)); |
PARAMS ((bfd *abfd, bfd_boolean dynamic, PTR *minisymsp, |
115 |
|
unsigned int *sizep)); |
116 |
static asymbol *vms_minisymbol_to_symbol |
static asymbol *vms_minisymbol_to_symbol |
117 |
PARAMS ((bfd *abfd, boolean dynamic, const PTR minisym, asymbol *sym)); |
PARAMS ((bfd *abfd, bfd_boolean dynamic, const PTR minisym, asymbol *sym)); |
118 |
static long vms_get_reloc_upper_bound PARAMS ((bfd *abfd, asection *sect)); |
static long vms_get_reloc_upper_bound |
119 |
|
PARAMS ((bfd *abfd, asection *sect)); |
120 |
static long vms_canonicalize_reloc |
static long vms_canonicalize_reloc |
121 |
PARAMS ((bfd *abfd, asection *srcsec, arelent **location, |
PARAMS ((bfd *abfd, asection *srcsec, arelent **location, |
122 |
asymbol **symbols)); |
asymbol **symbols)); |
123 |
static const struct reloc_howto_struct *vms_bfd_reloc_type_lookup |
static const struct reloc_howto_struct *vms_bfd_reloc_type_lookup |
124 |
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); |
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code)); |
125 |
static boolean vms_set_arch_mach |
static bfd_boolean vms_set_arch_mach |
126 |
PARAMS ((bfd *abfd, enum bfd_architecture arch, unsigned long mach)); |
PARAMS ((bfd *abfd, enum bfd_architecture arch, unsigned long mach)); |
127 |
static boolean vms_set_section_contents |
static bfd_boolean vms_set_section_contents |
128 |
PARAMS ((bfd *abfd, asection *section, PTR location, file_ptr offset, |
PARAMS ((bfd *abfd, asection *section, const PTR location, file_ptr offset, |
129 |
bfd_size_type count)); |
bfd_size_type count)); |
130 |
static int vms_sizeof_headers PARAMS ((bfd *abfd, boolean reloc)); |
static int vms_sizeof_headers |
131 |
|
PARAMS ((bfd *abfd, bfd_boolean reloc)); |
132 |
static bfd_byte *vms_bfd_get_relocated_section_contents |
static bfd_byte *vms_bfd_get_relocated_section_contents |
133 |
PARAMS ((bfd *abfd, struct bfd_link_info *link_info, |
PARAMS ((bfd *abfd, struct bfd_link_info *link_info, |
134 |
struct bfd_link_order *link_order, bfd_byte *data, |
struct bfd_link_order *link_order, bfd_byte *data, |
135 |
boolean relocateable, asymbol **symbols)); |
bfd_boolean relocatable, asymbol **symbols)); |
136 |
static boolean vms_bfd_relax_section |
static bfd_boolean vms_bfd_relax_section |
137 |
PARAMS ((bfd *abfd, asection *section, struct bfd_link_info *link_info, |
PARAMS ((bfd *abfd, asection *section, struct bfd_link_info *link_info, |
138 |
boolean *again)); |
bfd_boolean *again)); |
139 |
static boolean vms_bfd_gc_sections |
static bfd_boolean vms_bfd_gc_sections |
140 |
PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); |
PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); |
141 |
static boolean vms_bfd_merge_sections |
static bfd_boolean vms_bfd_merge_sections |
142 |
PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); |
PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); |
143 |
static struct bfd_link_hash_table *vms_bfd_link_hash_table_create |
static struct bfd_link_hash_table *vms_bfd_link_hash_table_create |
144 |
PARAMS ((bfd *abfd)); |
PARAMS ((bfd *abfd)); |
145 |
static void vms_bfd_link_hash_table_free |
static void vms_bfd_link_hash_table_free |
146 |
PARAMS ((struct bfd_link_hash_table *hash)); |
PARAMS ((struct bfd_link_hash_table *hash)); |
147 |
static boolean vms_bfd_link_add_symbols |
static bfd_boolean vms_bfd_link_add_symbols |
148 |
PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); |
PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); |
149 |
static boolean vms_bfd_final_link |
static bfd_boolean vms_bfd_final_link |
150 |
PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); |
PARAMS ((bfd *abfd, struct bfd_link_info *link_info)); |
151 |
static boolean vms_bfd_link_split_section |
static bfd_boolean vms_bfd_link_split_section |
152 |
PARAMS ((bfd *abfd, asection *section)); |
PARAMS ((bfd *abfd, asection *section)); |
153 |
static long vms_get_dynamic_symtab_upper_bound PARAMS ((bfd *abfd)); |
static long vms_get_dynamic_symtab_upper_bound |
154 |
|
PARAMS ((bfd *abfd)); |
155 |
static long vms_canonicalize_dynamic_symtab |
static long vms_canonicalize_dynamic_symtab |
156 |
PARAMS ((bfd *abfd, asymbol **symbols)); |
PARAMS ((bfd *abfd, asymbol **symbols)); |
157 |
static long vms_get_dynamic_reloc_upper_bound PARAMS ((bfd *abfd)); |
#define vms_get_synthetic_symtab _bfd_nodynamic_get_synthetic_symtab |
158 |
|
static long vms_get_dynamic_reloc_upper_bound |
159 |
|
PARAMS ((bfd *abfd)); |
160 |
static long vms_canonicalize_dynamic_reloc |
static long vms_canonicalize_dynamic_reloc |
161 |
PARAMS ((bfd *abfd, arelent **arel, asymbol **symbols)); |
PARAMS ((bfd *abfd, arelent **arel, asymbol **symbols)); |
162 |
static boolean vms_bfd_merge_private_bfd_data PARAMS ((bfd *ibfd, bfd *obfd)); |
static bfd_boolean vms_bfd_merge_private_bfd_data |
163 |
static boolean vms_bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags)); |
PARAMS ((bfd *ibfd, bfd *obfd)); |
164 |
|
static bfd_boolean vms_bfd_set_private_flags |
165 |
|
PARAMS ((bfd *abfd, flagword flags)); |
166 |
|
|
167 |
|
#define vms_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false) |
168 |
#define vms_make_empty_symbol _bfd_generic_make_empty_symbol |
#define vms_make_empty_symbol _bfd_generic_make_empty_symbol |
169 |
#define vms_bfd_link_just_syms _bfd_generic_link_just_syms |
#define vms_bfd_link_just_syms _bfd_generic_link_just_syms |
170 |
|
#define vms_bfd_is_group_section bfd_generic_is_group_section |
171 |
#define vms_bfd_discard_group bfd_generic_discard_group |
#define vms_bfd_discard_group bfd_generic_discard_group |
172 |
|
#define vms_section_already_linked \ |
173 |
|
_bfd_generic_section_already_linked |
174 |
|
#define vms_bfd_copy_private_header_data \ |
175 |
|
_bfd_generic_bfd_copy_private_header_data |
176 |
|
|
177 |
/*===========================================================================*/ |
/*===========================================================================*/ |
178 |
|
|
270 |
|
|
271 |
/* Initialize private data */ |
/* Initialize private data */ |
272 |
|
|
273 |
static boolean |
static bfd_boolean |
274 |
vms_initialize (abfd) |
vms_initialize (abfd) |
275 |
bfd *abfd; |
bfd *abfd; |
276 |
{ |
{ |
277 |
int i; |
int i; |
278 |
bfd_size_type amt; |
bfd_size_type amt; |
279 |
|
|
|
if (abfd->tdata.any != 0) |
|
|
return true; |
|
|
|
|
280 |
bfd_set_start_address (abfd, (bfd_vma) -1); |
bfd_set_start_address (abfd, (bfd_vma) -1); |
281 |
|
|
282 |
amt = sizeof (struct vms_private_data_struct); |
amt = sizeof (struct vms_private_data_struct); |
283 |
abfd->tdata.any = (struct vms_private_data_struct*) bfd_malloc (amt); |
abfd->tdata.any = (struct vms_private_data_struct*) bfd_alloc (abfd, amt); |
284 |
if (abfd->tdata.any == 0) |
if (abfd->tdata.any == 0) |
285 |
return false; |
return FALSE; |
286 |
|
|
287 |
#ifdef __ALPHA |
#ifdef __ALPHA |
288 |
PRIV (is_vax) = 0; |
PRIV (is_vax) = 0; |
293 |
PRIV (buf_size) = 0; |
PRIV (buf_size) = 0; |
294 |
PRIV (rec_length) = 0; |
PRIV (rec_length) = 0; |
295 |
PRIV (file_format) = FF_UNKNOWN; |
PRIV (file_format) = FF_UNKNOWN; |
296 |
PRIV (fixup_done) = false; |
PRIV (fixup_done) = FALSE; |
297 |
PRIV (sections) = NULL; |
PRIV (sections) = NULL; |
298 |
|
|
299 |
amt = sizeof (struct stack_struct) * STACKSIZE; |
amt = sizeof (struct stack_struct) * STACKSIZE; |
300 |
PRIV (stack) = (struct stack_struct *) bfd_malloc (amt); |
PRIV (stack) = (struct stack_struct *) bfd_alloc (abfd, amt); |
301 |
if (PRIV (stack) == 0) |
if (PRIV (stack) == 0) |
302 |
{ |
goto error_ret1; |
|
vms_init_no_mem1: |
|
|
free (abfd->tdata.any); |
|
|
abfd->tdata.any = 0; |
|
|
return false; |
|
|
} |
|
303 |
PRIV (stackptr) = 0; |
PRIV (stackptr) = 0; |
304 |
|
|
305 |
amt = sizeof (struct bfd_hash_table); |
amt = sizeof (struct bfd_hash_table); |
306 |
PRIV (vms_symbol_table) = (struct bfd_hash_table *) bfd_malloc (amt); |
PRIV (vms_symbol_table) = (struct bfd_hash_table *) bfd_alloc (abfd, amt); |
307 |
if (PRIV (vms_symbol_table) == 0) |
if (PRIV (vms_symbol_table) == 0) |
308 |
{ |
goto error_ret1; |
|
vms_init_no_mem2: |
|
|
free (PRIV (stack)); |
|
|
PRIV (stack) = 0; |
|
|
goto vms_init_no_mem1; |
|
|
} |
|
309 |
|
|
310 |
if (!bfd_hash_table_init (PRIV (vms_symbol_table), _bfd_vms_hash_newfunc)) |
if (!bfd_hash_table_init (PRIV (vms_symbol_table), _bfd_vms_hash_newfunc)) |
311 |
return false; |
goto error_ret1; |
312 |
|
|
313 |
amt = sizeof (struct location_struct) * LOCATION_SAVE_SIZE; |
amt = sizeof (struct location_struct) * LOCATION_SAVE_SIZE; |
314 |
PRIV (location_stack) = (struct location_struct *) bfd_malloc (amt); |
PRIV (location_stack) = (struct location_struct *) bfd_alloc (abfd, amt); |
315 |
if (PRIV (location_stack) == 0) |
if (PRIV (location_stack) == 0) |
316 |
{ |
goto error_ret2; |
|
vms_init_no_mem3: |
|
|
free (PRIV (vms_symbol_table)); |
|
|
PRIV (vms_symbol_table) = 0; |
|
|
goto vms_init_no_mem2; |
|
|
} |
|
317 |
|
|
318 |
for (i = 0; i < VMS_SECTION_COUNT; i++) |
for (i = 0; i < VMS_SECTION_COUNT; i++) |
319 |
PRIV (vms_section_table)[i] = NULL; |
PRIV (vms_section_table)[i] = NULL; |
320 |
|
|
321 |
PRIV (output_buf) = (unsigned char *) malloc (MAX_OUTREC_SIZE); |
amt = MAX_OUTREC_SIZE; |
322 |
|
PRIV (output_buf) = (unsigned char *) bfd_alloc (abfd, amt); |
323 |
if (PRIV (output_buf) == 0) |
if (PRIV (output_buf) == 0) |
324 |
{ |
goto error_ret2; |
325 |
free (PRIV (location_stack)); |
|
|
PRIV (location_stack) = 0; |
|
|
goto vms_init_no_mem3; |
|
|
} |
|
326 |
PRIV (push_level) = 0; |
PRIV (push_level) = 0; |
327 |
PRIV (pushed_size) = 0; |
PRIV (pushed_size) = 0; |
328 |
PRIV (length_pos) = 2; |
PRIV (length_pos) = 2; |
329 |
PRIV (output_size) = 0; |
PRIV (output_size) = 0; |
330 |
PRIV (output_alignment) = 1; |
PRIV (output_alignment) = 1; |
331 |
|
|
332 |
return true; |
return TRUE; |
333 |
|
|
334 |
|
error_ret2: |
335 |
|
bfd_hash_table_free (PRIV (vms_symbol_table)); |
336 |
|
error_ret1: |
337 |
|
bfd_release (abfd, abfd->tdata.any); |
338 |
|
abfd->tdata.any = 0; |
339 |
|
return FALSE; |
340 |
} |
} |
341 |
|
|
342 |
/* Fill symbol->section with section ptr |
/* Fill symbol->section with section ptr |
348 |
|
|
349 |
called from bfd_hash_traverse in vms_fixup_sections */ |
called from bfd_hash_traverse in vms_fixup_sections */ |
350 |
|
|
351 |
static boolean |
static bfd_boolean |
352 |
fill_section_ptr (entry, sections) |
fill_section_ptr (entry, sections) |
353 |
struct bfd_hash_entry *entry; |
struct bfd_hash_entry *entry; |
354 |
PTR sections; |
PTR sections; |
365 |
|
|
366 |
/* fill forward references (these contain section number, not section ptr). */ |
/* fill forward references (these contain section number, not section ptr). */ |
367 |
|
|
368 |
if ((unsigned int) sec < priv_section_count) |
if ((unsigned int) (size_t) sec < priv_section_count) |
369 |
{ |
{ |
370 |
sec = ((vms_symbol_entry *)entry)->symbol->section = |
sec = ((vms_symbol_entry *) entry)->symbol->section = |
371 |
((asection **)sections)[(int)sec]; |
((asection **) sections)[(unsigned int) (size_t) sec]; |
372 |
} |
} |
373 |
|
|
374 |
if (strcmp (sym->name, sec->name) == 0) |
if (strcmp (sym->name, sec->name) == 0) |
375 |
sym->flags |= BSF_SECTION_SYM; |
sym->flags |= BSF_SECTION_SYM; |
376 |
|
|
377 |
return true; |
return TRUE; |
378 |
} |
} |
379 |
|
|
380 |
/* Fixup sections |
/* Fixup sections |
386 |
alloc PRIV(sections) according to abfd->section_count |
alloc PRIV(sections) according to abfd->section_count |
387 |
copy abfd->sections to PRIV(sections) */ |
copy abfd->sections to PRIV(sections) */ |
388 |
|
|
389 |
static boolean |
static bfd_boolean |
390 |
vms_fixup_sections (abfd) |
vms_fixup_sections (abfd) |
391 |
bfd *abfd; |
bfd *abfd; |
392 |
{ |
{ |
393 |
if (PRIV (fixup_done)) |
if (PRIV (fixup_done)) |
394 |
return true; |
return TRUE; |
395 |
|
|
396 |
/* |
/* |
397 |
* traverse symbol table and fill in all section pointers |
* traverse symbol table and fill in all section pointers |
402 |
bfd_hash_traverse (PRIV (vms_symbol_table), fill_section_ptr, |
bfd_hash_traverse (PRIV (vms_symbol_table), fill_section_ptr, |
403 |
(PTR) (PRIV (sections))); |
(PTR) (PRIV (sections))); |
404 |
|
|
405 |
PRIV (fixup_done) = true; |
PRIV (fixup_done) = TRUE; |
406 |
|
|
407 |
return true; |
return TRUE; |
408 |
} |
} |
409 |
|
|
410 |
/*===========================================================================*/ |
/*===========================================================================*/ |
420 |
int prev_type; |
int prev_type; |
421 |
const struct bfd_target *target_vector = 0; |
const struct bfd_target *target_vector = 0; |
422 |
const bfd_arch_info_type *arch = 0; |
const bfd_arch_info_type *arch = 0; |
423 |
|
PTR tdata_save = abfd->tdata.any; |
424 |
|
bfd_vma saddr_save = bfd_get_start_address (abfd); |
425 |
|
|
426 |
#if VMS_DEBUG |
#if VMS_DEBUG |
427 |
vms_debug (1, "vms_object_p(%p)\n", abfd); |
vms_debug (1, "vms_object_p(%p)\n", abfd); |
428 |
#endif |
#endif |
429 |
|
|
430 |
if (!vms_initialize (abfd)) |
if (!vms_initialize (abfd)) |
431 |
{ |
goto error_ret; |
|
fprintf (stderr, "vms_initialize () failed !!\n"); |
|
|
return 0; |
|
|
} |
|
432 |
|
|
433 |
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET)) |
if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET)) |
434 |
{ |
goto err_wrong_format; |
|
bfd_set_error (bfd_error_file_truncated); |
|
|
return 0; |
|
|
} |
|
435 |
|
|
436 |
prev_type = -1; |
prev_type = -1; |
437 |
|
|
445 |
#if VMS_DEBUG |
#if VMS_DEBUG |
446 |
vms_debug (2, "next_record failed\n"); |
vms_debug (2, "next_record failed\n"); |
447 |
#endif |
#endif |
448 |
bfd_set_error (bfd_error_wrong_format); |
goto err_wrong_format; |
|
return 0; |
|
449 |
} |
} |
450 |
|
|
451 |
if ((prev_type == EOBJ_S_C_EGSD) |
if ((prev_type == EOBJ_S_C_EGSD) |
456 |
#if VMS_DEBUG |
#if VMS_DEBUG |
457 |
vms_debug (2, "vms_fixup_sections failed\n"); |
vms_debug (2, "vms_fixup_sections failed\n"); |
458 |
#endif |
#endif |
459 |
bfd_set_error (bfd_error_wrong_format); |
goto err_wrong_format; |
|
return 0; |
|
460 |
} |
} |
461 |
} |
} |
462 |
|
|
508 |
#if VMS_DEBUG |
#if VMS_DEBUG |
509 |
vms_debug (2, "slurp type %d failed with %d\n", prev_type, err); |
vms_debug (2, "slurp type %d failed with %d\n", prev_type, err); |
510 |
#endif |
#endif |
511 |
bfd_set_error (bfd_error_wrong_format); |
goto err_wrong_format; |
|
return 0; |
|
512 |
} |
} |
513 |
} |
} |
514 |
while ((prev_type != EOBJ_S_C_EEOM) && (prev_type != OBJ_S_C_EOM) && (prev_type != OBJ_S_C_EOMW)); |
while ((prev_type != EOBJ_S_C_EEOM) && (prev_type != OBJ_S_C_EOM) && (prev_type != OBJ_S_C_EOMW)); |
520 |
#if VMS_DEBUG |
#if VMS_DEBUG |
521 |
vms_debug (2, "vms_fixup_sections failed\n"); |
vms_debug (2, "vms_fixup_sections failed\n"); |
522 |
#endif |
#endif |
523 |
bfd_set_error (bfd_error_wrong_format); |
goto err_wrong_format; |
|
return 0; |
|
524 |
} |
} |
525 |
|
|
526 |
/* set arch_info to vax */ |
/* set arch_info to vax */ |
547 |
#if VMS_DEBUG |
#if VMS_DEBUG |
548 |
vms_debug (2, "arch not found\n"); |
vms_debug (2, "arch not found\n"); |
549 |
#endif |
#endif |
550 |
bfd_set_error (bfd_error_wrong_format); |
goto err_wrong_format; |
|
return 0; |
|
551 |
} |
} |
552 |
abfd->arch_info = arch; |
abfd->arch_info = arch; |
553 |
|
|
554 |
return target_vector; |
return target_vector; |
555 |
|
|
556 |
|
err_wrong_format: |
557 |
|
bfd_set_error (bfd_error_wrong_format); |
558 |
|
error_ret: |
559 |
|
if (abfd->tdata.any != tdata_save && abfd->tdata.any != NULL) |
560 |
|
bfd_release (abfd, abfd->tdata.any); |
561 |
|
abfd->tdata.any = tdata_save; |
562 |
|
bfd_set_start_address (abfd, saddr_save); |
563 |
|
return NULL; |
564 |
} |
} |
565 |
|
|
566 |
/* Check the format for a file being read. |
/* Check the format for a file being read. |
579 |
|
|
580 |
/* Set the format of a file being written. */ |
/* Set the format of a file being written. */ |
581 |
|
|
582 |
static boolean |
static bfd_boolean |
583 |
vms_mkobject (abfd) |
vms_mkobject (abfd) |
584 |
bfd *abfd; |
bfd *abfd; |
585 |
{ |
{ |
588 |
#endif |
#endif |
589 |
|
|
590 |
if (!vms_initialize (abfd)) |
if (!vms_initialize (abfd)) |
591 |
{ |
return 0; |
|
fprintf (stderr, "vms_initialize () failed !!\n"); |
|
|
return 0; |
|
|
} |
|
592 |
|
|
593 |
{ |
{ |
594 |
#ifdef __VAX |
#ifdef __VAX |
604 |
abfd->arch_info = arch; |
abfd->arch_info = arch; |
605 |
} |
} |
606 |
|
|
607 |
return true; |
return TRUE; |
608 |
} |
} |
609 |
|
|
610 |
/* Write cached information into a file being written, at bfd_close. */ |
/* Write cached information into a file being written, at bfd_close. */ |
611 |
|
|
612 |
static boolean |
static bfd_boolean |
613 |
vms_write_object_contents (abfd) |
vms_write_object_contents (abfd) |
614 |
bfd *abfd; |
bfd *abfd; |
615 |
{ |
{ |
622 |
if (PRIV (is_vax)) |
if (PRIV (is_vax)) |
623 |
{ |
{ |
624 |
if (_bfd_vms_write_hdr (abfd, OBJ_S_C_HDR) != 0) |
if (_bfd_vms_write_hdr (abfd, OBJ_S_C_HDR) != 0) |
625 |
return false; |
return FALSE; |
626 |
if (_bfd_vms_write_gsd (abfd, OBJ_S_C_GSD) != 0) |
if (_bfd_vms_write_gsd (abfd, OBJ_S_C_GSD) != 0) |
627 |
return false; |
return FALSE; |
628 |
if (_bfd_vms_write_tir (abfd, OBJ_S_C_TIR) != 0) |
if (_bfd_vms_write_tir (abfd, OBJ_S_C_TIR) != 0) |
629 |
return false; |
return FALSE; |
630 |
if (_bfd_vms_write_tbt (abfd, OBJ_S_C_TBT) != 0) |
if (_bfd_vms_write_tbt (abfd, OBJ_S_C_TBT) != 0) |
631 |
return false; |
return FALSE; |
632 |
if (_bfd_vms_write_dbg (abfd, OBJ_S_C_DBG) != 0) |
if (_bfd_vms_write_dbg (abfd, OBJ_S_C_DBG) != 0) |
633 |
return false; |
return FALSE; |
634 |
if (abfd->section_count > 255) |
if (abfd->section_count > 255) |
635 |
{ |
{ |
636 |
if (_bfd_vms_write_eom (abfd, OBJ_S_C_EOMW) != 0) |
if (_bfd_vms_write_eom (abfd, OBJ_S_C_EOMW) != 0) |
637 |
return false; |
return FALSE; |
638 |
} |
} |
639 |
else |
else |
640 |
{ |
{ |
641 |
if (_bfd_vms_write_eom (abfd, OBJ_S_C_EOM) != 0) |
if (_bfd_vms_write_eom (abfd, OBJ_S_C_EOM) != 0) |
642 |
return false; |
return FALSE; |
643 |
} |
} |
644 |
} |
} |
645 |
else |
else |
646 |
{ |
{ |
647 |
if (_bfd_vms_write_hdr (abfd, EOBJ_S_C_EMH) != 0) |
if (_bfd_vms_write_hdr (abfd, EOBJ_S_C_EMH) != 0) |
648 |
return false; |
return FALSE; |
649 |
if (_bfd_vms_write_gsd (abfd, EOBJ_S_C_EGSD) != 0) |
if (_bfd_vms_write_gsd (abfd, EOBJ_S_C_EGSD) != 0) |
650 |
return false; |
return FALSE; |
651 |
if (_bfd_vms_write_tir (abfd, EOBJ_S_C_ETIR) != 0) |
if (_bfd_vms_write_tir (abfd, EOBJ_S_C_ETIR) != 0) |
652 |
return false; |
return FALSE; |
653 |
if (_bfd_vms_write_tbt (abfd, EOBJ_S_C_ETBT) != 0) |
if (_bfd_vms_write_tbt (abfd, EOBJ_S_C_ETBT) != 0) |
654 |
return false; |
return FALSE; |
655 |
if (_bfd_vms_write_dbg (abfd, EOBJ_S_C_EDBG) != 0) |
if (_bfd_vms_write_dbg (abfd, EOBJ_S_C_EDBG) != 0) |
656 |
return false; |
return FALSE; |
657 |
if (_bfd_vms_write_eom (abfd, EOBJ_S_C_EEOM) != 0) |
if (_bfd_vms_write_eom (abfd, EOBJ_S_C_EEOM) != 0) |
658 |
return false; |
return FALSE; |
659 |
} |
} |
660 |
} |
} |
661 |
return true; |
return TRUE; |
662 |
} |
} |
663 |
|
|
664 |
/*-- 4.1, generic -----------------------------------------------------------*/ |
/*-- 4.1, generic -----------------------------------------------------------*/ |
665 |
|
|
666 |
/* Called when the BFD is being closed to do any necessary cleanup. */ |
/* Called when the BFD is being closed to do any necessary cleanup. */ |
667 |
|
|
668 |
static boolean |
static bfd_boolean |
669 |
vms_close_and_cleanup (abfd) |
vms_close_and_cleanup (abfd) |
670 |
bfd *abfd; |
bfd *abfd; |
671 |
{ |
{ |
|
asection *sec; |
|
|
vms_section *es, *es1; |
|
|
int i; |
|
|
|
|
672 |
#if VMS_DEBUG |
#if VMS_DEBUG |
673 |
vms_debug (1, "vms_close_and_cleanup(%p)\n", abfd); |
vms_debug (1, "vms_close_and_cleanup(%p)\n", abfd); |
674 |
#endif |
#endif |
675 |
if (abfd == 0) |
if (abfd == 0) |
676 |
return true; |
return TRUE; |
677 |
|
|
678 |
if (PRIV (vms_buf) != NULL) |
if (PRIV (vms_buf) != NULL) |
679 |
{ |
free (PRIV (vms_buf)); |
|
free (PRIV (vms_buf)); |
|
|
PRIV (vms_buf) = NULL; |
|
|
} |
|
|
PRIV (buf_size) = 0; |
|
|
|
|
|
if (PRIV (output_buf) != 0) |
|
|
{ |
|
|
free (PRIV (output_buf)); |
|
|
PRIV (output_buf) = 0; |
|
|
} |
|
|
|
|
|
sec = abfd->sections; |
|
|
while (sec != NULL) |
|
|
{ |
|
|
if (sec->contents) |
|
|
free (sec->contents); |
|
|
sec = sec->next; |
|
|
} |
|
680 |
|
|
681 |
if (PRIV (sections) != NULL) |
if (PRIV (sections) != NULL) |
682 |
{ |
free (PRIV (sections)); |
|
free (PRIV (sections)); |
|
|
PRIV (sections) = NULL; |
|
|
} |
|
683 |
|
|
684 |
if (PRIV (vms_symbol_table)) |
if (PRIV (vms_symbol_table)) |
685 |
{ |
bfd_hash_table_free (PRIV (vms_symbol_table)); |
|
bfd_hash_table_free (PRIV (vms_symbol_table)); |
|
|
PRIV (vms_symbol_table) = 0; |
|
|
} |
|
|
|
|
|
if (PRIV (stack)) |
|
|
{ |
|
|
free (PRIV (stack)); |
|
|
PRIV (stack) = 0; |
|
|
} |
|
|
|
|
|
if (PRIV (location_stack)) |
|
|
{ |
|
|
free (PRIV (location_stack)); |
|
|
PRIV (location_stack) = 0; |
|
|
} |
|
|
|
|
|
for (i = 0; i < VMS_SECTION_COUNT; i++) |
|
|
{ |
|
|
es = PRIV (vms_section_table)[i]; |
|
|
while (es != NULL) |
|
|
{ |
|
|
es1 = es->next; |
|
|
free (es); |
|
|
es = es1; |
|
|
} |
|
|
PRIV (vms_section_table)[i] = NULL; |
|
|
} |
|
686 |
|
|
687 |
free (abfd->tdata.any); |
bfd_release (abfd, abfd->tdata.any); |
688 |
abfd->tdata.any = NULL; |
abfd->tdata.any = NULL; |
689 |
|
|
690 |
return true; |
return TRUE; |
691 |
} |
} |
692 |
|
|
693 |
/* Ask the BFD to free all cached information. */ |
/* Ask the BFD to free all cached information. */ |
694 |
static boolean |
static bfd_boolean |
695 |
vms_bfd_free_cached_info (abfd) |
vms_bfd_free_cached_info (abfd) |
696 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
697 |
{ |
{ |
698 |
#if VMS_DEBUG |
#if VMS_DEBUG |
699 |
vms_debug (1, "vms_bfd_free_cached_info(%p)\n", abfd); |
vms_debug (1, "vms_bfd_free_cached_info(%p)\n", abfd); |
700 |
#endif |
#endif |
701 |
return true; |
return TRUE; |
702 |
} |
} |
703 |
|
|
704 |
/* Called when a new section is created. */ |
/* Called when a new section is created. */ |
705 |
|
|
706 |
static boolean |
static bfd_boolean |
707 |
vms_new_section_hook (abfd, section) |
vms_new_section_hook (abfd, section) |
708 |
bfd *abfd; |
bfd *abfd; |
709 |
asection *section; |
asection *section; |
723 |
amt *= sizeof (asection *); |
amt *= sizeof (asection *); |
724 |
PRIV (sections) = (asection **) bfd_realloc (PRIV (sections), amt); |
PRIV (sections) = (asection **) bfd_realloc (PRIV (sections), amt); |
725 |
if (PRIV (sections) == 0) |
if (PRIV (sections) == 0) |
726 |
return false; |
return FALSE; |
727 |
PRIV (section_count) = section_count; |
PRIV (section_count) = section_count; |
728 |
} |
} |
729 |
#if VMS_DEBUG |
#if VMS_DEBUG |
734 |
vms_debug (7, "%d: %s\n", section->index, section->name); |
vms_debug (7, "%d: %s\n", section->index, section->name); |
735 |
#endif |
#endif |
736 |
|
|
737 |
return true; |
return TRUE; |
738 |
} |
} |
739 |
|
|
740 |
/* Read the contents of a section. |
/* Read the contents of a section. |
741 |
buf points to a buffer of buf_size bytes to be filled with |
buf points to a buffer of buf_size bytes to be filled with |
742 |
section data (starting at offset into section) */ |
section data (starting at offset into section) */ |
743 |
|
|
744 |
static boolean |
static bfd_boolean |
745 |
vms_get_section_contents (abfd, section, buf, offset, buf_size) |
vms_get_section_contents (abfd, section, buf, offset, buf_size) |
746 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
747 |
asection *section ATTRIBUTE_UNUSED; |
asection *section ATTRIBUTE_UNUSED; |
756 |
|
|
757 |
/* shouldn't be called, since all sections are IN_MEMORY */ |
/* shouldn't be called, since all sections are IN_MEMORY */ |
758 |
|
|
759 |
return false; |
return FALSE; |
760 |
} |
} |
761 |
|
|
762 |
/* Read the contents of a section. |
/* Read the contents of a section. |
763 |
buf points to a buffer of buf_size bytes to be filled with |
buf points to a buffer of buf_size bytes to be filled with |
764 |
section data (starting at offset into section) */ |
section data (starting at offset into section) */ |
765 |
|
|
766 |
static boolean |
static bfd_boolean |
767 |
vms_get_section_contents_in_window (abfd, section, w, offset, count) |
vms_get_section_contents_in_window (abfd, section, w, offset, count) |
768 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
769 |
asection *section ATTRIBUTE_UNUSED; |
asection *section ATTRIBUTE_UNUSED; |
778 |
|
|
779 |
/* shouldn't be called, since all sections are IN_MEMORY */ |
/* shouldn't be called, since all sections are IN_MEMORY */ |
780 |
|
|
781 |
return false; |
return FALSE; |
782 |
} |
} |
783 |
|
|
784 |
/*-- Part 4.2, copy private data --------------------------------------------*/ |
/*-- Part 4.2, copy private data --------------------------------------------*/ |
786 |
/* Called to copy BFD general private data from one object file |
/* Called to copy BFD general private data from one object file |
787 |
to another. */ |
to another. */ |
788 |
|
|
789 |
static boolean |
static bfd_boolean |
790 |
vms_bfd_copy_private_bfd_data (src, dest) |
vms_bfd_copy_private_bfd_data (src, dest) |
791 |
bfd *src ATTRIBUTE_UNUSED; |
bfd *src ATTRIBUTE_UNUSED; |
792 |
bfd *dest ATTRIBUTE_UNUSED; |
bfd *dest ATTRIBUTE_UNUSED; |
794 |
#if VMS_DEBUG |
#if VMS_DEBUG |
795 |
vms_debug (1, "vms_bfd_copy_private_bfd_data(%p, %p)\n", src, dest); |
vms_debug (1, "vms_bfd_copy_private_bfd_data(%p, %p)\n", src, dest); |
796 |
#endif |
#endif |
797 |
return true; |
return TRUE; |
798 |
} |
} |
799 |
|
|
800 |
/* Merge private BFD information from the BFD @var{ibfd} to the |
/* Merge private BFD information from the BFD @var{ibfd} to the |
801 |
the output file BFD @var{obfd} when linking. Return <<true>> |
the output file BFD @var{obfd} when linking. Return <<TRUE>> |
802 |
on success, <<false>> on error. Possible error returns are: |
on success, <<FALSE>> on error. Possible error returns are: |
803 |
|
|
804 |
o <<bfd_error_no_memory>> - |
o <<bfd_error_no_memory>> - |
805 |
Not enough memory exists to create private data for @var{obfd}. */ |
Not enough memory exists to create private data for @var{obfd}. */ |
806 |
|
|
807 |
static boolean |
static bfd_boolean |
808 |
vms_bfd_merge_private_bfd_data (ibfd, obfd) |
vms_bfd_merge_private_bfd_data (ibfd, obfd) |
809 |
bfd *ibfd ATTRIBUTE_UNUSED; |
bfd *ibfd ATTRIBUTE_UNUSED; |
810 |
bfd *obfd ATTRIBUTE_UNUSED; |
bfd *obfd ATTRIBUTE_UNUSED; |
812 |
#if VMS_DEBUG |
#if VMS_DEBUG |
813 |
vms_debug (1,"vms_bfd_merge_private_bfd_data(%p, %p)\n", ibfd, obfd); |
vms_debug (1,"vms_bfd_merge_private_bfd_data(%p, %p)\n", ibfd, obfd); |
814 |
#endif |
#endif |
815 |
return true; |
return TRUE; |
816 |
} |
} |
817 |
|
|
818 |
/* Set private BFD flag information in the BFD @var{abfd}. |
/* Set private BFD flag information in the BFD @var{abfd}. |
819 |
Return <<true>> on success, <<false>> on error. Possible error |
Return <<TRUE>> on success, <<FALSE>> on error. Possible error |
820 |
returns are: |
returns are: |
821 |
|
|
822 |
o <<bfd_error_no_memory>> - |
o <<bfd_error_no_memory>> - |
823 |
Not enough memory exists to create private data for @var{obfd}. */ |
Not enough memory exists to create private data for @var{obfd}. */ |
824 |
|
|
825 |
static boolean |
static bfd_boolean |
826 |
vms_bfd_set_private_flags (abfd, flags) |
vms_bfd_set_private_flags (abfd, flags) |
827 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
828 |
flagword flags ATTRIBUTE_UNUSED; |
flagword flags ATTRIBUTE_UNUSED; |
830 |
#if VMS_DEBUG |
#if VMS_DEBUG |
831 |
vms_debug (1,"vms_bfd_set_private_flags(%p, %lx)\n", abfd, (long)flags); |
vms_debug (1,"vms_bfd_set_private_flags(%p, %lx)\n", abfd, (long)flags); |
832 |
#endif |
#endif |
833 |
return true; |
return TRUE; |
834 |
} |
} |
835 |
|
|
836 |
/* Called to copy BFD private section data from one object file |
/* Called to copy BFD private section data from one object file |
837 |
to another. */ |
to another. */ |
838 |
|
|
839 |
static boolean |
static bfd_boolean |
840 |
vms_bfd_copy_private_section_data (srcbfd, srcsec, dstbfd, dstsec) |
vms_bfd_copy_private_section_data (srcbfd, srcsec, dstbfd, dstsec) |
841 |
bfd *srcbfd ATTRIBUTE_UNUSED; |
bfd *srcbfd ATTRIBUTE_UNUSED; |
842 |
asection *srcsec ATTRIBUTE_UNUSED; |
asection *srcsec ATTRIBUTE_UNUSED; |
847 |
vms_debug (1, "vms_bfd_copy_private_section_data(%p, %s, %p, %s)\n", |
vms_debug (1, "vms_bfd_copy_private_section_data(%p, %s, %p, %s)\n", |
848 |
srcbfd, srcsec->name, dstbfd, dstsec->name); |
srcbfd, srcsec->name, dstbfd, dstsec->name); |
849 |
#endif |
#endif |
850 |
return true; |
return TRUE; |
851 |
} |
} |
852 |
|
|
853 |
/* Called to copy BFD private symbol data from one object file |
/* Called to copy BFD private symbol data from one object file |
854 |
to another. */ |
to another. */ |
855 |
|
|
856 |
static boolean |
static bfd_boolean |
857 |
vms_bfd_copy_private_symbol_data (ibfd, isym, obfd, osym) |
vms_bfd_copy_private_symbol_data (ibfd, isym, obfd, osym) |
858 |
bfd *ibfd ATTRIBUTE_UNUSED; |
bfd *ibfd ATTRIBUTE_UNUSED; |
859 |
asymbol *isym ATTRIBUTE_UNUSED; |
asymbol *isym ATTRIBUTE_UNUSED; |
864 |
vms_debug (1, "vms_bfd_copy_private_symbol_data(%p, %s, %p, %s)\n", |
vms_debug (1, "vms_bfd_copy_private_symbol_data(%p, %s, %p, %s)\n", |
865 |
ibfd, isym->name, obfd, osym->name); |
ibfd, isym->name, obfd, osym->name); |
866 |
#endif |
#endif |
867 |
return true; |
return TRUE; |
868 |
} |
} |
869 |
|
|
870 |
/*-- Part 4.3, core file ----------------------------------------------------*/ |
/*-- Part 4.3, core file ----------------------------------------------------*/ |
895 |
return 0; |
return 0; |
896 |
} |
} |
897 |
|
|
898 |
/* Return true if the core file attached to core_bfd was generated |
/* Return TRUE if the core file attached to core_bfd was generated |
899 |
by a run of the executable file attached to exec_bfd, false otherwise. */ |
by a run of the executable file attached to exec_bfd, FALSE otherwise. */ |
900 |
|
|
901 |
static boolean |
static bfd_boolean |
902 |
vms_core_file_matches_executable_p (abfd, bbfd) |
vms_core_file_matches_executable_p (abfd, bbfd) |
903 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
904 |
bfd *bbfd ATTRIBUTE_UNUSED; |
bfd *bbfd ATTRIBUTE_UNUSED; |
906 |
#if VMS_DEBUG |
#if VMS_DEBUG |
907 |
vms_debug (1, "vms_core_file_matches_executable_p(%p, %p)\n", abfd, bbfd); |
vms_debug (1, "vms_core_file_matches_executable_p(%p, %p)\n", abfd, bbfd); |
908 |
#endif |
#endif |
909 |
return false; |
return FALSE; |
910 |
} |
} |
911 |
|
|
912 |
/*-- Part 4.4, archive ------------------------------------------------------*/ |
/*-- Part 4.4, archive ------------------------------------------------------*/ |
913 |
|
|
914 |
/* ??? do something with an archive map. |
/* ??? do something with an archive map. |
915 |
Return false on error, true otherwise. */ |
Return FALSE on error, TRUE otherwise. */ |
916 |
|
|
917 |
static boolean |
static bfd_boolean |
918 |
vms_slurp_armap (abfd) |
vms_slurp_armap (abfd) |
919 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
920 |
{ |
{ |
921 |
#if VMS_DEBUG |
#if VMS_DEBUG |
922 |
vms_debug (1, "vms_slurp_armap(%p)\n", abfd); |
vms_debug (1, "vms_slurp_armap(%p)\n", abfd); |
923 |
#endif |
#endif |
924 |
return false; |
return FALSE; |
925 |
} |
} |
926 |
|
|
927 |
/* ??? do something with an extended name table. |
/* ??? do something with an extended name table. |
928 |
Return false on error, true otherwise. */ |
Return FALSE on error, TRUE otherwise. */ |
929 |
|
|
930 |
static boolean |
static bfd_boolean |
931 |
vms_slurp_extended_name_table (abfd) |
vms_slurp_extended_name_table (abfd) |
932 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
933 |
{ |
{ |
934 |
#if VMS_DEBUG |
#if VMS_DEBUG |
935 |
vms_debug (1, "vms_slurp_extended_name_table(%p)\n", abfd); |
vms_debug (1, "vms_slurp_extended_name_table(%p)\n", abfd); |
936 |
#endif |
#endif |
937 |
return false; |
return FALSE; |
938 |
} |
} |
939 |
|
|
940 |
/* ??? do something with an extended name table. |
/* ??? do something with an extended name table. |
941 |
Return false on error, true otherwise. */ |
Return FALSE on error, TRUE otherwise. */ |
942 |
|
|
943 |
static boolean |
static bfd_boolean |
944 |
vms_construct_extended_name_table (abfd, tabloc, tablen, name) |
vms_construct_extended_name_table (abfd, tabloc, tablen, name) |
945 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
946 |
char **tabloc ATTRIBUTE_UNUSED; |
char **tabloc ATTRIBUTE_UNUSED; |
950 |
#if VMS_DEBUG |
#if VMS_DEBUG |
951 |
vms_debug (1, "vms_construct_extended_name_table(%p)\n", abfd); |
vms_debug (1, "vms_construct_extended_name_table(%p)\n", abfd); |
952 |
#endif |
#endif |
953 |
return false; |
return FALSE; |
954 |
} |
} |
955 |
|
|
956 |
/* Truncate the name of an archive to match system-dependent restrictions */ |
/* Truncate the name of an archive to match system-dependent restrictions */ |
969 |
|
|
970 |
/* ??? write archive map */ |
/* ??? write archive map */ |
971 |
|
|
972 |
static boolean |
static bfd_boolean |
973 |
vms_write_armap (arch, elength, map, orl_count, stridx) |
vms_write_armap (arch, elength, map, orl_count, stridx) |
974 |
bfd *arch ATTRIBUTE_UNUSED; |
bfd *arch ATTRIBUTE_UNUSED; |
975 |
unsigned int elength ATTRIBUTE_UNUSED; |
unsigned int elength ATTRIBUTE_UNUSED; |
981 |
vms_debug (1, "vms_write_armap(%p, %d, %p, %d %d)\n", |
vms_debug (1, "vms_write_armap(%p, %d, %p, %d %d)\n", |
982 |
arch, elength, map, orl_count, stridx); |
arch, elength, map, orl_count, stridx); |
983 |
#endif |
#endif |
984 |
return true; |
return TRUE; |
985 |
} |
} |
986 |
|
|
987 |
/* Read archive header ??? */ |
/* Read archive header ??? */ |
1043 |
|
|
1044 |
/* This is a new function in bfd 2.5 */ |
/* This is a new function in bfd 2.5 */ |
1045 |
|
|
1046 |
static boolean |
static bfd_boolean |
1047 |
vms_update_armap_timestamp (abfd) |
vms_update_armap_timestamp (abfd) |
1048 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
1049 |
{ |
{ |
1050 |
#if VMS_DEBUG |
#if VMS_DEBUG |
1051 |
vms_debug (1, "vms_update_armap_timestamp(%p)\n", abfd); |
vms_debug (1, "vms_update_armap_timestamp(%p)\n", abfd); |
1052 |
#endif |
#endif |
1053 |
return true; |
return TRUE; |
1054 |
} |
} |
1055 |
|
|
1056 |
/*-- Part 4.5, symbols --------------------------------------------------------*/ |
/*-- Part 4.5, symbols --------------------------------------------------------*/ |
1072 |
|
|
1073 |
/* Copy symbols from hash table to symbol vector |
/* Copy symbols from hash table to symbol vector |
1074 |
|
|
1075 |
called from bfd_hash_traverse in vms_get_symtab |
called from bfd_hash_traverse in vms_canonicalize_symtab |
1076 |
init counter to 0 if entry == 0 */ |
init counter to 0 if entry == 0 */ |
1077 |
|
|
1078 |
static boolean |
static bfd_boolean |
1079 |
copy_symbols (entry, arg) |
copy_symbols (entry, arg) |
1080 |
struct bfd_hash_entry *entry; |
struct bfd_hash_entry *entry; |
1081 |
PTR arg; |
PTR arg; |
1087 |
else /* fill vector, inc counter */ |
else /* fill vector, inc counter */ |
1088 |
PRIV (symcache)[PRIV (symnum)++] = ((vms_symbol_entry *)entry)->symbol; |
PRIV (symcache)[PRIV (symnum)++] = ((vms_symbol_entry *)entry)->symbol; |
1089 |
|
|
1090 |
return true; |
return TRUE; |
1091 |
} |
} |
1092 |
|
|
1093 |
/* Read the symbols from the BFD abfd, and fills in the vector |
/* Read the symbols from the BFD abfd, and fills in the vector |
1096 |
return # of symbols read */ |
return # of symbols read */ |
1097 |
|
|
1098 |
static long |
static long |
1099 |
vms_get_symtab (abfd, symbols) |
vms_canonicalize_symtab (abfd, symbols) |
1100 |
bfd *abfd; |
bfd *abfd; |
1101 |
asymbol **symbols; |
asymbol **symbols; |
1102 |
{ |
{ |
1103 |
#if VMS_DEBUG |
#if VMS_DEBUG |
1104 |
vms_debug (1, "vms_get_symtab(%p, <ret>)\n", abfd); |
vms_debug (1, "vms_canonicalize_symtab(%p, <ret>)\n", abfd); |
1105 |
#endif |
#endif |
1106 |
|
|
1107 |
/* init counter */ |
/* init counter */ |
1210 |
return; |
return; |
1211 |
} |
} |
1212 |
|
|
1213 |
/* Return true if the given symbol sym in the BFD abfd is |
/* Return TRUE if the given symbol sym in the BFD abfd is |
1214 |
a compiler generated local label, else return false. */ |
a compiler generated local label, else return FALSE. */ |
1215 |
|
|
1216 |
static boolean |
static bfd_boolean |
1217 |
vms_bfd_is_local_label_name (abfd, name) |
vms_bfd_is_local_label_name (abfd, name) |
1218 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
1219 |
const char *name; |
const char *name; |
1241 |
return the name of the source file and the line nearest to the wanted |
return the name of the source file and the line nearest to the wanted |
1242 |
location. */ |
location. */ |
1243 |
|
|
1244 |
static boolean |
static bfd_boolean |
1245 |
vms_find_nearest_line (abfd, section, symbols, offset, file, func, line) |
vms_find_nearest_line (abfd, section, symbols, offset, file, func, line) |
1246 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
1247 |
asection *section ATTRIBUTE_UNUSED; |
asection *section ATTRIBUTE_UNUSED; |
1255 |
vms_debug (1, "vms_find_nearest_line(%p, %s, %p, %ld, <ret>, <ret>, <ret>)\n", |
vms_debug (1, "vms_find_nearest_line(%p, %s, %p, %ld, <ret>, <ret>, <ret>)\n", |
1256 |
abfd, section->name, symbols, (long int)offset); |
abfd, section->name, symbols, (long int)offset); |
1257 |
#endif |
#endif |
1258 |
return false; |
return FALSE; |
1259 |
} |
} |
1260 |
|
|
1261 |
/* Back-door to allow format-aware applications to create debug symbols |
/* Back-door to allow format-aware applications to create debug symbols |
1281 |
static long |
static long |
1282 |
vms_read_minisymbols (abfd, dynamic, minisymsp, sizep) |
vms_read_minisymbols (abfd, dynamic, minisymsp, sizep) |
1283 |
bfd *abfd; |
bfd *abfd; |
1284 |
boolean dynamic; |
bfd_boolean dynamic; |
1285 |
PTR *minisymsp; |
PTR *minisymsp; |
1286 |
unsigned int *sizep; |
unsigned int *sizep; |
1287 |
{ |
{ |
1298 |
static asymbol * |
static asymbol * |
1299 |
vms_minisymbol_to_symbol (abfd, dynamic, minisym, sym) |
vms_minisymbol_to_symbol (abfd, dynamic, minisym, sym) |
1300 |
bfd *abfd; |
bfd *abfd; |
1301 |
boolean dynamic; |
bfd_boolean dynamic; |
1302 |
const PTR minisym; |
const PTR minisym; |
1303 |
asymbol *sym; |
asymbol *sym; |
1304 |
{ |
{ |
1341 |
#if VMS_DEBUG |
#if VMS_DEBUG |
1342 |
vms_debug (1, "vms_canonicalize_reloc(%p, %s, <ret>, <ret>)\n", abfd, section->name); |
vms_debug (1, "vms_canonicalize_reloc(%p, %s, <ret>, <ret>)\n", abfd, section->name); |
1343 |
#endif |
#endif |
1344 |
return false; |
return FALSE; |
1345 |
} |
} |
1346 |
|
|
1347 |
/*---------------------------------------------------------------------------*/ |
/*---------------------------------------------------------------------------*/ |
1384 |
0, /* rightshift */ |
0, /* rightshift */ |
1385 |
0, /* size (0 = byte, 1 = short, 2 = long) */ |
0, /* size (0 = byte, 1 = short, 2 = long) */ |
1386 |
8, /* bitsize */ |
8, /* bitsize */ |
1387 |
true, /* pc_relative */ |
TRUE, /* pc_relative */ |
1388 |
0, /* bitpos */ |
0, /* bitpos */ |
1389 |
complain_overflow_dont, /* complain_on_overflow */ |
complain_overflow_dont, /* complain_on_overflow */ |
1390 |
reloc_nil, /* special_function */ |
reloc_nil, /* special_function */ |
1391 |
"IGNORE", /* name */ |
"IGNORE", /* name */ |
1392 |
true, /* partial_inplace */ |
TRUE, /* partial_inplace */ |
1393 |
0, /* src_mask */ |
0, /* src_mask */ |
1394 |
0, /* dst_mask */ |
0, /* dst_mask */ |
1395 |
true), /* pcrel_offset */ |
TRUE), /* pcrel_offset */ |
1396 |
|
|
1397 |
/* A 64 bit reference to a symbol. */ |
/* A 64 bit reference to a symbol. */ |
1398 |
HOWTO (ALPHA_R_REFQUAD, /* type */ |
HOWTO (ALPHA_R_REFQUAD, /* type */ |
1399 |
0, /* rightshift */ |
0, /* rightshift */ |
1400 |
4, /* size (0 = byte, 1 = short, 2 = long) */ |
4, /* size (0 = byte, 1 = short, 2 = long) */ |
1401 |
64, /* bitsize */ |
64, /* bitsize */ |
1402 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
1403 |
0, /* bitpos */ |
0, /* bitpos */ |
1404 |
complain_overflow_bitfield, /* complain_on_overflow */ |
complain_overflow_bitfield, /* complain_on_overflow */ |
1405 |
reloc_nil, /* special_function */ |
reloc_nil, /* special_function */ |
1406 |
"REFQUAD", /* name */ |
"REFQUAD", /* name */ |
1407 |
true, /* partial_inplace */ |
TRUE, /* partial_inplace */ |
1408 |
MINUS_ONE, /* src_mask */ |
MINUS_ONE, /* src_mask */ |
1409 |
MINUS_ONE, /* dst_mask */ |
MINUS_ONE, /* dst_mask */ |
1410 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
1411 |
|
|
1412 |
/* A 21 bit branch. The native assembler generates these for |
/* A 21 bit branch. The native assembler generates these for |
1413 |
branches within the text segment, and also fills in the PC |
branches within the text segment, and also fills in the PC |
1416 |
2, /* rightshift */ |
2, /* rightshift */ |
1417 |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
1418 |
21, /* bitsize */ |
21, /* bitsize */ |
1419 |
true, /* pc_relative */ |
TRUE, /* pc_relative */ |
1420 |
0, /* bitpos */ |
0, /* bitpos */ |
1421 |
complain_overflow_signed, /* complain_on_overflow */ |
complain_overflow_signed, /* complain_on_overflow */ |
1422 |
reloc_nil, /* special_function */ |
reloc_nil, /* special_function */ |
1423 |
"BRADDR", /* name */ |
"BRADDR", /* name */ |
1424 |
true, /* partial_inplace */ |
TRUE, /* partial_inplace */ |
1425 |
0x1fffff, /* src_mask */ |
0x1fffff, /* src_mask */ |
1426 |
0x1fffff, /* dst_mask */ |
0x1fffff, /* dst_mask */ |
1427 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
1428 |
|
|
1429 |
/* A hint for a jump to a register. */ |
/* A hint for a jump to a register. */ |
1430 |
HOWTO (ALPHA_R_HINT, /* type */ |
HOWTO (ALPHA_R_HINT, /* type */ |
1431 |
2, /* rightshift */ |
2, /* rightshift */ |
1432 |
1, /* size (0 = byte, 1 = short, 2 = long) */ |
1, /* size (0 = byte, 1 = short, 2 = long) */ |
1433 |
14, /* bitsize */ |
14, /* bitsize */ |
1434 |
true, /* pc_relative */ |
TRUE, /* pc_relative */ |
1435 |
0, /* bitpos */ |
0, /* bitpos */ |
1436 |
complain_overflow_dont, /* complain_on_overflow */ |
complain_overflow_dont, /* complain_on_overflow */ |
1437 |
reloc_nil, /* special_function */ |
reloc_nil, /* special_function */ |
1438 |
"HINT", /* name */ |
"HINT", /* name */ |
1439 |
true, /* partial_inplace */ |
TRUE, /* partial_inplace */ |
1440 |
0x3fff, /* src_mask */ |
0x3fff, /* src_mask */ |
1441 |
0x3fff, /* dst_mask */ |
0x3fff, /* dst_mask */ |
1442 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
1443 |
|
|
1444 |
/* 16 bit PC relative offset. */ |
/* 16 bit PC relative offset. */ |
1445 |
HOWTO (ALPHA_R_SREL16, /* type */ |
HOWTO (ALPHA_R_SREL16, /* type */ |
1446 |
0, /* rightshift */ |
0, /* rightshift */ |
1447 |
1, /* size (0 = byte, 1 = short, 2 = long) */ |
1, /* size (0 = byte, 1 = short, 2 = long) */ |
1448 |
16, /* bitsize */ |
16, /* bitsize */ |
1449 |
true, /* pc_relative */ |
TRUE, /* pc_relative */ |
1450 |
0, /* bitpos */ |
0, /* bitpos */ |
1451 |
complain_overflow_signed, /* complain_on_overflow */ |
complain_overflow_signed, /* complain_on_overflow */ |
1452 |
reloc_nil, /* special_function */ |
reloc_nil, /* special_function */ |
1453 |
"SREL16", /* name */ |
"SREL16", /* name */ |
1454 |
true, /* partial_inplace */ |
TRUE, /* partial_inplace */ |
1455 |
0xffff, /* src_mask */ |
0xffff, /* src_mask */ |
1456 |
0xffff, /* dst_mask */ |
0xffff, /* dst_mask */ |
1457 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
1458 |
|
|
1459 |
/* 32 bit PC relative offset. */ |
/* 32 bit PC relative offset. */ |
1460 |
HOWTO (ALPHA_R_SREL32, /* type */ |
HOWTO (ALPHA_R_SREL32, /* type */ |
1461 |
0, /* rightshift */ |
0, /* rightshift */ |
1462 |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
1463 |
32, /* bitsize */ |
32, /* bitsize */ |
1464 |
true, /* pc_relative */ |
TRUE, /* pc_relative */ |
1465 |
0, /* bitpos */ |
0, /* bitpos */ |
1466 |
complain_overflow_signed, /* complain_on_overflow */ |
complain_overflow_signed, /* complain_on_overflow */ |
1467 |
reloc_nil, /* special_function */ |
reloc_nil, /* special_function */ |
1468 |
"SREL32", /* name */ |
"SREL32", /* name */ |
1469 |
true, /* partial_inplace */ |
TRUE, /* partial_inplace */ |
1470 |
0xffffffff, /* src_mask */ |
0xffffffff, /* src_mask */ |
1471 |
0xffffffff, /* dst_mask */ |
0xffffffff, /* dst_mask */ |
1472 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
1473 |
|
|
1474 |
/* A 64 bit PC relative offset. */ |
/* A 64 bit PC relative offset. */ |
1475 |
HOWTO (ALPHA_R_SREL64, /* type */ |
HOWTO (ALPHA_R_SREL64, /* type */ |
1476 |
0, /* rightshift */ |
0, /* rightshift */ |
1477 |
4, /* size (0 = byte, 1 = short, 2 = long) */ |
4, /* size (0 = byte, 1 = short, 2 = long) */ |
1478 |
64, /* bitsize */ |
64, /* bitsize */ |
1479 |
true, /* pc_relative */ |
TRUE, /* pc_relative */ |
1480 |
0, /* bitpos */ |
0, /* bitpos */ |
1481 |
complain_overflow_signed, /* complain_on_overflow */ |
complain_overflow_signed, /* complain_on_overflow */ |
1482 |
reloc_nil, /* special_function */ |
reloc_nil, /* special_function */ |
1483 |
"SREL64", /* name */ |
"SREL64", /* name */ |
1484 |
true, /* partial_inplace */ |
TRUE, /* partial_inplace */ |
1485 |
MINUS_ONE, /* src_mask */ |
MINUS_ONE, /* src_mask */ |
1486 |
MINUS_ONE, /* dst_mask */ |
MINUS_ONE, /* dst_mask */ |
1487 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
1488 |
|
|
1489 |
/* Push a value on the reloc evaluation stack. */ |
/* Push a value on the reloc evaluation stack. */ |
1490 |
HOWTO (ALPHA_R_OP_PUSH, /* type */ |
HOWTO (ALPHA_R_OP_PUSH, /* type */ |
1491 |
0, /* rightshift */ |
0, /* rightshift */ |
1492 |
0, /* size (0 = byte, 1 = short, 2 = long) */ |
0, /* size (0 = byte, 1 = short, 2 = long) */ |
1493 |
0, /* bitsize */ |
0, /* bitsize */ |
1494 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
1495 |
0, /* bitpos */ |
0, /* bitpos */ |
1496 |
complain_overflow_dont, /* complain_on_overflow */ |
complain_overflow_dont, /* complain_on_overflow */ |
1497 |
reloc_nil, /* special_function */ |
reloc_nil, /* special_function */ |
1498 |
"OP_PUSH", /* name */ |
"OP_PUSH", /* name */ |
1499 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
1500 |
0, /* src_mask */ |
0, /* src_mask */ |
1501 |
0, /* dst_mask */ |
0, /* dst_mask */ |
1502 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
1503 |
|
|
1504 |
/* Store the value from the stack at the given address. Store it in |
/* Store the value from the stack at the given address. Store it in |
1505 |
a bitfield of size r_size starting at bit position r_offset. */ |
a bitfield of size r_size starting at bit position r_offset. */ |
1507 |
0, /* rightshift */ |
0, /* rightshift */ |
1508 |
4, /* size (0 = byte, 1 = short, 2 = long) */ |
4, /* size (0 = byte, 1 = short, 2 = long) */ |
1509 |
64, /* bitsize */ |
64, /* bitsize */ |
1510 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
1511 |
0, /* bitpos */ |
0, /* bitpos */ |
1512 |
complain_overflow_dont, /* complain_on_overflow */ |
complain_overflow_dont, /* complain_on_overflow */ |
1513 |
reloc_nil, /* special_function */ |
reloc_nil, /* special_function */ |
1514 |
"OP_STORE", /* name */ |
"OP_STORE", /* name */ |
1515 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
1516 |
0, /* src_mask */ |
0, /* src_mask */ |
1517 |
MINUS_ONE, /* dst_mask */ |
MINUS_ONE, /* dst_mask */ |
1518 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
1519 |
|
|
1520 |
/* Subtract the reloc address from the value on the top of the |
/* Subtract the reloc address from the value on the top of the |
1521 |
relocation stack. */ |
relocation stack. */ |
1523 |
0, /* rightshift */ |
0, /* rightshift */ |
1524 |
0, /* size (0 = byte, 1 = short, 2 = long) */ |
0, /* size (0 = byte, 1 = short, 2 = long) */ |
1525 |
0, /* bitsize */ |
0, /* bitsize */ |
1526 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
1527 |
0, /* bitpos */ |
0, /* bitpos */ |
1528 |
complain_overflow_dont, /* complain_on_overflow */ |
complain_overflow_dont, /* complain_on_overflow */ |
1529 |
reloc_nil, /* special_function */ |
reloc_nil, /* special_function */ |
1530 |
"OP_PSUB", /* name */ |
"OP_PSUB", /* name */ |
1531 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
1532 |
0, /* src_mask */ |
0, /* src_mask */ |
1533 |
0, /* dst_mask */ |
0, /* dst_mask */ |
1534 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
1535 |
|
|
1536 |
/* Shift the value on the top of the relocation stack right by the |
/* Shift the value on the top of the relocation stack right by the |
1537 |
given value. */ |
given value. */ |
1539 |
0, /* rightshift */ |
0, /* rightshift */ |
1540 |
0, /* size (0 = byte, 1 = short, 2 = long) */ |
0, /* size (0 = byte, 1 = short, 2 = long) */ |
1541 |
0, /* bitsize */ |
0, /* bitsize */ |
1542 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
1543 |
0, /* bitpos */ |
0, /* bitpos */ |
1544 |
complain_overflow_dont, /* complain_on_overflow */ |
complain_overflow_dont, /* complain_on_overflow */ |
1545 |
reloc_nil, /* special_function */ |
reloc_nil, /* special_function */ |
1546 |
"OP_PRSHIFT", /* name */ |
"OP_PRSHIFT", /* name */ |
1547 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
1548 |
0, /* src_mask */ |
0, /* src_mask */ |
1549 |
0, /* dst_mask */ |
0, /* dst_mask */ |
1550 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
1551 |
|
|
1552 |
/* Hack. Linkage is done by linker. */ |
/* Hack. Linkage is done by linker. */ |
1553 |
HOWTO (ALPHA_R_LINKAGE, /* type */ |
HOWTO (ALPHA_R_LINKAGE, /* type */ |
1554 |
0, /* rightshift */ |
0, /* rightshift */ |
1555 |
8, /* size (0 = byte, 1 = short, 2 = long) */ |
8, /* size (0 = byte, 1 = short, 2 = long) */ |
1556 |
256, /* bitsize */ |
256, /* bitsize */ |
1557 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
1558 |
0, /* bitpos */ |
0, /* bitpos */ |
1559 |
complain_overflow_dont, /* complain_on_overflow */ |
complain_overflow_dont, /* complain_on_overflow */ |
1560 |
reloc_nil, /* special_function */ |
reloc_nil, /* special_function */ |
1561 |
"LINKAGE", /* name */ |
"LINKAGE", /* name */ |
1562 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
1563 |
0, /* src_mask */ |
0, /* src_mask */ |
1564 |
0, /* dst_mask */ |
0, /* dst_mask */ |
1565 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
1566 |
|
|
1567 |
/* A 32 bit reference to a symbol. */ |
/* A 32 bit reference to a symbol. */ |
1568 |
HOWTO (ALPHA_R_REFLONG, /* type */ |
HOWTO (ALPHA_R_REFLONG, /* type */ |
1569 |
0, /* rightshift */ |
0, /* rightshift */ |
1570 |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
2, /* size (0 = byte, 1 = short, 2 = long) */ |
1571 |
32, /* bitsize */ |
32, /* bitsize */ |
1572 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
1573 |
0, /* bitpos */ |
0, /* bitpos */ |
1574 |
complain_overflow_bitfield, /* complain_on_overflow */ |
complain_overflow_bitfield, /* complain_on_overflow */ |
1575 |
reloc_nil, /* special_function */ |
reloc_nil, /* special_function */ |
1576 |
"REFLONG", /* name */ |
"REFLONG", /* name */ |
1577 |
true, /* partial_inplace */ |
TRUE, /* partial_inplace */ |
1578 |
0xffffffff, /* src_mask */ |
0xffffffff, /* src_mask */ |
1579 |
0xffffffff, /* dst_mask */ |
0xffffffff, /* dst_mask */ |
1580 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
1581 |
|
|
1582 |
/* A 64 bit reference to a procedure, written as 32 bit value. */ |
/* A 64 bit reference to a procedure, written as 32 bit value. */ |
1583 |
HOWTO (ALPHA_R_CODEADDR, /* type */ |
HOWTO (ALPHA_R_CODEADDR, /* type */ |
1584 |
0, /* rightshift */ |
0, /* rightshift */ |
1585 |
4, /* size (0 = byte, 1 = short, 2 = long) */ |
4, /* size (0 = byte, 1 = short, 2 = long) */ |
1586 |
64, /* bitsize */ |
64, /* bitsize */ |
1587 |
false, /* pc_relative */ |
FALSE, /* pc_relative */ |
1588 |
0, /* bitpos */ |
0, /* bitpos */ |
1589 |
complain_overflow_signed,/* complain_on_overflow */ |
complain_overflow_signed,/* complain_on_overflow */ |
1590 |
reloc_nil, /* special_function */ |
reloc_nil, /* special_function */ |
1591 |
"CODEADDR", /* name */ |
"CODEADDR", /* name */ |
1592 |
false, /* partial_inplace */ |
FALSE, /* partial_inplace */ |
1593 |
0xffffffff, /* src_mask */ |
0xffffffff, /* src_mask */ |
1594 |
0xffffffff, /* dst_mask */ |
0xffffffff, /* dst_mask */ |
1595 |
false), /* pcrel_offset */ |
FALSE), /* pcrel_offset */ |
1596 |
|
|
1597 |
}; |
}; |
1598 |
|
|
1639 |
Find the correct pointer to a structure and insert it into the arch_info |
Find the correct pointer to a structure and insert it into the arch_info |
1640 |
pointer. */ |
pointer. */ |
1641 |
|
|
1642 |
static boolean |
static bfd_boolean |
1643 |
vms_set_arch_mach (abfd, arch, mach) |
vms_set_arch_mach (abfd, arch, mach) |
1644 |
bfd *abfd; |
bfd *abfd; |
1645 |
enum bfd_architecture arch ATTRIBUTE_UNUSED; |
enum bfd_architecture arch ATTRIBUTE_UNUSED; |
1650 |
#endif |
#endif |
1651 |
abfd->arch_info = bfd_scan_arch("alpha"); |
abfd->arch_info = bfd_scan_arch("alpha"); |
1652 |
|
|
1653 |
return true; |
return TRUE; |
1654 |
} |
} |
1655 |
|
|
1656 |
/* Sets the contents of the section section in BFD abfd to the data starting |
/* Sets the contents of the section section in BFD abfd to the data starting |
1657 |
in memory at data. The data is written to the output section starting at |
in memory at data. The data is written to the output section starting at |
1658 |
offset offset for count bytes. |
offset offset for count bytes. |
1659 |
|
|
1660 |
Normally true is returned, else false. Possible error returns are: |
Normally TRUE is returned, else FALSE. Possible error returns are: |
1661 |
o bfd_error_no_contents - The output section does not have the |
o bfd_error_no_contents - The output section does not have the |
1662 |
SEC_HAS_CONTENTS attribute, so nothing can be written to it. |
SEC_HAS_CONTENTS attribute, so nothing can be written to it. |
1663 |
o and some more too */ |
o and some more too */ |
1664 |
|
|
1665 |
static boolean |
static bfd_boolean |
1666 |
vms_set_section_contents (abfd, section, location, offset, count) |
vms_set_section_contents (abfd, section, location, offset, count) |
1667 |
bfd *abfd; |
bfd *abfd; |
1668 |
asection *section; |
asection *section; |
1669 |
PTR location; |
const PTR location; |
1670 |
file_ptr offset; |
file_ptr offset; |
1671 |
bfd_size_type count; |
bfd_size_type count; |
1672 |
{ |
{ |
1673 |
#if VMS_DEBUG |
#if VMS_DEBUG |
1674 |
vms_debug (1, "vms_set_section_contents(%p, sec %s, loc %p, off %ld, count %d)\n", |
vms_debug (1, "vms_set_section_contents(%p, sec %s, loc %p, off %ld, count %d)\n", |
1675 |
abfd, section->name, location, (long int)offset, (int)count); |
abfd, section->name, location, (long int)offset, (int)count); |
1676 |
vms_debug (2, "secraw %d, seccooked %d\n", (int)section->_raw_size, (int)section->_cooked_size); |
vms_debug (2, "size %d\n", (int) section->size); |
1677 |
#endif |
#endif |
1678 |
return _bfd_save_vms_section(abfd, section, location, offset, count); |
return _bfd_save_vms_section(abfd, section, location, offset, count); |
1679 |
} |
} |
1685 |
static int |
static int |
1686 |
vms_sizeof_headers (abfd, reloc) |
vms_sizeof_headers (abfd, reloc) |
1687 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
1688 |
boolean reloc ATTRIBUTE_UNUSED; |
bfd_boolean reloc ATTRIBUTE_UNUSED; |
1689 |
{ |
{ |
1690 |
#if VMS_DEBUG |
#if VMS_DEBUG |
1691 |
vms_debug (1, "vms_sizeof_headers(%p, %s)\n", abfd, (reloc)?"True":"False"); |
vms_debug (1, "vms_sizeof_headers(%p, %s)\n", abfd, (reloc)?"True":"False"); |
1698 |
|
|
1699 |
static bfd_byte * |
static bfd_byte * |
1700 |
vms_bfd_get_relocated_section_contents (abfd, link_info, link_order, data, |
vms_bfd_get_relocated_section_contents (abfd, link_info, link_order, data, |
1701 |
relocateable, symbols) |
relocatable, symbols) |
1702 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
1703 |
struct bfd_link_info *link_info ATTRIBUTE_UNUSED; |
struct bfd_link_info *link_info ATTRIBUTE_UNUSED; |
1704 |
struct bfd_link_order *link_order ATTRIBUTE_UNUSED; |
struct bfd_link_order *link_order ATTRIBUTE_UNUSED; |
1705 |
bfd_byte *data ATTRIBUTE_UNUSED; |
bfd_byte *data ATTRIBUTE_UNUSED; |
1706 |
boolean relocateable ATTRIBUTE_UNUSED; |
bfd_boolean relocatable ATTRIBUTE_UNUSED; |
1707 |
asymbol **symbols ATTRIBUTE_UNUSED; |
asymbol **symbols ATTRIBUTE_UNUSED; |
1708 |
{ |
{ |
1709 |
#if VMS_DEBUG |
#if VMS_DEBUG |
1710 |
vms_debug (1, "vms_bfd_get_relocated_section_contents(%p, %p, %p, %p, %s, %p)\n", |
vms_debug (1, "vms_bfd_get_relocated_section_contents(%p, %p, %p, %p, %s, %p)\n", |
1711 |
abfd, link_info, link_order, data, (relocateable)?"True":"False", symbols); |
abfd, link_info, link_order, data, (relocatable)?"True":"False", symbols); |
1712 |
#endif |
#endif |
1713 |
return 0; |
return 0; |
1714 |
} |
} |
1715 |
|
|
1716 |
/* ??? */ |
/* ??? */ |
1717 |
|
|
1718 |
static boolean |
static bfd_boolean |
1719 |
vms_bfd_relax_section (abfd, section, link_info, again) |
vms_bfd_relax_section (abfd, section, link_info, again) |
1720 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
1721 |
asection *section ATTRIBUTE_UNUSED; |
asection *section ATTRIBUTE_UNUSED; |
1722 |
struct bfd_link_info *link_info ATTRIBUTE_UNUSED; |
struct bfd_link_info *link_info ATTRIBUTE_UNUSED; |
1723 |
boolean *again ATTRIBUTE_UNUSED; |
bfd_boolean *again ATTRIBUTE_UNUSED; |
1724 |
{ |
{ |
1725 |
#if VMS_DEBUG |
#if VMS_DEBUG |
1726 |
vms_debug (1, "vms_bfd_relax_section(%p, %s, %p, <ret>)\n", |
vms_debug (1, "vms_bfd_relax_section(%p, %s, %p, <ret>)\n", |
1727 |
abfd, section->name, link_info); |
abfd, section->name, link_info); |
1728 |
#endif |
#endif |
1729 |
return true; |
return TRUE; |
1730 |
} |
} |
1731 |
|
|
1732 |
static boolean |
static bfd_boolean |
1733 |
vms_bfd_gc_sections (abfd, link_info) |
vms_bfd_gc_sections (abfd, link_info) |
1734 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
1735 |
struct bfd_link_info *link_info ATTRIBUTE_UNUSED; |
struct bfd_link_info *link_info ATTRIBUTE_UNUSED; |
1737 |
#if VMS_DEBUG |
#if VMS_DEBUG |
1738 |
vms_debug (1, "vms_bfd_gc_sections(%p, %p)\n", abfd, link_info); |
vms_debug (1, "vms_bfd_gc_sections(%p, %p)\n", abfd, link_info); |
1739 |
#endif |
#endif |
1740 |
return true; |
return TRUE; |
1741 |
} |
} |
1742 |
|
|
1743 |
static boolean |
static bfd_boolean |
1744 |
vms_bfd_merge_sections (abfd, link_info) |
vms_bfd_merge_sections (abfd, link_info) |
1745 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
1746 |
struct bfd_link_info *link_info ATTRIBUTE_UNUSED; |
struct bfd_link_info *link_info ATTRIBUTE_UNUSED; |
1748 |
#if VMS_DEBUG |
#if VMS_DEBUG |
1749 |
vms_debug (1, "vms_bfd_merge_sections(%p, %p)\n", abfd, link_info); |
vms_debug (1, "vms_bfd_merge_sections(%p, %p)\n", abfd, link_info); |
1750 |
#endif |
#endif |
1751 |
return true; |
return TRUE; |
1752 |
} |
} |
1753 |
|
|
1754 |
/* Create a hash table for the linker. Different backends store |
/* Create a hash table for the linker. Different backends store |
1777 |
|
|
1778 |
/* Add symbols from this object file into the hash table. */ |
/* Add symbols from this object file into the hash table. */ |
1779 |
|
|
1780 |
static boolean |
static bfd_boolean |
1781 |
vms_bfd_link_add_symbols (abfd, link_info) |
vms_bfd_link_add_symbols (abfd, link_info) |
1782 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
1783 |
struct bfd_link_info *link_info ATTRIBUTE_UNUSED; |
struct bfd_link_info *link_info ATTRIBUTE_UNUSED; |
1785 |
#if VMS_DEBUG |
#if VMS_DEBUG |
1786 |
vms_debug (1, "vms_bfd_link_add_symbols(%p, %p)\n", abfd, link_info); |
vms_debug (1, "vms_bfd_link_add_symbols(%p, %p)\n", abfd, link_info); |
1787 |
#endif |
#endif |
1788 |
return false; |
return FALSE; |
1789 |
} |
} |
1790 |
|
|
1791 |
/* Do a link based on the link_order structures attached to each |
/* Do a link based on the link_order structures attached to each |
1792 |
section of the BFD. */ |
section of the BFD. */ |
1793 |
|
|
1794 |
static boolean |
static bfd_boolean |
1795 |
vms_bfd_final_link (abfd, link_info) |
vms_bfd_final_link (abfd, link_info) |
1796 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
1797 |
struct bfd_link_info *link_info ATTRIBUTE_UNUSED; |
struct bfd_link_info *link_info ATTRIBUTE_UNUSED; |
1799 |
#if VMS_DEBUG |
#if VMS_DEBUG |
1800 |
vms_debug (1, "vms_bfd_final_link(%p, %p)\n", abfd, link_info); |
vms_debug (1, "vms_bfd_final_link(%p, %p)\n", abfd, link_info); |
1801 |
#endif |
#endif |
1802 |
return true; |
return TRUE; |
1803 |
} |
} |
1804 |
|
|
1805 |
/* Should this section be split up into smaller pieces during linking. */ |
/* Should this section be split up into smaller pieces during linking. */ |
1806 |
|
|
1807 |
static boolean |
static bfd_boolean |
1808 |
vms_bfd_link_split_section (abfd, section) |
vms_bfd_link_split_section (abfd, section) |
1809 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
1810 |
asection *section ATTRIBUTE_UNUSED; |
asection *section ATTRIBUTE_UNUSED; |
1812 |
#if VMS_DEBUG |
#if VMS_DEBUG |
1813 |
vms_debug (1, "vms_bfd_link_split_section(%p, %s)\n", abfd, section->name); |
vms_debug (1, "vms_bfd_link_split_section(%p, %s)\n", abfd, section->name); |
1814 |
#endif |
#endif |
1815 |
return false; |
return FALSE; |
1816 |
} |
} |
1817 |
|
|
1818 |
/*-- Part 4.9, dynamic symbols and relocations ------------------------------*/ |
/*-- Part 4.9, dynamic symbols and relocations ------------------------------*/ |
1829 |
return 0; |
return 0; |
1830 |
} |
} |
1831 |
|
|
1832 |
static boolean |
static bfd_boolean |
1833 |
vms_bfd_print_private_bfd_data (abfd, file) |
vms_bfd_print_private_bfd_data (abfd, file) |
1834 |
bfd *abfd ATTRIBUTE_UNUSED; |
bfd *abfd ATTRIBUTE_UNUSED; |
1835 |
void *file ATTRIBUTE_UNUSED; |
void *file ATTRIBUTE_UNUSED; |