3 * libaout.h (machine_type): added M_68K_NETBSD and M_SPARC_NETBSD.
4 * i386netbsd.c, ns32knetbsd.c, sparcnetbsd.c: removed RCS Id's.
5 changed how PAGE_SIZE and SEGMENT_SIZE are defined so they are
6 consistant with each other.
7 * netbsd.h (N_HEADER_IN_TEXT, TEXT_START_ADDR): NetBSD fits its
8 header into the start of its text segment.
12 * targets.c (BFD_JUMP_TABLE_ARCHIVE): Add case for
13 _construct_extended_name_table.
14 (bfd_target): Add _bfd_construct_extended_name_table.
15 * archive.c (_bfd_archive_bsd_construct_extended_name_table): New
17 (_bfd_archive_coff_construct_extended_name_table): New function.
18 (_bfd_construct_extended_name_table): Renamed by adding a leading
19 underscore, and made externally visible. Added trailing_slash
20 argument, and used it instead of elf_style. Changed type of
21 tablen to bfd_size_type *.
22 (_bfd_write_archive_contents): Use BFD_SEND to call
23 construct_extended_name_table. Use the returned name.
24 * libbfd-in.h (_bfd_construct_extended_name_table): Declare.
25 (_bfd_noarchive_construct_extended_name_table): Define.
26 (_bfd_archive_bsd_construct_extended_name_table): Declare.
27 (_bfd_archive_coff_construct_extended_name_table): Declare.
30 * som.c (som_construct_extended_name_table): New static function.
31 * aout-target.h (MY_construct_extended_name_table): Define.
32 * coff-rs6000.c (rs6000coff_construct_extended_name_table):
34 * ieee.c (ieee_construct_extended_name_table): Define.
35 * libecoff.h (_bfd_ecoff_construct_extended_name_table): Define.
36 * oasys.c (oasys_construct_extended_name_table): Define.
38 Fix the ELF linker to not require an interpreter if no dynamic
39 objects were seen, even when linking PIC code.
40 * libelf.h (ELF_LINK_HASH_NEEDS_PLT): Define.
41 (struct elf_link_hash_table): Add field dynamic_sections_created.
42 * elfcode.h (elf_link_record_dynamic_symbol): Create dynstr if it
43 doesn't already exist.
44 (elf_link_add_object_symbols): Create dynamic sections based on
45 dynamic_sections_created field, not dynobj field. Don't bother to
47 (elf_link_create_dynamic_sections): If dynamic sections were
48 already created, don't do anything. If dynobj is already set, use
49 it; otherwise, set it to the bfd argument. Don't initialize
50 dynsymcount. Only create dynstr if it does not exist. Set
51 dynamic_sections_created to true.
52 (NAME(bfd_elf,size_dynamic_sections)): Skip most of this function
53 if no dynamic objects were seen.
54 (elf_adjust_dynamic_symbol): If a symbol has the
55 ELF_LINK_HASH_NEEDS_PLT flag set, let the backend adjust it.
56 (elf_bfd_final_link): Change most decisions based on dynobj to
57 check dynamic_sections_created instead.
58 (elf_link_output_extsym): Only handle dynamic symbols if a dynamic
60 * elf.c (_bfd_elf_link_hash_table_init): Initialize new field
61 dynamic_sections_created. Set dynsymcount to 1, not 0.
62 * elf32-i386.c (elf_i386_create_dynamic_sections): Call
63 elf_i386_create_got_section rather than creating the .got and
65 (elf_i386_create_got_section): New static function.
66 (elf_i386_check_relocs): Just call elf_i386_create_got_section if
67 a GOT table is needed, not bfd_elf32_link_create_dynamic_sections.
68 Only create the .rel.got section, and only make space for a reloc,
69 for a global symbol or when generating a shared object. For a
70 R_386_PLT32 reloc, just set the ELF_LINK_HASH_NEEDS_PLT flag.
71 (elf_i386_adjust_dynamic_symbol): Rework initial assertion to
72 permit ELF_LINK_HASH_NEEDS_PLT non dynamic symbols. Create a
73 procedure linkage table entry for such symbols. But, if no
74 dynamic objects were seen, never create a PLT entry.
75 (elf_i386_size_dynamic_sections): If no dynamic objects were seen,
76 skip most of this function, and force the size of the .rel.got
78 (elf_i386_relocate_section): For a R_386_GOT32 reloc against a global
79 symbol when no dynamic object was seen, initialize the contents of
80 the .got section. For a R_386_GOT32 against a local symbol, only
81 create a R_386_RELATIVE reloc when generating a shared object.
82 Treat a R_386_PLT32 reloc against a symbol for which we did not
83 create a PLT entry as a R_386_PC32 reloc.
84 (elf_i386_finish_dynamic_sections): Only fiddle with the dynamic
85 entries and the PLT if we saw a dynamic object.
86 * elf32-sparc.c (elf_sparc_howto_table): Fix R_SPARC_PC22 by
87 setting rightshift to 10. Fix R_SPARC_WPLT20 by setting
88 rightshift to 2, size to 2, bitsize to 30, and dst_mask to
90 (elf32_sparc_create_dynamic_sections): Don't set the size of the
91 .plt section. Call elf32_sparc_create_got_section rather than
92 creating the .got section.
93 (elf32_sparc_check_relocs): Call elf32_sparc_create_got_section if
94 a GOT table is needed, not bfd_elf32_link_create_dynamic_sections.
95 Only create the .rela.got section, and only make space for a
96 reloc, for a global symbol or when generating a shared object.
97 Set the alignment of the .rela.got section to 2. For a
98 R_SPARC_WPLT30 reloc, just set the ELF_LINK_HASH_NEEDS_PLT flag.
99 (elf32_sparc_adjust_dynamic_symbol): Rework initial assertion to
100 permit ELF_LINK_HASH_NEDS_PLT non dynamic symbols. Create a
101 procedure linkage table for such symbols. But, if no dynamic
102 objects were seen, never create a PLT entry. Initialize the size
104 (elf32_sparc_size_dynamic_sections): If no dynamic objects were
105 seen, skip most of this function, and force the size of the
106 .rela.got section to zero. Strip empty reloc sections, and strip
107 an empty .plt section.
108 (elf32_sparc_relocate_section): For a GOT reloc against a global
109 symbol when no dynamic object was seen, initialize the contents of
110 the .got section. For a GOT reloc against a local symbol, only
111 create a R_SPARC_RELATIVE reloc when generating a shared object.
112 Treat a R_SPARC_WPLT30 reloc against a symbol for which we did not
113 create a PLT entry as a R_SPARC_WDISP30 reloc.
114 (elf32_sparc_finish_dynamic_sections): Only fiddle with the
115 dynamic entries and the PLT if we saw a dynamic object.
119 * elfcode.h (elf_map_symbols): Don't worry about section symbols
120 in a section not owned by any BFD.
121 (elf_section_from_bfd_section): Separate out loop which calls
122 backend routine. Check bfd_section and call the backend routine
123 even for a section not owned by any BFD.
124 * elf32-mips.c (mips_elf_section_from_bfd_section): Handle
129 * coffgen.c (coff_print_symbol): Make names for section number and
130 storage class slightly more verbose. It's not clear how many
131 characters I can justify using up, but before this change they
132 both were abbreviated "sc" which is (IMHO) clearly unacceptable.
136 * binary.c (binary_set_section_contents): Set the base file
137 position from the lowest section VMA, not the start address.
139 * aoutx.h (NAME(aout,slurp_symbol_table)): Don't return an error
140 if there are no symbols.
141 * coffgen.c (coff_get_normalized_symtab): Likewise.
142 * hp300hpux.c (MY(slurp_symbol_table)): Likewise.
146 * aout-target.h (MY_bfd_copy_private_section_data): Only copy
147 subformat to another bfd_target_aout_flavour file.
149 * binary.c: New file for raw binary output format.
150 * Makefile.in (BFD_LIBS): Add binary.o.
151 (CFILES): Add binary.c.
152 * targets.c (binary_vec): Declare.
153 (bfd_target_vector): Include binary_vec.
155 * srec.c (tdata_type): Add field tail.
156 (srec_mkobject): Initialize tail.
157 (srec_set_section_contents): Sort S record list by address.
161 * elfcode.h (elf_map_symbols): Sort the symbols into a new array,
162 rather than messing with Elf_Sym_Extra. Store the symbol index in
164 (swap_out_syms): Use outbound_syms as a pointer rather than as an
165 array. Don't worry about elf_sym_num.
166 * libelf.h (struct elf_sym_extra): Don't define.
167 (Elf_Sym_Extra): Don't define.
168 (struct elf_obj_tdata): Remove sym_extra field.
169 (elf_sym_extra): Don't define.
170 * elf32-hppa.c (elf32_hppa_backend_final_write_processing): Use
171 udata.i rather than elf_sym_extra array.
173 * syms.c (asymbol): Change udata field into a union.
174 * bfd-in2.h: Rebuild.
175 * aoutx.h (NAME(aout,translate_symbol_table)): Use udata.p rather
177 * bout.c (perform_slip): Likewise.
178 * hp300hpux.c (MY(slurp_symbol_table)): Likewise.
179 * ieee.c (ieee_slurp_external_symbols): Likewise.
180 * linker.c (generic_link_add_symbol_list): Likewise.
181 (default_indirect_link_order): Likewise.
182 * oasys.c (oasys_slurp_symbol_table): Likewise.
183 * reloc16.c (bfd_perform_slip): Likewise.
184 * srec.c (fillup_symbols): Likewise.
185 * coffcode.h (get_index): Use udata.i rather than just udata.
186 (coff_slurp_symbol_table): Likewise.
187 * coffgen.c (set_index): Likewise.
188 * ecoff.c (ecoff_set_symbol_info): Likewise.
189 * elfcode.h (elf_symbol_from_bfd_symbol): Likewise.
190 * libecoff.h (ecoff_get_sym_index, ecoff_set_sym_index): Likewise.
191 * som.c (compare_syms): Likewise.
192 (som_prep_for_fixups): Likewise.
193 (som_write_fixups): Likewise.
195 Use a hash table when writing out ELF symbol names.
196 * elfcode.h (elf_stringtab_init): New static function.
197 (bfd_new_strtab, bfd_add_to_strtab, bfd_add_2_to_strtab): Remove.
198 Change all callers to use elf_stringtab_init or
199 _bfd_stringtab_add, and get stringtab lengths using
201 (elf_fake_sections): Change ignored argument to pointer to
202 boolean, and set the boolean to true if an error occurs. If an
203 error has already occurred, don't do anything.
204 (assign_section_numbers): Just set sh_size, not contents.
205 (elf_compute_section_file_positions): Pass the address of a
206 boolean to elf_fake_sections. Pass the address of a
207 bfd_strtab_hash to swap_out_syms. Write out the .strtab section.
208 (prep_headers): Change shstrtab to bfd_strtab_hash.
209 (swap_out_syms): Take a pointer to a bfd_strtab_hash as an
210 argument. Set it to the symbol names.
211 (NAME(bfd_elf,write_object_contents)): Write out the section
212 header names using _bfd_stringtab_emit.
213 (elf_debug_section): Remove first argument; get the section name
214 via the bfd_section pointer. Change caller.
215 (elf_bfd_final_link): Write out the symbol names using
216 _bfd_stringtab_emit. Likewise for the .dynstr section contents.
217 Free the symbol names at the end of the function.
218 (elf_link_input_bfd): Remove the last argument, output_names,
219 from relocate_section. Save the old symbol contents before
220 calling elf_link_output_sym, and restore them afterward.
221 * libelf.h (struct elf_link_hash_table): Change dynstr field to
222 struct bfd_strtab_hash.
223 (struct elf_backend_data): Remove last argument, output_names,
224 from elf_backend_relocate_section field.
225 (struct strtab): Don't define.
226 (struct elf_obj_tdata): Change strtab_ptr field to struct
228 * elf32-hppa.c (elf32_hppa_relocate_section): Remove last
229 argument, output_names.
230 * elf32-i386.c (elf_i386_relocate_section): Likewise.
231 * elf32-mips.c (mips_elf_relocate_section): Likewise.
232 * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
234 * libbfd-in.h (DEFAULT_STRING_SPACE_SIZE): Don't define.
235 (bfd_add_to_string_table): Don't declare.
237 * libbfd.c (bfd_add_to_string_table): Remove.
239 * elfcode.h (elf_swap_shdr_in): Use bfd_section, not rawdata.
240 Clear contents field.
241 (bfd_section_from_shdr): In SHT_STRTAB case, check bfd_section,
242 not rawdata. Don't set rawdata if e_shstrndx. Use bfd_section
243 rather than rawdata in commented out code. In SHT_REL[A] case,
244 don't bother to check elf_section_data of section returned by
245 section_from_elf_index.
246 (elf_fake_sections): Set bfd_section, not rawdata. Don't set
248 (elf_map_symbols): Don't set elf_num_section_syms. Don't create
249 section symbols that already exist.
250 (assign_file_position_for_section): Use bfd_section, not rawdata.
251 (section_from_elf_index): Just check bfd_section field.
252 (elf_section_from_bfd_section): Likewise.
253 (elf_debug_section): Don't print rawdata, contents, or size.
254 (elf_link_add_object_symbols): Don't error out if
255 section_from_elf_index returns NULL.
256 (elf_bfd_final_link): Check return value from
257 section_from_elf_index against NULL, not bfd_is_abs_section.
258 (elf_link_input_bfd): Don't check section_from_elf_index return
260 * libelf.h (struct elf_obj_tdata): Remove num_section_syms field.
261 (elf_num_section_syms): Don't define.
262 * elf.c (elf_get_str_section): Store section contents in contents
263 field rather than rawdata field.
264 (elf_string_from_elf_section): Likewise.
265 (_bfd_elf_make_section_from_shdr): Store BFD section pointer in
266 bfd_section field rather than rawdata field.
267 * elf32-hppa.c (elf32_hppa_read_symext_info): Use bfd_section
269 (elf32_hppa_size_stubs): Likewise.
270 (elf32_hppa_backend_symbol_table_processing): Don't set
271 symextn_hdr->size; just use sh_size.
272 * elf32-mips.c (mips_elf_final_write_processing): Use bfd_section
273 rathern than rawdata.
274 (mips_elf_section_from_shdr): Likewise.
275 (mips_elf_section_processing): Likewise.
276 (mips_elf_section_from_bfd_section): Remove rawdata check.
278 * srec.c (pass_over): Set the start address for S7, S8 or S9.
282 * VERSION: Updated to 2.5.
286 * bfd.c (bfd_scan_vma): Cast end to be non const before passing it
291 * bfd.c (bfd_scan_vma): Pass end argument on to strtoul.
295 * opncls.c (bfd_realloc): Deleted, since it's broken and fixing it
296 would make it slow. Besides, it isn't used much.
297 * elfcode.h (elf_map_symbols): Always allocate new storage for the
302 * ecoff.c (ecoff_set_symbol_info): Mark local stProc, stLabel or
303 stabs symbols as BSF_DEBUGGING.
305 * rs6000-core.c (rs6000coff_core_file_matches_executable_p): Make
306 str1 and str2 const pointers.
308 * Makefile.in (INSTALL): Use top level install.sh script.
309 * config/README (INSTALL): Remove.
310 * config/delta88.mh (INSTALL): Remove.
311 * config/i386v4.mh (INSTALL): Remove.
312 * config/irix4.mh (INSTALL): Remove.
313 * config/irix5.mh (INSTALL): Remove.
314 * config/ncrt3000.mh (INSTALL): Remove.
318 * elf32-i386.c (elf_i386_check_relocs): Make sure that a symbol
319 with a global offset table entry or a procedure linkage table
320 entry is added to the dynamic symbol table.
321 * elf32-sparc.c (elf32_sparc_check_relocs): Likewise.
322 * elf32-i386.c (elf_i386_adjust_dynamic_symbol): If a symbol has
323 already gotten a procedure linkage table entry, change the
324 definition to the PLT entry.
325 * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
329 * lynx-core.c (lynx_core_file_p): SPARC Lynx appears to start
330 dumping the .data section in a core file at a page boundary.
334 * cofflink.c (_bfd_coff_final_link): Cast argument to bfd_h_put_32
336 (coff_read_string_table): Cast argument to bfd_h_get_32 to correct
338 * elfcode.h (elf_link_output_extsym): Cast argument to
339 bfd_elf_hash to correct type.
341 * elf32-sparc.c (elf_sparc_howto_table): The PC10, PC22, and
342 WPLT30 relocations are PC-relative.
346 * aoutx.h (adjust_o_magic): Correctly initialize vma if the vma of
347 the text section was user-defined.
351 * archive.c (bfd_construct_extended_name_table): SVR4 uses slash
352 newline at the end of the file name, not just newline.
356 * ecoff.c (_bfd_ecoff_new_section_hook): Default section alignment
357 power to 4, rather than using align_power_min.
359 * coffcode.h (coff_new_section_hook): Don't use align_power_min;
360 use COFF_DEFAULT_SECTION_ALIGNMENT_POWER instead. Force the .stab
361 and .stabstr sections to be aligned to no more than 2. Remove
362 COFF_SPARC special cases.
363 * coff-a29k.c: Define COFF_DEFAULT_SECTION_ALIGNMENT_POWER.
364 * coff-apollo.c, coff-go32.c, coff-h8300.c: Likewise.
365 * coff-h8500.c, coff-i386.c, coff-i960.c, coff-m68k.c: Likewise.
366 * coff-m88k.c, coff-rs6000.c, coff-sh.c, coff-sparc.c: Likewise.
367 * coff-we32k.c, coff-z8k.c: Likewise.
369 * configure.in: Use ${config_shell} when running config.bfd.
371 * cofflink.c (coff_link_input_bfd): Don't try to convert a long
372 filename if the offset field is zero.
374 * elfcode.h (swap_out_syms): If the alignment of a common symbol
375 was not set, use a sensible default rather than zero.
379 * opncls.c (bfd_close): Honor umask when setting execution bits.
380 (bfd_close_all_done): Likewise.
384 * rs6000-core.c (rs6000coff_core_p): Set SEC_HAS_CONTENTS flag
385 for .stack and .ldinfo sections. Cast coredata.c_tab to a
386 file_ptr to avoid warnings from gcc.
390 * elfcode.h (elf_bfd_final_link): Remove assertion when a non
391 SEC_IN_MEMORY section is found in dynobj. This can happen when
392 linking PIC compiled code.
396 * reloc.c (bfd_install_relocation): Change type of "data" to
397 bfd_byte *, to go along with yesterday's change.
399 * elf.c (bfd_elf_print_symbol): Moved here from elf_print_symbol
400 in elfcode.h. (case bfd_print_symbol_all): Print symbol's size
401 field, except for common symbols; print their alignment.
402 * elfcode.h (elf_print_symbol): Deleted.
403 * libelf.h (bfd_elf_print_symbol): Declare.
404 (bfd_elf{32,64}_print_symbol): Replace declarations with macros.
406 * syms.c (bfd_print_symbol_vandf): Show BSF_LOCAL and BSF_GLOBAL
407 in one column. Use the column freed up to show BSF_FUNCTION and
412 * syms.c (stt): Add .rdata and .rodata.
416 * reloc.c (bfd_install_relocation): Cast data_start to bfd_byte *
417 before trying to add values to it.
421 * elf32-hppa.c (elf32_hppa_backend_final_write_processing): Cast
422 return value from elf_sym_extra.
423 (elf32_hppa_build_stubs): Cast return value from bfd_zalloc.
424 (elf32_hppa_size_stubs): Cast return value from malloc.
426 * gen-aout.c (main): Declare and initialize "arch".
428 * cofflink.c (coff_link_add_symbols): Cast return value of
431 * riscix.c (riscix_callback): Use PARAMS macro in prototype.
433 * reloc.c (bfd_install_relocation): New function, mostly copied
434 from bfd_perform_relocation, adjusted for the assembler's needs.
435 * bfd-in2.h: Regenerated.
439 * elfcode.h (assign_file_positions_except_relocs): Align the
440 section VMA and the file position even if D_PAGED is not set.
442 * bfd-in.h (bfd_seek): Change declaration to not mark fp const.
443 * bfd-in2.h: Rebuild.
444 * libbfd.c (bfd_seek): Don't mark parameters const, to avoid
445 conflicts with declaration.
449 * elfcode.h (map_program_segments): Don't abort if we allocated
450 too much space for the program header, only if we allocated too
452 (assign_file_positions_except_relocs): Similar change.
456 * libaout.h: Fix comment.
457 * ns32knbsd.h: Changed M_NS32K_NETBSD to M_532_NETBSD to match
462 * Makefile.in: Rebuilt dependencies.
463 (BFD32_BACKENDS): Add sparcnetbsd.o.
464 (CFILES): Add ns32knetbsd.c and sparcnetbsd.c.
465 * targets.c: ns32knetbsd_vec was renamed to pc532netbsd_vec.
467 * coff-sh.c (rtype2howto): Remove; unused.
468 (coff_sh_relocate_section): Remove unused local variable rstat.
469 (reloc_processing): Comment out; unused.
473 * aoutx.h (aout_link_write_other_symbol): If h->indx is -2, then
474 always write it out even if it would normally be stripped.
475 (aout_link_input_section_std): If we find a reloc against a
476 stripped global symbol, force it to be written out rather than
477 merely calling unattached_reloc.
478 (aout_link_input_section_ext): Likewise.
479 (aout_link_reloc_link_order): Likewise.
483 * som.h (struct somdata): New field sorted_syms.
484 (obj_som_sorted_syms): Accessor macro.
485 * som.c (som_object_setup): Initialize sorted_syms to NULL.
486 (som_prep_for_fixups): Sort a copy of the BFD's symbol table;
487 store the sorted symbol table in sorted_syms.
488 (som_write_fixups): Initalize tmp_reloc to NULL to make GCC happy.
489 (som_begin_writing): Similarly for exec_header. Pass the sorted
490 symbol table to som_write_symbol_strings.
491 (som_build_and_write_symbol_table): Use the sorted symbols rather
492 than the canonical symbol table.
494 * som.h (som_symbol_type): Add "stringtab_offset" field.
495 * som.c (som_write_symbol_strings): Use "stringtab_offset"
496 rather than destroying the "name" field in the BFD symbol.
497 (som_build_and_write_symbol_table): Likewise.
501 * aoutx.h (aout_link_write_symbols): Rename skip_indirect to
502 skip_next. If we find an N_WARNING symbol which has already been
503 written out, set skip_next.
505 * libecoff.h (struct ecoff_tdata): Add field find_buffer.
506 * ecoff.c: Include aout/stab_gnu.h.
507 (ecoff_find_nearest_line): Handle stabs debugging information.
509 * elfcode.h (elf_link_output_extsym): Keep a symbol marked as weak
510 even if it is referenced by another object.
514 * som.c (som_fixup_formats): Case R_ENTRY (0xb3), set both
515 'T' and 'U' to grab all the unwind information.
516 (som_set_reloc_info): Make 'U' unwind bits persist across
517 multiple SOM relocations. Set the addend field of an R_ENTRY
518 relocation to the value in 'T'; set the addend field on an
519 R_EXIT relocation to the value in 'U'.
521 * som.h (som_symbol_type): Delete unwind field.
523 * som.c (som_write_fixups): For R_ENTRY fixups, get 32bits of
524 unwind information from the addend field of the R_ENTRY, get the
525 other 32bits from the addend field of the R_EXIT.
526 (bfd_som_attach_unwind_info): Delete function and all references.
528 * som.h (som_symbol_type): Delete unused a.out-related fields.
530 * som.c (bfd_section_from_som_symbol): Use bfd_abs_section_ptr
531 instead of &bfd_abs_section.
533 * som.c (som_object_setup): Handle exec_entry and exec_flags being
534 switched in executables created by the OSF1 linker.
535 (som_write_fixups): Handle R_EXIT just like the R_{F,L,R}SEL
536 fixups. Support R_ALT_ENTRY (handle just like R_EXIT).
540 * cofflink.c (coff_link_input_bfd): syment_base is unsigned
541 so can't compare -ve numbers with it.
545 * configure.in (shcoff_vec): Use cofflink.o now.
546 * coff-sh.c: Rewritten to use new fast coff backend.
550 * aoutx.h (NAME(aout,final_link)): Don't assume that all the input
555 * configure.host (sparc-*-netbsd): use sparcnbsd.
556 (ns32k-*-netbsd): use ns32knbsd.
558 * hosts/{nbsd,i386nbsd,ns32knbsd,sparcnbsd}.h: New files, NetBSD
561 * sparcnetbsd.c: New file, adds support for NetBSD/sparc.
562 * config/sparc-nbsd.mt: Likewise.
564 * netbsd.h: New file, definitions common to all netbsd ports.
565 * i386netbsd.c: Use it.
566 * ns32knetbsd.c: Use it.
568 * Makefile.in, configure.in, targets.c, config/i386-nbsd.mt,
569 config/ns32k-nbsd.mt: canonicalize netbsd targets to conform to
570 file/variable naming conventions.
571 * i386netbsd.c: New file, renamed from netbsd386.c.
572 * ns32knetbsd.c: New file, renamed from netbsd532.c.
576 * som.c (som_reloc_skip): Correct off-by-one error for 4-byte
577 R_NO_RELOCATION fixups.
578 (bfd_section_from_som_symbol): Return the absolute section if the
579 symbol isn't contained in any section in the output file.
580 (som_slurp_symbol_table): ST_PRI_PROG and ST_SEC_PROG symbols are
581 not function symbols (they are magic code labels which *can* be the
582 targets of cross space branches). $START$ is not a section symbol.
586 * coff-alpha.c (ecoffalpha_little_vec): Add SEC_CODE and SEC_DATA
588 * coff-mips.c (ecoff_little_vec, ecoff_big_vec): Likewise.
590 * elfcode.h (swap_out_syms): Set the type of an undefined symbol
591 to STT_FUNC if the BSF_FUNCTION flag is set.
593 * cofflink.c (coff_link_input_bfd): If r_symndx is -1, don't
595 (_bfd_coff_generic_relocate_section): If r_symndx is -1, it is an
596 absolute reloc. Don't dump core using r_symndx as an array index.
597 * cf-m68klynx.c (coff_bfd_link_add_symbols): Define.
598 (lynx_link_add_symbols): New static function (copy of function in
600 (coff_m68k_lynxrtype_to_howto): sym argument may be NULL.
601 * coff-i386.c (coff_i386_rtype_to_howto): Likewise.
602 * coff-a29k.c (coff_a29k_relocate_section): Handle an r_symndx
603 value of -1, meaning an absolute reloc.
605 * ctor.c: Remove; obsolete.
606 * Makefile.in: Rebuild dependencies.
607 (BFD_LIBS): Remove ctor.o.
608 (CFILES): Remove ctor.c.
613 * elf32-hppa.c (elf32_hppa_relocate_section): If there was a link
614 error of some sort (for example, undefined symbols), then do not
615 apply any relocs, just notify the user of the errors.
616 (elf32_hppa_backend_begin_write_processing): Do not build a symbol
617 extension section for an executable (it's useless).
618 (elf32_hppa_link_output_symbol_hook): Do nothing if there was a
619 link error of some sort (for example, undefined symbols).
620 (elf32_hppa_read_symext_info): Kludge. Turn off SEC_HAS_CONTENTS
621 for all the input symbol extension sections to keep the generic
622 BFD code happy. Temporarily turn it on to read the contents of
623 the symbol extension section.
627 * config/hppaosf.mh (RANLIB): Do not set.
628 * config/hppabsd.mh (RANLIB): Likewise.
632 * cf-i386lynx.c: Remove #if 0 code.
633 (i386_lynxos_coff_object_p): Remove unused function.
634 (coff_bfd_link_add_symbols): Define.
635 (lynx_link_add_symbols): New static function.
636 * coffcode.h (coff_bfd_link_hash_table_create): If
637 coff_relocate_section is defined, only define this if not already
639 (coff_bfd_link_add_symbols, coff_bfd_final_link): Likewise.
641 * linker.c (_bfd_generic_final_link): Handle
642 bfd_indirect_link_order explicitly, rather than via
643 _bfd_default_link_order.
644 (set_symbol_from_hash): New static function, broken out of
645 _bfd_generic_link_write_global_symbol.
646 (_bfd_generic_link_write_global_symbol): Symbol setting code moved
647 to set_symbol_from_hash; call it.
648 (default_indirect_link_order): Add generic_linker argument.
649 Change all callers. If false, set the generic symbols based on
650 the hash table entries.
654 * coffgen.c (coff_get_symtab): Reindented. Removed commented out
655 call to bfd_constructor_entry.
657 Convert m68k COFF to use new COFF backend linker.
658 * coff-m68k.c (coff_relocate_section): Define.
659 * cf-m68klynx.c (coff_rtype_to_howto): Define.
660 (coff_m68k_lynx_rtype_to_howto): New static function.
661 * configure.in (m68kcoff_vec): Build cofflink.o.
662 (m68kcoffun_vec, m68klynx_coff_vec): Likewise.
666 * coff-h8300.c (h8300_reloc16_extra_cases, case RELBYTE): Flag
671 * libelf.h (struct elf_backend_data): Change second argument of
672 elf_backend_final_write_processing hook to boolean.
673 (struct elf_obj_tdata): Add linker field.
674 * elfcode.h (NAME(bfd_elf,write_object_contents)): Pass value of
675 tdata linker field to final_write_processing, rather than NULL.
676 (elf_bfd_final_link): Don't call final_write_processing hook. Set
677 tdata linker field to true.
678 * elf32-mips.c (mips_elf_final_write_processing): Change type of
679 second argument to boolean.
680 * elf32-hppa.c (elf32_hppa_backend_final_write_processing):
683 * coff-go32.c (RTYPE2HOWTO): Fully parenthesize arguments.
684 * coff-i960.c (RTYPE2HOWTO): Likewise.
685 * coff-m88k.c (RTYPE2HOWTO): Likewise.
686 * coff-we32k.c (RTYPE2HOWTO): Likewise.
688 Make i386 COFF use new COFF backend linker.
689 * coff-i386.c (RTYPE2HOWTO): Fully parenthesize arguments.
690 (coff_relocate_section): Define.
691 (coff_i386_rtype_to_howto): New function.
692 * configure.in (i386coff_vec): Use cofflink.o.
693 (i386lynx_coff_vec): Likewise.
695 * coffcode.h (bfd_coff_backend_data): Add new field
696 _bfd_coff_rtype_to_howto.
697 (bfd_coff_rtype_to_howto): Define.
698 (coff_rtype_to_howto): Define to use RTYPE2HOWTO, if not already
700 (bfd_coff_std_swap_table): Initialize new field.
701 * cofflink.c (_bfd_coff_final_link): Allocate section_count + 1
702 section_info structures, since the target_index is 1 based.
703 (coff_link_input_bfd): Set *secpp to bfd_com_section_ptr for a
704 common symbol. Adjust rel_hash by the output reloc count.
705 (_bfd_coff_generic_relocate_section): New function.
706 * libcoff-in.h (_bfd_coff_generic_relocate_section): Declare.
707 * libcoff.h: Rebuild.
708 * coff-alpha.c (alpha_ecoff_backend_data): Initialize new field.
709 * coff-mips.c (mips_ecoff_backend_data): Likewise.
713 * som.c (som_bfd_derive_misc_symbol_info): Treat undefined code
714 symbols and undefined symbols which no type in the same manner
715 if the associated BFD symbol has BSF_FUNCTION set. For a defined
716 symbol which no type, select a SOM type based on the flags of the
717 section containing the symbol.
718 (som_slurp_symbol_type): Set BSF_FUNCTION for undefined ST_STUB
719 or ST_CODE symbols (importing a non-function code symbol is
721 (som_set_reloc_info): Don't set "offset" to the section's vma; it
722 should always start at zero.
726 Add new style linker support to COFF backend. a29k only for now.
727 * cofflink.c: New file.
728 * libcoff-in.h: Include bfdlink.h.
729 (obj_coff_external_syms, obj_coff_strings): Define accessor macro.
730 (obj_coff_sym_hashes): Define accessor macro.
731 (struct coff_tdata): Add fields external_syms, strings, and
733 (struct coff_link_hash_entry): Define.
734 (struct coff_link_hash_table): Define.
735 (coff_link_hash_lookup, coff_link_hash_traverse): Define.
736 (coff_hash_table): Define.
737 (_bfd_coff_link_hash_table_create): Declare.
738 (_bfd_coff_link_add_symbols, _bfd_coff_final_link): Declare.
739 * coffcode.h (bfd_coff_backend_data): Add fields _bfd_relsz,
740 _bfd_coff_swap_reloc_in, _bfd_coff_sym_is_global,
741 _bfd_coff_compute_section_file_positions,
742 _bfd_coff_relocate_section.
743 (bfd_coff_relsz, bfd_coff_swap_reloc_in): Define.
744 (bfd_coff_sym_is_global): Define.
745 (bfd_coff_compute_section_file_positions): Define.
746 (bfd_coff_relocate_section): Define.
747 (coff_mkobject_hook): Initialize obj_raw_syment_count and
749 (coff_compute_section_file_positions): Set target_index of all
750 sections. Set output_has_begun field.
751 (coff_write_object_contents): Don't set target_index; now done by
752 coff_compute_section_file_positions. Remove obsolete handling of
753 scn_base and data_base. Don't bother to check that target_index
754 is positive, since it always is. Remove use of pad, which is
755 always zero. Check obj_raw_syment_count, not bfd_get_symcount,
756 for the number of symbols, but only write them out if
757 bfd_get_symcount is non-zero. Don't check obj_raw_syment_count
758 until after coff_write_symbols is called.
759 (coff_slurp_symbol_table): Use obj_raw_syment_count, not
760 bfd_get_symcount for the number of symbols. Don't set
762 (coff_sym_is_global): New static function or macro.
763 (coff_slurp_reloc_table): Call coff_swap_reloc_in, not
765 (coff_bfd_link_hash_table_create): If coff_relocate_section is
766 defined, define as _bfd_coff_link_hash_table_create.
767 (coff_bfd_link_add_symbols): Similar change.
768 (coff_bfd_final_link): Similar change.
769 (coff_relocate_section): Define as NULL if not defined.
770 (bfd_coff_std_swap_table): Initialize new fields.
771 * coffgen.c (coff_real_object_p): Don't set obj_raw_syment_count
772 and obj_conv_table_size here.
773 (coff_count_linenumbers): Reindent. If bfd_get_symcount is zero,
774 add up the line numbers from the sections.
775 (coff_write_symbols): Set obj_raw_syment_count, not
777 (coff_pointerize_aux): Don't pointerize a nonpositive x_endndx
779 (coff_get_normalized_symtab): Use obj_raw_syment_count, not
781 (coff_print_symbol): If auxp->fix_end, print x_endndx value.
782 * coffswap.h (coff_swap_reloc_in): Rename from bfd_swap_reloc_in.
783 Reindent. Change argument type to PTR.
784 * coff-a29k.c (coff_a29k_relocate_section): New static function.
785 (coff_relocate_section): Define.
786 * configure.in (a29kcoff_big_vec): Compile cofflink.o.
787 * coff-alpha.c (alpha_ecoff_backend_data): Initialize new fields.
788 * coff-mips.c (mips_ecoff_backend_data): Likewise.
789 * libcoff.h: Rebuilt.
790 * Makefile.in: Rebuilt dependencies.
791 (BFD32_BACKENDS): Add cofflink.o.
792 (CFILES): Add cofflink.c.
796 * coffgen.c (coff_print_symbol, case bfd_symbol_print_all): Check
797 for section symbol, and print its aux fields with appropriate
800 * Makefile.in (ALL_MACHINES): Added cpu-arm.o.
804 * aoutx.h (NAME(aout,machine_type)): Recognize the ARM processor.
805 * archures.c, config.bfd, configure.host, libaout.h, reloc.c,
806 targets.c: Add support for the ARM.
807 * cpu-arm.c, riscix.c, config/riscix.mh, config/riscix.mt: New files.
809 * aoutx.h (add_to_stringtable): Check that str isn't a NULL pointer.
813 * reloc.c (enum bfd_reloc_code_real): Rewrote definition to use
814 new "chew" commands for simultaneous definition of enumerator and
815 enumerator name table.
816 (bfd_get_reloc_code_name): New function, for retrieving a symbolic
817 name associated with an enumerator.
818 * libbfd.h, bfd-in2.h: Regenerated.
822 * som.c (som_write_fixups, case R_ENTRY): Handle case where no
823 unwind descriptor information is available.
827 * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Add soname
828 argument, and use it to set DT_SONAME dynamic entry.
829 * bfd-in.h (bfd_elf32_size_dynamic_sections): Update prototype.
830 (bfd_elf64_size_dynamic_sections): Update prototype.
831 * bfd-in2.h: Rebuilt.
835 * coffgen.c (coff_real_object_p): Set obj_raw_syment_count.
836 (coff_get_normalized_symtab): Verify obj_raw_syment_count, rather
841 * archive.c (bsd_write_armap): Remove host dependencies.
843 * aoutx.h (add_to_stringtab): Check for _bfd_stringtab_add error
844 before adding BYTES_IN_WORD.
846 * coffgen.c (coff_find_nearest_line): Look for the best C_FILE,
847 not merely the first.
849 * coffgen.c (coff_write_alien_symbol): If we are not using the
850 symbol, clear the name so that it is not put in the string table.
855 * coffgen.c (coff_print_symbol): Cast pointer different to long
856 and use %ld to print it.
857 * osf-core.c (osf_core_core_file_p): Remove unused variable
859 * ecoffswap.h (ecoff_swap_ext_out): If ECOFF_64, clear remaining
862 * configure.host, config.bfd: Change i[34]86 to i[345]86.
863 * coffgen.c (coff_real_object_p): Set obj_conv_table_size here,
864 rather than waiting until coff_slurp_symbol_table.
865 (coff_write_alien_symbol): Just ignore BSF_DEBUGGING symbols.
868 * section.c (bfd_make_section_anyway): Fix failure check of
871 * aoutx.h (translate_to_native_sym_flags): Use the output_section
872 (and output_offset) if there is one.
874 * aoutx.h (aout_link_check_archive_element): Discard the symbols
875 if the archive element was not needed.
877 * aoutx.h (aout_get_external_symbols): Ensure that a zero string
878 index yields an empty string.
879 (aout_link_write_symbols): If info->keep_memory is false, use name
880 from original hash table entry, not from entry in *sym_hash.
882 * aoutx.h (struct aout_final_link_info): Add fields contents,
883 relocs, symbol_map and output_syms.
884 (NAME(aout,final_link)): Work out the largest section size, reloc
885 size, and number of symbols. Use them to preallocate buffers that
886 are large enough for all cases.
887 (aout_link_input_bfd): Use preallocated symbol_map.
888 (aout_link_write_symbols): Remove symbol_map argument; use
889 preallocated symbol_map instead. Change all callers. Use
890 preallocated output_syms.
891 (aout_link_input_section): Remove symbol_map argument. Change all
892 callers. Use preallocated contents and relocs.
893 (aout_link_input_section_std): Remove symbol_map argument; use
894 preallocated symbol_map instead. Change all callers.
895 (aout_link_input_section_ext): Likewise.
899 * archive.c (_bfd_write_archive_contents): Don't update the
900 symbol map timestamp if there is no symbol map. From
905 * targets.c (BFD_JUMP_TABLE_ARCHIVE): Add _update_armap_timestamp.
906 (bfd_target): Add field _bfd_update_armap_timestamp.
907 * bfd.c (bfd_update_armap_timestamp): Define.
908 * bfd-in2.h: Rebuilt.
909 * libbfd-in.h (_bfd_noarchive_update_armap_timestamp): Define.
910 (_bfd_archive_bsd_update_armap_timestamp): Declare.
911 (_bfd_archive_coff_update_armap_timestamp): Define.
913 * archive.c (_bfd_write_archive_contents): Call
914 bfd_update_armap_timestamp instead of checking for a BSD archive
915 and calling bsd_update_armap_timestamp.
916 (_bfd_archive_bsd_update_armap_timestamp): Rename from
917 _bsd_update_armap_timestamp. Don't assume that armap_datepos is
919 * aout-target.h (MY_update_armap_timestamp): Define if not already
921 * coff-rs6000.c (rs6000coff_update_armap_timestamp): Define.
922 * ieee.c (ieee_update_armap_timestamp): Define.
923 * libecoff.h (_bfd_ecoff_update_armap_timestamp): Define.
924 * oasys.c (oasys_update_armap_timestamp): Define.
925 * som.c (som_update_armap_timestamp): Define.
927 * hash.c: Copy string hash functions from aoutx.h.
928 * aoutx.h: String hash functions moved to hash.c. Retain
929 simplified versions of add_to_stringtab and emit_stringtab.
930 Change all callers to use new function and structure names.
931 * libbfd-in.h (_bfd_stringtab_init, _bfd_stringtab_free): Declare.
932 (_bfd_stringtab_size, _bfd_stringtab_add): Declare.
933 (_bfd_stringtab_emit): Declare.
938 * i386linux.c (linux_add_one_symbol): Create a fixup for any
939 defined absolute symbol, not just GOT or PLT symbols.
940 (linux_tally_symbols): Correct handling of references to defined
945 Get ld -x -r to handle a.out set symbols correctly.
946 * aoutx.h (adjust_o_magic): If the .bss VMA was set outside of
947 BFD, pad the .data section up to the VMA of the .bss section.
948 (aout_link_add_symbols): If a set symbol does not get modified,
949 treat it as a local symbol.
950 (aout_link_write_symbols): Set the value of set symbols
951 correctly. Don't discard set symbols even if discarding local
953 (aout_link_write_other_symbol): Don't abort on bfd_link_hash_new,
954 since it can now happen for set symbols.
956 * elfcode.h (elf_fake_sections): Just check for ".rela" and
957 ".rel", not ".rela." and ".rel."; make this work by checking
959 * elf32-i386.c (elf_i386_check_relocs): Just check for ".rel", not
961 (elf_i386_size_dynamic_sections): Likewise.
962 (elf_i386_relocate_section): Likewise.
963 * elf32-sparc.c (elf32_sparc_check_relocs): Just check for
964 ".rela", not ".rela."
965 (elf32_sparc_size_dynamic_sections): Likewise.
966 (elf32_sparc_relocate_section): Likewise.
970 * linker.c (_bfd_generic_link_add_archive_symbols): Initialize
971 PASS to the old value + 1.
973 * coffgen.c (coff_get_normalized_symtab): If a C_FILE symbol has
974 no aux entries, use the symbol name as the file name.
975 (coff_find_nearest_line): Look for the right C_FILE symbol, rather
976 than always using the first one. If there is a debugging symbol
977 after a function symbol, skip it. Add the section VMA to the line
978 offset, since it was subtracted out in coff_slurp_line_table.
982 * som.c (som_prep_headers): If writing some form of an executable,
983 allocate and attach an exec header to the BFD private data.
984 (som_begin_writing): Don't fill fields of the exec header based
985 on BFD private data here (like the exec flags). Do not write
986 the exec header here.
987 (som_write_headers): Instead do it here.
988 * som.h (struct somdata): New field "exec_hdr" for the executable
990 (obj_som_exec_hdr): New accessor macro.
994 * i386linux.c (linux_link_create_dynamic_sections): Create section
995 named .linux-dynamic, not .dynamic.
996 (linux_add_one_symbol): Use .linux-dynamic, not .dynamic.
997 (bfd_linux_size_dynamic_sections): Likewise.
998 (linux_finish_dynamic_link): Likewise.
1002 * coffgen.c (STRING_SIZE_SIZE): Define.
1003 (coff_fix_symbol_name): Use STRING_SIZE_SIZE, not 4.
1004 (coff_write_symbols, build_string_table): Likewise.
1005 (coff_get_normalized_symtab): Likewise.
1007 * libcoff-in.h (obj_symbol_slew): Don't define.
1008 (struct coff_tdata): Remove unused fields index_slew, raw_linenos,
1010 * libcoff.h: Rebuilt.
1011 * coffcode.h (coff_mkobject): Don't initialize raw_linenos.
1012 (coff_mkobject_hook): Don't initialize flags.
1014 * aout-target.h (MY_zmagic_contiguous): Define as 0 if not already
1016 (MY(backend_data)): Use MY_zmagic_contiguous, not hardcoded 0.
1017 * i386linux.c (MY_zmagic_contiguous): Define.
1019 * elfcode.h (bfd_section_from_shdr): If a SHT_SYMTAB section in a
1020 shared object has SHF_ALLOC set, create a BFD section for it.
1021 (elf_section_from_bfd_section): There may be a BFD section for a
1024 * coffcode.h (styp_to_sec_flags): Add name argument. If no flags
1025 are recognized, chose section flags based on the name.
1026 (bfd_coff_backend_data): _bfd_styp_to_sec_flags_hook field: Add
1028 (bfd_coff_styp_to_sec_flags_hook): Add name argument.
1029 (coff_compute_section_file_positions): Don't adjust the section
1030 position by COFF_PAGE_SIZE unless SEC_ALLOC is set.
1031 * libcoff.h: Rebuilt.
1032 * coffgen.c (make_a_section_from_file): Pass section name to
1033 bfd_coff_styp_to_sec_flags_hook.
1034 * ecoff.c (_bfd_ecoff_styp_to_sec_flags): Add unused name
1036 * libecoff.h (_bfd_ecoff_styp_to_sec_flags): Add name argument to
1041 * elfcode.h (section_from_elf_index): Correct check for invalid
1044 * elfcode.h (elf_link_add_object_symbols): If there is no symbol
1045 table, try using the dynamic symbol table. From Eric Youngdale
1048 * configure.host (sparc-*-solaris2*): Use solaris2, not sysv4.
1049 The linker depends upon configuring for solaris2.
1050 * hosts/solaris2.h: New file; include hosts/sysv4.h.
1051 * config/solaris2.mh: New file; copy of config/sysv4.mh.
1055 * aoutx.h (adjust_z_magic): Make sure data section is padded to
1056 page boundary when the VMA is set by the calling program. From
1062 * aout-ns32k.c: Add declarations that were in aout-ns32k.h, change
1063 declarations to traditional form.
1064 (MY_reloc_howto, MY_put_reloc): Change from macro to function.
1065 (ns32k_relocate_contents): New function.
1066 * aout-ns32k.h: Remove.
1067 * cpu-ns32k.c: Add declarations that were in aout-ns32k.h, change
1068 declarations to traditional form.
1069 (ns32k_final_link_relocate): Call ns32k_relocate_contents.
1070 * netbsd532.c: Reformat to standards, add copyright notice.
1071 (ARCH): Don't define.
1072 (aout-ns32k.h): Don't include.
1073 * pc532-mach.c: Ditto.
1077 * coff-i960.c (coff_i960_relocate): Don't try to convert relocs
1078 against common symbols.
1082 * irix-core.c (irix_core_core_file_p): Ignore sections that
1083 are not contained in the core file.
1087 * coff-m68k.c (m68k_reloc_type_lookup): New function.
1088 (coff_bfd_reloc_type_lookup): Define.
1089 * cf-m68klynx.c (_bfd_m68kcoff_reloc_type_lookup): Define.
1091 * elfcode.h (elf_bfd_final_link): Force the vma of sections which
1092 do not have SEC_ALLOC set to be 0. This is needed to handle
1093 relocs against debugging sections.
1097 * coff-i960.c (coff_i960_relocate): Rewrote to change relocs
1098 against locally defined symbols into relocs against section
1099 symbols, for VxWorks 5.1.
1103 * i386linux.c (linux_add_one_symbol): Only handle
1104 SHARABLE_CONFLICTS specially if BSF_CONSTRUCTOR is set. Set hashp
1105 for a GOT or PLT symbol. Set jump field of fixup for a PLT symbol.
1106 (linux_tally_symbols): Check section of real symbol. When looking
1107 for a builtin fixup, check builtin and jump flags. Create no more
1108 than one fixup, and always create one if the real symbol is in the
1109 absolute section. Only strip absolute symbols.
1113 * coffcode.h (coff_write_object_contents): set internal_a.magic to
1114 LYNXCOFFMAGIC whenever 68k, SPARC or i386 LynxOS
1115 (yes, they have the same magic number!)
1119 * hp300hpux.c (BMAGIC): Define as HPUX_DOT_O_MAGIC, to make test
1120 in aoutx.h work correctly.
1122 * coff-i960.c (coff_i960_relocate): New function.
1123 (howto_rellong, howto_iprmed): Use it as special_function.
1125 * libbfd-in.h: Move declarations of bfd_read, bfd_write, bfd_seek,
1126 bfd_tell, bfd_flush, and bfd_stat from here...
1127 * bfd-in.h: ...to here, to make them visible to programs which
1128 know more about the object file format than BFD does.
1129 * libbfd.h, bfd-in2.h: Rebuilt.
1133 * ptrace-core.c (ptrace_unix_core_file_p): Convert zalloc usage
1138 * elf64-sparc.c (ELF_MAXPAGESIZE): Define.
1141 * elfcode.h (elf_link_create_dynamic_sections): Set type of
1142 _DYNAMIC to STT_OBJECT.
1143 (NAME(bfd_elf,record_link_assignment)): Always create hash table
1144 entry. Set type to STT_OBJECT.
1145 (elf_link_output_extsym): Don't set type of weak defined symbol to
1146 STB_WEAK if symbol was referenced.
1147 (map_program_segments): Check DYNAMIC as well as EXEC_P.
1148 (assign_file_positions_except_relocs): Likewise.
1149 * elf32-i386.c (elf_i386_create_dynamic_sections): Set type of
1150 _GLOBAL_OFFSET_TABLE to STT_OBJECT.
1151 (elf_i386_check_relocs): Ignore local PLT32 relocs.
1152 (elf_i386_relocate_section): Treat local PLT32 relocs as PC32.
1154 * elfcode.h (elf_adjust_dynamic_symbol): Correct weak symbol
1157 * elfcode.h (elf_slurp_reloc_table): Don't try to read the relocs
1158 if there aren't any.
1160 * configure.host (sparc-*-solaris2*): Use sysv4, not solaris2.
1161 * hosts/solaris2.h: Remove.
1162 * config/solaris2.mh: Remove.
1166 * elf32-hppa.c, elf32-hppa.h: Update comment reflecting which
1167 HPPA ELF spec the code implements.
1171 * cpu-i960.c (MAX_ARCH): New macro.
1172 (compatible): Use it in computing array bounds. Put comma after
1173 last entry in array, for regularity.
1174 (arch_info_struct): Adjust spacing for easier reading.
1176 * coff-i960.c (howto_rellong, howto_iprmed, howto_optcall): Use
1179 start-sanitize-i960xl
1180 * cpu-i960.c (XL): Define as bfd_mach_i960_xl.
1181 (scan_960_mach): Recognize xl machine.
1182 (MAX_ARCH): Define to be XL.
1183 (compatible): Add XL row to array.
1184 (arch_info_struct): Add XL entry.
1186 * archures.c (bfd_mach_i960_xl): New macro.
1187 * bfd-in2.h: Regenerated.
1189 * coffcode.h (coff_set_arch_mach_hook): For F_I960XL, set machine
1190 to bfd_mach_i960_xl.
1191 (coff_set_flags): For bfd_mach_i960_xl, set F_I960XL.
1196 * elfcode.h (elf_adjust_dynamic_symbol): When handling a weak
1197 symbol, correct check to see whether the equivalent normal symbol
1200 Add support for creating shared libraries under i386 ELF and SPARC
1202 * libelf.h (struct elf_link_hash_entry): Remove copy_offset field.
1203 Add got_offset and plt_offset fields.
1204 (ELF_LINK_HASH_REF_DYNAMIC_MULTIPLE): Don't define.
1205 (ELF_LINK_HASH_DEF_DYNAMIC_MULTIPLE): Don't define.
1206 (ELF_LINK_HASH_NEEDS_COPY): Define.
1207 (struct elf_backend_data): Add check_relocs field.
1208 (struct bfd_elf_section_data): Change relocs from PTR to
1209 Elf_Internal_Rela *.
1210 (struct elf_obj_tdata): Add local_got_offsets field.
1211 (elf_local_got_offsets): Define accessor macro.
1212 (bfd_elf32_link_create_dynamic_sections): Declare.
1213 (bfd_elf32_link_record_dynamic_symbol): Declare.
1214 (bfd_elf64_link_create_dynamic_sections): Declare.
1215 (bfd_elf64_link_record_dynamic_symbol): Declare.
1216 * elfcode.h (elf_slurp_reloc_table): Don't use the section data
1218 (elf_link_record_dynamic_symbol): Make globally visible. Use
1219 macro to rename to NAME(bfd_elf,link_record_dynamic_symbol).
1220 (elf_link_add_object_symbols): If creating a shared library, put
1221 make all local symbols dynamic. Don't bother with the
1222 DYNAMIC_MULTIPLE flags. Call the check_relocs backend function if
1224 (elf_link_create_dynamic_sections): Make globally visible. Use
1225 macro to rename to NAME(bfd_elf,link_create_dynamic_sections). If
1226 creating a shared library, make sure that _DYNAMIC is added as a
1228 (elf_link_read_relocs): New function.
1229 (NAME(bfd_elf,record_link_assignment)): If creating a shared
1230 library, always create symbols, and always make them dynamic.
1231 (elf_bfd_final_link): Permit creation of shared libraries.
1232 (elf_link_input_bfd): Use elf_link_read_relocs to get the relocs.
1233 * elf.c (_bfd_elf_link_hash_newfunc): Don't initialize
1234 copy_offset. Initialize got_offset and plt_offset.
1235 * elf32-target.h (elf_backend_check_relocs): Define as 0 if not
1237 (elf32_bed): Initialize check_relocs field.
1238 * elf64-target.h (elf_backend_check_relocs): Define as 0 if not
1240 (elf64_bed): Initialize check_relocs field.
1241 * elf32-i386.c (elf_howto_table): Change R_386_PLT32 and
1242 R_386_GOTPC to be pc_relative and pcrel_offset.
1243 (elf_i386_pic_plt0_entry): Define.
1244 (elf_i386_pic_plt_entry): Define.
1245 (elf_i386_create_dynamic_sections): Create a .got.plt section, and
1246 define _GLOBAL_OFFSET_TABLE_ at the start of it. If creating a
1247 shared library, make sure that _GLOBAL_OFFSET_TABLE_ is added as a
1248 dynamic symbol. Don't create .rel.bss if creating a shared
1250 (elf_i386_check_relocs): New function.
1251 (elf_i386_adjust_dynamic_symbol): Don't make a PLT entry if the
1252 symbol already has one. When making a PLT entry, set plt_offset.
1253 Don't create a copy reloc when creating a shared library. Don't
1254 set copy_offset, just set ELF_LINK_HASH_NEEDS_COPY.
1255 (elf_i386_allocate_dynamic_section): Remove.
1256 (elf_i386_size_dynamic_sections): Look through all the sections
1257 rather than assuming we know their names. Remove any empty reloc
1258 or plt sections. Only add a DT_DEBUG entry if not creating a
1259 shared library. Only add a DT_PLTGOT entry if there is a PLT.
1260 Add a DT_TEXTREL entry if required.
1261 (elf_i386_relocate_section): Permit undefined symbols when
1262 creating a shared library. Handle the special relocation types
1264 (elf_i386_finish_dynamic_symbol): Create a PLT entry if plt_offset
1265 is set. If creating a shared library, produce a PIC PLT entry.
1266 Only mark a PLT symbol as undefined if it was not defined by a
1267 regular object file. Create a GOT entry if got_offset is set.
1268 Create a copy reloc if ELF_LINK_HASH_NEEDS_COPY is set.
1269 (elf_i386_finish_dynamic_sections): Change the handling of
1270 DT_RELSZ to simply subtract out the size of .rel.plt. If creating
1271 a shared library, produce PIC PLT code.
1272 (elf_backend_check_relocs): Define.
1273 * elf32-sparc.c (elf_sparc_howto_table): Change R_SPARC_GOT10,
1274 R_SPARC_GOT22, and R_SPARC_PC10 to not warn about reloc overflow.
1275 (elf32_sparc_create_dynamic_sections): If creating a shared
1276 library, make sure that _GLOBAL_OFFSET_TABLE_ is added as a
1277 dynamic symbol, and set the type to STT_OBJECT. Likewise for
1278 _PROCEDURE_LINKAGE_TABLE_. Don't create .rel.bss if creating a
1280 (elf32_sparc_check_relocs): New function.
1281 (elf32_sparc_adjust_dynamic_symbol): Don't make a PLT entry if the
1282 symbol already has one. When making a PLT entry, set plt_offset.
1283 Don't create a copy reloc when creating a shared library. Don't
1284 set copy_offset, just set ELF_LINK_HASH_NEEDS_COPY.
1285 (elf32_sparc_allocate_dynamic_section): Remove.
1286 (elf32_sparc_size_dynamic_sections): Look through all the sections
1287 rather than assuming we know their names. Only add a DT_DEBUG
1288 entry if not creating a shared library. Add a DT_TEXTREL entry if
1290 (elf32_sparc_relocate_section): Permit undefined symbols when
1291 creating a shared library. Handle the special relocation types
1293 (elf32_sparc_finish_dynamic_symbol): Create a PLT entry if plt_offset
1294 is set. Only mark a PLT symbol as undefined if it was not defined
1295 by a regular object file. Create a GOT entry if got_offset is
1296 set. Create a copy reloc if ELF_LINK_HASH_NEEDS_COPY is set.
1297 (elf32_sparc_finish_dynamic_sections): Store dynobj in a local
1299 (elf_backend_check_relocs): Define.
1303 * configure.in (pc532mach_vec): Change to pc532machaout_vec.
1304 * config.bfd (ns32k-*-netbsd*): Use ns32k-nbsd as bfd_name.
1305 * Makefile.in (ALL_MACHINES): Add cpu-ns32k.o.
1306 (BFD32_BACKENDS): Add aout-ns32k.o, netbsd532.o, m88kmach3.o,
1308 * targets.c (pc532machaout_vec): Use instead of pc532mach_vec.
1309 * config/pc532-mach.mt (DEFAULT_VECTOR): Ditto.
1310 (SELECT_VECS): Remove.
1311 * config/ns32k-nbsd.mt: New file, was ns32k-netbsd.mt.
1312 * config/ns32k-netbsd.mt: Remove, name too long.
1316 * linker.c (generic_link_check_archive_element): When changing a
1317 symbol to common, set the alignment.
1318 (_bfd_generic_link_add_one_symbol): When creating a common symbol,
1320 * aoutx.h (aout_link_check_ar_symbols): When changing a symbol to
1321 common, set the alignment.
1322 (aout_link_add_symbols): Restrict the alignment of a common symbol
1323 to the alignment power given by the architecture.
1324 * libelf.h (struct elf_link_hash_entry): Remove align field. Add
1326 * elfcode.h (elf_link_add_object_symbols): Store alignment in
1327 new bfd_link_hash_entry field, not in elf_link_hash_entry field.
1328 (elf_link_output_extsym): Similar change when getting alignment.
1329 * elf.c (_bfd_elf_link_hash_newfunc): Don't initialize align. Do
1330 initialize copy_offset.
1331 * elf32-i386.c (elf_i386_adjust_dynamic_symbol): Use copy_offset
1332 field rather than align field. Get alignment using bfd_log2
1334 * elf32-sparc.c (elf32_sparc_adjust_dynamic_symbol): Likewise.
1335 * elf32-i386.c (elf_i386_finish_dynamic_symbol): Use copy_offset,
1337 * elf32-sparc.c (elf32_sparc_finish_dynamic_symbol): Likewise.
1339 * aoutx.h (NAME(aout,some_aout_object_p)): Just check
1340 STAT_FOR_EXEC, don't check MACH.
1341 * m88kmach3.c (MACH): Don't define.
1342 * config/i386-mach3.mt (TDEFINES): Define STAT_FOR_EXEC.
1343 * config/m88k-mach3.mt (TDEFINES): Likewise.
1344 * config/mips-mach3.mt (TDEFINES): Likewise.
1348 * i386mach3.c: Reverted to version from before Jul 5 1994 changes.
1352 * reloc.c (struct reloc_howto_struct): Remove special_function1.
1353 It's the wrong way to do things.
1354 (HOWTO): Change accordingly.
1356 (_bfd_final_link_relocate): Remove references to
1358 * bfd-in2.h: Rebuilt.
1359 * aoutx.h (aout_link_input_section_std): Remove references to
1361 (aout_link_reloc_link_order): Likewise.
1365 * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Add rpath
1366 argument. If it is not NULL, use it to set DT_RPATH.
1367 * bfd-in.h (bfd_elf32_size_dynamic_sections): Update prototype.
1368 (bfd_elf64_size_dynamic_sections): Likewise.
1369 * bfd-in2.h: Rebuilt.
1373 * elfcode.h (elf_get_dynamic_symtab_upper_bound): If there is no
1374 dynamic symtab, return error.
1376 * libelf.h (ELF_LINK_HASH_DEFINED_WEAK): Define.
1377 * elfcode.h (elf_link_add_object_symbols): If symbol is defined as
1378 weak, set ELF_LINK_HASH_DEFINED_WEAK.
1379 (elf_link_output_extsym): If symbol is defined as weak, mark it
1382 * libelf.h (struct bfd_elf_section_data): Add relocs field.
1383 (shdr_name): Remove; unused.
1384 * elfcode.h (elf_slurp_reloc_table): Rewrote to handle both REL
1385 and RELA relocs. Free up the unswapped relocs. Permit the relocs
1386 to be cached in the section_data. Correct the reloc address.
1387 (elf_slurp_reloca_table): Remove.
1388 (elf_canonicalize_reloc): Rewrote.
1389 (elf_link_input_bfd): Permit the relocs to be cached in the
1394 * config.bfd (m88*-harris-cxux*): Recognize.
1395 * hosts/harris.h (POSIX_UTIME, HAVE_PROCFS): Define.
1397 * configure.host (m68*-atari-sysv4*): New host.
1398 (m68*-cbm-sysv4*): Use m68kv4 instead of amix.
1399 * hosts/amix.h: Remove.
1400 * hosts/m68kv4.h: New file, was amix.h.
1404 * reloc.c (enum bfd_reloc_code_real, bfd_type, struct
1405 reloc_howto_struct, reloc_howto_type, HOWTO, HOWTO2): Copied
1406 changes over from bfd-in2.h so they get generated properly next
1407 time someone runs "make headers".
1408 * bfd-in2.h: Rebuilt.
1410 * targets.c (netbsd532_vec, pc532mach_vec): Declare const.
1411 (m88kmach3_vec): Restore deleted declaration.
1413 * configure.in: Alphabetize target vector names.
1415 * config/pc532mach.mh: New file.
1416 (HDEPFILES, HDEFINES): Define here.
1417 * config/pc532-mach.mt (HDEPFILES, HDEFINES): Deleted.
1418 * config/ns32k-netbsd.mt (HDEPFILES, HDEFINES): Deleted.
1422 * pc532-mach.c: New File. pc532-mach a.out format.
1424 * netbsd532.c: New file. pc532-netbsd532 a.out format.
1426 * hosts/pc532mach.h: New file. pc532-mach host support.
1428 * cpu-ns32k.c: New file. ns32k support cpu specific code rather
1429 than format specific code.
1431 * config/pc532-mach.mt: New file. Support for pc532-mach target.
1433 * config/ns32k-netbsd.mt: New file. Support for netbsd532 target.
1435 * aout-ns32k.c, aout-ns32k.h: New files supporting aout format for
1438 * targets.c: Add netbsd532_vec and pc532machaout_vec into
1439 bfd_target_vector array. Move netbsd386_vec to alphabetic order
1442 * reloc.c (_bfd_final_link_relocate) Add support for
1443 special_function1 in howto.
1445 * libaout.h: add M_NS32032, M_NS32532, M_532_NETBSD entries in
1448 * configure.in: add pc532mach_vec and netbsd532_vec entries.
1450 * config.bfd: add pc532mach host entries. Use for both
1451 ns32k-pc532-mach and ns32k-pc532-netbsd.
1453 * config.bfd: it doesn't work to use i386-mach3 for ns32k*-*-mach.
1454 add ns32k-pc532-mach* and ns32k-*-netbsd* entries.
1456 * bfd-in2.h: Add ns32k specific relocations to bfd_reloc_code_real
1459 * bfd-in2.h: Add special_function1 to struct howto. Change HOWTO
1460 and NEWHOWTO macros to make special_function1 NULL. Neww HOWTO2
1463 * bfd-in2.h: Split definition of struct reloc_howto_struct
1464 and corresponding typedef into two statements.
1466 * bfd-in2.h: Add entry bfd_arch_ns32k to bfd_architecture enum.
1468 * archures.c: Add bfd_ns32k_arch prototype, and entry in
1469 archures_init_table.
1471 * aoutx.h (aout_link_reloc_link_order): Allow for target dependent
1472 MY_put_reloc macro. Allow for target dependent special_function1
1473 to apply the relocation.
1475 * aoutx.h (aout_link_input_section_std): Allow for target
1476 dependent determination of reloc howto. Allow for target dependent
1477 special_function1 to apply the relocation.
1479 * aoutx.h (get_reloc_upper_bound): Detect bss and return 0.
1481 * aoutx.h (slurp_reloc_table): Detect bss and succesfully read
1484 * aoutx.h (machine_type): Add bfd_arch_ns32k case.
1486 * aoutx.h: Stat to determine executable status if STAT_FOR_EXEC
1487 is defined (not just MACH). Use fstat instead of stat and check
1490 * aoutx.h: Allow target dependent swap_std_reloc_{in,out}.
1492 * aoutx.h: Allow CTORS reloc info to be in target dependent reloc
1495 * aout-target.h: Apply SWAP_MAGIC (if defined) after
1496 swap_exec_header_in, otherwise we have magic in the wrong order.
1500 * coff-sparc.c (sparccoff_vec): Have leading underscores.
1504 * aix386-core.c, aoutf1.h, cisco-core.c, elfcode.h, hppabsd-core.c,
1505 hpux-core.c, irix-core.c, lynx-core.c, osf-core.c, ptrace-core.c,
1506 rs6000-core.c, trad-core.c: Remove SEC_ALLOC flag from .reg
1507 sections, .reg sections are not allocated and contain debug
1509 * osf-core.c (make_bfd_asection, osf_core_core_file_p): Use
1510 bfd_make_section_anyway instead of building unique section names.
1514 * libelf.h (bfd_elf32_swap_symbol_in): Declare.
1515 (bfd_elf32_swap_symbol_out): Declare.
1516 (bfd_elf64_swap_symbol_in, bfd_elf64_swap_symbol_out): Declare.
1517 * elf32-hppa.c (elf32_hppa_args_hash_table_init): Correct cast.
1519 * aout-encap.c (ARCH): Don't define. Obsolete.
1520 * aout0.c, aoutx.h, gen-aout.c, hp300bsd.c, hp300hpux.c: Likewise.
1521 * i386aout.c, i386bsd.c, i386dynix.c, i386linux.c: Likewise.
1522 * i386lynx.c, m68klynx.c, mipsbsd.c, netbsd386.c: Likewise.
1523 * newsos3.c, sparclynx.c, sunos.c: Likewise.
1527 * section.c (STD_SECTION): Make the sixth argument boolean, not
1532 * aoutx.h (bfd_free_cached_info): Change name of FREE to BFCI_FREE
1533 in order not to collide with LynxOS's definition of FREE in
1534 /usr/include/sys/proc.h
1538 * reloc.c (bfd_perform_relocation): Don't clobber the relocation
1539 value for coff-Intel-little or coff-Intel-big. Hack upon hack.
1543 * aoutx.h (howto_table_std): Add entry for GOT relocations
1544 which are present in sun3 shared libraries, to avoid assertions
1545 when reading the dynamic relocations.
1549 * som.h (R_HPPA_COMPLEX): Fix dumb typo.
1553 * hosts/sysv4.h (qsort, strtol): Don't declare.
1555 * elfcode.h (elf_link_output_sym): Don't call output_symbol_hook
1558 * elf32-mips.c (mips_elf_final_write_processing): Add ignored info
1559 argument to correspond to recent libelf.h change.
1563 * coff-alpha.c (alpha_ecoff_mkobject_hook): New hook to
1564 additionally copy object type information from the alpha file
1565 header to the BFD flags.
1566 (alpha_ecoff_backend_data): Use it.
1567 (ecoffalpha_little_vec): Add DYNAMIC to object_flags.
1568 * aout64.c: Fix typo in conditional QMAGIC definition.
1572 * hppabsd-core.c (hppabsd_core_core_file_p): Sanity check the
1573 value of clicksz to help weed out non HPPA BSD core files.
1578 * config.bfd (m88*-*-mach3*, mips*-dec-mach3*, mips*-*-mach3*):
1580 * configure.host (i[34]86-*-mach3*, ns32k-*-mach3*): Recognize
1581 "mach3" instead of "mach".
1582 (m88*-*-mach3*, mips*-dec-mach3*, mips*-*-mach3*): New hosts.
1583 * targets.c (m88kmach3_vec): New target vector.
1584 (bfd_target_vector): Add i386mach3_vec and m88kmach3_vec, but
1586 * aoutx.h (some_aout_object_p) [MACH]: Recognize executables by
1587 checking for execute permission, instead of looking at entry
1589 * i386mach3.c: Update, define MACH, N_TXTOFF, N_TXTADDR,
1590 N_SHARED_LIB, don't include aout/*.h files, etc.
1591 * m88kmach3.c: New file, m88k Mach 3 target.
1592 * config/m88k-mach3.mt, config/mips-mach3.mt: New files, target
1594 * config/i386mach3.mh, config/m88kmach3.mh, config/mipsmach3.mh:
1595 New files, host makefile fragments.
1596 * hosts/m88kmach3.h, hosts/mipsmach3.h: New files, host definitions.
1600 * elfcode.h (swap_out_syms): Get alignment of common symbol from
1601 st_value field of saved ELF symbol information, if there is any.
1605 * som.h (R_HPPA_COMPLEX): Define.
1606 * elf32-hppa.h (R_HPPA_COMPLEX): Define.
1607 (elf32_hppa_reloc_type): Delete R_PARISC_STUB_CALL_17.
1611 * Support code for enabling the new style linker for PA ELF.
1612 * elfcode.h (swap_symbol_in, swap_symbol_out): Externalize.
1613 (elf_compute_section_file_positions): Pass link_info to
1614 the begin_write_processing hook.
1615 (bfd_elf_write_object_contents): Pass NULL for new link_info
1616 argument to final_write_processing hook.
1617 (elf_link_output_sym): Accept new "input_section" argument for
1618 the symbols's input section. All callers changed. Call the
1619 link_output_symbol_hook if it's defined.
1620 (elf_bfd_final_link): Call the final_write_processing hook if
1622 * libelf.h (elf_backend_link_output_symbol_hook): Declare.
1623 (elf_backend_begin_write_processing): Add new "info" argument.
1624 (elf_backend_final_write_processing): Likewise.
1625 * elf32-target.h (elf_backend_link_output_symbol_hook): Provide
1626 a default definition.
1627 (elf32_bed): Add elf_backend_link_output_symbol_hook.
1628 * elf64-target.h: Likewise.
1630 * Major rework of the PA ELF code. Uses the new style BFD
1631 linker, major cleanups.
1632 * hppa_stubs.h: Rewrite from scratch. Much smaller and simpler.
1633 * elf32-hppa.h: Delete all symbol extension related code.
1634 (hppa_look_for_stubs_in_section): Delete decl.
1635 (elf32_hppa_size_stubs, elf32_hppa_build_stubs): New decls.
1636 * elf32-hppa.c: Symbol extension stuff moved form elf32-hppa.h
1637 into elf32-hppa.c. Do not include aout64.h.
1638 (typdef hppa_stub_type): Delete.
1639 (elf32_hppa_stub_name_list_struct): Delete.
1640 (elf32_hppa_stub_description_struct): Delete.
1641 (arg_reloc_type): Use simpler enumerations. All references changed.
1642 (arg_location, arg_reloc_relocation): Likewise.
1643 (elf32_hppa_symextn_map_struct): Delete.
1644 (get_symbol_value): Delete.
1645 (elf32_hppa_get_sym_extn): Delete.
1646 (find_stubs, new_stubs, type_of_mismatch): Delete.
1647 (find_stub_by_name, add_stub_by_name): Delete.
1648 (hppa_elf_stub_finish, hppa_elf_stub_reloc): Delete.
1649 (hppa_elf_arg_reloc_needed): Renamed. Simplify.
1650 (hppa_elf_build_linker_stub, hppa_elf_create_stub_sec): Delete.
1651 (hppa_elf_long_branch_needed_p): Delete.
1652 (hppa_look_for_stubs_in_section): Delete.
1653 (hppa_elf_get_section_contents): Delete.
1654 (elf32_hppa_backend_symbol_processing): Delete.
1655 (elf32_hppa_backend_section_processing): Delete.
1656 (elf32_hppa_backend_section_from_shdr): Delete.
1657 (elf32_hppa_backend_fake_sections): Delete.
1658 (elf32_hppa_backend_section_from_bfd_section): Delete.
1659 (NEW_INSTRUCTION): Delete.
1660 (CURRENT_STUB_OFFSET): Delete.
1661 (elf32_hppa_relocate_section): New function.
1662 (elf32_hppa_bfd_final_link_relocate): New function.
1663 (elf32_hppa_size_symext): New function.
1664 (elf32_hppa_link_output_symbol_hook): New function.
1665 (elf32_hppa_read_symext_info): New function.
1666 (elf32_hppa_add_symbol_hook): New function.
1667 (elf32_hppa_name_of_stub): New function.
1668 (elf32_hppa_size_of_stub): New function.
1669 (elf32_hppa_build_one_sub): New function.
1670 (elf32_hppa_build_stubs): New function.
1671 (elf32_hppa_size_stubs): New function.
1672 (linker, stub and argument hash tables): Add appropriate
1673 structures, definitions and functions to implement all three
1675 (hppa_elf_relocate_insn): Don't need argument location information
1677 (add_entry_to_symext_chain): Accept a symbol's argument location
1678 information rather than the symbol itself. All callers changed.
1679 (hppa_elf_gen_reloc_type): Simplify.
1680 (hppa_elf_set_section_contents): Stub section is no longer special.
1681 (hppa_elf_reloc): Greatly simplify.
1682 (elf32_hppa_begin_write_processing): Accept link_info argument.
1683 Handle being called from the BFD backend linker.
1684 (elf32_hppa_final_write_processing): Likewise.
1685 (elf_hppa_tc_make_sections): No longer call stub_finish.
1689 * section.c (bfd_get_section_contents): Put in parens to get
1694 * libelf.h (relocate_section): New argument "output_names" added
1696 * elfcode.h (elf_link_input_bfd): New argument "output_names"
1697 added to prototype of relocate_section. Pass the output symbol
1698 names to relocate_section.
1699 * elf32-i386.c (elf_i386_relocate_section): Use "output_names" to
1700 determine the name of a local symbol.
1701 * elf32-mips.c (mips_elf_relocate_section): Likewise.
1702 * elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
1706 Add Solaris BCP (the part of Solaris which allows it to run
1707 SunOS4 a.out files) core file handling.
1708 * aoutf1.h (external_solaris_bcp_core, swapcore_solaris_bcp):
1709 New structure and its swap in function.
1710 (internal_sunos_core): New member c_data_addr, to receive the
1711 start address of the data section in the core file.
1712 (swapcore_sun3, swapcore_sparc, sunos4_core_file_p): Use it.
1713 (sunos4_core_file_p): Recognize Solaris BCP core file.
1714 (sunos4_core_file_matches_executable_p): Always indicate match
1715 for Solaris BCP core files.
1719 Preliminary support for generating shared libraries, from Eric
1721 * elfcode.h (prep_headers): If DYNAMIC, set e_type to ET_DYN.
1722 (elf_link_add_object_symbols): If generating a shared library,
1723 create dynamic sections for first input BFD with the right format.
1724 (elf_link_create_dynamic_sections): Don't create .interp section
1725 if creating a shared library.
1726 (elf_link_input_bfd): Skip dynamic sections in input file.
1727 (elf_bfd_final_link): If creating a shared library, it's OK for
1728 dynobj to have sections which are not SEC_IN_MEMORY.
1729 * elf32-i386.c (elf_i386_size_dynamic_sections): Only set .interp
1730 section if not creating a shared library.
1731 * elf32-sparc.c (elf_sparc_size_dynamic_sections): Likewise.
1733 * elfcode.h (elf_object_p): Don't set DYNAMIC just because there
1734 is an SHT_DYNAMIC section.
1736 * cf-i386lynx.c (i386coff_vec): Don't include DYNAMIC in
1738 * coff-sparc.c (sparccoff_vec): Likewise.
1739 * hppabsd-core.c (hppabsd_core_vec): Likewise.
1741 * aoutx.h (NAME(aout,some_aout_object_p)): Don't set SEC_RELOC
1742 just because DYNAMIC is set.
1746 * configure.in: Change --with-targets to --enable-targets and
1747 --with-64-bit-bfd to --enable-64-bit-bfd.
1748 * Makefile.in, mpw-make.in, targets.c: Change comments.
1752 * config.bfd (powerpc-*-elf*): New target, just like
1755 * linker.c (FAIL): Undefine macro before defining as enum.
1759 * linker.c (_bfd_generic_link_add_archive_symbols): Initialize
1760 pass from abfd->archive_pass, and save it there as well.
1762 * hash.c (bfd_hash_allocate): Don't call bfd_set_error if
1763 obstack_alloc returns NULL unless the size is non-zero.
1765 * linker.c (archive_hash_allocate): Define.
1766 (_bfd_generic_link_add_archive_symbols): Use archive_hash_allocate
1767 rather than obstack_alloc, for clarity.
1769 * elfcode.h (elf_get_reloc_upper_bound): Correct.
1771 * aout64.c (BMAGIC, QMAGIC): Define if not already defined. From
1775 * libaout.h (struct aoutdata): Add field zmagic_disk_block_size.
1776 * aout-target.h (MY(callback)): Only set alignment according to
1777 architecture if the section sizes are aligned to that alignment,
1778 for backward compatibility.
1779 (MY(set_sizes)): Initialize zmagic_disk_block_size field.
1780 * aoutx.h (adjust_z_magic): Set ztih if using q_magic_format. Set
1781 text section filepos to zmagic_disk_block_size if not ztih. Use a
1782 different padding algorithm if not ztih.
1783 * i386linux.c (MY_text_includes_header): Don't define.
1785 * aoutx.h (aout_link_check_ar_symbols): Just skip N_STAB and N_FN
1786 symbols; don't look them up in the hash table. From
1791 * coff-go32.c (go32coff_archive_p): Remove unused function.
1793 * section.c (bfd_abs_section): Make const.
1794 (bfd_abs_section_ptr, bfd_is_abs_section): Define.
1795 (bfd_und_section): Make const.
1796 (bfd_und_section_ptr, bfd_is_und_section): Define.
1797 (bfd_com_section): Make const.
1798 (bfd_com_section_ptr): Define.
1799 (bfd_ind_section): Make const.
1800 (bfd_ind_section_ptr, bfd_is_ind_section): Define.
1801 (bfd_abs_symbol, bfd_com_symbol): Make const.
1802 (bfd_und_symbol, bfd_ind_symbol): Likewise.
1803 (global_syms): Cast initialization of section field.
1804 (STD_SECTION): Define as const, and cast initializations.
1805 * bfd-in2.h: Rebuilt.
1806 * Many files: Change uses of bfd_abs_section, etc., to use
1807 bfd_abs_section_ptr or bfd_is_abs_section, etc.
1811 * Many files: change all bfd_target vectors to be const. Change
1812 all uses of bfd_target * to be const bfd_target *. Change
1813 bfd_target_vector and bfd_default_vector arrays to be const
1814 bfd_target * const *.
1816 * ecoff.c, libecoff.h, ecoffswap.h, coff-alpha.c, coff-mips.c,
1817 elf32-mips.c: Renamed all externally visible ECOFF routines which
1818 are local to BFD to start with _bfd_ecoff instead of just ecoff.
1820 * ecoff.c (ecoff_swap_tir_in): Change input argument to const.
1821 (ecoff_swap_tir_out): Likewise.
1822 (ecoff_swap_rndx_in, ecoff_swap_rndx_out): Likewise.
1823 (ecoff_slurp_symbolic_info): Add new arguments to correspond to
1824 read_debug_info entry point in ecoff_debug_swap structure.
1826 * libecoff.h (ecoff_slurp_symbolic_info): Change declaration.
1827 * ecoffswap.h (ecoff_swap_tir_in, ecoff_swap_tir_out): Declare.
1828 (ecoff_swap_rndx_in, ecoff_swap_rndx_out): Declare.
1829 * coff-alpha.c (alpha_ecoff_backend_data): Initialize new
1830 ecoff_debug_swap fields.
1831 * coff-mips.c (mips_ecoff_backend_data): Likewise.
1832 * elf32-mips.c (mips_elf_read_ecoff_info): Undefine READ.
1833 (mips_elf_ecoff_debug_swap): Initialize new ecoff_debug_swap
1835 * configure.in (bfd_elf32_bigmips_vec): Use ecoff.o and
1837 (bfd_elf32_littlemips_vec): Likewise.
1838 (ecoff_big_vec, ecoff_little_vec): Likewise.
1839 (ecoffalpha_little_vec): Likewise.
1840 * Makefile.in (BFD_LIBS): Remove ecoff.o and ecofflink.o.
1841 (BFD32_BACKENDS): Add ecoff.o and ecofflink.o.
1843 * aoutx.h (NAME(aout,final_link)): Check flavour of sub, not abfd,
1844 when computing reloc sizes. From Eric Youngdale
1846 * elfcode.h (elf_bfd_final_link): Don't try to compute maximum
1847 reloc count or size for a non-ELF file.
1849 * mipsbsd.c (MY_final_link_callback): Define to avoid warning.
1851 * hp300hpux.c (MY_final_link_callback): Define to avoid warning.
1852 (BMAGIC, QMAGIC): Define; used by aoutx.h.
1853 (MY(slurp_symbol_table)): Change translate_from_native_sym_flags
1854 calls to use new parameters.
1858 * aout-target.h (MY(callback)): Set the alignments of the text,
1859 data and bss sections after determining the architecture.
1861 * sunos.c (sunos_add_one_symbol): Treat a common symbol from a
1862 dynamic object as being in the .bss section of the object, rather
1863 than as being undefined.
1867 * libhppa.h (bfd_hppa_insn2fmt, hppa_rebuild_insn): Make INLINE.
1869 * elf32-hppa.h (elf_hppa_final_processing): Delete decl.
1873 * elfcode.h (elf_link_input_bfd): Don't try to read local symbols
1874 if there aren't any in the input file.
1878 * i386linux.c: Many new functions and definitions for linker
1879 support for Linux shared libraries.
1880 * bfd-in.h (bfd_linux_size_dynamic_sections): Declare.
1881 * bfd-in2.h: Rebuild.
1885 * config.bfd: If second argument is ``_'', then, instead of
1886 echoing config file name, echo whether target uses leading
1887 underscores on symbol names. Add appropriate settings to
1888 different cases. Used by binutils/configure.in to set default for
1891 * elfcode.h (elf_bfd_final_link): If trying to generate a shared
1892 object, warn and return false.
1894 * aoutx.h (NAME(aout,some_aout_object_p)): Accept BMAGIC objects
1895 and treat them as OMAGIC.
1899 Enable sparc v9 support for release. Note that this is still a
1900 work in progress, pending release of an ABI specification.
1901 * config.bfd, configure.in: Include sparc v9 elf config.
1902 * elfcode.h (prep_headers): Handle sparc v9 (64 bit).
1903 * reloc.c (bfd_reloc_code_real): New reloc types.
1904 * elf64-sparc.c: Implement elf64-sparc target.
1905 * Makefile.in, targets.c: Updated.
1909 * libelf.h (struct elf_obj_tdata): New field dt_needed_name.
1910 (elf_dt_needed_name): New accessor macro.
1911 * elfcode.h (elf_link_add_object_symbols): If elf_dt_needed_name
1912 is set, use that instead of the filename for the DT_NEEDED dynamic
1914 * elf.c (bfd_elf_set_dt_needed_name): New function.
1915 * bfd-in.h (bfd_elf_set_dt_needed_name): Declare.
1916 * bfd-in2.h: Rebuilt.
1918 * elfcode.h (NAME(bfd_elf,size_dynamic_sections)): Add sinterpptr
1919 argument, and set it to the .interp section.
1920 * bfd-in.h (bfd_elf32_size_dynamic_sections): Update prototype.
1921 (bfd_elf64_size_dynamic_sections): Likewise.
1922 * bfd-in2.h: Rebuilt.
1924 * coff-sparc.c (SWAP_OUT_RELOC_EXTRA): Define to clear the r_spare
1925 field of the reloc rather than letting it be garbage.
1927 * archive.c (bfd_slurp_armap): Recognize __.SYMDEF/ as well as
1928 __.SYMDEF; the former was used in old Linux archives. From
1931 * i386linux.c (i386linux_write_object_contents): Define; like
1932 MY(write_object_contents) in aout-target.h, but set MACHTYPE to
1934 (MY_write_object_contents): Define.
1936 * aoutx.h (translate_from_native_sym_flags): Treat N_SETV symbols
1938 (aout_link_add_symbols): Likewise.
1940 * aoutx.h: Rewrite symbol duplicate elimination to use BFD hash
1942 (struct stringtab_entry, struct stringtab_data): Remove.
1943 (HASHMAXLEN, HASH_CHAR, hash, compare, log2, emit_strtab): Remove.
1944 (struct strtab_hash_entry, struct strtab_hash): Define.
1945 (strtab_hash_newfunc, strtab_hash_lookup): Define.
1946 (stringtab_free, emit_stringtab): Define.
1947 (stringtab_init, add_to_stringtab): Rewrite.
1948 (NAME(aout,write_syms)): Use new stringtab code.
1949 (struct aout_final_link_info, NAME(aout,final_link)): Likewise.
1950 (aout_link_write_symbols, aout_link_write_other_symbol): Likewise.
1952 * bfd-in.h (BFD_TRADITIONAL_FORMAT): Define new BFD flag to
1953 request BFD to write object in the traditional format, whatever
1954 that means for the particular backend.
1955 * bfd-in2.h: Rebuilt.
1957 * hash.c (bfd_hash_allocate): If obstack_alloc fails, set
1958 bfd_error_no_memory.
1962 * libaout.h (struct aoutdata): Add q_magic_format to subformat
1964 * aout-target.h (MY_bfd_copy_private_bfd_data): Define as function
1965 if not already defined. Copy subformat information.
1966 (MY_text_includes_header): Define as 0 if not already defined.
1967 (MY(backend_data)): Use MY_text_includes_header rather than 0.
1968 (MY_final_link_callback): Rename from final_link_callback, and
1969 define only if MY_final_link_callback is not already defined.
1970 (MY_bfd_final_link): Rename use of final_link_callback to
1971 MY_final_link_callback.
1972 * aoutx.h (NAME(aout,some_aout_object_p)): Handle QMAGIC like
1973 ZMAGIC, but set the subformat to q_magic_format. Abort if the
1974 magic number if not recognized.
1975 (adjust_z_magic): Use QMAGIC if q_magic_format.
1976 * i386linux.c (MY_text_includes_header): Define as 1.
1977 (i386linux_bfd_final_link): New static function.
1978 (MY_bfd_final_link): Define as i386linux_bfd_final_link.
1980 * aoutx.h (translate_to_native_sym_flags): Check both section and
1981 output_section against sections of abfd.
1983 * libecoff.h (struct ecoff_link_hash_entry): Change type of
1984 written from boolean to char. Add new field small.
1985 * ecoff.c (ecoff_link_hash_newfunc): Initialize written to 0
1986 rather than false. Initialize small to 0.
1987 (ecoff_link_add_externals): If ECOFF type is scSUndefined, set
1988 small. If small is set, and hash table type is common, force the
1989 symbol into a section named SCOMMON and change the ECOFF type from
1990 scCommon to scSCommon.
1991 (ecoff_link_write_external): Set written to 1 rather than true.
1992 * coff-mips.c (mips_relocate_section): Correct JMPADDR reloc
1993 overflow check to consider section VMA of input file.
1997 * aoutf1.h (aout_32_sunos4_write_object_contents): Handle a
1998 machine type of 68000.
1999 * aoutx.h (NAME(aout,machine_type)): Add new argument unknown.
2000 Set *unknown to true if machine type is really unknown, as opposed
2001 to M_UNKNOWN for the 68000.
2002 (NAME(aout,set_arch_mach)): Change NAME(aout,machine_type) call
2004 * libaout.h (NAME(aout,machine_type)): Add new argument to
2009 * som.c (EXEC_AUX_ID): Define based on availablity of HPUX_AUX_ID
2011 (som_begin_writing): Use EXEC_AUX_ID instead of HPUX_AUX_ID.
2012 (som_write_armap): Use CPU_PA_RISC1_0 as the magic number. Note
2013 som.c is careful to always define CPU_PA_RISC1_0.
2017 Add weak symbols as an extension to a.out.
2018 * aoutx.h (sym_in_text_section): Don't define.
2019 (sym_in_data_section, sym_in_bss_section): Likewise.
2020 (sym_is_undefined, sym_is_global_defn): Likewise.
2021 (sym_is_debugger_info, sym_is_fortrancommon): Likewise.
2022 (sym_is_absolute, sym_is_indirect): Likewise.
2023 (translate_from_native_sym_flags): Rewrite for clarity. Rearrange
2024 arguments and change caller. Handle weak symbols.
2025 (translate_to_native_sym_flags): Likewise.
2026 (aout_link_check_ar_symbols): Don't ignore weak symbols. Pull
2027 object in from archive if a weak defintion is found for an
2028 existing undefined symbol.
2029 (aout_link_add_symbols): Put all cases in switch. Set flags of an
2030 undefined symbol to 0. Handle weak symbols.
2031 (aout_link_write_symbols): Handle weak symbols.
2032 (aout_link_write_other_symbol): Likewise.
2033 (aout_link_input_section_std): Likewise.
2034 (aout_link_input_section_ext): Likewise.
2035 * sunos.c (sunos_write_dynamic_symbol): Likewise.
2039 * aoutx.h (NAME(aout,canonicalize_reloc)): Handle .bss section.
2040 (NAME(aout,get_reloc_upper_bound)): Likewise.
2042 * coff-i960.c (coff_i960_reloc_type_lookup): Add BFD_RELOC_CTOR.
2043 * linker.c (_bfd_generic_link_write_global_symbol): Don't assume
2044 the section of a common symbol is not NULL.
2048 * nlmcode.h (nlm_object_p): Set EXEC_P and start address for GDB.
2052 * aoutx.h (aout_get_external_symbols): Don't try to read the
2053 strings if there are no symbols.
2054 (aout_link_write_other_symbol): Use the output section when
2055 working out the type.
2059 * elfcode.h (assign_section_numbers): Put shstrtab, symtab and
2060 strtab sections at end of file. Avoids bug in some versions of
2063 * coffcode.h (styp_to_sec_flags): If COFF_PAGE_SIZE is defined,
2064 set SEC_DEBUGGING for STYP_INFO sections.
2065 (coff_compute_section_file_positions): If COFF_PAGE_SIZE is
2066 defined, and D_PAGED is set, set the file position equal to the
2067 section VMA modulo COFF_PAGE_SIZE.
2068 * coffgen.c (coff_real_object_p): If F_EXEC is set, set D_PAGED.
2069 * coff-i386.c: Set D_PAGED in BFD target.
2070 (COFF_PAGE_SIZE): Define.
2071 * coff-m68k.c, coff-sparc.c: Likewise.
2075 * elfcode.h (bfd_section_from_shdr): Don't turn a reloc section
2076 into a BFD section just because SHF_ALLOC is set; require that it
2077 not use the normal symbol table.
2078 (elf_section_from_bfd_section): Corresponding change.
2080 Better indirect and warning symbol handling inspired by Stuart
2082 * linker.c (enum link_action): Add REF, MIND, CWARN, REFC.
2083 (link_action): Change UNDEF_ROW/def and UNDEFW_ROW/def from NOACT
2084 to REF. Change UNDEF_ROW/indr and UNDEFW_ROW/indr from CYCLE to
2085 REFC. Change DEF_ROW/indr and COMMON_ROW/indr from CYCLE to MDEF.
2086 Change DEFW_ROW/indr from CYCLE to NOACT. Change INDR_ROW/indr
2087 from MDEF to MIND. Change INDR_ROW/warn from WARNC to CYCLE.
2088 Change WARN_ROW/def and WARN_ROW/indr from MWARN to CWARN. Change
2089 WARN_ROW/com from MWARN to WARN. Change WARN_ROW/warn from NOACT
2090 to CYCLE. Change SET_ROW/warn from WARNC to CYCLE>
2091 (_bfd_generic_link_add_one_symbol): Handle REF, MIND, CWARN and
2092 REFC. If a new indirect symbol has been referenced, push the
2093 reference down to the symbol it points to. FIx handling of WARN.
2094 * aoutx.h (translate_from_native_sym_flags): If N_WARNING, don't
2095 clobber e_type of next symbol.
2096 (translate_to_native_sym_flags): Likewise.
2097 (aout_link_write_symbols): Loop on bfd_link_hash_warning as well
2098 as bfd_link_hash_indirect.
2100 * libaout.h (struct aout_link_hash_entry): New field written.
2101 * aoutx.h (NAME(aout,link_hash_newfunc)): Initialize written.
2102 (aout_link_write_symbols): Use written, not root.written.
2103 (aout_link_write_other_symbol): Likewise.
2104 * sunos.c (sunos_scan_dynamic_symbol): Likewise.
2105 * libecoff.h (struct ecoff_link_hash_entry): New field written.
2106 * ecoff.c (ecoff_link_hash_newfunc): Initialize written.
2107 (ecoff_link_write_external): use written, not root.written.
2108 * genlink.h (struct generic_link_hash_entry): New field written.
2109 * linker.c (_bfd_link_hash_newfunc): Don't initialize written.
2110 (generic_link_hash_newfunc): Initialize written.
2111 (_bfd_generic_link_output_symbols): Use written, not root.written.
2112 (_bfd_generic_link_write_global_symbol): Likewise.
2113 (_bfd_generic_reloc_link_order): Likewise.
2115 * libecoff.h (ecoff_data_type): Add linker field.
2116 * ecoff.c (ecoff_write_object_contents): Check new tdata linker
2117 field, rather than outsymbols being non-NULL, to decide whether to
2118 output the symbols and relocs.
2119 (ecoff_bfd_final_link): Set new tdata linker field to true.
2121 * ecoff.c (ecoff_bfd_copy_private_bfd_data): Don't try to copy
2122 data to a non-ECOFF file.
2124 * libbfd-in.h: Add warning that libbfd.h is a generated file.
2125 * libbfd.h: Rebuilt.
2129 Changes to support ELF strip and objcopy on dynamically linked
2131 * elfcode.h (elf_fake_sections): Add prototype.
2132 (bfd_section_from_shdr): Make a BFD section from an SHT_HASH
2133 section, and from an SHT_DYNSYM section, and from the dynamic
2134 string table section.
2135 (elf_object_p): Set D_PAGED if there is a program header.
2136 (elf_make_sections): Remove.
2137 (fix_up_strtabs): Remove.
2138 (elf_fake_sections): Rewrite. Now sets sh_entsize.
2139 (assign_section_numbers): Rewrite. Now sets sh_link and sh_info
2141 (elf_compute_section_file_positions): Don't call obsolete
2142 functions elf_make_sections or fix_up_strtabs.
2143 (swap_out_syms): Set sh_addralign to FILE_ALIGN rather than 4.
2144 (NAME(bfd_elf,write_object_contents)): Permit writing DYNAMIC
2146 (elf_section_from_bfd_section): Treat SHT_DYNSYM like other normal
2147 sections. If an SHT_REL or SHT_RELA section is allocated or uses
2148 an unusual symbol table, permit a BFD section to map to it.
2149 Permit most SHT_STRTAB sections to have a BFD section mapped to
2151 (elf_bfd_final_link): Don't set sh_link, sh_info or sh_entsize
2152 fields of dynamic sections here; do it in assign_section_numbers.
2153 * elf32-target.h, elf64-target.h: Add D_PAGED to permitted object
2156 * elf.c (_bfd_elf_make_section_from_shdr): Only set SEC_DATA if
2157 SEC_LOAD is set, rather than checking SEC_ALLOC.
2159 * libbfd-in.h (bfd_realloc): Change last arg to "size_t size".
2163 * som.c (som_write_object_contents): Don't compute the file header's
2165 (som_write_headers): Instead do it here.
2167 * libbfd.h (bfd_realloc): Change last arg to "size_t size".
2171 * hosts/sun3.h: Include <stdlib.h>. Don't declare free, exit or
2174 Add linker support for SunOS shared libraries.
2175 * sunos.c: Include bfdlink.h. Add many new functions and
2176 definitions for SunOS shared library support.
2177 * bfd-in.h (bfd_sunos_record_link_assignment): Declare.
2178 (bfd_sunos_size_dynamic_sections): Declare.
2179 * bfd-in2.h: Rebuilt.
2180 * aoutx.h (struct aout_link_hash_entry): Move to libaout.h.
2181 (struct aout_link_hash_table): Likewise.
2182 (aout_link_hash_lookup, aout_link_hash_traverse): Likewise.
2183 (aout_hash_table): Likewise.
2184 (NAME(aout,link_hash_newfunc)): Rename from aout_link_hash_newfunc
2185 and make externally visible.
2186 (NAME(aout,link_hash_table_init)): New function.
2187 (NAME(aout,link_hash_table_create)): Call
2188 NAME(aout,link_hash_table_init), not _bfd_link_hash_table_init.
2189 (aout_link_add_symbols): Don't fail if no symbols. If it exists,
2190 call add_dynamic_symbols backend entry point for dynamic objects.
2191 Use add_one_symbol backend entry point if it exists.
2192 (NAME(aout,final_link)): Call finish_dynamic_link backend entry
2193 point, if it exists.
2194 (aout_link_input_bfd): For a dynamic object, call
2195 link_dynamic_object backend entry point, if it exists.
2196 (aout_link_write_other_symbol): Call write_dynamic_symbol backend
2197 entry point, if it exists.
2198 (aout_link_input_section): Don't read the relocs if they have
2200 (aout_link_input_section_std): When doing a final link, for a
2201 reloc against an external symbol, call check_dynamic_reloc backend
2202 entry point, if it exists.
2203 (aout_link_input_section_ext): Likewise.
2204 * libaout.h: Protect against multiple inclusion. Include
2206 (struct aout_link_hash_entry): Move in from aoutx.h.
2207 (struct aout_link_hash_table): Likewise.
2208 (aout_link_hash_lookup, aout_link_hash_traverse): Likewise.
2209 (aout_hash_table): Likewise.
2210 (struct aout_backend_data): Add fields add_dynamic_symbols,
2211 add_one_symbol, link_dynamic_object, write_dynamic_symbol,
2212 check_dynamic_reloc, and finish_dynamic_link.
2213 (struct aout_section_data_struct): Define new structure.
2214 (aout_section_data): Define new accessor macro.
2215 (NAME(aout,link_hash_newfunc)): Declare.
2216 (NAME(aout,link_hash_table_init)): Declare.
2217 * aoutf1.h (sunos4_aout_backend): Initialize new aout_backend_data
2219 * aout-target.h (MY(backend_data)): Likewise.
2220 * i386aout.c (MY(backend_data)): Likewise.
2221 * i386mach3.c (MY(backend_data)): Likewise.
2222 * mipsbsd.c (MY(backend_data)): Likewise.
2223 * sparclynx.c (sparclynx_aout_backend): Likewise.
2225 * aoutx.h (NAME(aout,slurp_symbol_table)): Don't zero out cached
2226 until we know it is non-NULL.
2227 (aout_link_write_symbols): Don't skip a warning symbol even if it
2228 has already been written out. If skipping an indirect symbol,
2229 skip the next symbol as well.
2233 * hosts/sun3.h: Don't declare qsort, malloc or realloc.
2237 * nlmcode.h (nlm_swap_auxiliary_headers_in): Cast bfd_byte pointer
2238 to char pointer to avoid compiler warnings.
2240 * dep-in.sed: Remove spaces before colons.
2242 Merged changes back in from FSF gas release 2.3:
2244 * Makefile.in (stmp-bfd.h): Wrap `if' block around grep
2245 invocation, to avoid a bug in BSD 4.4 make.
2247 From Ralph Campbell:
2248 * mipsbsd.c (mips_fix_jmp_addr): If symbol is undefined, return an
2250 (mips_fix_hi16_s): Ditto.
2254 * makefile.dos: define a default target, or archives won't work
2255 due to multiple matches.
2259 * configure.bat: update for latest files
2260 * makefile.dos: update for correct targets and sources
2261 * coff-go32.c: [new] go32's COFF format (i386coff with underscores)
2262 * targets.c: add go32coff target
2263 * makefile.in: add coff-go32.c support
2267 * som.c (som_prep_headers): Do not set the system_id here, private
2268 bfd data has not been copied yet.
2269 (som_write_headers): Instead do it here.
2273 Make MIPS ELF use new ELF backend linker. No shared library
2275 * elf32-mips.c (bfd_mips_elf32_swap_gptab_in): New function.
2276 (bfd_mips_elf32_swap_gptab_out): New function.
2277 (mips_elf_object_p): If last symbol is LOCAL, set elf_bad_symtab.
2278 (mips_elf_final_write_processing): Set sh_info field for .gptab.*
2280 (mips_elf_fake_sections): Set sh_entsize for .gptab.* sections.
2281 (mips_elf_read_ecoff_info): Read and free external symbols last,
2282 not first, for clarity.
2283 (struct mips_elf_link_hash_entry): Define new structure.
2284 (struct mips_elf_link_hash_table): Define new structure.
2285 (mips_elf_link_hash_lookup): Define new macro.
2286 (mips_elf_link_hash_traverse): Define new macro.
2287 (mips_elf_hash_table): Define new macro.
2288 (mips_elf_link_hash_newfunc): New static function.
2289 (mips_elf_link_hash_table_create): New static function.
2290 (mips_elf_add_symbol_hook): New static function.
2291 (struct extsym_info): Define new structure.
2292 (mips_elf_get_extr, mips_elf_set_index): Remove.
2293 (mips_elf_output_extsym): New static function.
2294 (gptab_compare): New static function.
2295 (mips_elf_final_link): Rewrite to use ELF backend linker, and to
2296 merge gptab information in input files.
2297 (mips_elf_relocate_hi16): New static function.
2298 (mips_elf_relocate_section): New static function.
2299 (bfd_elf32_bfd_link_hash_table_create): Define as macro before
2300 including elf32-target.h.
2301 (elf_backend_relocate_section): Likewise.
2302 (elf_backend_add_symbol_hook): Likewise.
2303 * elf.c (_bfd_elf_link_hash_newfunc): Rename from
2304 elf_link_hash_newfunc and make globally visible. Change caller.
2305 (_bfd_elf_link_hash_table_init): New function, broken out of
2306 _bfd_elf_link_hash_table_create.
2307 (_bfd_elf_link_hash_table_create): Use
2308 _bfd_elf_link_hash_table_init.
2309 * libelf.h (struct elf_obj_tdata): Add new field bad_symtab.
2310 (elf_bad_symtab): Define new accessor macro.
2311 (_bfd_elf_link_hash_newfunc): Declare.
2312 (_bew_elf_link_hash_table_init): Declare.
2313 * elfcode.h (elf_object_p): Call backend object_p hook after
2314 swapping in all the section headers.
2315 (map_program_segments): Correct typo: Internal for External.
2316 (elf_link_add_object_symbols): If elf_bad_symtab is set, read all
2317 the symbols. Skip STB_LOCAL symbols rather than giving an error.
2318 (elf_bfd_final_link): If elf_bad_symtab is set, allocate space for
2319 all symbols, not just locals.
2320 (elf_link_output_extsym): Only skip a symbol not mentioned by a
2321 regular file if it is mentioned by a dynamic object.
2322 (elf_link_input_bfd): If elf_bad_symtab is set, read all the
2327 * som.c (som_set_reloc_info): Do not set any relocation info
2328 for SOM fixups which are never passed to BFD.
2332 * coff-mips.c (mips_relocate_section): Add MIPS_R_JMPADDR overflow
2335 * elf32-i386.c (elf_i386_size_dynamic_sections): Add DT_DEBUG to
2336 the dynamic linking information for the benefit of the debugger.
2338 * elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise.
2340 * elf.c (_bfd_elf_make_section_from_shdr): New function, based on
2341 code repeated three times in bfd_section_from_shdr in elfcode.h.
2342 * libelf.h (_bfd_elf_make_section_from_shdr): Declare.
2343 * elfcode.h (bfd_section_from_shdr): Use new function
2344 _bfd_elf_make_section_from_shdr to create BFD sections. If a
2345 reloc section does not use the main symbol table, or it is part of
2346 the process image, treat it as a normal section, not relocs.
2347 * elf32-mips.c (mips_elf_section_from_shdr): Use new function
2348 _bfd_elf_make_section_from_shdr.
2352 * elf32-target.h, elf64-target.h: Change ar_max_namelen value from
2353 15 to 14 to match SVR4 ar.
2355 Add support for ELF shared libraries. Loosely based on work by
2357 * libelf.h (struct elf_backend_data): Add new fields for dynamic
2358 linking: elf_backend_create_dynamic_sections,
2359 elf_backend_adjust_dynamic_symbol,
2360 elf_backend_size_dynamic_sections,
2361 elf_backend_finish_dynamic_symbol,
2362 elf_backend_finish_dynamic_sections.
2363 (struct elf_link_hash_entry): Change type of align field to
2364 bfd_size_type. Add fields dynindx, dynstr_index, weakdef,
2365 elf_link_hash_flags.
2366 (struct elf_link_hash_table): Add fields dynobj, dynsymcount,
2367 dynstr, bucketcount.
2368 (bfd_elf32_swap_reloc_in, bfd_elf32_swap_reloc_out): Declare.
2369 (bfd_elf32_swap_reloca_in, bfd_elf32_swap_reloca_out): Declare.
2370 (bfd_elf32_swap_dyn_in, bfd_elf32_swap_dyn_out): Declare.
2371 (bfd_elf32_add_dynamic_entry): Declare.
2372 (bfd_elf64_swap_reloc_in, bfd_elf64_swap_reloc_out): Declare.
2373 (bfd_elf64_swap_reloca_in, bfd_elf64_swap_reloca_out): Declare.
2374 (bfd_elf64_swap_dyn_in, bfd_elf64_swap_dyn_out): Declare.
2375 (bfd_elf64_add_dynamic_entry): Declare.
2376 * elfcode.h (Elf_External_Dyn): Define.
2377 (elf_swap_reloc_in): Define as macro using NAME. Make externally
2379 (elf_swap_reloc_out): Likewise.
2380 (elf_swap_reloca_in, elf_swap_reloca_out): Likewise.
2381 (elf_swap_dyn_in, elf_swap_dyn_out): Define as macro using NAME
2382 and as new externally visible function.
2383 (elf_fake_sections): Set section type of dynamic sections based on
2385 (elf_write_phdrs): Remove.
2386 (assign_file_position_for_section): Add new align argument.
2388 (get_program_header_size): New static function.
2389 (struct seg_info): Remove.
2390 (map_program_segments): Completely rewrite.
2391 (assign_file_positions_except_relocs): Completely rewrite.
2392 (assign_file_positions_for_relocs): Don't set a file position for
2393 sections which already have one. Don't bother to align the file
2395 (section_from_elf_index): Handle SHT_HASH and SHT_DYNAMIC
2397 (elf_section_from_bfd_section): Likewise.
2398 (elf_slurp_symbol_table): If section_from_elf_index fails, just
2399 use bfd_abs_section rather than returning an error.
2400 (elf_sizeof_headers): Make useful.
2401 (elf_link_record_dynamic_symbol): New static function.
2402 (elf_link_add_object_symbols): Handle dynamic objects.
2403 (elf_link_create_dynamic_sections): New static function.
2404 (elf_add_dynamic_entry): Define as macro using NAME and as new
2405 externally visible function.
2406 (NAME(bfd_elf,record_link_assignment)): New function.
2407 (elf_buckets): New static variable.
2408 (NAME(bfd_elf,size_dynamic_sections)): New function.
2409 (struct elf_final_link_info): Add dynsym_sec and hash_sec fields.
2410 (elf_bfd_final_link): Handle dynamic linking. Create a section
2411 symbol for all ELF sections, not all BFD sections. Store section
2412 symbol index in target_index field, not index field. Traverse
2413 over global symbols even if stripping.
2414 (elf_link_output_extsym): Output dynamic symbols. Mark symbols
2415 defined by dynamic objects as undefined.
2416 (elf_link_input_bfd): Ignore dynamic objects. Use target_index
2417 field for section relocs, and make sure it is set.
2418 (elf_reloc_link_order): Use target_index field for section relocs,
2419 and make sure it is set.
2420 * elf.c (elf_link_hash_newfunc): Initialize dynindx, dynstr_index,
2421 weakdef and elf_link_hash_flags fields.
2422 (_bfd_elf_link_hash_table_create): Initialize dynobj, dynsymcount,
2423 dynstr and bucketcount fields.
2424 * elf32-target.h: Initialize new dynamic linking fields.
2425 * elf64-target.h: Likewise.
2426 * elf32-i386.c: New functions for dynamic linking support.
2427 * elf32-sparc.c: Likewise.
2428 * bfd-in.h (bfd_elf32_record_link_assignment): Declare.
2429 (bfd_elf64_record_link_assignment): Declare.
2430 (bfd_elf32_size_dynamic_sections): Declare.
2431 (bfd_elf64_size_dynamic_sections): Declare.
2432 * bfd-in2.h: Rebuilt.
2436 * som.c: Don't include <sys/dir.h> or <sys/user.h>.
2437 (som_reloc_queue_find): Call memcmp instead of bcmp.
2438 (som_bfd_reloc_type_lookup): Change first argument to bfd *.
2439 (compare_syms): Change types of arguments to const void *.
2440 (bfd_section_from_som_symbol): Removed unused local found.
2441 (som_write_armap): Add elength, map, orl_count and int arguments.
2442 (som_write_armap): Use %ld and cast to long for getuid result.
2446 * elf32-hppa.h (R_HPPA_ABS_CALL): Define.
2447 * elf32-hppa.c (hppa_elf_gen_reloc_type): Handle absolute calls.
2449 * som.h (R_HPPA_ABS_CALL): Define.
2450 * som.c (hppa_som_gen_reloc_type): Delete complex relocation types.
2454 * coff-i960.c (icoff_little_vec, icoff_big_vec): Indicate leading
2455 underscore, for compatibility with Intel tool chain (gnu960v2).
2459 * bfd-in2.h: Rebuilt.
2461 * elf32-hppa.c: Change .hppa_linker_stubs to .PARISC.stubs,
2462 likewise for other PA specific sections.
2463 (hppa_elf_relocate_unwind_table): Delete unused
2465 (elf_hppa_howto_table): Completely new table based on 94-02-02
2466 draft PA ELF spec. Change relocation tags appropriately
2467 throughout elf32-hppa.c
2468 (hppa_elf_gen_reloc_type): Rewrite and simplify based on 94-02-02
2470 (hppa_elf_reloc): Likewise.
2471 (hppa_look_for_stubs_in_section): Likewise
2472 (ELF_MACHINE_CODE): Change to EM_PARISC.
2473 * elf32-hppa.h: Include "elf/hppa.h". Change relocation tags
2474 appropriately throughout elf32-hppa.h.
2475 (elf32_hppa_reloc_type): New table based on 94-02-02 draft PA ELF
2477 (R_HPPA_ABS_CALL, R_HPPA_COMPLEX*, R_HPPA_UNWIND): Delete definitions.
2478 * elfcode.h (prep_headers): Use EM_PARISC instead of EM_HPPA.
2479 * reloc.c (bfd_reloc_code_real): Delete unused HPPA relocations.
2480 * som.h (R_HPPA_ABS_CALL, R_HPPA_COMPLEX): Delete definitions.
2482 * libhppa.h (hppa_field_adjust): Avoid adding constant_value into
2483 the final value twice for LR and RR field selectors.
2487 * aoutx.h (add_to_stringtab): Use BFD_ASSERT not assert. This
2488 avoids __eprintf troubles.
2492 * bout.c (b_out_bfd_reloc_type_lookup): Handle BFD_RELOC_CTOR.
2494 * config/mipsbelf.mt (SELECT_VECS): Add ecoff_big_vec and
2495 ecoff_little_vec since Irix 5 supports ECOFF executables.
2499 * ecoff.c (ecoff_find_nearest_line): Handle fdr.adr != pdr.adr
2502 * Makefile.in (stmp-bfd.h): Use || instead of ; to force SunOS
2503 make to invoke the shell.
2507 * section.c (SEC_COFF_SHARED_LIBRARY): Renamed from
2508 SEC_SHARED_LIBRARY for clarity. Changed all uses.
2509 * bfd-in2.h: Rebuilt.
2510 * coffcode.h (sec_to_styp_flags): If SEC_COFF_SHARED_LIBRARY is
2511 set, set STYP_NOLOAD.
2512 * coffgen.c (coff_section_from_bfd_index): Don't get an assertion
2513 failure because of a bad shared library.
2517 * linker.c: Add missing comment terminator.
2521 * linker.c (_bfd_generic_link_add_one_symbol): If hashp and *hashp
2522 are not NULL, assume the caller has already looked up the symbol
2523 in the hash table and has stored the entry in *hashp.
2524 (generic_link_add_symbol_list): Set h to NULL before calling
2525 _bfd_generic_link_add_one_symbol.
2526 * ecoff.c (ecoff_link_add_externals): Likewise.
2528 * elfcode.h (assign_file_positions_except_relocs): Don't require
2529 page shared between .data and .bss segments to contain zeroes.
2531 * elfcode.h: Include bfdlink.h. Added several new functions to do
2533 (ELF_R_TYPE): Define.
2534 (bfd_add_to_strtab): Return unsigned long. Change check for
2536 (elf_fake_sections): Check return value of bfd_add_to_strtab.
2537 (elf_compute_section_file_positions): Add link_info argument.
2538 Call elf_backend_begin_write_processing hook and prep_headers
2539 here. Only call swap_out_syms if link_info is NULL. Set up
2540 .shstrtab section here. Pass dosyms argument to
2541 assign_file_positions_except_relocs. Set output_has_begun flag.
2542 (assign_file_positions_for_symtab_and_strtabs): Add dosyms
2543 argument, and use it to control setting .symtab and .strtab file
2545 (assign_file_positions_except_relocs): Add dosyms argument, and
2547 (prep_headers): Check return value of bfd_add_to_strtab.
2548 (swap_out_syms): Likewise. Also, don't set up .shstrtab here.
2549 (NAME(bfd_elf,write_object_contents)): Some calls moved into
2550 elf_compute_section_file_positions.
2551 (elf_set_section_contents): Likewise.
2552 (elf_slurp_symbol_table): SHN_LORESERV corrected to SHN_LORESERVE.
2553 * libelf.h: Include bfdlink.h.
2554 (struct elf_backend_data): Add fields collect,
2555 elf_add_symbol_hook, elf_backend_relocate_section.
2556 (struct bfd_elf_section_data): Add field rel_hashes.
2557 (struct elf_obj_tdata): Remove fields internal_syms and symbols.
2558 Add field sym_hashes.
2559 (obj_symbols, obj_internal_syms): Remove definitions.
2560 (elf_sym_hashes): Define.
2561 (struct elf_link_hash_entry): Define.
2562 (struct elf_link_hash_table): Define.
2563 (elf_link_hash_lookup): Define.
2564 (elf_link_hash_traverse): Define.
2565 (elf_hash_table): Define.
2566 (_bfd_elf_link_hash_table_create): Declare.
2567 (bfd_elf32_bfd_link_add_symbols): Declare.
2568 (bfd_elf32_bfd_final_link): Declare.
2569 (bfd_elf64_bfd_link_add_symbols): Declare.
2570 (bfd_elf64_bfd_final_link): Declare.
2571 * elf.c: Include bfdlink.h.
2572 (elf_link_hash_newfunc): New function.
2573 (_bfd_elf_link_hash_table_create): New function.
2574 * elf32-target.h (elf_backend_relocate_section): If not defined,
2575 define as 0 and use generic linker. Otherwise, use ELF backend
2577 (elf_backend_collect): If not defined, define as false.
2578 (elf_backend_add_symbol_hook): If not defined, define as 0.
2579 (elf32_bed): Initialize new fields.
2580 * elf64-target.h: Same changes as elf32-target.h.
2581 * elf32-i386.c: Include bfdlink.h.
2582 (elf_i386_relocate_section): New function.
2583 (elf_backend_relocate_section): Define.
2584 * elf32-sparc.c: Include bfdlink.h.
2585 (elf_info_to_howto): Change type of dst from Elf32_Internal_Rela
2586 to Elf_Internal_Rela (they're the same type anyhow).
2587 (elf_sparc_relocate_section): New function.
2588 (elf_backend_relocate_section): Define.
2589 * elf32-mips.c (elf_backend_collect): Define.
2591 * Makefile.in (stmp-bfd.h): Avoid useless make error message in a
2592 different way; touch takes a numeric argument on some systems.
2596 * nlmcode.h (nlm_swap_auxiliary_headers_in): Rework custom header
2597 handling for latest suggested format.
2598 (nlm_swap_auxiliary_headers_out): Likewise.
2599 (nlm_compute_section_file_positions): Likewise.
2603 * config.bfd: handle erricsson config (for OSE).
2607 Patches from Ralph Campbell:
2608 * mipsbsd.c (mips_fix_jmp_addr): New function.
2609 (mips_fix_hi16_s): Use bfd_is_com_section.
2610 (mips_howto_table_ext): Call mips_fix_jmp_addr for MIPS_RELOC_JMP.
2614 * config/go32.mh: XX support.
2617 * Makefile.in: Build sysdep.h without causing worrying but
2618 harmless error message.
2622 Changed m68k-aout to set flags to 0; m68k-sunos still uses 1.
2623 * aout0.c: New file.
2624 * targets.c (aout0_big_vec): Declare.
2625 (bfd_target_vector): Add aout0_big_vec.
2626 * config.bfd (m68*-*-aout*): Use m68k-0aout, not m68k-aout.
2627 * config/m68k-aout.mt (SELECT_VECS): Removed.
2628 * config/m68k-0aout.mt: New file.
2629 * configure.in (aout0_big_vec): New target vector: use aout0.o,
2630 aout32.o and stab-syms.o.
2631 * Makefile.in: Rebuilt dependencies.
2632 (BFD32_BACKENDS): Add aout0.o.
2633 (CFILES): Add aout0.c.
2635 * libaout.h (struct aout_backend_data): Add field exec_hdr_flags.
2636 * aout-target.h (MY_exec_hdr_flags): If not defined, define as 0.
2637 MY(backend_data): Initialize exec_hdr_flags field.
2638 * aoutf1.h (sunos_32_set_arch_mach): Make static.
2639 (aout32_sunos4_write_object_contents): Set flags from backend
2641 (MY_exec_hdr_flags): If not defined, define as 1.
2642 (sunos4_aout_backend): Initialize exec_hdr_flags field.
2643 * aout-encap.c (encap_write_object_contents): Set flags from
2645 (MY_exec_hdr_flags): Define as N_FLAGS_COFF_ENCAPSULATE.
2646 * hp300hpux.c (MY_exec_hdr_flags): Define as 0x2.
2647 (MY(write_object_contents)): Set flags from backend info.
2648 * i386aout.c (MY(backend_data)): Initialize exec_hdr_flags field.
2649 * i386mach3.c (MY(backend_data)): Likewise.
2650 * mipsbsd.c (MY(backend_data)): Likewise.
2651 * sparclynx.c (NAME(aout,sparclynx_write_object_contents)): Set
2652 flags from backend info.
2653 (sparclynx_aout_backend): Initialize exec_hdr_flags field.
2657 * config.bfd (i386-*-gnu*): Treat like i386-*-mach*.
2658 (m68*-apollo-*): Treat all Apollo configs the same, don't handle
2663 * cache.c: Rewrote to work correctly.
2664 * libbfd.h: Rebuilt.
2665 * opncls.c (bfd_cache_init, bfd_open_file): Don't declare.
2666 (bfd_fdopenr): Check return value of bfd_cache_init.
2670 * cf-m68klynx.c (CALC_ADDEND): Check for PC relative relocs by
2671 enumerating them, since the reloc type can not serve as an index
2672 into the m68k COFF howto_table.
2676 * config.bfd (*-go32): Changed to coff.
2677 * coff-h8300.c (JMPL1): Get HOWTO right for 24bit branches.
2678 * srec.c (srec_write_symbols): Write out the correct number of
2679 symbols and don't stick in extra nulls.
2683 * cf-sparclynx.c (LYNXOS, COFF_LONG_FILENAMES): Define.
2684 * coff-sparc.c (BADMAG): Recognize LYNXCOFFMAGIC.
2685 (COFF_SPARC): Define.
2686 * coffcode.h (coff_new_section_hook): If COFF_SPARC, set alignment
2687 power of data and bss sections to 3.
2688 * hosts/lynx.h (__LYNXOS): Define.
2692 * elf32-hppa.c (hppa_elf_reloc): Adjust the addend of relocations
2693 against section symbols to avoid losing during ld -r.
2697 * elfcode.h (shstrtab_length_fixed): Remove useless static
2699 (struct elf_sect_data): Remove unused structure.
2700 (elf_object_p): Free memory if error occurs. Check return value
2701 of bfd_default_set_arch_mach. If elf_get_str_section fails,
2702 preserve error code rather than setting wrong_format.
2703 (null_shdr): Remove static variable.
2704 (assign_section_numbers): Remove shstrtab_length_fixed assignment.
2705 Allocate first section header on BFD obstack rather than using
2707 (bfd_prpsinfo): Remove unused local variable newsect.
2711 * elfcode.h (write_relocs): Undo patch of Apr 10; breaks Solaris.
2713 * elfcode.h (bfd_section_from_shdr): Use bfd_make_section_anyway
2714 to create sections. Check return value of recursive calls.
2715 (bfd_section_from_phdr): Check return value of bfd_make_section.
2716 (elf_symbol_from_bfd_symbol): Likewise.
2717 (elf_object_p): Check return value of bfd_section_from_shdr.
2718 (section_from_elf_index): Likewise.
2719 (elf_slurp_symbol_table): Check return value of
2720 section_from_elf_index.
2721 (bfd_prstatus): Return boolean value. Check return value of
2723 (bfd_fpregset): Likewise.
2724 (bfd_prpsinfo): Return boolean value.
2725 (elf_corefile_note): Check return values of bfd_prstatus,
2726 bfd_fpregset, and bfd_prpsinfo.
2727 (elf_core_file_p): Check return value of elf_corefile_note.
2731 Get rid of the ECOFF .reginfo section hack.
2732 * ecoff.c (ecoff_mkobject_hook): Don't create a .reginfo section.
2733 (ecoff_new_section_hook): Don't handle the .reginfo section.
2734 (ecoff_sizeof_headers): Likewise.
2735 (ecoff_get_section_contents): Likewise.
2736 (ecoff_compute_section_file_positions): Likewise.
2737 (ecoff_compute_reloc_file_positions): Likewise.
2738 (ecoff_set_section_contents): Likewise.
2739 (ecoff_write_object_contents): Likewise.
2740 (ecoff_bfd_final_link): Likewise.
2741 (ecoff_bfd_copy_private_bfd_data): Copy the GP value and the
2743 (bfd_ecoff_get_gp_value): New function.
2744 (bfd_ecoff_set_gp_value): New function.
2745 (bfd_ecoff_set_regmasks): New function.
2746 * bfd-in.h (bfd_ecoff_get_gp_value): Declare.
2747 (bfd_ecoff_set_gp_value): Declare.
2748 (bfd_ecoff_set_regmasks): Declare.
2749 * bfd-in2.h: Rebuilt.
2751 Fix ECOFF objcopy to actually copy debugging information.
2752 * ecoff.c (ecoff_bfd_copy_private_bfd_data): New function.
2753 (ecoff_get_extr): Assume that any ECOFF symbol with local clear is
2754 an external symbol, rather than checking the symbol flags. Only
2755 check the flags for non-ECOFF symbols.
2756 * ecofflink.c (bfd_ecoff_debug_externals): Don't crash if the
2757 output_section field of the symbol section is NULL.
2758 * libecoff.h (ecoff_bfd_copy_private_bfd_data): Declare as
2759 function rather than defining as macro.
2761 * ieee.c (ieee_object_p): Set bfd_error_got_wrong_format if
2764 * targets.c (bfd_target_vector): Add bfd_elf32_powerpc_vec.
2766 * aout-adobe.c (aout_adobe_set_arch_mach): Check return value of
2767 bfd_default_set_arch_mach. Accept bfd_arch_m68k as well as
2769 * coffcode.h (coff_set_arch_mach): Check return value of
2770 bfd_default_set_arch_mach.
2771 * elfcode.h (elf_set_arch_mach): Don't check a list of ELF
2772 architectures, just see if the desired architecture matches what
2773 the ELF backend permits.
2775 * coffcode.h (coff_set_arch_mach_hook): Rename SHMAGIC to
2776 SH_ARCH_MAGIC to match change in coff/sh.h.
2777 (coff_set_flags): Likewise.
2779 Follow convention in which each NLM header has an 8 byte stamp
2780 followed by a four byte length.
2781 * libnlm.h (struct nlm_obj_tdata): Rename nlm_cygnus_section_hdr
2782 to nlm_cygnus_ext_header, and change type to
2783 Nlm_Internal_Cygnus_Ext_Header.
2784 (nlm_cygnus_ext_header): Rename from nlm_cygnus_section_header.
2785 * nlmcode.h (nlm_swap_auxiliary_headers_in): Use CyGnUsEx instead
2786 of CyGnUsSeCs. Rename from cygnus_section to cygnus_ext. Require
2787 length word to be 8.
2788 (nlm_swap_auxiliary_headers_out): Rename from cygnus_section to
2789 cygnus_ext. Set length word to 8.
2790 (nlm_compute_section_file_positions): Rename from cygnus_section
2793 Thu Apr 21 22:54:22 1994 Stu Grossman (grossman at cygnus.com)
2795 * nlmcode.h (nlm_swap_auxiliary_headers_in): Keep section table
2796 (from CyGnUsSeCs) in more permanent memory to keep section names
2797 from getting trashed.
2801 * libelf.h (elf_obj_tdata): Add members for dynamic symbol table
2803 * elfcode.h (bfd_section_from_shdr): Handle dynamic symbol table.
2804 * elfcode.h (elf_slurp_symbol_table): Take additional parameter
2805 to select static or dynamic symbol table and return number of
2806 symbols slurped or -1 on error.
2807 * elfcode.h (elf_get_symtab): Set bfd symcount from
2808 elf_slurp_symbol_table result.
2809 * elfcode.h (elf_get_dynamic_symtab_upper_bound,
2810 elf_canonicalize_dynamic_symtab): New functions to handle dynamic
2812 * elf32-target.h, elf64-target.h (BFD_JUMP_TABLE_DYNAMIC):
2813 Change to handle dynamic symbol table, provide default definitions
2815 * aoutx.h (howto_table_std, NAME(aout,swap_std_reloc_out),
2816 NAME(aout,swap_std_reloc_in), aout_link_input_section_std,
2817 aout_link_reloc_link_order): Handle r_jmptable and r_relative
2822 Clean up uses of _bfd_dummy_target (from Peter Schauer).
2823 * libbfd.c (_bfd_dummy_target): Set bfd_error_wrong_format.
2824 * nlm-target.h (nlm_core_file_p): Define as _bfd_dummy_target, not
2826 * srec.c (srec_vec): Use _bfd_dummy_target, not NULL, in
2828 (symbolsrec_vec): Likewise.
2829 * tekhex.c (tekhex_vec): Likewise.
2831 * libnlm.h (struct nlm_obj_tdata): Add nlm_cygnus_section_hdr
2833 (nlm_cygnus_section_header): New accessor macro.
2834 * nlmcode.h (nlm_object_p): Free new tdata structure if failure.
2835 Add fixed sections before swapping in auxiliary headers. After
2836 adding sections, treat errors as real, not as wrong format.
2837 (nlm_swap_auxiliary_headers_in): Swap in the sections header; add
2838 sections to the BFD for each section it describes.
2839 (nlm_swap_auxiliary_headers_out): Swap out the sections header.
2840 (nlm_compute_section_file_positions): Account for the size of the
2845 * coff-sparc.c (sparccoff_vec): Change minimum alignment power to
2846 2, so that stab sections can be multiples of 4 bytes only.
2848 * hosts/i386aix.h: Changes to avoid prototypes conflicts with the
2849 ones defined in stdlib.h. (From Minh Tran-Le.)
2853 * nlm32-ppc.c: Complete rewrite for new version of PowerPC
2854 NetWare. Old code still present, but ifdeffed out.
2856 * nlmcode.h (nlm_swap_auxiliary_headers_in): Don't assume a
2857 particular format for the customer header. Allocate a block of
2858 memory and read it into that.
2859 (nlm_swap_auxiliary_headers_out): Write out the block of memory.
2860 (nlm_compute_section_file_positions): Include length of customer
2861 header when computing its size.
2865 * som.c (som_prep_headers): Get the space's number from the
2866 backend private section data rather than target_index.
2867 (bfd_som_set_section_attributes): Store the space's number
2868 in the backend private section data rather than target_index.
2870 * som.h (som_copyable_section_data_struct): Add space_number.
2874 * coff-a29k.c (reloc_processing): Always set the address of a
2875 R_IHCONST reloc to that of the immediately preceding R_IHIHALF.
2876 gas does this anyhow, but some other assemblers seem to leave
2877 garbage in the R_IHCONST address field.
2879 * bfd/archive.c: Consistently use ARFMAG; from
2881 (_bfd_write_archive_contents): Use ARFMAG rather than '`' and
2883 (bsd_write_armap): Likewise.
2884 (coff_write_armap): Likewise.
2886 * coff-mips.c (mips_relocate_section): When relaxing, adjust local
2887 relocs against the .text section as required.
2888 * ecofflink.c (bfd_ecoff_debug_accumulate): When relaxing, adjust
2889 PDR addresses as required.
2891 * ecoff.c (ecoff_emit_aggregate): Take fdr argument. Map fdr
2892 index through rfd map if it exists. Check for a couple of cases
2893 which gdb handles specially. Change all callers.
2894 (ecoff_type_to_string): Take fdr argument rather than aux_ptr and
2895 bigendian argument. Change all callers.
2896 (ecoff_print_symbol): Handle stStruct, stUnion and stEnum.
2900 * coff-mips.c (mips_howto_table): Add dummy entries to account for
2901 numbering changes in include/coff/mips.h. Add entries for
2902 MIPS_R_RELHI and MIPS_R_RELLO.
2903 (mips_ecoff_swap_reloc_in): Handle an extra bit for the reloc type
2904 when little endian. Treat internal MIPS_R_RELLO or MIPS_R_RELHI
2905 relocs like MIPS_R_SWITCH, and convert r_offset from 24 to 32
2907 (mips_ecoff_swap_reloc_out): Likewise.
2908 (mips_adjust_reloc_in): Handle internal MIPS_R_RELLO or
2909 MIPS_R_RELHI relocs like MIPS_R_SWITCH.
2910 (mips_adjust_reloc_out): Likewise.
2911 (mips_relhi_addr, mips_relhi_addend): New static variables.
2912 (mips_relhi_reloc, mips_rello_reloc): New functions.
2913 (mips_bfd_reloc_type_lookup): Turn BFD_RELOC_PCREL_HI16_S into
2914 MIPS_R_RELHI and turn BFD_RELOC_PCREL_LO16 into MIPS_R_RELLO.
2915 (mips_relocate_hi): Rename from mips_relocate_refhi, and add pcrel
2916 argument. Changed all callers.
2917 (mips_relocate_section): Rename got_reflo to got_lo and
2918 reflo_int_rel to lo_int_rel. Handle MIPS_R_RELLO and MIPS_R_RELHI
2920 (mips_relax_section): Adjust MIPS_R_RELHI/MIPS_R_RELLO pairs when
2921 expanding a PC relative call.
2923 * reloc.c (bfd_reloc_code_real_type): Add BFD_RELOC_PCREL_HI16_S
2924 and BFD_RELOC_PCREL_LO16.
2925 * bfd-in2.h: Rebuilt.
2929 * coff-sparc.c (sparccoff_vec): Set minimum alignment power to 3.
2933 * som.c (som_write_fixups): Always emit at least
2934 one relocation for any non-bss section.
2938 * elfcode.h (assign_file_positions_except_relocs): Don't require
2939 the file alignment to correspond to the page size when linking
2944 * elfcode.h (write_relocs): For rela relocations, adjust the
2945 addend for relocations involving section symbols to account
2946 for the lossage of 1:1 mapping from input section symbols to
2947 output section symbols.
2951 * aoutx.h (NAME(aout,make_sections)): New function.
2952 (NAME(aout,some_aout_object_p)): Call NAME(aout,make_sections)
2953 rather than making sections inline.
2954 (NAME(aout,mkobject)): Don't make any sections.
2955 (NAME(aout,adjust_sizes_and_vmas)): Call NAME(aout,make_sections).
2956 (NAME(aout,final_link)): Don't dereference obj_textsec (abfd) or
2957 obj_datasec (abfd) if they are NULL.
2958 * libaout.h (NAME(aout,make_sections)): Declare.
2959 * bout.c (b_out_mkobject): Don't make any sections.
2960 (b_out_write_object_contents): Call aout_32_make_sections.
2961 (b_out_set_section_contents): Likewise.
2962 * i386os9k.c (os9k_mkobject): Don't make any sections.
2963 (os9k_write_object_contents): Call aout_32_make_sections.
2964 (os9k_set_section_contents): Likewise.
2966 * aoutx.h (NAME(aout,new_section_hook)): Don't set N_EXT in target
2971 * config.bfd, configure.host: Add mips-*-sysv4* support.
2975 * coff-mips.c (mips_howto_table): Add entry for MIPS_R_SWITCH.
2976 (mips_ecoff_swap_reloc_in): For MIPS_R_SWTICH, copy r_symndx into
2977 r_offset and set r_symndx to RELOC_SECTION_TEXT.
2978 (mips_ecoff_swap_reloc_out): For MIPS_R_SWITCH, get the r_symndx
2979 value from the r_offset field.
2980 (mips_adjust_reloc_in): Maximum r_type value is now MIPS_R_SWITCH.
2981 For MIPS_R_SWITCH, copy the r_offset field into the addend field.
2982 (mips_adjust_reloc_out): For MIPS_R_SWITCH, copy the addend field
2983 into the r_offset field.
2984 (mips_switch_reloc): New function.
2985 (mips_bfd_reloc_type_lookup): Translate BFD_RELOC_GPREL32 into
2987 (mips_relocate_section): Handle MIPS_R_SWITCH.
2988 (mips_relax_section): Adjust MIPS_R_SWITCH offset if necessary.
2992 * elfcode.h (elf_set_section_contents): Support calling the backend
2993 function elf_backend_begin_write_processing when just beginning to
2994 write an object file.
2996 * libelf.h (elf_backend_begin_write_processing): Declare.
2998 * elf{32,64}-target.h (elf_backend_begin_write_processing): Provide
2999 a default definition.
3000 (elf{32,64}_bed): Add elf_backend_begin_write_processing.
3002 * elf32-hppa.h (elf_hppa_tc_symbol): Delete extern declaration.
3003 (elf_hppa_tc_make_sections): Likewise.
3005 * elf32-hppa.c (symext_chain_built): Delete.
3006 (symext_chain_size): Renamed from symextn_contents_real_size.
3007 (elf32_hppa_backend_{begin,final}_write_processing): New functions.
3008 (add_entry_to_symext_chain): New function.
3009 (hppa_elf_set_section_contents): Ignore writes to the symbol extension
3010 section until it's been rebuilt internally.
3011 (hppa_elf_get_section_contents): Symbol extension section is no
3013 (elf_backend_{begin,final}_write_processing): Define.
3014 (elf_hppa_tc_make_sections): Simplify now that much code has
3015 migrated into elf32_hppa_backend_{being,final}_write_processing.
3019 Add new target vectors to read the dynamic symbols and dynamic
3020 relocs. Change a.out to use these rather than reading the dynamic
3021 symbols and relocs along with the normal symbols and relocs.
3022 * targets.c (bfd_target): Add fields
3023 _bfd_get_dynamic_symtab_upper_bound,
3024 _bfd_canonicalize_dynamic_symtab,
3025 _bfd_get_dynamic_reloc_upper_bound,
3026 _bfd_canonicalize_dynamic_reloc.
3027 (BFD_JUMP_TABLE_DYNAMIC): Define.
3028 * libbfd-in.h (_bfd_nodynamic_get_dynamic_symtab_upper_bound):
3030 (_bfd_nodynamic_canonicalize_dynamic_symtab): Define.
3031 (_bfd_nodynamic_get_dynamic_reloc_upper_bound): Define.
3032 (_bfd_nodynamic_canonicalize_dynamic_reloc): Define.
3033 * bfd.c (bfd_get_dynamic_symtab_upper_bound): Define.
3034 (bfd_canonicalize_dynamic_symtab): Define.
3035 (bfd_get_dynamic_reloc_upper_bound): Define.
3036 (bfd_canonicalize_dynamic_reloc): Define.
3037 * sunos.c (MY_read_dynamic_symbols): Don't define.
3038 (MY_read_dynamic_relocs): Don't define.
3039 (MY_get_dynamic_symtab_upper_bound): Define.
3040 (MY_canonicalize_dynamic_symtab): Define.
3041 (MY_get_dynamic_reloc_upper_bound): Define.
3042 (MY_canonicalize_dynamic_reloc): Define.
3043 (struct sunos_dynamic_info): Change type of dynsym_count and
3044 dynrel_count to long. Add fields canonical_dynsym and
3046 (sunos_read_dynamic_info): Check that BFD had DYNAMIC flag set.
3047 Clear info->canonical_dynsym and info->canonical_dynrel.
3048 (MY(read_dynamic_symbols)): Removed.
3049 (MY(read_dynamic_relocs)): Removed.
3050 (sunos_get_dynamic_symtab_upper_bound): New function.
3051 (sunos_canonicalize_dynamic_symtab): New function.
3052 (sunos_get_dynamic_reloc_upper_bound): New function.
3053 (sunos_canonicalize_dynamic_reloc): New function.
3054 * libaout.h: Declare struct reloc_ext_external and
3055 reloc_std_external to avoid prototype problems.
3056 (struct aout_backend_data): Remove fields read_dynamic_symbols and
3057 read_dynamic_relocs.
3058 (NAME(aout,translate_symbol_table)): Declare.
3059 (NAME(aout,swap_ext_reloc_in)): Declare.
3060 (NAME(aout,swap_std_reloc_in)): Declare.
3061 * aoutx.h (NAME(aout,translate_symbol_table)): Renamed from
3062 translate_symbol_table and made non-static. Changed all callers.
3063 (NAME(aout,slurp_symbol_table)): Don't read dynamic symbols.
3064 (NAME(aout,slurp_reloc_table)): Don't read dynamic relocs.
3065 (NAME(aout,get_reloc_upper_bound)): Don't count dynamic relocs.
3066 * aoutf1.h (aout_32_sunos4_write_object_contents): Don't bother to
3067 remove dynamic symbols and relocs. They will no longer be
3069 (MY_read_dynamic_symbols): Don't define.
3070 (MY_read_dynamic_relocs): Don't define.
3071 (sunos4_aout_backend): Don't initialize dynamic entry points.
3072 * aout-target.h (MY_read_dynamic_symbols): Don't define.
3073 (MY_read_dynamic_relocs): Don't define.
3074 (MY(backend_data)): Don't initialize dynamic entry points.
3075 (MY_get_dynamic_symtab_upper_bound): If not defined, define to
3076 _bfd_nodynamic version.
3077 (MY_canonicalize_dynamic_symtab): Likewise.
3078 (MY_get_dynamic_reloc_upper_bound): Likewise.
3079 (MY_canonicalize_dynamic_reloc): Likewise.
3080 * All backends: Added BFD_JUMP_TABLE_DYNAMIC to target vector.
3081 * bfd-in2.h: Rebuilt.
3082 * libbfd.h: Rebuilt.
3084 * cf-m68klynx.c: Include sysdep.h.
3086 * hp300hpux.c: Removed some spaces in uses of NAME to avoid
3087 problems with traditional C compilers.
3089 * targets.c (bfd_target): Rearranged fields in target vector.
3090 Removed _bfd_debug_info_start, _bfd_debug_info_end and
3091 _bfd_debug_info_accumulate, which were never used.
3092 (BFD_JUMP_TABLE_GENERIC, BFD_JUMP_TABLE_COPY): Defined.
3093 (BFD_JUMP_TABLE_CORE, BFD_JUMP_TABLE_ARCHIVE): Defined.
3094 (BFD_JUMP_TABLE_SYMBOLS, BFD_JUMP_TABLE_RELOCS): Defined.
3095 (BFD_JUMP_TABLE_WRITE, BFD_JUMP_TABLE_LINK): Defined.
3096 * All backends: Changed to use the new BFD_JUMP_TABLE_* macros
3097 rather than the single JUMP_TABLE macro. Removed many of the
3098 weird macro definitions needed to support the monolithic
3100 * bfd-in.h (JUMP_TABLE): Removed.
3101 * libbfd-in.h: Define a bunch of macros, and declare a few
3102 functions, for use with the new BFD_JUMP_TABLE_* macros.
3103 * libbfd.c (_bfd_dummy_new_section_hook): Removed.
3104 (bfd_false): Set bfd_error_invalid_operation.
3105 (bfd_nullvoidptr): Likewise.
3106 (bfd_n1): New function.
3107 (_bfd_nocore_core_file_matches_executable_p): Renamed from
3108 _bfd_dummy_core_file_matches_executable_p.
3109 (_bfd_nocore_core_file_failing_command): Similar rename. Set
3110 bfd_error_invalid_operation.
3111 (_bfd_nocore_core_file_failing_signal): Likewise.
3112 (_bfd_generic_get_section_contents): Renamed from
3113 bfd_generic_get_section_contents. Changed all callers.
3114 (_bfd_generic_set_section_contents): Similar rename.
3115 * ieee.c: #if 0 out ieee_bfd_debug_info_start,
3116 ieee_bfd_debug_info_end, ieee_bfd_debug_info_accumulate. They
3118 * bfd-in2.h: Rebuilt.
3119 * libbfd.h: Rebuilt.
3123 * Crude support for examining dynamic libraries.
3124 * som.c (som_object_setup): Set DYNAMIC flag for SHL_MAGIC and
3126 (som_prep_headers): Preserve the system_id for DYNAMIC objects.
3127 Use SHL_MAGIC as the magic number of the DYNAMIC flag is set.
3128 Write exec headers for DYNAMIC objects.
3129 (som_begin_writing): DYNAMIC objects have the same alignment
3130 restrictions as D_PAGED objects.
3131 (bfd_section_from_som_symbol): Treat DYNAMIC objects like EXEC_P
3133 (object_flags): Add DYNAMIC.
3137 * i386lynx.c, sparclynx.c (NAME): Remove embedded whitespace in
3138 macro uses, confuses some non-ANSI compilers.
3142 * som.c (som_bfd_free_cached_info): Add missing PARAMS decl.
3143 Don't free anything if we don't have a bfd_object.
3144 (som_close_and_cleanup): Call som_bfd_free_cached_info.
3148 * elf32-mips.c (mips_elf_final_link): Don't remove empty sections.
3149 It turns out not to be required on Irix 5, and it causes problems
3150 if the sections happen to contain symbols.
3152 * elfcode.h (write_shdrs_and_ehdr): Correct bfd_write check.
3154 * aoutx.h (NAME(aout,canonicalize_reloc)): Don't error out if
3155 section->relocation is NULL; malloc might have returned NULL when
3156 given a zero size if there were no relocations.
3157 * bout.c (b_out_canonicalize_reloc): Likewise.
3158 * coffcode.h (coff_canonicalize_reloc): Likewise.
3159 * ecoff.c (ecoff_canonicalize_reloc): Likewise.
3160 * elfcode.h (elf_canonicalize_reloc): Likewise.
3161 * mipsbsd.c (MY(canonicalize_reloc)): Likewise.
3162 * i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
3163 * nlmcode.h (nlm_canonicalize_reloc): Likewise.
3164 * som.c (som_canonicalize_reloc): Likewise.
3165 * hp300hpux.c (MY(slurp_reloc_table)): Likewise. Also, if malloc
3166 returns NULL, don't report an error if we asked for zero bytes.
3167 * i386lynx.c (NAME(lynx,slurp_reloc_table)): If malloc returns
3168 NULL, don't report an error if we asked for zero bytes.
3169 * nlmcode.h (nlm_slurp_reloc_fixups): Likewise.
3173 * aoutx.h (NAME(aout,bfd_free_cached_info)): Don't free anything
3174 if we don't have a bfd_object.
3176 Made sure that every call to bfd_read, bfd_write, and bfd_seek
3177 checks the return value and handled bfd_error correctly. These
3178 changes are not itemised. Also:
3179 * aoutx.h (emit_strtab): Change return type to boolean, and return
3181 (NAME(aout,write_syms)): Check emit_strtab return value.
3182 (NAME(aout,final_link)): Likewise.
3183 * coffcode.h (coff_write_relocs): Change return type to boolean,
3185 (coff_write_object_contents): Check coff_write_relocs return
3187 * i386os9k.c (os9k_swap_exec_header_in): Change return type to
3189 (os9k_object_p): Check os9k_swap_exec_header_in return value.
3190 * oasys.c (oasys_read_record): Change return type to boolean.
3191 (oasys_slurp_symbol_table: Check oasys_read_record return value.
3192 (oasys_object_p, oasys_slurp_section_data): Likewise.
3193 (oasys_write_record): Change return type to boolean.
3194 (oasys_write_syms): Likewise. Also, check oasys_write_record
3196 (oasys_write_sections): Check oasys_write_record return value.
3197 (oasys_write_header): Change return type to boolean. Check
3198 oasys_write_record return value.
3199 (oasys_write_end, oasys_write_data): Likewise.
3200 (oasys_write_object_contents): Check return values of
3201 oasys_write_header, oasys_write_syms, oasys_write_data, and
3203 * srec.c (srec_write_record): Change return type to boolean.
3204 (srec_write_header): Likewise. Also, check srec_write_record
3206 (srec_write_section, srec_write_terminator): Likewise.
3207 (srec_write_symbols): Change return type to boolean.
3208 (internal_srec_write_object_contents): Check return value of
3209 srec_write_symbols, srec_write_header, srec_write_section, and
3210 srec_write_terminator.
3212 * Makefile.in: Rebuilt dependencies.
3216 * aix386-core.c (aix386_bfd_is_local_label): Correct cast from
3217 asection to asymbol.
3218 * ptrace-core.c (ptrace_unix_bfd_is_local_label): Correct cast from
3220 * trad-core.c (trad_unix_bfd_is_local_label): Correct cast from
3221 asection to asymbol.
3225 * som.c (som_slurp_string_table): Use malloc to allocate space
3226 for the cached copy of the native string table.
3227 (som_slurp_symbol_table): Likewise for the native symbol table.
3228 (som_slurp_reloc_table): Likewise for the native and generic
3230 (som_bfd_free_cached_info): Free the cached native strings,
3231 symbols, and relocations. Also free the canonical cached
3236 * aoutx.h (aout_link_write_symbols): If keep_memory is false, make
3237 sure the symbol name is stored in permanent memory before adding
3238 it to the string table.
3240 * archive.c (_bfd_write_archive_contents): Once we've found an
3241 object, don't bother to look for more when deciding whether to
3243 (compute_and_write_armap): After adding the symbols for a BFD,
3244 call bfd_free_cached_info on it.
3246 Add bfd_free_cached_info support to a.out backends.
3247 * aoutx.h (aout_get_external_symbols): Renamed from
3248 aout_link_get_symbols. Read strings even if symbols have been
3249 read. Store string size in obj_aout_string_size.
3250 (NAME(aout,slurp_symbol_table)): Call aout_get_external_symbols to
3251 read the symbols. Allocate the cached symbols with malloc, not
3253 (NAME(aout,slurp_reloc_table)): Allocate the cached relocs with
3254 malloc, not bfd_alloc.
3255 (NAME(aout,bfd_free_cached_info)): New function; free cached
3257 * libaout.h (struct aoutdata): Add external_string_size field.
3258 (obj_aout_external_string_size): New accessor macro.
3259 (NAME(aout,close_and_cleanup)): Don't declare.
3260 (NAME(aout,bfd_free_cached_info)): Declare.
3261 (aout_32_close_and_cleanup): Don't define.
3262 (aout_64_close_and_cleanup): Don't define.
3263 * aout-target.h (MY_bfd_free_cached_info): If not already defined,
3264 define as NAME(aout,free_cached_info).
3265 (MY_close_and_cleanup): If not already defined, define as
3266 MY_bfd_free_cached_info.
3267 * aout-adobe.c (aout_32_close_and_cleanup): Define.
3268 (aout_32_bfd_free_cached_info): Don't define.
3269 * bout.c (aout_32_close_and_cleanup): Define.
3270 (aout_32_bfd_free_cached_info): Don't define.
3271 * hp300hpux.c (MY_bfd_free_cached_info): Define as bfd_true.
3272 (MY_close_and_cleanup): Don't define.
3273 * i386lynx.c (NAME(lynx,slurp_reloc_table)): Allocate the cached
3274 relocs with malloc, not bfd_alloc.
3275 * i386os9k.c (aout_32_close_and_cleanup): Define.
3276 (aout_32_bfd_free_cached_info): Don't define.
3278 Add a new entry point to free memory cached by a BFD.
3279 * targets.c (bfd_target): Add _bfd_free_cached_info field.
3280 * bfd.c (bfd_free_cached_info): Define.
3281 * bfd-in.h (JUMP_TABLE): Add _bfd_free_cached_info.
3282 * bfd-in2.h: Rebuilt.
3283 * All backends: Initialize bfd_free_cached_info entry point to
3286 * elf32-hppa.c (elf_hppa_reloc_type_lookup): Correct type of
3287 first, unused, argument.
3288 (hppa_elf_is_local_label): Declare instead of
3289 som_bfd_is_local_label.
3291 * coff-a29k.c (a29k_reloc): Add reloc_entry->address to value of
3292 absolute R_IREL reloc.
3296 Added some support for Irix 4 shared libraries.
3297 * ecoff.c (ecoff_new_section_hook): Set SEC_SHARED_LIBRARY for a
3299 (ecoff_sec_to_styp_flags): Set SEC_SHARED_LIBRARY if
3300 STYP_ECOFF_LIB bit is set.
3301 (ecoff_compute_section_file_positions): Round the contents of a
3302 .lib section up to the next page boundary.
3303 (ecoff_set_section_contents): If we see a .lib section, increment
3304 the vma by one to count the number of shared libraries we have.
3305 (ecoff_write_object_contents): Don't crash if we see a
3306 STYP_ECOFF_LIB section, and don't adjust text_start or data_start
3309 * coffcode.h (CALC_ADDEND): Change to fetch original symbol value
3310 from original BFD, rather than using value of current BFD symbol.
3311 Needed for new linker.
3312 * coff-sparc.c (CALC_ADDEND): Likewise.
3314 * ecoff.c (ecoff_write_object_contents): Set the text_start and
3315 data_start entries in the optional header correctly even if a text
3316 or data section starts at location zero.
3318 * reloc.c (bfd_reloc_code_real_type): Added BFD_RELOC_26 (from sef
3320 * bfd-in2.h: Rebuilt.
3322 * nlm32-i386.c (nlm_i386_read_import): Null terminate the symbol
3324 * nlm32-alpha.c (nlm_alpha_read_import): Likewise.
3325 * nlm32-sparc.c (nlm_sparc_read_import): Likewise.
3327 * coffgen.c (coff_write_symbol): Reindented. Changed to return
3328 boolean, and changed written to unsigned int *. Check error
3329 returns from called functions.
3330 (coff_write_alien_symbol): Likewise.
3331 (coff_write_native_symbol): Likewise.
3332 (coff_write_symbols): Likewise. Reworked checks on whether to
3333 write symbol name to string table for clarity and to avoid core
3334 dumping when given a non COFF symbol.
3335 * libcoff-in.h (coff_write_symbols): Declare as returning boolean.
3336 * libcoff.h: Rebuilt.
3337 * coffcode.h (coff_write_object_contents): Check return value of
3342 Changes to let BFD return an error indication from
3343 get_symtab_upper_bound, bfd_canonicalize_symtab,
3344 bfd_get_reloc_upper_bound, and bfd_canonicalize_reloc. They now
3345 return long instead of unsigned int, and use -1 to indicate an
3346 error. Along the way, rename get_symtab_upper_bound to
3347 bfd_get_symtab_upper_bound.
3348 * bfd.c (bfd_get_reloc_upper_bound): Return long, and -1 on
3350 (bfd_canonicalize_reloc): Likewise.
3351 * syms.c (bfd_get_symtab_upper_bound): Renamed from
3352 get_symtab_upper_bound.
3353 * targets.c (bfd_target): Renamed _get_symtab_upper_bound to
3354 _bfd_get_symtab_upper_bound, and changed it and
3355 _bfd_canonicalize_symtab and _get_reloc_upper_bound and
3356 _bfd_canonicalize_reloc to all return long.
3357 * aoutx.h (NAME(aout,get_symtab)): Return long, and -1 on errors.
3358 (NAME(aout,canonicalize_reloc)): Likewise.
3359 (NAME(aout,get_reloc_upper_bound)): Likewise.
3360 (NAME(aout,get_symtab_upper_bound)): Likewise.
3361 * bout.c (b_out_canonicalize_reloc): Likewise.
3362 (b_out_get_reloc_upper_bound): Likewise.
3363 * coffcode.h (coff_canonicalize_reloc): Likewise.
3364 * coffgen.c (coff_get_symtab_upper_bound): Likewise.
3365 (coff_get_symtab): Likewise.
3366 (coff_get_reloc_upper_bound): Likewise.
3367 * ecoff.c (ecoff_get_symtab_upper_bound): Likewise.
3368 (ecoff_get_symtab): Likewise.
3369 (ecoff_canonicalize_reloc): Likewise.
3370 * elfcode.h (elf_get_symtab_upper_bound): Likewise.
3371 (elf_get_reloc_upper_bound): Likewise.
3372 (elf_canonicalize_reloc): Likewise.
3373 (elf_get_symtab): Likewise.
3374 * hp300hpux.c (MY(get_symtab)): Likewise.
3375 (MY(get_symtab_upper_bound)): Likewise.
3376 (MY(canonicalize_reloc)): Likewise.
3377 * i386lynx.c (NAME(lynx,canonicalize_reloc)): Likewise.
3378 * ieee.c (ieee_slurp_external_symbols): Change return type to
3379 boolean. Check for errors from get_symbol.
3380 (ieee_slurp_symbol_table): Change return type to boolean. Check
3381 for errors from ieee_slurp_external_symbols.
3382 (ieee_get_symtab_upper_bound): Return long, and -1 on errors.
3383 (ieee_get_symtab): Likewise.
3384 (ieee_get_reloc_upper_bound): Likewise.
3385 (ieee_canonicalize_reloc): Likewise.
3386 * mipsbsd.c (MY(canonicalize_reloc)): Likewise.
3387 * nlmcode.h (nlm_get_symtab_upper_bound): Likewise.
3388 (nlm_get_symtab): Likewise.
3389 (nlm_get_reloc_upper_bound): Likewise.
3390 (nlm_canonicalize_reloc): Likewise.
3391 * oasys.c (oasys_get_symtab_upper_bound): Likewise.
3392 (oasys_get_symtab): Likewise.
3393 (oasys_get_reloc_upper_bound): Likewise.
3394 (oasys_canonicalize_reloc): Likewise.
3395 * som.c (som_get_symtab_upper_bound): Likewise.
3396 (som_get_symtab): Likewise.
3397 (som_get_reloc_upper_bound): Likewise.
3398 (som_canonicalize_reloc): Likewise.
3399 * srec.c (srec_get_symtab_upper_bound): Likewise.
3400 (srec_get_symtab): Likewise.
3401 (srec_get_reloc_upper_bound): Define as bfd_0l.
3402 (srec_canonicalize_reloc): Likewise.
3403 * tekhex.c (tekhex_get_symtab): Return long, and -1 on errors.
3404 (tekhex_get_symtab_upper_bound): Likewise.
3405 (tekhex_get_reloc_upper_bound): Define as bfd_0l.
3406 (tekhex_canonicalize_reloc): Likewise.
3407 * libaout.h (NAME(aout,get_symtab_upper_bound)): Change
3408 declaration to return long.
3409 (NAME(aout,get_symtab)): Likewise.
3410 (NAME(aout,canonicalize_reloc)): Likewise.
3411 (NAME(aout,get_reloc_upper_bound)): Likewise.
3412 * libcoff-in.h (coff_get_symtab_upper_bound): Likewise.
3413 (coff_get_symtab): Likewise.
3414 (coff_get_reloc_upper_bound): Likewise.
3415 * libecoff.h (ecoff_get_symtab_upper_bound): Likewise.
3416 (ecoff_get_symtab): Likewise.
3417 (ecoff_canonicalize_reloc): Likewise.
3418 * libelf.h (bfd_elf32_get_symtab_upper_bound): Likewise.
3419 (bfd_elf32_get_symtab): Likewise.
3420 (bfd_elf32_get_reloc_upper_bound): Likewise.
3421 (bfd_elf32_canonicalize_reloc): Likewise.
3422 (bfd_elf64_get_symtab_upper_bound): Likewise.
3423 (bfd_elf64_get_symtab): Likewise.
3424 (bfd_elf64_get_reloc_upper_bound): Likewise.
3425 (bfd_elf64_canonicalize_reloc): Likewise.
3426 * libnlm.h (nlmNAME(get_symtab_upper_bound)): Likewise.
3427 (nlmNAME(get_symtab)): Likewise.
3428 (nlmNAME(get_reloc_upper_bound)): Likewise.
3429 (nlmNAME(canonicalize_reloc)): Likewise.
3430 * archive.c (compute_and_write_armap): Use error_return and
3431 no_memory_return labels rather than freeing information in various
3432 places. Change storage, symcount and src_count to long. Check
3433 errors from bfd_get_symtab_upper_bound and
3434 bfd_canonicalize_symtab.
3435 * bout.c (b_out_relax_section): Change reloc_size to long. Check
3436 for errors from bfd_get_reloc_upper_bound and
3437 bfd_canonicalize_reloc.
3438 (b_out_get_relocated_section_contents): Likewise.
3439 * coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
3441 * elf32-mips.c: Likewise.
3442 * elf32-hppa.c (hppa_elf_stub_finish): Likewise.
3443 (hppa_look_for_stubs_in_section): Check for errors from
3444 bfd_get_symtab_upper_bound, bfd_canonicalize_symtab, and
3445 bfd_canonicalize_reloc.
3446 * ecofflink.c (bfd_ecoff_debug_accumulate_other): Check for errors
3447 from bfd_get_symtab_upper_bound and bfd_canonicalize_symtab.
3448 * linker.c (generic_link_read_symbols): Likewise.
3449 (_bfd_generic_final_link): Check for errors from
3450 bfd_get_reloc_upper_bound and bfd_canonicalize_reloc.
3451 * reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
3452 * reloc16.c (bfd_coff_reloc16_relax_section): Likewise.
3453 (bfd_coff_reloc16_get_relocated_section_contents): Likewise.
3454 * libbfd.c (bfd_0l): New function.
3455 * libbfd-in.h (bfd_0l): Declare.
3456 * aix386-core.c: Change get_symtab_upper_bound, get_symtab,
3457 get_reloc_upper_bound, and canonicalize_reloc to use bfd_0l rather
3459 * cisco-core.c, hppabsd-core.c, hpux-core.c: Likewise.
3460 * irix-core.c, osf-core.c, ptrace-core.c, trad-core.c: Likewise.
3461 * bfd-in2.h: Rebuilt.
3462 * libbfd.h: Rebuilt.
3463 * libcoff.h: Rebuilt.
3465 * nlm32-sparc.c (nlm_sparc_read_reloc): Remove unused variables
3470 * hosts/dpx2.h: Define POSIX_UTIME.
3474 * i386dynix.c, config/i386-dynix.mt: New files, handling Dynix
3476 * configure.in, config.bfd: Use them for Dynix.
3477 * Makefile.in: Add dependencies for i386dynix.o.
3478 * targets.c: Add definition for i386dynix_vec.
3479 * hosts/symmetry.h: Do not define TRAD_CORE_USER_OFFSET for Dynix.
3480 Define HOST_DATA_START_ADDR and TRAD_UNIX_CORE_FILE_FAILING_SIGNAL
3481 for Dynix. Remove inclusion of dynix3.h, Dynix bfd is now handled by
3486 * Makefile.in (BFD32_BACKENDS): Add coff-sparc.o.
3488 * coffcode.h (coff_set_flags): Handle bfd_arch_powerpc like
3491 * config.bfd (powerpc-*-aix*): New target; use rs6000.mt.
3492 * config/rs6000.mt (SELECT_ARCHITECTURES): Add bfd_powerpc_arch.
3494 * aoutx.h (translate_from_native_sym_flags): Set SEC_RELOC flag
3495 for generated constructor section.
3499 * som.c (som_begin_writing): New approach at dealing with holes
3500 in executables left by the HP linker. Does not rely on subspace
3501 alignments as subspaces are *NOT* guaranteed to be properly
3502 aligned in an executable (can you believe that!).
3506 * som.c (som_get_section_contents): New function. Do not try
3507 to actually read data from a section that doesn't have either
3508 SEC_LOAD or SEC_DEBUGGING set (eg $BSS$) just return true.
3510 * libbfd.c (bfd_read): Set bfd_error as appropriate for a short
3511 read. (bfd_error_system_call or bfd_error_file_truncated).
3513 * som.c: Do not blindly set bfd_error_system_call after a
3514 failing bfd_read, bfd_write, or bfd_seek. In a few places
3515 (like som_object_p) override the error status set by bfd_read.
3517 * aix386-core.c, aout-encap,c archive.c, bout.c: Likewise.
3518 * coff-rs6000.c, coffgen.c ecoff.c, elf.c: Likewise.
3519 * elf32-hppa.c, elfcode.h, hp300hpux.c, i386lynx.c: Likewise.
3520 * nlm32-alpha.c, nlm32-i386.c, nlm32-sparc.c: Likewise.
3522 * som.c: Check return values from several bfd_{seek,read,write}
3523 calls that we just assumed were not failing.
3527 * hosts/sysv4.h (HAVE_PROCFS): Add comments about ptx4.
3528 * config/sysv4.mh: Add comment.
3529 * config/symmetry.mh: Change comment.
3530 * configure.host: Use sysv4, not symmetry, for i[34]86-sequent-sysv4*.
3534 Changes to support linker relaxing of embedded MIPS PIC code to
3535 use a five instruction sequence for function calls which are out of
3536 range of the bal instruction.
3537 * libecoff.h (struct ecoff_section_tdata): Define.
3538 (ecoff_section_data): Define.
3539 (ecoff_bfd_relax_section): Don't define.
3540 * ecoff.c (ecoff_final_link_debug_accumulate): Don't read or free
3541 the debugging information if it has already been read.
3542 (ecoff_indirect_link_order): Handle _cooked_size being different
3543 from _raw_size. Don't reread the contents or the relocs if they
3544 have already been read in.
3545 * coff-mips.c (mips_howto_table): Change bitsize of PCREL16 from
3547 (PCREL16_EXPANSION_ADJUSTMENT): Define.
3548 (mips_relocate_refhi): Take adjust argument.
3549 (mips_relocate_section): Handle reloc offsets stored in section
3550 used_by_bfd field. Call mips_relax_pcrel16 to handle details of
3551 expanding an out of range PCREL16. Keep trace of adjustments
3552 required by expansions. Set s and unset h when converting a reloc
3553 from undefined to section. Change handling of PC relative relocs:
3554 if against a section, they are correct in the object file, if
3555 against an external symbol they are pcrel_offset.
3556 (mips_relax_section): New function.
3557 (mips_relax_pcrel16): New function.
3558 (ecoff_bfd_relax_section): Define.
3559 * coff-alpha.c (ecoff_bfd_relax_section): Define.
3560 * ecofflink.c (bfd_ecoff_debug_accumulate): Handle adjustments
3561 built by mips_relax_section when writing out addresses.
3562 * elf32-mips.c (mips_elf_read_ecoff_info): Clear adjust field.
3564 * aoutx.h (NAME(aout,find_nearest_line)): The caller expects
3565 functionname_ptr to be set to a symbol name, so prepend
3566 symbol_leading_char.
3570 * coff-h8300.c (h8300_reloc16_extra_cases): Add relaxing info
3571 for 16bit relative branches.
3572 * coff-h8500.c (r_high8, r_low16, r_high16): Don't complain on
3577 * som.c (som_bfd_prep_for_ar_write): Ignore non-SOM objects.
3578 (som_bfd_ar_write_symbol_stuff, som_write_armap): Likewise.
3582 * netbsd386.c (N_SET_FLAGS): Delete the old definition.
3586 Clean up the relaxing code for the new linker.
3587 * targets.c (_bfd_relax_section): Take boolean *again argument
3588 rather than asymbol list.
3589 * bfd.c (bfd_relax_section): Change name of fourth argument from
3591 * reloc.c (bfd_generic_relax_section): Take boolean *again
3592 argument rather than asymbol list. Always return true.
3593 * bout.c: Include genlink.h.
3594 (aligncode, perform_slip): Declare.
3595 (perform_slip): Take BFD argument rather than asymbol list.
3596 Changed all callers. Get the symbols from the BFD. Change the
3597 hash table entry value as well as the symbol value.
3598 (abs32code): Take BFD argument rather than asymbol list. Changed
3600 (aligncode): Likewise.
3601 (b_out_relax_section): Take boolean *again argument rather than
3602 asymbol list. Only return false if an error occurred. Set *again
3603 to false. Get symbols from BFD.
3604 * reloc16.c: Include genlink.h.
3605 (bfd_perform_slip): Take BFD argument rather than asymbol list.
3606 Get the symbols from the BFD. Change the hash table entry value
3607 as well as the symbol value.
3608 (bfd_coff_reloc16_relax_section): Take boolean *again argument
3609 rather than asymbol list. Only return false if an error occurred.
3610 Set *again to false. Get symbols from BFD.
3611 * coffcode.h (bfd_coff_backend_data): Change
3612 _bfd_coff_reloc16_estimate to take BFD argument rather than
3614 (bfd_coff_reloc16_estimate): Corresponding change.
3615 (dummy_reloc16_estimate): Corresponding change.
3616 * libcoff-in.h (bfd_coff_reloc16_relax_section): Change
3617 declaration to take boolean * rather than asymbol list.
3618 (bfd_perform_slip): Change declaration to take BFD rather than
3620 * coff-h8300.c (h300_reloc16_estimate): Take BFD argument rather
3621 than asymbol list. Changed calls to bfd_perform_slip.
3622 * bfd-in2.h: Rebuilt.
3623 * libbfd.h: Rebuilt.
3624 * libcoff.h: Rebuilt.
3625 * Makefile.in: Rebuilt dependencies.
3627 * genlink.h (_bfd_generic_link_get_symbols): Define.
3628 (_bfd_generic_link_get_symcount): Define.
3629 * linker.c (generic_link_read_symbols): New function.
3630 (generic_link_add_object_symbols): Use it. Use
3631 _bfd_generic_link_get_symbols and _bfd_generic_link_get_symcount
3632 to get the symbols from the BFD.
3633 (generic_link_check_archive_element): Likewise.
3634 (_bfd_generic_final_link): Likewise.
3635 (_bfd_generic_link_output_symbols): Likewise.
3636 (default_indirect_link_order): Likewise.
3637 (generic_link_add_symbol_list): Store pointer to hash table entry
3638 in asymbol udata field.
3642 * coff-mips.c (mips_howto_table): Add entry for new MIPS_R_PCREL16
3643 reloc, used in embedded PIC code.
3644 (mips_adjust_reloc_in): Change sanity check to permit new reloc.
3645 (mips_bfd_reloc_type_lookup): Turn BFD_RELOC_16_PCREL_S2 into
3648 * elf32-mips.c (mips_elf_final_link): Account for link_order
3649 relocs when allocating space for relocations. Set SEC_RELOC flag
3650 for any section which has relocs. Handle link_order relocs in
3651 link_order loop. Use _bfd_generic_link_add_symbols_collect for
3652 add_symbls entry point.
3654 * linker.c (_bfd_generic_final_link): Set reloc_count to 0 before
3655 counting relocs. Set SEC_RELOC flag for any section which has
3658 * linker.c (_bfd_default_link_order): Handle bfd_data_link_order.
3660 * linker.c (_bfd_generic_link_add_symbols): Just call
3661 generic_link_add_symbols.
3662 (_bfd_generic_link_add_symbols_collect): New function, like
3663 _bfd_generic_link_add_symbols but also collect constructors and
3664 destructors by name as collect2 does.
3665 (generic_link_add_symbols): New function, like old
3666 _bfd_generic_link_add_symbols but with collect argument.
3667 (generic_link_add_object_symbols): Take collect argument.
3668 (generic_link_check_archive_element_no_collect): New function.
3669 (generic_link_check_archive_element_collect): New function.
3670 (generic_link_check_archive_element): Take collect argument.
3671 (generic_link_add_symbol_list): Take collect argument.
3672 (_bfd_generic_link_add_one_symbol): Rename constructor argument to
3674 * libbfd-in.h (_bfd_generic_link_add_symbols_collect): Declare.
3675 * libbfd.h: Rebuilt.
3679 * archive.c (bfd_construct_extended_name_table): Use ar_padchar
3680 for first character in an extended name.
3681 (_bfd_write_archive_contents): If ar_padchar == '/', then use
3682 "//" as the name of the special archive member holding the
3683 extended name table.
3687 Support for link_order types which generate relocs in order to
3688 support -Ur in the linker.
3689 * linker.c (generic_link_add_symbol_list): Remove bitsize argument
3690 from call to _bfd_generic_link_add_one_symbol.
3691 (_bfd_generic_link_add_one_symbol): Remove bitsize argument.
3692 Don't pass bitsize to constructor call back. Pass BFD_RELOC_CTOR
3693 instead of bitsize to add_to_set call back.
3694 (_bfd_generic_final_link): Account for link_order relocs when
3695 allocating space for relocations. Handle them in link_order loop.
3696 (_bfd_generic_reloc_link_order): New function.
3697 (_bfd_default_link_order): If a reloc_link_order is seen here,
3699 (_bfd_count_link_order_relocs): New function.
3700 * libbfd-in.h (_bfd_generic_link_add_one_symbol): Remove bitsize
3701 argument from declaration.
3702 (_bfd_generic_reloc_link_order): Declare.
3703 (_bfd_count_link_order_relocs): Declare.
3704 * libbfd.h: Rebuilt.
3705 * aoutx.h (aout_link_add_symbols): Remove bitsize argument from
3706 call to _bfd_generic_link_add_one_symbol.
3707 (NAME(aout,final_link)): Account for link_order relocs when
3708 allocating space for relocations. Handle them after handling all
3710 (aout_link_reloc_link_order): New function.
3711 * ecoff.c (ecoff_link_add_externals): Remove bitsize argument from
3712 call to _bfd_generic_link_add_one_symbol.
3713 (ecoff_bfd_final_link): Account for link_order relocs when
3714 allocating space for relocations. Handle them in link_order loop.
3715 (ecoff_link_write_external): Set the storage class of a defined
3716 linker created symbol based on the section it is in. Correct
3717 bfd_link_hash_weak case to use .sc rather than .st.
3718 (ecoff_reloc_link_order): New function.
3719 * coff-alpha.c (alpha_bfd_reloc_type_lookup): Handle
3721 * coff-mips.c (mips_bfd_reloc_type_lookup): Likewise.
3723 * sunos.c (sunos_read_dynamic_info): Remove unused locals dynsym
3726 * cisco-core.c (cisco_core_file_p): Only pass one argument to
3727 bfd_zmalloc. Free a pointer, not a union.
3728 (cisco_bfd_is_local_label): Correct cast from asection to asymbol.
3732 * bfd/som.c (som_begin_writing): Fix thinko (off by one error).
3734 * som.c (bfd_section_from_som_symbol): Only to do the value
3735 comparison for function symbols within executables.
3737 * som.c (bfd_section_from_som_symbol): Renamed from
3738 som_section_from_subspace_index. Pass in a native SOM symbol.
3739 For executables, iterate through the sections to find out
3740 which contains the symbol's address rather than using the
3741 symbol_info field. (symbol_info has a different meaning for
3742 dynamicly linked executables.)
3744 * trad-core.c (trad_unix_core_file_p): Don't pass abfd to
3747 * som.c (som_begin_writing): Fix braino (one call to align
3748 space/subspace data was done unconditionally rather than
3749 just for executables.)
3751 * som.c (som_begin_writing): Align text in all executables to
3752 make HPUX kernel happy. Fixes strip/objcopy for shared
3757 * som.c (som_begin_writing): Account for alignment needs of
3758 subspaces too when writing executables. Never request a negative
3759 bss size. Fixes some problems with demand paged executables,
3760 still having problems with pure executables and shared executables.
3764 * trad-core.c (trad_unix_core_file_p): Call bfd_zmalloc not
3765 bfd_zalloc for rawptr, because later on we may call free, not
3768 * bfd.c (struct _bfd): Add cisco_core_struct to tdata union.
3769 * libbfd.c (bfd_read, bfd_seek): Add comments regarding errors.
3770 * cisco-core.c: New file.
3771 * Makefile.in: Change accordingly.
3772 * configure.in: Recognize cisco_core_vec.
3773 * config/m68k-aout.mt (SELECT_VECS): Add cisco_core_vec.
3774 * targets.c: Add cisco_core_vec.
3775 * bfd-in2.h: Rebuilt.
3779 * som.h (som_copyable_section_data_struct): New structure
3780 containing all the private section information which needs
3781 to be copied from input section to output section during
3783 (som_section_data_struct): Remove several fields now in
3784 som_copyable_section_data_struct. Make the space and
3785 subspace dictionaries be pointers (to save space when
3786 only reading objects).
3788 * som.c (bfd_som_set_section_attributes): Now returns a boolean;
3789 some references changed. Allocate a copyable data stucture if
3790 none exists. Store info into the copyable data structure.
3791 (bfd_som_set_subsection_attributes): Likewise.
3792 (som_is_space, som_is_subspace, som_is_container): New functions.
3793 Use these instead of directly accessing private data.
3794 (som_prep_headers): Allocate space and subspace headers here.
3795 Fill in some fields in the space/subspace headers from the
3797 (som_bfd_copy_private_section_data): Only copy the stuff
3798 that we really need to make objcopy and strip work. Allocate
3799 the copy_data structure for the output bfd before copying.
3801 * som.h (struct som_exec_data): New structure to hold exec
3802 info that must be preserved when running objcopy/strip.
3803 (struct somdata): Add new "exec_data" field and accessor
3804 macro. Add some comments on how the various fields are used.
3805 (som_section_data_struct): Make is_space and is_subspace bitfields.
3806 Delete unused subspace_index. All references now use the
3807 target_index field within the section structure itself.
3809 * som.c (make_unique_section): Delete unused declaration.
3810 (som_bfd_copy_private_bfd_data): New function.
3811 (som_object_setup): Allocate space for and save exec information
3812 that needs to be copied during objcopy/strip.
3813 (som_mkobject): Do not allocate space for a file header here.
3814 It is not used when only reading SOM objects.
3815 (som_prep_headers): Allocate space for and attach a file header
3816 to the output bfd. For executables, use the saved system_id
3817 value rather than trying to guess the right value. Do not abort
3818 wwhen setting file_hdr->entry* for executables.
3819 (som_begin_writing): For executables, set the exec_entry and
3821 (som_copy_private_backend_section_data): Always return a value.
3823 * libhppa.h (PA_PAGESIZE): Define.
3825 * som.c (SOM_ALIGN): Define.
3826 (som_begin_writing): If writing an executable, initialize all
3827 fields in the exec header to zero. Update fields in the exec
3828 header as sizes of loadable subspaces are computed. Carefully
3829 preserve alignments when building executables. Actually write the
3830 exec after all the fields are filled in.
3832 * Better long-filename handling. Reads SOM ABI compliant extended
3833 names, but doesn't quite write compliant extended names yet.
3834 * som.c (som_slurp_extended_name_table): Delete function. The
3835 generic code will handle things correctly.
3836 (som_slurp_armap): Seek to the beginning of the next member.
3837 (normalize): New function.
3838 (som_bfd_ar_write_symbol_stuff): Take the size of the extended
3839 name table into account when computing the file offsets in the
3840 SOM dictionary. Make sure to align to an even boundary.
3841 (som_write_armap): Initialize the checksum to zero.
3842 (ar_maxchars): Fix. Opps.
3846 * aoutx.h (reloc_type_lookup): Handle BFD_RELOC_CTOR on a 64-bit
3847 machine. Handle BFD_RELOC_SPARC13 and BFD_RELOC_SPARC_BASE13.
3851 * bfd-in.h (BFD_VERSION): Use @VERSION@.
3852 * Makefile.in (bfd.h): Replace it with contents of VERSION file.
3853 * bfd-in2.h: Regenerated.
3855 * trad-core.c (trad_unix_bfd_is_local_label): Fixed typo where
3856 this was also named trad_unix_bfd_copy_private_bfd_data.
3860 * aoutx.h, elfcode.h, coff-alpha.c, bout.c, ecoff.c, ecofflink.c,
3861 elf32-hppa.c, elf32-mips.c, linker.c, som.c, sunos.c: If malloc(0)
3862 returns NULL, it is not an error. It's possible that some of
3863 these checks are not necessary (because the size can never be
3864 zero), but putting in the checks is the conservative thing to do
3865 in light of the fact that some of these malloc calls replaced
3866 unchecked alloca calls, in which a zero argument would work fine.
3870 * osf-core.c (osf_core_bfd_copy_private_bfd_data): Remove
3871 duplicate definition.
3872 (osf_core_bfd_is_local_label): Define.
3874 * reloc.c (bfd_generic_get_relocated_section_contents): Don't fail
3875 if malloc (0) fails. bfd_canonicalize_reloc returning 0 is not a
3876 failure indication, it merely means there are no relocs.
3878 * elfcode.h (NAME(bfd_elf,write_object_contents)): Don't use space
3879 after NAME, since SunOS /bin/cc can't handle it.
3883 * netbsd386.c (N_SET_FLAGS): Don't nuke the machine id field.
3888 * aoutf1.h (4 places): Use a simple #if on ARCH_SIZE, rather than
3889 all that convoluted stuff with NAME, CAT3, etc. The convoluted
3890 stuff broke for SunOS4 /bin/cc (due to DEFUN elimination, I guess).
3894 * som.c (som_prep_for_fixups): Detect section symbols based
3895 on either the lack of private data or the symbol flags. Do not
3896 munge section symbol names anymore -- they no longer confuse GDB.
3897 (som_begin_writing): Leave space for an exec header if writing
3899 (som_slurp_symbol_table): Recognize both forms of section symbol
3900 names "L$0\002" and "$<FOO>$". Change the name of "L$0\002"
3901 section symbols to be the name of the section they represent.
3902 Debugging symbols begin with "L$0\001", not just "L$".
3906 * bfd-in2.h, libbfd.h, libcoff.h: Rebuilt.
3908 * bfd-in.h (JUMP_TABLE): Add new entries to the jump table
3909 for bfd_copy_private_section_data, bfd_copy_private_bfd_data,
3910 and bfd_is_local_label.
3912 * targets.c: Add new entries to the bfd_target structure.
3914 * bfd.c (bfd_copy_private_bfd_data): New definition.
3916 * section.c (bfd_copy_private_section_data): New definition.
3918 * syms.c (bfd_is_local_label): New definition.
3920 * libbfd-in.h (bfd_generic_is_local_label): Declare.
3922 * libbfd.c (bfd_generic_is_local_label): New function.
3924 * *-core.c: Provide default definitions for new functions in
3925 the target vector which all point to bfd_false.
3927 * aout-target.h, coffcode.h, elf32-target.h elf64-target.h, ieee.c
3928 libaout.h, libecoff.h, nlm-target.h, oasys.c, srec.c, tekhex.c
3929 Default new vectors for copying private backend data to bfd_true.
3930 Default new vector for determining if a symbol is a local label
3931 to bfd_generic_is_local_label.
3933 * som.c (som_bfd_copy_private_section_data): New function.
3934 (som_bfd_is_local_label): New function.
3935 (som_bfd_copy_private_bfd_data): For now default to bfd_true.
3937 * elf32-hppa.c (hppa_elf_is_local_label): New function.
3941 * cf-m68klynx.c (CALC_ADDEND): Use _bfd_m68klynx_howto_table.
3946 Replace DEFUN and DEFUN_VOID with K&R-style function definition.
3947 Indent some of them to GNU standards.
3949 * aout32.c, archures.c, core.c, cpu-h8300.c, cpu-i960.c,
3950 cpu-m68k.c, cpu-m88k.c, cpu-mips.c, cpu-vax.c, ctor.c, demo64.c,
3951 elf32-hppa.h, gen-aout.c, host-aout.c, init.c, libhppa.h,
3952 libieee.h, liboasys.h, newsos3.c, som.h, stab-syms.c, sunos.c:
3953 Update copyright years.
3957 * som.c (som_prep_for_fixups): A relocation involving the section
3958 symbol for the *ABS* section is really a relocation involving
3960 (som_slurp_symbol_table): Do not set BSF_GLOBAL or BSF_EXPORT for
3961 undefined symbols. Correctly distinguish between debugger symbols
3962 and section symbols.
3964 * som (setup_sections): Set SEC_DEBUGGING and the section attributes
3965 for spaces and subspaces.
3967 * som.c (som_bfd_count_ar_symbols): Fix typo.
3969 * som.c (som_object_setup): Set EXEC_P, D_PAGED, WP_TEXT, and
3970 HAS_RELOC based on the object's magic number.
3971 (make_unique_section): Delete function. BFD and its users are
3972 prepared to handle multiple sections with the same name.
3973 (setup_sections): Allocate space on the BFD's obstack to hold
3974 section names. Use bfd_make_setion_anyway rather than the
3975 obsolete make_unique_section.
3976 (som_prep_headers): Choose the correct SOM magic number based
3978 (som_bfd_fill_in_ar_symbols): Return false, not NULL on error.
3982 * elf32-ppc.c: Renamed from elf32-powerpc.c.
3983 * nlm32-ppc.c: Renamed from nlm32-powerpc.c.
3984 * Makefile.in, configure.in: Corresponding changes.
3988 * elf32-powerpc.c: Extensive changes to update to preliminary ABI.
3992 * sunos.c (sunos_read_dynamic_info): Assume that dynamic info
3993 is always located at the start of the data section to allow
3994 recovery of the dynamic info from a stripped executable.
3995 * ecoff.c (ecoff_styp_to_sec_flags): Handle STYP_PDATA, STYP_XDATA
4000 * libbfd-in.h: Remove alloca cruft. It was missing some necessary
4001 cruft (like the #pragma alloca for AIX).
4002 In addition to that problem, the C alloca calls xmalloc, which
4003 means checking for being out of memory can't work right. The
4004 following changes remove all uses of alloca from BFD.
4005 * hosts/solaris2.h: Remove alloca cruft.
4006 * som.c: Replace alloca with a fixed size auto array.
4007 * aoutx.h, elfcode.h, nlmcode.h, bout.c, coff-alpha.c, ecoff.c,
4008 ecofflink.c, elf32-hppa.c, elf32-mips.c, linker.c, reloc.c, som.c,
4009 sunos.c: Replace alloca with malloc and appropriate error checking and
4011 * linker.c: Replace alloca with obstack_alloc.
4012 * libbfd.h: Rebuilt.
4016 * coff-mips.c (mips_relocate_section): Handle MIPS_R_LITERAL like
4021 * elf32-hppa.h, elfcode.h: Replace uses of Elf*_Half, Elf*_Word,
4022 Elf*_Off typedefs by their expansion, the typedefs have been
4023 removed from include/elf/internal.h.
4024 * elfcode.h (bfd_section_from_shdr): Handle SHT_DYNAMIC section like
4025 SHT_PROGBITS section.
4029 * som.h (_PA_RISC_ID): Treat HOST_HPPAOSF just like HOST_HPPABSD.
4033 * configure.host: Recognize i[34]86-sequent-*.
4035 * trad-core.c (trad_unix_core_file_p): A non-zero, not zero,
4036 return from bfd_seek indicates an error.
4037 New macro TRAD_CORE_DSIZE_INCLUDES_TSIZE to replace
4038 TRAD_CORE_STACK_OFFSET.
4039 * hosts/symmetry.h: Define TRAD_CORE_DSIZE_INCLUDES_TSIZE and
4040 TRAD_CORE_USER_OFFSET but not HOST_STACK_OFFSET.
4044 * som.[ch]: Do not include libhppa.h in som.c, instead include
4047 * elf32-hppa.[ch]: Do not include libhppa.h in elf32-hppa.c, instead
4048 include it in elf32-hppa.h.
4050 * som.c (log2): Return -1 on error rather than aborting.
4051 (setup_sections): Bubble up an error from log2.
4053 * Changes to make HP C compiler happy in both traditional
4055 * som.c (hppa_som_gen_reloc_type): Use correct enum type for
4057 (bfd_som_set_section_attributes): Use unsigned int rather than
4058 unsigned char to avoid GNU-C extensions.
4059 (bfd_som_attach_aux_hdr): Return a boolean to indicate success
4060 or failure rather than aborting on failure.
4062 * som.h (bfd_som_set_section_attributes): Fix prototype to match
4064 (bfd_som_attach_aux_hdr): Add prototype.
4065 (hppa_som-gen_reloc_type): Likewise.
4067 * elf32-hppa.c: Add a couple casts to make HP compiler happy.
4068 (hppa_look_for_stubs_in_section): Do not return false on failure
4069 until rest of code is ready to handle it. Abort for now.
4073 * bfd-in2.h: Rebuilt.
4077 * i386os9k.c: use new functions bfd_set_error and bfd_get_error.
4078 * Makefile.in: delete an extra blank.
4079 * configure.in : Add i396os9k_vec.
4083 * config.bfd : Add i386-os9k.
4084 * config/i386-os9k.mt : Newly add os9k target makefile.
4086 * i386os9k.c : new file to handle os9k format bfd.
4087 * Makefile.in : Handle new file i386os9k.c
4088 * targets.c : Add bfd_target_os9k_flavour and i386os9k_vec.
4089 * cache.c : Initialize cache_sentinel to 0.
4093 * elf32-hppa.c (mismatches, retval_mismatches): Fix mismatch
4094 action in case where caller specified no argument relocation.
4095 (hppa_elf_build_linker_stub): Try again to get the sym_ptr_ptr
4096 right in the original relocation and the stub's relocation.
4098 * elf32-hppa.h (hppa_look_for_stub_in_section): Fix typo. Delete
4099 unused symbols argument.
4101 * elf32-hppa.c (hppa_elf_stub_reloc): Accept asymbol ** rather
4102 than asymbol * for original target symbol. All callers changed.
4103 Set reloc->sym_ptr_ptr appropriately.
4104 (hppa_elf_build_linker_stub): Set reloc->sym_ptr_ptr correctly.
4105 (hppa_elf_look_for_stubs_in_section): No longer need symbols
4106 argument. Use the output symbols when canonicalizing the relocs,
4107 creating them if necessary.
4109 * linker.c (_bfd_generic_link_output_symbols): Do not
4110 rebuild/clobber the output symbols if they already exist.
4114 * targets.c (BFD_SEND, BFD_SEND_FMT): Add debugging versions that
4115 check all the pointer dereferences. Enabled via DEBUG_BFD_SEND.
4116 * bfd-in2.h: Rebuilt.
4118 * srec.c (hex_value): Always set to a size of 256 bytes.
4119 (srec_init): Cosmetic changes.
4123 * elf32-hppa.c: Second half of major cleanup. More comments,
4124 PARAMize and staticize rest of functions. Delete unused
4125 functions. Delete unused/unnecessary arguments to some functions.
4126 Group static vars together. Abort for bad errors until we have
4127 error code propogation working. Work on spacing and indention.
4128 Add FIXMEs for unresolved problems. Use enums rather than
4129 #defines for lots of things. Merge two functions which build
4130 linker stubs into a single function (so they can easily share a
4131 ton of common code).
4135 * reloc.c (_bfd_relocate_contents): Adjust handling of overflow to
4136 avoid depending upon right shifts of signed numbers, and to
4137 correct handling of src_mask with lower bits zero.
4139 * aoutx.h, archive.c: Add casts to avoid warnings from SVR4 cc.
4140 * ecoff.c, ecofflink.c, ecoffswap.h, srec.c: Likewise.
4141 * elf32-i386.c: Likewise.
4142 * elfcode.h (bfd_section_from_shdr): Make i unsigned; remove old
4144 (elf_write_phdrs): Make i unsigned.
4145 (map_program_segments): Make i and n_left unsigned.
4146 (assign_file_positions_except_relocs): Make i unsigned.
4147 (write_shdrs_and_ehdr): Make count unsigned.
4148 (assign_file_positions_for_relocs): Make i unsigned.
4149 (NAME(bfd,elf_write_object_contents)): Make count unsigned.
4150 (section_from_elf_index): Make index argument unsigned.
4154 * elfcode.h: Don't include assert.h.
4155 (swap_out_syms): Use BFD_ASSERT rather than assert.
4157 * linker.c (_bfd_generic_link_write_global_symbol): Add missing
4160 * hosts/i386v4.h (qsort, strtol): Remove incorrect and useless
4165 * libhppa.h (hppa_rebuild_insn): Moved here from elf32-hppa.c.
4167 * elf32-hppa.h (elf_hppa_tc_symbol): Add new arguments.
4168 (elf_hppa_tc_make_sections): Likewise.
4169 (elf_hppa_final_processing): Add extern decl.
4171 * elf32-hppa.c: First half of major cleanup. Add/cleanup lots of
4172 comments. PARAMize some static functions. Delete unused functions.
4173 Delete unused/unnecessary arguments to many functions. Group
4174 static vars together. Collapse common case statements together
4175 in many places. Use default case when possible instead of listing
4176 each case separately. Abort for bad errors until we get error
4177 code propogation working. Work on spacing and indention problems.
4178 Add FIXMEs for some unresolved problems. Delete hopelessly broken
4179 COMPLEX relocation support (it's never used anyway).
4180 (hppa_elf_rebuild_insn): Delete. Moved into libhppa.h.
4181 (elf_hppa_tc_symbol): Accept and use new arguments (symext chains).
4182 (elf_hppa_tc_make_sections): Likewise.
4184 * format.c (bfd_check_format_matches): Initialize matching_vector
4185 to keep gcc -Wall quiet.
4187 * elfcode.h (elf_slurp_reloca_table): Fix typo.
4189 * som.c (som_get_symtab_upper_bound): Use "sizeof (asymbol *)"
4190 not "sizeof (som_symbol_type *)".
4192 * elfcode.h (elf_get_symtab_upper_bound): Use "sizeof (asymbol *)"
4193 not "sizeof (asymbol"). Opps.
4197 * bfd.c (bfd_get_gp_size): Can't return gp value on an archive.
4198 (bfd_set_gp_size): Can't set gp value on an archive.
4202 * srec.c (pass_over): Don't skip too many characters when
4207 * ecoff.c (ecoff_sizeof_headers): Align result to 16 byte
4212 * som.c (som_bfd_derive_misc_symbol_info): Derive symbol_info
4213 field for absolute symbols in the same manner as undefined
4218 * elfcode.h (elf_core_file_p): Check for core file e_machine match
4219 like in elf_object_p.
4223 * elfcode.h (alloca): Delete declaration.
4225 * som.c (som_prep_headers): Use CPU_PA_RISC1_0 for magic
4226 number rather than HP9000S800_ID. Note som.c is careful
4227 to make sure CPU_PA_RISC1_0 is always defined.
4231 * Makefile.in (targets.o, archures.o): Use ALL_CFLAGS to supply
4232 flags to explicit compile actions.
4236 * ecofflink.c (ecoff_write_symhdr): Set symhdr->magic here.
4237 * ecoff.c (ecoff_write_object_contents): Make sure .bss section
4238 ends on a page boundary if there is no symbol table.
4239 (ecoff_bfd_final_link): Don't set symhdr->magic here.
4241 * hosts/hp300.h: Include <stdlib.h>; don't declare free.
4243 * som.c (som_bfd_count_ar_symbols): Use a pointer and alloca
4244 rather than an array of variable size.
4245 (som_bfd_fill_in_ar_symbols): Likewise.
4246 (som_bfd_ar_write_symbol_stuff): Likewise.
4248 * coff-alpha.c (alpha_relocate_section): Rewrite mask and shift
4249 operation to avoid OSF 1.3 cc bug.
4250 * ecoff.c (ecoff_write_object_contents): Make text_size, data_size
4251 and bss_size bfd_size_type instead of unsigned long. Make
4252 text_start and data_start bfd_vma instead of unsigned long.
4253 * ecofflink.c (ecoff_add_string): Remove incorrect cast of return
4258 * linker.c (_bfd_generic_link_add_archive_symbols): Consider
4259 symbols in the order they appear in the archive map.
4263 * coff-alpha.c (reloc_nil): Add forward declaration, add missing
4264 error_message argument.
4265 * coff-sparc.c (bfd_coff_generic_reloc): Add forward declaration,
4266 add missing error_message argument.
4267 * mipsbsd.c (mips_fix_hi16_s): Add forward declaration, add missing
4268 error_message argument.
4272 Support for PowerPC NetWare.
4273 * nlm32-powerpc.c: New file.
4274 * config.bfd (powerpc-*-netware*): New target; use ppc-nlm.
4275 * config/ppc-nlm.mt: New file.
4276 * configure.in (nlm32_powerpc_vec): New target vector; use
4277 nlm32-powerpc.o, nlm32.o, nlm.o.
4278 * targets.c (nlm32_powerpc_vec): Declare.
4279 * Makefile.in (BFD32_BACKENDS): Add nlm32-powerpc.o.
4280 (CFILES): Add nlm32-powerpc.c.
4282 Initial support for PowerPC ELF. Done without an ABI, and
4283 probably to be changed when I get an ABI.
4284 * config.bfd (powerpc-*-sysv4*): New target; use ppc-elf.
4285 * config/ppc-elf.mt: New file.
4286 * configure.in (bfd_elf32_powerpc_vec): New target vector; use
4287 elf32-powerpc.o, elf32.o, elf.o.
4288 * elf32-powerpc.c: New file.
4289 * elfcode.h (prep_headers): Add bfd_arch_powerpc case.
4290 (elf_set_arch_mach): Likewise.
4291 * targets.c (bfd_elf32_powerpc_vec): Declare.
4292 * Makefile.in (BFD32_BACKENDS): Add elf32-powerpc.o.
4293 (CFILES): Add elf32-powerpc.c.
4294 Rebuilt dependencies.
4298 * coffgen.c (coff_write_linenumbers): Always return a value.
4300 * elfcode.h (elf_slurp_symbol_table): Handle zero symbols
4301 reasonably. Allocate x_symp using alloca.
4303 * elfcode.h (map_program_segments): ELF program header entries
4304 must be sorted by load address. This used to generate the entries
4307 * section.c (SEC_IN_MEMORY): Define.
4308 (asection): Rename unused field otheruserdata to contents, and
4310 (bfd_make_section_anyway): Initialize contents field to NULL.
4311 (bfd_get_section_contents): If SEC_IN_MEMORY is set, get section
4312 contents from contents field rather than from file.
4313 * bfd-in2.h: Rebuilt.
4317 * bfd.c (bfd_get_error, bfd_set_error): New functions.
4318 (bfd_error): Make static.
4319 (bfd_error_type): Renamed from bfd_ec. Prepend "bfd_error_" to
4321 * bfd-in2.h: Regenerated.
4322 * aix386-core.c, aout-adobe.c, aout-encap.c, aout-target.h,
4323 aoutf1.h, aoutx.h, archive.c, archures.c,
4324 bfd.c, bout.c, cache.c, coff-alpha.c, coff-mips.c,
4325 coff-rs6000.c, coffcode.h, coffgen.c, core.c, ctor.c,
4326 ecoff.c, ecofflink.c, elf.c, elf32-hppa.c, elf32-mips.c,
4327 elfcode.h, format.c, hash.c, hp300hpux.c, hppabsd-core.c,
4328 i386lynx.c, ieee.c, libbfd.c, libelf.h, linker.c,
4329 lynx-core.c, nlm.c, nlm32-alpha.c, nlm32-i386.c,
4330 nlm32-sparc.c, nlmcode.h, oasys.c, opncls.c, osf-core.c,
4331 ptrace-core.c, reloc16.c, rs6000-core.c, section.c, som.c,
4332 srec.c, sunos.c, syms.c, targets.c, tekhex.c,
4333 trad-core.c: Change callers.
4337 * som.c: Remove FIXMEs for things which have been dealt with.
4341 * section.c (bfd_get_section_contents): Since this function reads
4342 unrelocated contents, the section's raw size is always the one to
4343 use for bounds checking.
4345 * linker.c (default_indirect_link_order): In assertion, compare
4346 link_order size field against cooked size, not raw size, of input
4349 * bout.c (b_out_get_reloc_upper_bound): For BSS section, just
4351 (aligncode): When shrinking, the addend should be set to the
4352 current offset in the section plus the number of bytes of padding
4353 that will actually be retained.
4354 (b_out_relax_section): If a section contains no relocations, don't
4355 bother processing them.
4356 (b_out_get_relocated_section_contents): Set reloc_done. Assert
4357 that bfd_get_section_contents returns true. Check that relocs are
4359 (b_out_get_relocated_section_contents, case ALIGNDONE): Assert
4360 that reloc->addend falls between the current source offset and the
4361 raw size of the input section.
4363 * config.bfd: Support i960 vxworks versions > 5.0 with coff, not
4364 bout. Default with no version number is still bout. Support
4365 explicit i960-coff target too.
4367 * bout.c: Changed some indentation, deleted trailing whitespace,
4368 fixed some comments, removed some "#if 1" lines.
4369 (output_addr): New macro.
4370 (calljx_callback, callj_callback, get_value, abs32code, aligncode,
4371 b_out_get_relocated_section_contents): Use it for readability.
4375 * som.c (som_bfd_prep_for_ar_write): Iterate through the SOM
4376 symbols, not the BFD symbols.
4377 (som_bfd_ar_write_symbol_stuff): Likewise.
4381 * som.c (som_slurp_symbol_table): Do not die if a BFD doesn't
4384 * Finish basic read-write support for SOM archive libraries. Bugs
4385 surely remain as this hasn't been tested all that much.
4386 * som.c (SOM_LST_HASH_SIZE, SOM_LST_MODULE_LIMIT): Define.
4387 (struct som_misc_symbol_info): New structure to hold info necessary
4388 to build both normal and library symbol tables.
4389 (som_derive_misc_symbol_info): New function to derive info necessary
4390 to build both normal and library symbol tables.
4391 (som_build_and_write_symbol_table): Use new function to derive misc
4393 (som_slurp_symbol_table): Update backend private data for symbols
4395 (som_bfd_prep_for_ar_write): New function.
4396 (som_bfd_ar_symbol_hash): New function.
4397 (som_bfd_ar_write_symbol_stuff): New function.
4398 (som_write_armap): Flesh out.
4399 (som_vec): Fix ar padding character.
4401 * som.c: Consistently use memset rather than bzero.
4403 Mon Feb 14 17:02:28 1994 Stu Grossman (grossman at cygnus.com)
4405 * coff-rs6000.c: Add Lynx core file support, use HOST_AIX, where
4407 * rs6000-core.c: Use HOST_AIX instead of COREFILES_PLEASE.
4408 * config/rs6000.mh: Remove defs of ARCHIVES_PLEASE and
4410 * config/rs6000lynx.mh: Turn on Lynx core file support.
4411 * hosts/rs6000.h: #define HOST_AIX.
4412 * hosts/rs6000lynx.h: Create this to enable Lynx host support.
4416 * som.h (som_symbol_data): Safely access backend private data
4417 for BFD symbols. All callers changed.
4419 * Read-only SOM archive support.
4420 * som.c (som_bfd_count_ar_symbols): New helper function.
4421 (som_bfd_fill_in_ar_symbols): New helper function.
4422 (som_slurp_armap): New function to read a SOM LST.
4424 * som.h: Include <lst.h> and <ar.h>.
4428 * elfcode.h (elf_map_symbols): Fix typo.
4429 (write_object_contents): Check return values from prep_headers and
4430 elf_compute_section_file_positions.
4431 (set_section_contents): Likewise.
4435 * archive.c (normalize) [VMS]: Call malloc, not bfd_xmalloc.
4436 (bfd_construct_extended_name_table): Check result of normalize.
4440 Make all callers of malloc or realloc (including via obstacks)
4441 check the result for NULL. Most set bfd_error to no_memory and
4442 return in that case; a few are harder to fix, and are marked
4443 with "FIXME <return type>".
4445 * elf32-hppa.c (hppa_elf_build_arg_reloc_stub
4446 hppa_elf_build_long_branch_stub): Check bfd_make_empty_symbol return.
4447 * linker.c (_bfd_generic_link_output_symbols
4448 _bfd_generic_link_write_global_symbol): Ditto
4449 * section.c (bfd_make_section_anyway): Ditto.
4451 * tekhex.c (find_chunk tekhex_mkobject): Check bfd_alloc.
4452 (first_phase): Ditto. FIXME void
4453 (tekhex_make_empty_symbol): Check bfd_zalloc.
4455 * sunos.c (sunos_read_dynamic_info): Check bfd_zalloc.
4456 (MY(read_dynamic_symbols) MY(read_dynamic_relocs)): Check bfd_alloc.
4458 * stringhash.c (_bfd_stringtab_hash_newfunc): Check bfd_hash_allocate.
4461 (fillup_symbols): Check bfd_alloc. FIXME void
4462 (srec_mkobject srec_get_section_contents
4463 srec_set_section_contents): Check bfd_alloc.
4464 (srec_make_empty_symbol): Check bfd_zalloc.
4466 * som.c (hppa_som_gen_reloc_type): Check bfd_alloc_by_size_t.
4467 (make_unique_section): Check bfd_alloc.
4468 (som_new_section_hook): Check bfd_zalloc.
4469 (bfd_som_attach_aux_hdr): Ditto. FIXME void
4471 * rs6000-core.c (rs6000coff_core_p): Check bfd_zalloc.
4473 * osf-core.c (osf_core_make_empty_symbol): Check bfd_zalloc.
4474 (osf_core_core_file_p): Check bfd_alloc.
4476 * oasys.c (oasys_slurp_symbol_table oasys_archive_p
4477 oasys_mkobject oasys_object_p oasys_new_section_hook
4478 oasys_set_section_contents): Check bfd_alloc.
4479 (oasys_slurp_section_data): Check bfd_zalloc and bfd_alloc.
4480 (oasys_make_empty_symbol): Check bfd_zalloc.
4482 * nlmcode.h (nlm_make_empty_symbol): Check bfd_zalloc.
4483 (nlm_slurp_symbol_table): Check bfd_zalloc and bfd_alloc.
4485 * nlm32-sparc.c (nlm_sparc_read_import): Check bfd_alloc.
4487 * nlm32-i386.c (nlm_i386_read_import): Check bfd_alloc.
4489 * nlm32-alpha.c (nlm_alpha_read_import): Check bfd_alloc.
4491 * linker.c (_bfd_link_hash_newfunc
4492 (generic_link_hash_newfunc
4493 (archive_hash_newfunc
4494 (_bfd_generic_link_add_one_symbol): Check bfd_hash_allocate.
4495 (_bfd_generic_final_link
4496 (_bfd_generic_link_output_symbols
4497 (default_indirect_link_order): Check bfd_alloc.
4498 (bfd_new_link_order): Check bfd_alloc_by_size_t.
4500 * irix-core.c (irix_core_make_empty_symbol): Check bfd_zalloc.
4503 (read_id get_symbol get_section_entry ieee_archive_p ieee_object_p
4504 ieee_slurp_section_data ieee_new_section_hook): Check bfd_alloc.
4505 (do_one): Check bfd_alloc. Return a boolean.
4506 (ieee_slurp_section_data): Check it.
4507 (init_for_output): Check bfd_alloc. Return a boolean.
4508 (ieee_set_section_contents): Check it.
4509 (do_with_relocs): Check bfd_alloc. Return a boolean.
4510 (ieee_bfd_debug_info_accumulate): Ditto. FIXME void.
4511 (ieee_mkobject): Check bfd_zalloc.
4512 (ieee_make_empty_symbol): Check bfd_zmalloc.
4514 * hpux-core.c (hpux_core_make_empty_symbol): Check
4517 * hppabsd-core.c (hppabsd_core_make_empty_symbol): Check
4519 (hppabsd_core_core_file_p): Check bfd_zalloc.
4521 * hp300hpux.c (MY(slurp_symbol_table)): Check bfd_alloc.
4523 * elfcode.h (elf_new_section_hook): Check bfd_alloc.
4524 (bfd_section_from_phdr): Ditto.
4525 (write_relocs): Ditto. FIXME void
4526 (elf_map_symbols assign_section_numbers map_program_segments):
4527 Ditto. Return a boolean.
4528 (swap_out_syms): Ditto. Check elf_map_symbols.
4529 (elf_slurp_symbol_table): Check bfd_zalloc.
4530 (elf_slurp_reloca_table): Check bfd_alloc.
4531 (elf_slurp_reloc_table): Ditto.
4532 (elf_compute_section_file_positions): Check assign_section_numbers.
4533 (assign_file_positions_except_relocs): Return a boolean.
4534 Check map_program_segments.
4535 (elf_compute_section_file_positions): Check it.
4537 * elf32-mips.c (mips_elf_final_link): Check bfd_alloc.
4539 * elf32-hppa.c (hppa_elf_stub_branch_reloc): Check bfd_zmalloc and
4541 (hppa_elf_stub_reloc): Ditto.
4542 (hppa_elf_build_arg_reloc_stub): Check bfd_zalloc.
4543 (hppa_elf_build_long_branch_stub): Ditto.
4544 (elf32_hppa_backend_symbol_table_processing): Ditto.
4546 * ecoff.c (ecoff_set_symbol_info): Check bfd_alloc. Return a boolean.
4547 (ecoff_slurp_symbol_table): Check it.
4548 (ecoff_slurp_armap): Check bfd_alloc.
4549 (ecoff_write_armap): Check bfd_zalloc.
4550 (ecoff_link_hash_newfunc): Check bfd_hash_allocate and
4551 _bfd_link_hash_newfunc.
4552 (ecoff_link_add_externals): Check bfd_alloc.
4554 * ctor.c (bfd_constructor_entry): Check bfd_alloc.
4556 * coffgen.c (coff_real_object_p): Check bfd_alloc.
4557 (coff_renumber_symbols): Check bfd_alloc_by_size_t. Return a boolean.
4558 (coff_write_symbol): Check bfd_alloc. FIXME int
4559 (coff_write_linenumbers): Check bfd_alloc. Return a boolean.
4560 (coff_section_symbol): Check bfd_alloc_by_size_t.
4561 (coff_get_normalized_symtab): Check bfd_alloc.
4562 (coff_bfd_make_debug_symbol): Check bfd_zalloc.
4563 * libcoff-in.h: Change decls of coff_renumber_symbols,
4564 coff_write_linenumbers.
4565 * libcoff.h: Rebuilt.
4566 * coffcode.h (coff_write_object_contents): Check
4567 coff_renumber_symbols, coff_write_linenumbers.
4569 * coffcode.h: Indent.
4570 (coff_add_missing_symbols): Check bfd_alloc_by_size_t. Return a
4572 (coff_write_object_contents): Check it.
4574 * coff-alpha.c (alpha_relocate_section): Check bfd_alloc.
4575 * coff-mips.c (mips_relocate_section): Ditto.
4577 * archive.c (bfd_slurp_bsd_armap_f2): Check bfd_alloc value.
4578 (do_slurp_bsd_armap): Ditto.
4579 (compute_and_write_armap): Check bfd_realloc value.
4581 * aoutx.h (translate_from_native_sym_flags): Check bfd_alloc
4582 return value. Return boolean value.
4583 (NAME(aout,make_empty_symbol)): Check bfd_zalloc return value.
4584 (NAME(aout,slurp_symbol_table)): Check bf_alloc and bfd_zalloc
4586 (add_to_stringtab): Ditto. FIXME void
4587 (aout_link_hash_newfunc): Check bfd_hash_allocate return value.
4588 (aout_link_add_symbols): Check bfd_alloc value.
4589 (translate_symbol_table): Check translate_from_native_sym_flags.
4590 * hp300hpux.c (MY(slurp_symbol_table)): Ditto.
4591 * aoutx.h (aout_link_hash_newfunc): Check _bfd_link_hash_newfunc.
4593 * opncls.c (bfd_zalloc bfd_realloc): Check result of bfd_alloc.
4595 * opncls.c (obstack_chunk_alloc): Define as malloc, not
4596 bfd_xmalloc_by_size_t.
4597 (_bfd_new_bfd): Check obstack_begin for 0 return.
4599 * ieee.c (obstack_chunk_alloc): Define as malloc, not
4600 bfd_xmalloc_by_size_t.
4601 (ieee_archive_p): Check obstack_begin for 0 return and
4602 obstack_finish for NULL return.
4604 * hash.c (obstack_chunk_alloc): Define as malloc, not
4605 bfd_xmalloc_by_size_t.
4606 (bfd_hash_table_init_n): Check obstack_begin for 0 return and
4607 obstack_finish for NULL return.
4608 (bfd_hash_lookup): Check obstack_alloc for NULL return.
4610 * ecofflink.c (obstack_chunk_alloc): Define as malloc, not
4611 bfd_xmalloc_by_size_t.
4612 bfd_ecoff_debug_accumulate
4613 bfd_ecoff_debug_accumulate_other): Check obstack_alloc.
4614 (add_file_shuffle add_memory_shuffle): Check obstack_alloc for
4615 NULL return. Return boolean, not void.
4616 (bfd_ecoff_debug_init): Check obstack_begin for 0 return.
4617 (bfd_ecoff_debug_accumulate): Check add_file_shuffle
4618 and add_memory_shuffle return.
4619 (string_hash_newfunc): Check bfd_hash_allocate and bfd_hash_newfunc.
4620 (bfd_ecoff_debug_accumulate): Check bfd_alloc.
4621 (ecoff_add_string): Check add_memory_shuffle return.
4623 * libbfd-in.h (xmalloc, bfd_xmalloc, bfd_xmalloc_by_size_t):
4625 * libbfd.h: Rebuilt.
4627 Fri Feb 11 15:35:32 1994 Stu Grossman (grossman at cygnus.com)
4629 * configure.host: Add Lynx/rs6000 support.
4630 * config/i386-nlm.mt: Enable a.out file support.
4631 * config/rs6000lynx.mh: Lynx/rs6000 host support.
4635 * archive.c (compute_and_write_armap): Rewrite somewhat to improve
4640 * archive.c: Change all references to '\n' in archive magic
4641 to '\012', for greater portability.
4642 * ecoff.c (ecoff_write_armap): Ditto.
4646 * aoutx.h (aout_link_write_other_symbol): Check strip settings to
4647 see whether symbol should be output.
4648 * genlink.h (struct generic_write_global_symbol_info): Added info
4650 * linker.c (_bfd_generic_final_link): Initialize wginfo.info.
4651 (_bfd_generic_link_write_global_symbol): Check strip settings to
4652 see whether symbol should be output.
4653 * elf32-mips.c (mips_elf_final_link): Initialize wginfo.info.
4657 * som.c (som_reloc_queue_find): Do not examine a NULL queue entry.
4659 * som.c: Cast return values from BFD memory allocation routines to
4660 avoid warnings from the HP compiler.
4664 * coff-alpha.c (alpha_relocate_section): Accept a LITERAL
4665 reloc on an "ldl" instruction too.
4667 * archive.c (bfd_ar_hdr_from_filesystem): Cast status elements
4668 when passing them to sprintf. Use %ld instead of %d.
4670 * coff-rs6000.c (rs6000coff_mkarchive): Return false.
4671 (rs6000_coff_snarf_ar_hdr): Don't declare errno; it's not used.
4672 Also removed unused variable namelen.
4673 (rs6000coff_write_armap): Declare orl_count and stridx parameters.
4677 * libbfd-in.h (xmalloc): Don't declare parameter type, to avoid
4679 * libbfd.h: Rebuilt.
4683 * coff-alpha.c (reloc_nil): New function.
4684 (alpha_howto_table): Use it as special_function to prevent certain
4685 relocs from being adjusted by bfd_perform_relocation. IGNORE
4686 reloc should be partial_inplace.
4687 (alpha_ecoff_get_relocated_section_contents): Accept a LITERAL
4688 reloc on an "ldl" instruction too.
4692 * elf32-hppa.c (CURRENT_STUB_OFFSET, hppa_elf_build_arg_reloc_stub,
4693 hppa_elf_build_long_branch_stub): Cast to char * instead of int
4694 before performing pointer arithmetic.
4698 * config.bfd (hppa*-*-osf*): Use bfd_name hppaosf for this
4700 (hppa*-*-*elf*): This configuration used hppa-elf now.
4702 * som.c: This file is also used for HOST_HPPAOSF.
4704 * targets.c (bfd_target_vector): Enable som_vec for HOST_HPPAOSF.
4706 * hosts/hppaosf.h: New host configuration file.
4708 * config/hppabsd.mt (SELECT_VECS): Add bfd_elf32_hppa_vec as
4709 BSD handles both SOM and ELF object files.
4711 * config/hppaosf.mh (HDEFINES): Delete. No longer needed.
4712 (RANLIB): Doesn't do anything, define it to be "echo".
4714 * config/hppaosf.mt: New target makefile fragment for a PA running
4719 * archures.c (enum bfd_architecture): Added bfd_arch_powerpc.
4720 (archures_init_table): If SELECT_ARCHITECTURES is not defined,
4721 added bfd_powerpc_arch.
4722 * bfd-in2.h: Rebuilt.
4723 * cpu-powerpc.c: New file.
4724 * Makefile.in (ALL_MACHINES, CFILES): Added cpu-powerpc.c.
4725 Rebuilt dependencies.
4727 * elfcode.h (bfd_section_from_shdr): Get vma and alignment_power
4728 of an SHT_STRTAB section from sh_addr and sh_addralign, rather
4729 than just setting them to zero.
4733 * elfcode.h (prep_headers, swap_out_syms): Check for NULL return
4734 from bfd_new_strtab.
4735 (elf_compute_section_file_positions): Check for false return from
4738 * linker.c (default_indirect_link_order): Check for NULL return
4739 from bfd_get_relocated_section_contents.
4741 * syms.c: Make example application in doc call xmalloc, not
4744 * aoutx.h (NAME(aout,slurp_symbol_table),
4745 aout_link_get_symbols, NAME(aout,link_hash_table_create)):
4746 * bout.c (b_out_slurp_reloc_table, b_out_squirt_out_relocs):
4747 * ecoff.c (ecoff_bfd_link_hash_table_create):
4748 * ecofflink.c (bfd_ecoff_debug_init):
4749 * format.c (bfd_check_format_matches):
4750 * linker.c (_bfd_generic_link_hash_table_create):
4751 (_bfd_generic_final_link):
4752 * reloc16.c (bfd_coff_reloc16_relax_section):
4753 (bfd_coff_reloc16_get_relocated_section_contents):
4754 * elf32-hppa.c (hppa_elf_build_arg_reloc_stub):
4755 * elf32-mips.c (mips_elf_final_link):
4756 * elfcode.h (bfd_new_strtab):
4757 (bfd_add_2_to_strtab):
4758 (elf_slurp_symbol_table):
4759 (elf_corefile_note):
4760 * libbfd.c (bfd_zmalloc):
4761 Use malloc and check the result, instead of bfd_xmalloc.
4765 * config.bfd: Put m68*-*-sysv* line after m68*-*-sysv4*.
4769 * srec.c (srec_write_record): Put CONST keyword for "src" before
4770 "unsigned", some compilers don't like it after "unsigned".
4771 * libcoff.h, libcoff-in.h (bfd_perform_slip): Rename "value" to
4772 "val" in prototype declaration because some compilers don't like
4773 arguments whose names are the same as types.
4777 * aoutx.h (aout_link_check_ar_symbols): Correct test for whether
4778 object file defines symbol. Also, if skipping a symbol, skip the
4779 second symbol of a N_WARNING or N_INDR symbol as well.
4783 Add basic support for writing RS/6000 XCOFF files.
4784 * coff-rs6000.c (dummy_reloc): Removed.
4785 (rs6000coff_howto_table): Defined XCOFF relocs.
4786 (RTYPE2HOWTO): Defined to use rs6000coff_rtype2howto.
4787 (rs6000coff_rtype2howto): New function.
4788 (coff_bfd_reloc_type_lookup): Defined to use
4789 rs6000coff_reloc_type_lookup.
4790 (rs6000coff_reloc_type_lookup): New function.
4791 (SELECT_RELOC): Defined to set r_type and r_size fields.
4792 (COFF_LONG_FILENAMES): Defined.
4793 * coffcode.h (combined_entry_type): Changed fix_tag and fix_end
4794 fields to bitfields. Added fields fix_value and fix_scnlen.
4795 (sec_to_styp_flags): If STYP_DEBUG is defined, use it rather than
4796 STYP_INFO for the type of a section named .debug.
4797 (coff_add_missing_symbols): Don't define if RS6000COFF_C.
4798 (coff_write_object_contents): If RS6000COFF_C, don't call
4799 coff_add_missing_symbols.
4800 (coff_slurp_symbol_table): If RS6000COFF_C, then if the last aux
4801 entry has type STY_LD change the x_scnlen into a pointer to a
4802 symbol and set fix_scnlen. Also, for a C_BSTAT symbol, change the
4803 value into a pointer to a symbol and set fix_value.
4804 * libcoff.h: Rebuilt.
4805 * coffgen.c (coff_mangle_symbols): Reindent. If fix_value is set,
4806 get the symbol offset. Likewise for fix_scnlen.
4807 (string_size): Change type to bfd_size_type.
4808 (debug_string_size, debug_string_section): New static variables.
4809 (coff_fix_symbol_name): If bfd_coff_symname_in_debug returns true,
4810 write the symbol name into the .debug section; assume that the
4811 section has already been created with the right size.
4812 (coff_write_symbols): Initialize debug_string_size to 0. If
4813 bfd_coff_symname_in_debug returns true, don't put symbol name in
4814 usual string table. After writing out all symbols, if
4815 debug_string_size is not 0, check that it matches the size of the
4817 (coff_get_normalized_symtab): Clear new fix_value and fix_scnlen
4818 fields. If the string offset is 0, always use an empty string as
4820 (coff_make_empty_symbol): Zero out the symbol structure.
4821 * reloc.c (bfd_perform_relocation): Work around one gross hack
4822 with another: actually look at the target name to avoid the broken
4824 (bfd_reloc_code_real_type): Add BFD_RELOC_PPC_B26,
4825 BFD_RELOC_PPC_BA26 and BFD_RELOC_PPC_TOC16.
4826 * bfd-in2.h: Rebuilt.
4830 * libbfd.c (bfd_zmalloc): Call bfd_xmalloc instead of malloc.
4831 (bfd_xmalloc, bfd_xmalloc_by_size_t): Functions deleted.
4832 * libbfd-in.h: Define them as macros calling xmalloc and declare
4834 * libbfd.h: Rebuilt.
4838 * ecofflink.c (bfd_ecoff_debug_externals): If a small undefined
4839 symbol has a value in the ECOFF symbol but not in the BFD symbol,
4840 keep the value in the ECOFF symbol. This helps gas.
4842 * linker.c (_bfd_generic_link_output_symbols,
4843 _bfd_generic_link_write_global_symbol): Don't require that all
4844 references to a common symbol be themselves common symbols.
4846 * aoutx.h (aout_reloc_index_to_section): Handle N_UNDF.
4850 * libbfd.c, bfd-in.h, hosts/alphaosf.h, hosts/sparc-ll.h, aoutf1.h,
4851 sparclynx.c, Makefile.in: Change HOST_64_BIT to BFD_HOST_64_BIT.
4852 * bfd-in2.h: Rebuilt.
4856 * coffswap.h (coff_swap_reloc_out): If RS6000COFF_C, handle type
4858 (coff_swap_aux_in): If RS6000COFF_C, change x_csect.x_scnlen to
4859 x_csect.x_scnlen.l to match change in coff/internal.h.
4860 (coff_swap_aux_out): Likewise.
4862 * coff-mips.c (mips_ecoff_backend_data), coff-alpha.c
4863 (alpha_ecoff_backend_data): Change casts of aux_in and aux_out
4864 fields to match yesterday's changes.
4866 * coffcode.h (coff_write_relocs): If SELECT_RELOC is defined, pass
4867 in the internal_reloc itself, not the type.
4868 * coff-apollo.c, coff-h8300.c, coff-h8500.c, coff-i386.c,
4869 coff-m68k.c, coff-sh.c, coff-we32k.c, coff-z8k.c: Changed
4870 definition of SELECT_RELOC accordingly.
4874 * coffcode.h (bfd_coff_backend_data): Added new arguments to
4875 _bfd_coff_swap_aux_in and _bfd_coff_swap_aux_out: aux index number
4876 and number of aux entries.
4877 (bfd_coff_swap_aux_in, bfd_coff_swap_aux_out): Changed
4879 * libcoff.h: Rebuilt.
4880 * coffswap.h (coff_swap_aux_in, coff_swap_aux_out): Accept new
4881 arguments. If RS6000COFF_C, only treat C_EXT and C_HIDEXT
4882 specially if this is the last aux entry.
4883 * coffgen.c (coff_write_symbol, coff_get_normalized_symtab): Pass
4884 new arguments to swap_aux functions.
4888 * gen-aout.c (main): Set DEFAULT_ARCH based on preprocessor macros
4889 (only testing for m68k and vax at the moment); do verify that the
4890 preprocessor didn't trash the arch name inside the string version.
4891 Don't print out "pagesize =" line that prevents output from
4892 compiling. Derive BYTES_IN_WORD and ARCH values from sizeof
4894 * Makefile.in (aout-params.h): Pass gen-aout a dummy target name.
4895 (check, installcheck): Identify directory in "no testsuites"
4900 * aoutx.h (aout_link_write_symbols): Write out correct value for
4905 * hosts/vaxbsd.h (HOST_STACK_END_ADDR): Vax BSD doesn't define
4906 KERNBASE, so hard-code 0x80000000 instead.
4910 * linker.c (generic_link_add_symbol_list): If symbol is common,
4911 set the BSF_OLD_COMMON flag.
4915 * format.c (bfd_check_format_matches): Put the new entry in the
4916 correct element of matching_vector.
4920 * som.c, som.h (bfd_som_set_section_attributes,
4921 bfd_som_set_subsection_attributes): Change parameters from char
4922 to int. Following a prototype with an old-style function definition
4923 in the presence of widened parameters is a GCC-ism not supported
4924 by the HP compiler in ANSI mode.
4928 * reloc.c (bfd_get_reloc_size): Size of type -2 is 4 bytes, not 2.
4930 * hp300hpux.c (MY(write_object_contents)): Write out the symbols
4931 before writing out the relocs, so that the right symbol indices
4934 * archive.c (do_slurp_bsd_armap, bfd_slurp_bsd_armap_f2): Do not
4935 try to overlay the internal carsyms on the external symdefs. That
4936 can not work if the size of a host pointer is larger than 4 bytes.
4938 * format.c (bfd_check_format_matches): Cast result of
4939 bfd_xmalloc_by_size_t.
4940 * opncls.c (_bfd_new_bfd): Avoid ANSI C prototype.
4942 * archive.c: Reindented to GNU standards.
4946 * opncls.c (_bfd_new_bfd, _bfd_new_bfd_contained_in): Add
4947 "_bfd_" to function names.
4948 * archive.c (_bfd_create_empty_archive_element_shell),
4949 libbfd-in.h: Change callers.
4951 * libbfd.c (bfd_zmalloc): Renamed from zalloc.
4952 * libbfd.c (bfd_add_to_string_table),
4953 trad-core.c (trad_unix_core_file_p),
4954 targets.c (bfd_target_list),
4955 ptrace-core.c (ptrace_unix_core_file_p),
4956 opncls.c (new_bfd), libbfd-in.h,
4957 ieee.c (ieee_make_empty_symbol),
4958 elf32-hppa.c (hppa_elf_stub_branch_reloc),
4959 (hppa_elf_stub_reloc): Change callers.
4960 * libbfd.h: Regenerated.
4962 * archive.c (_bfd_look_for_bfd_in_cache): Add "_bfd_" to name.
4963 (_bfd_get_elt_at_filepos),
4964 coff-rs6000.c (rs6000coff_get_elt_at_filepos), libbfd-in.h:
4967 * format.c (bfd_check_format_matches), libbfd-in.h, targets.c,
4968 elfcode.h (elf_object_p): Rename target_vector to bfd_target_vector
4969 and default_vector to bfd_default_vector.
4970 * libbfd.h: Regenerated.
4972 * format.c (bfd_check_format_matches): New function.
4973 (bfd_check_format): Call it.
4974 (bfd_matching_formats): Function removed.
4975 * targets.c: Replace the vector added on Jan 21 with a count of
4976 entries in default_vector.
4977 * bfd-in2.h: Regenerated.
4981 * coff-alpha.c (alpha_ecoff_object_p): New function. Set size of
4982 .pdata section based on lnnoptr field, not section header.
4983 (alpha_relocate_section): Don't bother to check if r_symndx >= 0,
4984 since it is unsigned.
4985 (ecoffalpha_little_vec): Use alpha_ecoff_object_p rather than
4987 * ecoff.c (ecoff_new_section_hook): Set alignment_power field of
4988 .pdata section to 3.
4989 (ecoff_compute_section_file_positions): Save the size of the
4990 .pdata section in the line_filepos field, and actually align the
4991 .pdata section to an alignment power of 4.
4992 (ecoff_compute_reloc_file_positions): Set output_has_begun after
4993 calling ecoff_compute_section_file_positions.
4994 (ecoff_write_object_contents): Set s_lnnoptr for the .pdata
4995 section from the line_filepos field. Set vstamp for the optional
4996 header from the vstamp of the symbolic header.
4997 (ecoff_bfd_final_link): Set vstamp of the symbolic header to the
4998 vstamp used by the first object file in the link.
5000 * ecofflink.c (ecoff_align_debug): Align RFDs to debug_align.
5002 * linker.c (generic_link_check_achive_element): Set SEC_ALLOC flag
5003 for a created common section.
5004 (_bfd_generic_link_add_one_symbol): Likewise.
5006 * elfcode.h (swap_out_syms): Use elf_section_from_bfd_section to
5007 get the index of a common section, rather than always using
5008 SHN_COMMON (MIPS has multiple common sections).
5010 * elf32-hppa.c (hppa_elf_gen_reloc_type): Typo (== for =).
5012 * bfd/aoutx.h (aout_link_input_section_std,
5013 aout_link_input_section_ext): Pass additional arguments to
5014 reloc_overflow callback.
5015 * coff-alpha.c (alpha_ecoff_get_relocated_section_contents,
5016 alpha_relocat_section): Likewise.
5017 * coff-h8300.c (h8300_reloc16_extra_cases): Likewise.
5018 * coff-h8500.c (extra_case): Likewise.
5019 * coff-mips.c (mips_relocate_section): Likewise.
5020 * coff-z8k.c (extra_case): Likewise.
5021 * elf32-hppa.c (hppa_elf_stub_finish): Likewise.
5022 * reloc.c (bfd_generic_get_relocated_section_contents): Likewise.
5024 * bout.c (calljx_callback, callj_callback): Use get_value to get
5025 the symbol value and check for undefined symbols.
5026 (get_value): If the symbol is undefined, look it up in the linker
5028 (b_out_get_relocated_section_contents): For PCREL24 and PCREL13
5029 use get_value to get the symbol value and check for undefined
5031 * reloc16.c (bfd_coff_reloc16_get_value): If the symbol is
5032 undefined, look it up in the linker hash table.
5034 * aoutx.h (translate_symbol_table): The string index 0 has a
5035 special meaning for normal symbols, but not for dynamic symbols.
5037 Sat Jan 22 12:26:01 1994 Stu Grossman (grossman at cygnus.com)
5039 * sparclynx.c: Setup appropriate macros to enable core file
5044 * targets.c: Add a vector of matching format names.
5045 * format.c (bfd_matching_formats): New function to return it.
5046 (bfd_check_format): Set it.
5047 * bfd-in2.h: Regenerated.
5049 * bfd-in.h: Remove decls of bfd_ec type and error printing functions.
5050 Remove decl of type symclass; wasn't used.
5051 * bfd.c: Document error handling, including code fragments
5052 containing the error decls that were in bfd-in.h.
5054 * bfd-in2.h: Regenerated.
5058 * nlmcode.h, liblnm.h, nlm32-alpha.c nlm32-i386.c nlm32-sparc.c:
5059 The sparc (and possibly other?) NLM format requires a different
5060 way to write exports, so add a write_export field to the backend
5061 data (and set it to NULL for everything but the sparc).
5065 * sunos.c (MY(read_dynamic_relocs)): Compare info->dynrel with NULL,
5066 not (struct external_nlist *) NULL. info->dynrel is a PTR, not
5067 a struct external_nlist *.
5071 * bfd.c: Remove error strings for errors removed below.
5072 * aoutx.h (translate_to_native_sym_flags), bfd-in.h (bfd_ec),
5073 oasys.c (oasys_write_sections): Rename
5074 bfd_error_nonrepresentable_section to nonrepresentable_section.
5075 None of the other bfd error names start with "bfd_error".
5076 Remove errors symbol_not_found and no_relocation_info, which seem
5078 * bfd-in2.h: Regenerated.
5082 * bfd.c (bfd_get_gp_size): Added support for ELF.
5084 * syms.c (BSF_DYNAMIC): New symbol flag.
5085 (bfd_print_symbol_vandf): Print it.
5086 * bfd-in2.h: Rebuilt.
5087 * libaout.h (struct aout_backend_data): New read_dynamic_symbols
5088 and read_dynamic_relocs fields.
5089 (struct aoutdata): New dynamic_info field.
5090 (obj_aout_dynamic_info): New accessor macro.
5091 * sunos.c (struct sunos_dynamic_info): New structure.
5092 (sunos_read_dynamic_info, MY(read_dynamic_symbols),
5093 MY(read_dynamic_relocs)): New functions to read dynamic symbols
5095 * aoutx.h (NAME(aout,some_aout_object_p)): If the object is
5096 dynamically linked, set SEC_RELOC for both the .text and .data
5098 (translate_from_native_sym_flags): Don't set BSF_LOCAL for an
5100 (translate_symbol_table): New function, split out of
5101 slurp_symbol_table; set the BSF_DYNAMIC flag appropriately.
5102 (NAME(aout,slurp_symbol_table)): Read dynamic symbols, if any.
5103 (NAME(aout,slurp_reloc_table)): Read dynamic relocs, if any.
5104 (NAME(aout,get_reloc_upper_bound)): Include dynamic reloc count in
5106 * aoutf1.h (NAME(aout,sunos4_write_object_contents)): Don't write
5107 out dynamic symbols or relocs against reloc symbols, since they
5108 are already in the .text section and we wouldn't know where to
5110 (sunos4_aout_backend): Initialize read_dynamic_symbols and
5111 read_dynamic_relocs fields.
5112 * aout-target.h (MY(backend_data)): Initialize
5113 read_dynamic_symbols and read_dynamic_relocs fields.
5117 * hosts/alphaosf.h (uint64e_type, uint64_type, int64_type): Delete
5118 typedefs, since HOST_64_BIT will take care of defining them in
5123 * config/alphaosf.mh (HDEFINES): Don't define HOST_64_BIT here;
5124 that's dealt with elsewhere.
5125 * hosts/alphaosf.h (sprintf_vma, fprintf_vma): New macros.
5126 (uint64_typeHIGH, uint64_typeLOW): Comment with HOST_64_BIT so
5127 they get copied to bfd.h.
5129 * reloc.c (enum bfd_reloc_code_real): Add some Alpha relocation
5130 types. Reorganized some of the existing ones.
5131 * coff-alpha.c (alpha_howto_table): Construct 64-bit negative one
5132 values in case of compilation on a 32-bit machine. Fix pcrel
5133 fields of some reloc types.
5134 (alpha_bfd_reloc_type_lookup): Handle more relocation types.
5136 * bfd-in.h (uint64_typeHIGH, uint64_typeLOW): Supply default
5137 definitions when not defined, regardless of whether uint64_type is
5138 a defined macro or not.
5139 (fprintf_vma, sprintf_vma): Define only if fprintf_vma is not
5144 * aoutx.h (translate_to_native_sym_flags): Set the type of a
5145 BSF_WARNING symbol to N_WARNING.
5149 * aoutx.h (aout_link_add_symbols): Increment sym_hash as well as p
5150 for an indirect or warning symbol.
5151 (aout_link_write_symbols): Update sym_hash with the target of an
5152 indirect or warning symbol. If an indirect symbol is defined,
5153 output the calculated value and don't output the target symbol.
5157 * aoutx.h (translate_from_native_sym_flags): Give warning symbols
5158 an (unused) nonzero section value, needed for check below.
5162 * aoutx.h (translate_from_native_sym_flags,
5163 aout_link_add_symbols): Treat N_SET[ABDT] | N_EXT like
5168 * elfcode.h (elf_object_p): If there is a SHT_DYNAMIC section, set
5169 the DYNAMIC flag for the BFD.
5170 (NAME(bfd_elf,write_object_contents)): Don't try to write out a
5171 BFD with the DYNAMIC flag set, since we don't generate the program
5172 header table correctly.
5176 * elfcode.h (elf_slurp_symbol_table): Free x_symp at the end
5177 of the function to avoid storage leak.
5181 * ecoff.c (ecoff_link_write_external): An ifd can be -1.
5185 * som.c (som_set_reloc_info): Provide a default symbol for
5186 relocations which don't actually have an associated symbol.
5188 * som.c (hppa_som_reloc): Add new "error message" argument.
5192 Enable gdb to write to core files on more core file readers.
5193 * libbfd.c (bfd_generic_set_section_contents): Remove range check
5194 for section size, it is already done in bfd_set_section_contents
5195 with bfd_get_section_size_now.
5196 * aix386-core.c, hppabsd-core.c, hpux-core.c, irix-core.c,
5197 osf-core.c, ptrace-core.c, trad-core.c (*_set_section_contents):
5198 Use bfd_generic_set_section_contents instead of bfd_false.
5202 * linker.c: Added initial documentation.
5204 * linker.c (default_indirect_link_order): Don't expect space for
5205 output relocations if there aren't any input relocations.
5209 * aoutx.h (NAME(aout,final_link)): Set a_entry before computing
5212 * elfcode.h (swap_out_syms): A common symbol is STT_OBJECT, not
5217 * config.bfd: Use ELF, not COFF for m88*-*-dgux*.
5218 Combine m88k-*-* and m88110-*-* cases into m88*-*-*.
5222 * ecofflink.c: Extensive changes to compress and merge debugging
5223 information, and to write some of out directly rather than saving
5224 it in memory. Several new functions and structures, and new
5225 arguments to existing functions.
5226 * ecoff.c (ecoff_compute_reloc_file_positions): Compute
5227 sym_filepos as well.
5228 (ecoff_get_extr): Use ifdmap instead of ifdbase.
5229 (ecoff_write_object_contents): Don't compute sym_filepos here.
5230 Only output symbols if outsymbols is not NULL.
5231 (ecoff_bfd_final_link): Adjust for changes in ecoff_debug_info and
5232 bfd_ecoff_debug functions. Write out debugging information here.
5233 (ecoff_final_link_debug_accumulate): Adjust for changes in
5234 bfd_ecoff_debug functions.
5235 (ecoff_link_write_external): Use ifdmap rather than ifdbase.
5236 * elf32-mips.c (mips_elf_read_ecoff_info): Read external symbols
5237 first, to put them in the first memory buffer. Clear fdr field.
5238 (mips_elf_get_extr): Use pointer to unswapped external symbol.
5239 (mips_elf_final_link): Adjust for changes in bfd_ecoff functions.
5240 Preserve .text, .data and .bss even if they are empty. Save
5241 pointer to unswapped external symbol rather than copying it.
5242 Don't free up the external symbols.
5243 * libelf.h (elf_symbol_type): Change mips_extr to PTR.
5244 * bfd-in.h (bfd_ecoff_debug_init, bfd_ecoff_debug_free): Declare.
5245 (bfd_ecoff_debug_accumulate): Update declaration.
5246 (bfd_ecoff_debug_accumulate_other): Rename declaration from
5247 bfd_ecoff_debug_link_other and update.
5248 (bfd_ecoff_write_accumulated_debug): Declare.
5249 * bfd-in2.h: Rebuilt.
5250 * Makefile.in: Rebuilt dependencies.
5254 * Makefile.in (install): Remove "@" which follows a backslash. In
5255 this position it just causes errors, not suppresses echoes.
5259 * som.c (hppa_som_gen_reloc_type): Fix handling of LT and RT
5264 * config/i386-netbsd.mt (SELECT_VECS): Include i386bsd_vec.
5268 * aoutx.h (adjust_z_magic): Don't merge the start of bss with the
5269 end of data if they are not contiguous.
5271 * aoutf1.h (sunos4_aout_backend): Comment the fields' meanings.
5275 * ecoff.c (ecoff_mkobject_hook): Don't set SEC_SHARED_LIBRARY flag
5276 for .reginfo section here.
5277 (ecoff_new_section_hook): Set it here instead.
5281 * bfd-in.h: (bfd_boolean): Add workaround for systems that also
5282 define true and false as enums.
5283 (ALMOST_STDC): Add as alternative to __STDC__.
5284 * bfd-in2.h: Rebuilt.
5285 * syms.c (bfd_print_symbol_vandf): Convert a PTR to FILE*.
5289 * aoutx.h (translate_to_native_sym_flags): Catch the case where
5290 there is no output section.
5294 * nlmcode.h (nlm_object_p): If we can't read the fixed header,
5295 count it as a wrong format error, not a system call error, since
5296 the object file might simply be too small.
5298 * targets.c (target_vector): Added nlm32_alpha_vec inside #ifdef
5300 * Makefile.in (BFD32_BACKENDS): Remove nlm32-alpha.o.
5301 (BFD64_BACKENDS): Add nlm32-alpha.o. It depends on 64 bit
5302 support, even though it is for an Alpha in 32 bit mode.
5303 * configure.in (nlm32_alpha_vec): Set target64 to true.
5305 * nlm32-gen.c, nlm64-gen.c: Removed. All nlm targets are
5306 different, so there is no point to providing a generic one.
5307 * libnlm.h: Don't bother to check for nlm_backend(bfd) being NULL
5308 in the backend accessor macros; that should no longer be possible.
5309 * targets.c (target_vector): Removed nlm32_big_generic_vec,
5310 nlm64_big_generic_vec, nlm64_little_generic_vec.
5311 * configure.in (nlm32_big_generic_vec, nlm32_little_generic_vec,
5312 nlm64_big_generic_vec, nlm64_little_generic_vec): Removed.
5313 * Makefile.in: Rebuilt dependencies, and
5314 (BFD32_BACKENDS): Removed nlm32-gen.o.
5315 (BFD64_BACKENDS): Removed nlm64-gen.o.
5316 (CFILES): Removed nlm32-gen.c and nlm64-gen.c.
5318 * hp300hpux.c (ARCH_SIZE): Define before including aoutx.h.
5320 * linker.c (_bfd_generic_link_add_one_symbol): Add constructor and
5321 bitsize arguments. Changed all callers (aoutx.h).
5322 * libbfd-in.h (_bfd_generic_link_add_one_symbol): Add constructor
5323 and bitsize arguments to declaration.
5324 * libbfd.h: Rebuilt.
5326 * ecoff.c: First cut at new style of linker backend for
5327 ECOFF--added a bunch of functions. Also:
5328 (ecoff_sec_to_styp_flags): Set flags for .pdata and .xdata.
5329 (ecoff_slurp_symbolic_header): New function.
5330 (ecoff_slurp_symbolic_info): Call ecoff_slurp_symbolic_header.
5331 (ecoff_compute_reloc_file_positions): New function.
5332 (ecoff_set_section_contents): Get out quickly if count is zero.
5333 Check errors better.
5334 (ecoff_write_object_contents): Put .xdata section in data segment.
5335 Call ecoff_compute_reloc_file_positions. Don't output relocs or
5336 external symbols if outsymbols is NULL.
5337 (ecoff_bfd_final_link): Completely rewritten.
5338 * libecoff.h: Include bfdlink.h.
5339 (struct ecoff_backend_data): Add relocate_section field.
5340 (ecoff_data_type): Add sym_hashes and symndx_to_section fields.
5341 (struct ecoff_link_hash_entry): Define.
5342 (struct ecoff_link_hash_table): Define.
5343 (ecoff_bfd_link_add_symbols): Declare as function, not macro.
5344 (ecoff_bfd_link_hash_table_create): Likewise.
5345 * ecofflink.c (bfd_ecoff_debug_one_external): New function.
5346 (bfd_ecoff_debug_externals): Call bfd_ecoff_debug_one_external.
5347 * bfd-in.h (bfd_ecoff_debug_one_external): Declare.
5348 * bfd-in2.h: Rebuilt.
5349 * coff-alpha.c (alpha_howto_table): Mark BRADDR as
5350 partial_inplace, and set the src_mask to 0x1fffff.
5351 (alpha_ecoff_get_relocated_section_contents): Remove unused
5353 (alpha_convert_external_reloc): New static function.
5354 (alpha_relocate_section): New static function.
5355 (alpha_ecoff_backend_data): Initialize relocate_section field.
5356 * coff-mips.c (mips_relocate_refhi): New static function.
5357 (mips_relocate_section): New static function.
5358 (mips_ecoff_backend_data): Initialize relocate_section field.
5360 * reloc.c (_bfd_relocate_contents): Corrected signed overflow
5361 checking when there is an addend.
5363 * aoutx.h (NAME(aout,final_link)): Don't abort when trying to link
5364 a non a.out file, just pass it to _bfd_default_link_order.
5365 (aout_link_input_section_std): When doing a final PC relative link
5366 against a section symbol, subtract the VMA of the input section.
5367 (aout_link_input_section_ext): Likewise.
5369 * linker.c (default_indirect_link_order): Renamed from
5370 _bfd_generic_indirect_link_order and made static.
5371 (_bfd_generic_final_link): Don't switch on link_order type, just
5372 call _bfd_default_link_order.
5373 (_bfd_default_link_order): Handle bfd_indirect_link_order type.
5374 * genlink.h: Removed declaration of
5375 _bfd_generic_indirect_link_order.
5376 * elf32-mips.c (mips_elf_final_link): Don't switch on link_order
5377 type, just call _bfd_default_link_order.
5381 * linker.c (generic_link_check_archive_element): Base the name of
5382 the created common section on the name of the section the symbol
5384 (_bfd_generic_link_add_one_symbol): (case BIG): A common symbol
5385 must have a section, so don't bother to create one.
5389 * aout-target.h (MY(vec)): Add DYNAMIC to mask of object flags.
5390 * aoutf1.h (NAME(aout,sunos4_write_object_contents)):
5391 If the DYNAMIC flag is set, set it in the exec header.
5392 * aoutx.h (NAME(aout,some_aout_object_p)): If the object is
5393 dynamically linked, set the DYNAMIC flag in the BFD.
5394 * libaout.h (N_SET_DYNAMIC): New macro.
5395 (N_DYNAMIC): Add missing 0 in mask.
5399 * ecoff.c (ecoff_get_extr): Don't output section symbols as
5402 * bfd-in.h, hash.c: Change bfd_hash_allocate argument from size_t
5403 to unsigned int, because size_t may not be defined in bfd.h.
5404 * bfd-in2.h: Rebuilt.
5406 * bfd-in.h (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
5408 * bfd-in2.h: Rebuilt.
5409 * libbfd.c (bfd_get{b,l}[_signed_]{16,32,64}): Declare argument to
5411 * targets.c (bfd_target): Change swap function pointers
5413 * archive.c (do_slurp_coff_armap): Change swap accordingly.
5414 * aix386-core.c: Change NO_GET and NO_GETS accordingly.
5415 * hppabsd-core.c, hpux-core.c, irix-core.c, osf-core.c,
5416 ptrace-core.c, trad-core.c: Change NO_GET and NO_SIGNED_GET
5419 * libbfd-in.h (struct artdata): Added tdata field.
5420 (_bfd_add_bfd_to_archive_cache): Declare.
5421 (_bfd_get_elt_at_filepos): Declare.
5422 (_bfd_snarf_ar_hdr): Renamed from snarf_ar_hdr.
5423 * libbfd.h: Rebuilt.
5424 * archive.c: Cleaned up some more.
5425 (_bfd_generic_mkarchive, bfd_generic_archive_p): Initialize
5426 pointer elements of artdata.
5427 (_bfd_add_bfd_to_archive_cache): Renamed from add_bfd_to_cache.
5428 (_bfd_snarf_ar_hdr): Renamed from snarf_ar_hdr.
5429 (_bfd_get_elt_at_filepos): Renamed from get_elt_at_filepos.
5430 (get_extended_arelt_filename, bfd_construct_extended_name_table,
5431 bfd_ar_hdr_from_filesystem, compute_and_write_armap): Made static.
5432 * ecoff.c: Some comment changes.
5433 (ecoff_slurp_armap): Handle rename of snarf_ar_hdr. Set
5434 ardata->tdata to raw_armap.
5435 (ecoff_archive_p): Initialize pointer elements of artdata.
5436 * coff-rs6000.c (rs6000coff_get_elt_at_filepos): Handle rename of
5439 * hash.c: Added some documentation.
5443 * aout-target.h, netbsd386.c: Replace NO_SWAP_MAGIC with SWAP_MAGIC,
5444 and do the swapping here rather than calling ntohl from the N_*
5445 macros. This cleans up assumptions about the size of a host long,
5446 the existence to ntohl, etc.
5450 * config.bfd: Add support for VSTa micro-kernel. It currently uses
5455 * hosts/i386mach3.h (HOST_SEGMENT_SIZE): Fix value.
5456 * i386mach3.c (SEGMENT_SIZE): Fix value.
5460 Minor cleanups suggested by CodeCenter.
5461 * aoutx.h, coffgen.c, ecoff.c, ecofflink.c, elf.c, libbfd.c,
5462 linker.c, reloc.c, section.c, srec.c: Added /*ARGSUSED*/ as
5464 * aoutx.h (struct external_exec): Removed unnecessary declaration.
5465 (NAME(aout,some_aout_object_p)): Set some tdata pointers to NULL.
5466 (adjust_z_magic): Removed useless variable data_vma.
5467 (stringtab_init): Initialize hash_zero.
5468 (add_to_stringtab): Removed unused fourth argument.
5469 (NAME(aout,swap_std_reloc_out)): Removed useless variable
5471 (aout_link_input_section): Added some casts.
5472 * archive.c (get_extended_arelt_filename, do_slurp_coff_armap,
5473 bfd_ar_hdr_from_filesystem, bsd_write_armap, coff_write_armap):
5474 Minor code rewriting to make it more C like.
5475 (do_slurp_bsd_armap): Added some casts.
5476 * ecoff.c (ecoff_write_object_contents): Removed useless variable
5478 (ecoff_write_armap): Added some casts. Use "" rather than "\0".
5479 * ecofflink.c (bfd_ecoff_write_debug): Added a cast.
5480 * libaout.h (struct internal_exec): Removed unnecessary
5482 * linker.c (_bfd_generic_indirect_link_order): Added a cast.
5483 * opncls.c (new_bfd): Removed a cast.
5484 * reloc.c (bfd_generic_get_relocated_section_contents): Added
5486 * srec.c (internal_srec_write_object_contents): Removed useless
5487 variable bytes_written.
5491 * i386mach3.c (N_TXTADDR): Don't define after all.
5492 (TEXT_START_ADDR): Don't include exec header size in value.
5496 * i386mach3.c (N_TXTADDR): Define.
5500 Extensive changes to move the bulk of the linker into BFD so that
5501 more efficient backend code can be written for specific object
5502 files. Only existing efficient backend is a.out.
5503 * seclet.c, seclet.h: Removed.
5504 * hash.c, linker.c, genlink.h: New files.
5505 * bfd-in.h: Removed bfd_error_vector. Declared hash table
5506 structures and functions.
5507 (JUMP_TABLE): Removed bfd_seclet_link, added
5508 bfd_link_hash_table_create, bfd_link_add_symbols and
5510 * All backends: Changed accordingly.
5511 * bfd-in2.h: Rebuilt.
5512 * bfd.c (struct _bfd): Added link_next and archive_pass fields.
5513 Removed ld_symbols field.
5514 (bfd_nonrepresentable_section, bfd_undefined_symbol,
5515 bfd_reloc_value_truncated, bfd_reloc_is_dangerous,
5516 bfd_error_vector): Removed.
5517 (bfd_default_error_trap, bfd_error_trap,
5518 bfd_error_nonrepresentabltrap): Removed.
5519 (bfd_get_relocated_section_contents): Pass link_info. Pass
5520 link_order instead of seclet. Pass symbols.
5521 (bfd_relax_section): Pass link_info.
5522 (bfd_seclet_link): Removed.
5523 (bfd_link_hash_table_create, bfd_link_add_symbols,
5524 bfd_final_link): New macros.
5525 * libbfd-in.h: If __GNUC__ is defined and alloca is not, define
5526 alloca as __builtin_alloca. Declare internal linking functions.
5527 * libbfd.h: Rebuilt.
5528 * libbfd.c (bfd_seek): Comment out fseek assertion. It's worked
5530 * reloc.c (reloc_howto_type): Added error_message argument to
5531 special_function field. Changed all callers and all definitions.
5532 (bfd_get_reloc_size): Make argument a const pointer.
5533 (bfd_perform_relocation): Add error_message argument to hold
5534 string set if return value if bfd_reloc_dangerous. Changed all
5536 (_bfd_final_link_relocate, _bfd_relocate_contents): New functions.
5537 * section.c (asection): Renamed seclets_head and seclets_tail to
5538 link_order_head and link_order_tail.
5539 * targets.c (bfd_target): Replaced seclet argument with link_info
5540 and link_order and symbols arguments in
5541 bfd_get_relocated_section_contents. Added symbols argument to
5542 bfd_relax_section. Removed bfd_seclet_link. Added
5543 bfd_link_hash_table_create, bfd_link_add_symbols and
5545 * libaout.h (struct aoutdata): Added external_syms,
5546 external_sym_count, external_strings, sym_hashes fields.
5547 (obj_aout_external_syms, obj_aout_external_sym_count,
5548 obj_aout_external_strings, obj_aout_sym_hashes): New accessor
5550 (WRITE_HEADERS): Only output symbols if outsymbols is not NULL.
5551 * aoutx.h: Wrote new back end linker routines.
5552 (translate_to_native_sym_flags): Return boolean value. Don't use
5554 (NAME(aout,write_syms)): Return boolean value. Check return value
5555 of translate_to_native_sym_flags and bfd_write.
5556 * aout-target.h (final_link_callback): New function.
5557 (MY_bfd_final_link): New function.
5558 * aout-adobe.c (aout_adobe_write_object_contents): Check return
5559 value of aout_32_write_syms.
5560 * hp300hpux.c (MY(write_object_contents)): Likewise.
5561 * i386lynx.c (WRITE_HEADERS): Likewise.
5562 * libaout.h (WRITE_HEADERS): Likewise.
5563 * bout.c: Changed functions to use link_info->callbacks rather
5564 than bfd_error_vector, and link_orders rather than seclets.
5565 * coff-alpha.c: Likewise.
5566 * coff-h8300.c: Likewise.
5567 * coff-h8500.c: Likewise.
5568 * coff-sh.c: Likewise.
5569 * coff-z8k.c: Likewise.
5570 * elf32-hppa.c: Likewise.
5571 * reloc16.c: Likewise.
5572 * coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look
5573 up _gp in the hash table rather than in outsymbols.
5574 * coff-a29k.c (a29k_reloc): Pass errors back in new error_message
5575 argument rather than printing them.
5576 * coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and
5577 link_order arguments rather than seclet. Changed all uses and
5579 (bfd_coff_reloc16_estimate): Pass link_info arguments. Changed
5580 all uses and definitions.
5581 * libcoff.h: Rebuilt.
5582 * ecoff.c (ecoff_get_extr): If symbol is defined by linker, but
5583 not by ECOFF, make it scAbs.
5584 (ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and
5586 * elf32-mips.c (mips_elf_final_link): Renamed from
5587 mips_elf_seclet_link and rewritten.
5588 * elf32-hppa.c (elf32_hppa_stub_description): Added link_info
5590 (new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub,
5591 hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section):
5592 Added link_info arguments. Changed all callers.
5593 * elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is
5595 * oasys.c (oasys_write_sections): Return boolean value rather than
5596 using bfd_error_vector.
5597 (oasys_write_object_contents): Check return value of
5598 oasys_write_sections.
5599 * hosts/std-host.h: Don't declare qsort or strtol.
5600 * Makefile.in: Rebuild dependencies.
5601 (BFD_LIBS): Removed seclet.o. Added hash.o and linker.o.
5602 (CFILES): Removed seclet.c. Added hash.c and linker.c.
5603 (HFILES): Removed seclet.h. Added genlink.h.
5607 * section.c (bfd_get_section_contents): Return zero filled buffer
5608 if section has no contents.
5612 * elf.c (bfd_elf_generic_reloc): If this is not an inplace reloc,
5613 then skip bfd_perform_relocation even if the addend is non-zero.
5617 * coffcode.h (coff_write_relocs) [SWAP_OUT_RELOC_OFFSET]: Copy
5618 addend to r_offset field.
5620 * Makefile.in (CFILES): Added coff-sparc.c. Rebuild dependencies.
5622 * coff-sparc.c (SWAP_IN_RELOC_OFFSET, SWAP_OUT_RELOC_OFFSET,
5623 CALC_ADDEND): Define.
5625 * aix386-core.c (aix386_core_file_p): Use cd_regs[0] for computing
5626 the offsetof because AIX /bin/cc does not like to take the address
5627 of an array. (From Minh Tran-Le.)
5633 * elf32-hppa.c (hppa_elf_build_arg_reloc_stub): Make sure to copy
5634 the return pointer into %r2 if no jump-in-call-delay-slot
5635 optimization was done.
5637 * hosts/hp300bsd.h: Correctly identify 4.3BSD vs 4.4BSD.
5641 * hosts/std-host.h: (time): Don't declare; conflicts on Mach3.
5643 * hosts/i386mach3.h (HOST_PAGE_SIZE): Set to 1 to avoid padding.
5644 (HOST_SEGMENT_SIZE): Set to 0 for same reason.
5646 * i386mach3.c (PAGE_SIZE, SEGMENT_SIZE): Same changes as above.
5647 (TEXT_START_ADDR): Correct.
5648 (MY_backend_data): Define.
5650 * aoutx.h (adjust_o_magic, adjust_z_magic, adjust_n_magic):
5651 New functions; code moved from aout_<size>_adjust_sizes_and_vmas.
5655 * som.c (som_begin_writing): Fix thinkos in auxiliary header
5657 (bfd_som_attach_aux_hdr): Likewise.
5661 * elf32-hppa.c (hppa_elf_gen_reloc_type): Handle 'T' field
5662 selectors for PIC code.
5664 * som.c (hppa_som_gen_reloc_type): Handle 'T' field selectors.
5665 (som_write_fixups): Handle R_DLT_REL, R_FSEL, R_RSEL, R_LSEL
5666 relocations needed by PIC.
5668 Tue Dec 7 15:47:51 1993 Stu Grossman (grossman at cygnus.com)
5670 * nlmcode.h: Fixes to avoid compiler warnings...
5674 * libnlm.h (nlm_backend_data): Removed macro definition.
5675 (nlm_alpha_backend_data): Adjusted accordingly.
5679 * som.c (som_begin_writing): Flesh out code for handling simple
5681 (bfd_som_attach_aux_hdr): New function.
5683 * som.h (struct somdata): Add fields for attaching version and
5684 copyright headers. Add accessor macros.
5686 * som.c (R_DLT_REL, R_AUX_UNWIND, R_SEC_STMT): Add protected
5687 definitions for old versions of HPUX which fail to define them.
5688 (som_hppa_howto_talbe): Add R_DLT_REL, R_AUX_UNWIND, and R_SEC_STMT
5689 now that they're safe. Delete bogus R_STATEMENT relocations.
5691 * som.c (som_hppa_howto_table): Add missing R_END_TRY. Delete
5692 extra R_DATA_OVERRIDE.
5693 (hppa_som_gen_reloc_type): Generate a relocation for the rounding
5694 mode selector if needed.
5695 (som_write_fixups): Handle requests for a change in the default
5696 rounding mode. Rounding modes do not consume input bytes, but
5697 are just markers much like R_ENTRY and R_EXIT.
5703 * elf32-hppa.c: (hppa_elf_reloc): Do not do code reordering when
5704 the branch instruction as originally been nullified.
5705 hppa_elf_reloc): Avoid useless call to bfd_put_32 () in the
5706 case of no code reordering due to an LDO instruction in the
5707 delay slot of the branch. Make sure to relocate the correct
5708 instruction. Do not perform instruction reordering for millicode
5710 (hppa_elf_build_arg_reloc_stub): Change the relocation type
5711 to R_HPPA_STUB_CALL_17 when special processing might be needed.
5712 (hppa_elf_build_long_branch_stub): Prevent code reordering on
5713 a call from a linker stub to another linker stub and for millicode
5714 calls. Do not trash the return register for calls from one linker
5715 stub to a second linker stub.
5717 * elf32-hppa.c: (elf_hppa_howto_table): PLABEL and DLT
5718 relocations are not pc-relative.
5720 * hppa_stubs.h: (BLE_N_XXX_0_31): New instruction used in
5722 (COPY_2_31): Likewise.
5726 * config/solaris2.mh (HDEFINES): Remove -Dconst=
5727 * hosts/solaris.h: If not __GNUC__, define const as empty.
5731 * ecoff.c: Added various casts for 32/64 bit cross targeting.
5732 (ecoff_mkobject_hook): Set SEC_SHARED_LIBRARY for the .reginfo
5733 section so that the linker ignores it.
5734 * ecofflink.c: Added various casts for 32/64 bit cross targeting.
5735 (ecoff_add_bytes): Changed need argument to size_t.
5736 (bfd_ecoff_debug_link_other): Check return value of
5739 * libbfd-in.h (new_bfd): Use void rather than an empty parameter
5741 * libbfd.h: Rebuilt.
5743 * libnlm.h (struct nlm_obj_tdata): New field backend_data.
5744 (nlm_backend_data, nlm_alpha_backend_data): New accessor macros.
5745 (struct nlm_backend_data): New field no_uninitialized_data.
5746 (nlm_no_uninitialized_data): New accessor macro.
5747 * nlmcode.h (nlm_compute_section_file_positions): Handle
5748 no_uninitialized_data.
5749 (nlm_external_reloc_compare): Sort relocs by address for a
5750 particular symbol, to make the sort more stable.
5751 (nlm_write_object_contents): Cast the arguments to qsort. Get the
5752 value of a debugging symbol the same way we get the value of a
5754 * nlm32-alpha.c: Various changes. Write out GP and .lita relocs.
5755 Set no_uninitialized_data to true.
5756 * nlm32-i386.c (nlm32_i386_backend), nlm32-sparc.c
5757 (nlm32_sparc_backend): Set no_uninitialized_data field false.
5758 * nlmswap.h (nlm_swap_fixed_header_out): Zero out destination
5759 before filling it in.
5763 * som.c (som_section_type, som_decode_symcalss): New functions.
5764 (som_get_symbol_info): Use them.
5765 (som_slurp_symbol_table): Set the section of common and undefined
5770 * elfcode.h (write_relocs): Initialize local var LAST_SYM_IDX, to
5773 * mipsbsd.c: Changes from Ralph Campbell:
5774 (mips_howto_table_ext): MIPS_RELOC_LO16 should use
5775 complain_overflow_dont.
5776 (aout_mips_*_vec): Make name use "a.out" instead of "aout", to
5779 * bfd.c (bfd_errmsgs): Reword invalid-target message.
5781 * config.bfd: For sparc*-*-coff, use sparc-coff.
5782 * configure.in: Handle sparccoff_vec.
5783 * targets.c (sparccoff_vec): Declare.
5785 * reloc.c (bfd_get_reloc_size): New function.
5786 (struct reloc_howto_type): Update documentation of size field.
5790 * nlm32-alpha.c: New file; preliminary Alpha NetWare support.
5791 * config.bfd (alpha-*-netware*): New target; use alpha-nlm.
5792 * config/alpha-nlm.mt: New file.
5793 * configure.in (nlm32_alpha_vec): New vector; use nlm32-alpha.o,
5795 * Makefile.in (BFD32_BACKENDS): Added nlm32-alpha.o.
5796 (CFILES): Added nlm32-alpha.c.
5797 Rebuilt dependencies.
5798 * targets.c (nlm32_alpha_vec): Declare.
5800 * libnlm.h (struct nlm_backend_data): New fields
5801 optional_prefix_size, nlm_backend_object_p, nlm_write_prefix,
5802 nlm_set_public_section, nlm_get_public_offset. Removed unused
5803 nlm_write_reloc field. Changed nlm_write_import to remove
5804 unnecessary symbol argument. Renamed nlm_write_externals to
5805 nlm_write_external, and changed cound argument from bfd_vma to
5807 (nlm_optional_prefix_size, nlm_backend_object_p_func,
5808 nlm_write_prefix_func, nlm_set_public_section_func,
5809 nlm_get_public_offset_func): New accessor macros.
5810 (nlm_write_reloc_func): Removed.
5811 (nlm_write_external_func): Adjusted for field renaming.
5812 * nlm32-i386.c (nlm_i386_write_import): Renamed from
5813 nlm_i386_write_reloc. Removed old nlm_i386_write_import which
5814 just called old nlm_i386_write_reloc.
5815 (nlm_i386_write_external): Renamed from nlm_i386_write_externals.
5816 Declared. Changed second argument from bfd_vma to bfd_size_type.
5817 (nlm32_i386_backend): Adjusted for changes to fields and names.
5818 * nlm32-sparc.c (nlm_sparc_mangle_relocs): Removed unused,
5820 (nlm_sparc_write_import): Removed second argument.
5821 (nlm_sparc_write_external): Renamed from
5822 nlm_sparc_write_externals. Changed second argument from bfd_vma
5824 (nlm32_sparc_backend): Adjusted for changes to fields and names.
5825 * nlmcode.h: Removed some unused code.
5826 (nlm_object_p): Don't destroy tdata pointer. Call
5827 backend_object_p function if it exists.
5828 (nlm_slurp_symbol_table): Removed unused variable rcount. Call
5829 set_public_section_func if it exists instead of checking
5831 (nlm_compute_section_file_positions): Account for
5832 optional_prefix_size.
5833 (nlm_write_object_contents): Account for optional_prefix_size.
5834 Removed useless variable write_reloc_func. Changed declaration
5835 and call of write_import_func. Call write_prefix_func if it
5836 exists. Removed unused variables len and temp. Call
5837 get_public_offset_func if it exists rather than setting NLM_HIBIT.
5838 * nlmswap.h: Declare functions.
5840 * bfd-in.h (uint64_typeLOW, uint64_typeHIGH): Fully parenthesize
5842 (fprintf_vma, sprintf_vma): Use %lx, not %x.
5843 * bfd-in2.h: Rebuilt.
5844 * hosts/alphaosf.h (uint64_typeLOW, uint64_typeHIGH): Cast results
5847 * config.bfd: Don't set target64 here, as the setting is ignored.
5848 * configure.in (ecoffalpha_little_vec): Set target64.
5850 * config/alphaosf.mt (TDEFINES): Removed; setting host parameters
5851 in TDEFINES is wrong.
5853 * coff-alpha.c (alpha_ecoff_get_relocated_section_contents):
5854 Remove unused variable output_section.
5858 * irix-core.c: New file for Irix 4 and Irix 5 core support.
5859 Functions taken out of coff-mips.c. Handle vmap type VMAPFILE.
5860 * coff-mips.c: Irix 4 core file support moved to irix-core.c.
5861 * targets.c: If IRIX_CORE defined, include irix_core_vec in
5863 * config/irix4.mh (HDEFINES): Add -DIRIX_CORE.
5864 (HDEPFILES): Define to be irix-core.o.
5865 * config/irix5.mh (HDEFINES): Define to be -DIRIX_CORE.
5866 (HDEPFILES): Define to be irix-core.o.
5867 * Makefile.in (OPTIONAL_BACKENDS): Added irix-core.o. Removed
5868 sco-core.o, which no longer exists.
5869 (CFILES): Added all *-core.c files.
5870 Rebuilt dependencies.
5874 * elfcode.h (map_program_segments): Restore check of file_size !=
5875 mem_size, but only if SHT_PROGBITS.
5877 * ecofflink.c: New file to hold ECOFF debug information linking
5879 * ecoff.c (ecoff_clear_output_flags, ecoff_rel, ecoff_dump_seclet,
5880 ecoff_add_string, ecoff_get_debug): Removed. Functionality now in
5882 (ecoff_get_extr, ecoff_set_index): New functions.
5883 (ecoff_slurp_symbolic_info): Don't save raw_size.
5884 (ecoff_bfd_seclet_link): Rewrote to use ecofflink.c functions.
5885 (ecoff_compute_section_file_positions): Don't set EXEC_P just
5886 because there is a start address.
5887 (ecoff_write_object_contents): Handle external symbols here. Use
5888 ecofflink.c functions to write out debugging information.
5889 * elf32-mips.c (mips_elf_read_ecoff_info, mips_elf_get_extr,
5890 mips_elf_set_index): New functions.
5891 (mips_elf_seclet_link): Discard empty sections, the .options
5892 section and .gptab sections. Handle linking .mdebug section.
5893 * libecoff.h (ecoff_data_type): Removed raw_size and ifdbase.
5894 * libelf.h (elf_symbol_type): Added mips_extr to tc_data union.
5895 * bfd-in.h: Added prototypes for routines in ecofflink.c (some are
5896 called by gas, so they are public).
5897 * bfd-in2.h: Rebuilt.
5898 * Makefile.in (BFD_LIBS): Added ecofflink.o.
5899 (CFILES): Added ecofflink.c.
5900 (ecofflink.o): New target. Rebuilt dependencies.
5904 * som.c (hppa_object_p): Also recognize SHARED_MAGIC_CNX as
5905 a valid magic number if it's been defined.
5909 * ecoff.c (ecoff_mkobject): Don't create .scommon section; linker
5910 no longer requires it.
5911 (ecoff_bfd_seclet_link, ecoff_sizeof_headers,
5912 ecoff_write_object_contents): Don't treat .scommon section
5918 * bfd/config/delta88.mh (HDEFINES): Define this to be -DPTRACE_CORE.
5919 * bfd/config/delta88.mh (HDEPFILES): Defined to be ptrace-core.o.
5920 * bfd/ptrace-core.c: New file for dealing with core files with
5921 start with the ptrace_user structure found on BCS compliant systems.
5922 * bfd/targets.c (ptrace_core_vec): New vector.
5926 * Minimal support for reading SOM fixup streams. Allows
5927 objdump -r to do something reasonable.
5928 * som.c (som_get_reloc_upper_bound): Implement.
5929 (som_canonicalize_reloc): Implement.
5930 (som_set_reloc_info, som_slurp_reloc_table): New functions.
5934 * hosts/lynx.h (FPRINTF_ALREADY_DECLARED): Define.
5935 * hosts/sparclynx.h: Include lynx.h instead of duplicating it.
5939 * coff-a29k.c (a29k_reloc): For R_IREL, don't left shift
5940 signed_value before sign extending it. Don't subtract out
5941 reloc_entry->address. This makes it compatible with what gas is
5944 * elfcode.h (elf_fake_sections): Accept .sbss as the name for a
5945 SHT_NOBITS sections.
5946 (map_program_segments): Don't leave the loop after the first
5948 (assign_file_positions_except_relocs): Only force sh_offset and
5949 sh_addr to match modulo maxpagesize for a section which is not
5950 SHT_NOBITS. Changed the method used to force page alignment after
5951 a SHT_NOBITS section to only do it for the last such consecutive
5952 section, and to really force page alignment.
5956 * coffcode.h (coff_slurp_symbol_table): Print more verbose message
5957 in the case of an unknown (or unhandled) storage class.
5959 * config/i386-lynx.mt (TDEFINES): FPRINTF_ALREADY_DECLARED should
5960 not be defined here, since it is a host attribute, not a target
5962 * config/m68k-lynx.mt, config/sparc-lynx.mt: Ditto.
5964 * coffcode.h (coff_bfd_reloc_type_lookup): Don't define if already
5967 * coff-sparc.c: Define some relocations, based on ELF relocations.
5968 (enum reloc_type, bfd_coff_generic_reloc, coff_sparc_howto_table,
5969 struct coff_reloc_map, sparc_reloc_map,
5970 coff_sparc_reloc_type_lookup): Borrowed from elf32-sparc.c and
5972 (coff_bfd_reloc_type_lookup): Define to be coff_sparc_reloc_....
5973 (rtype2howto): Index into coff_sparc_howto_table using
5978 * config.bfd (mips*-*-irix5*): New target; use mipsbelf.
5979 * configure.host (mips-sgi-irix5*) New host; use irix5 (no
5980 hosts/irix5.h created; just use std-host.h).
5981 * config/irix5.mh: New file; like irix4.mh, but don't use -G or
5983 * Makefile.in: Rebuilt dependencies.
5985 * ecoffswap.h: Changed type of internal pointers for swap out
5986 functions to const *.
5988 * elf32-mips.c (mips_elf_got16_reloc): New function. Handle GOT16
5989 correctly for assembler, but linker support not implemented.
5990 (elf_mips_howto_table): Use mips_elf_got16_reloc for GOT16.
5991 (mips_elf_sym_is_global): New function; at least on Irix 5, all
5992 non section symbols are considered global.
5993 (elf_backend_sym_is_global): Define.
5994 (mips_elf_final_write_processing): New function. Set the MIPS
5995 architecture level correctly.
5996 (elf_backend_final_write_processing): Define.
5997 (mips_elf_section_from_shdr): Handle SHT_MIPS_OPTIONS.
5998 (mips_elf_fake_sections): Set entsize of .mdebug or .reginfo
5999 section to 1. Handle .options section.
6000 (mips_elf_acom_section, mips_elf_acom_symbol,
6001 mips_elf_acom_symbol_ptr): New static variables, used to build a
6002 generic .acommon section to hold SHN_MIPS_ACOMMON symbols.
6003 (mips_elf_symbol_processing): Handle SHN_MIPS_ACOMMON symbols by
6004 putting them all in a global .acommon section.
6006 * elfcode.h (bfd_section_from_shdr): Don't dump core if target
6007 section has no ELF section data.
6008 (elf_make_sections): Set addralign of reloc section to 4.
6009 (elf_fake_sections): Likewise.
6010 (map_program_segments): Don't consider section 0.
6011 (assign_file_positions_except_relocs): Don't consider section 0.
6012 In the main loop, skip the symtab and strtab sections, since their
6013 positions are set elsewhere.
6014 (swap_out_syms): Set addralign of symtab section to 4. Set
6015 addralign of strtab sections to 1.
6016 (assign_file_positions_for_relocs): Don't consider section 0.
6017 (write_object_contents): Don't write out section 0.
6019 * libelf.h (struct elf_backend_data): Added fields
6020 elf_backend_sym_is_global and elf_backend_final_write_processing.
6021 * elf32-target.h (elf32_bed): Added corresponding initializers.
6022 * elf64-target.h (elf64_bed): Likewise.
6023 * elfcode.h (sym_is_global): Take abfd argument. Call
6024 elf_backend_sym_is_global if it is not NULL.
6025 (elf_map_symbols): Pass abfd to sym_is_global.
6026 (write_object_contents): Call elf_backend_final_write_processing
6031 * libecoff.h: Include coff/ecoff.h.
6032 (struct ecoff_backend_data): Move external debugging information
6033 fields into a single field pointing to an ecoff_debug_swap
6035 (ecoff_data_type): Move debugging information fields into a single
6036 field pointing to an ecoff_debug_info structure.
6037 * coff-alpha.c, coff-mips.c, ecoff.c: Corresponding changes.
6041 * nlmswap.h: New file to swap fixed header. Included by NLM
6043 * libnlm.h (struct reloc_and_sec): Define.
6044 (struct nlm_backend_data): Add fields fixed_header_size,
6045 nlm_read_import, nlm_write_import, nlm_swap_fhdr_in,
6047 (nlm_fixed_header_size, nlm_read_import_func,
6048 nlm_write_import_func, nlm_swap_fixed_header_in_func,
6049 nlm_swap_fixed_header_out_func, nlm_write_external_func): New
6051 * nlmcode.h: Use new functions.
6052 * nlm32-i386.c: Provide new functions.
6053 * nlm32-sparc.c: New file; SPARC NLM backend.
6057 * i386lynx.c (swap_std_reloc_in, swap_ext_reloc_in): Ignore
6058 garbage bits appearing in the upper end of symbolnums.
6060 * config/sparc-lynx.mt (TDEFINES): Add -DFPRINTF_ALREADY_DECLARED.
6062 Tue Nov 16 17:03:41 1993 Stu Grossman (grossman at cygnus.com)
6064 * lynx-core.c (lynx_core_file_p): Change bfd_zalloc to bfd_alloc.
6065 * m68klynx.c: Define core file macros.
6066 * hosts/i386lynx.h, hosts/m68klynx.h, hosts/lynx.h: Move all
6067 non-architecture specific stuff into lynx.h.
6071 * i386linux.c: Define new macro ZMAGIC_DISK_BLOCK_SIZE to 1024, and
6072 change PAGE_SIZE to 4096.
6076 * Makefile.in (diststuff): New target.
6082 * som.c (som_object_setup): Do not create dummy ".text", ".data",
6083 and ".bss" sections.
6084 (setup_sections): Do not set SEC_HAS_CONTENTS if a section's size
6085 is zero. Recognize BSS type sections and turn off SEC_LOAD and
6086 SEC_DATA (so binutils/size works). Set the correct value for
6087 a section's _raw_size.
6088 (som_slurp_symbol_table): Program entry points, and millicode are
6089 also functions. Mark them as such. Also mark L$* symbols as
6092 * bfd-in2.h: Rebuilt.
6096 * som.c (som_bfd_reloc_type_lookup): Add missing prototype. Returns
6097 a pointer to constant data. Delete bogus #define which made the
6100 * som.c (som_prep_for_fixups): New function.
6101 (som_write_fixups): New function.
6102 (som_write_space_strings): New function.
6103 (som_write_symbol_strings): New function.
6104 (som_begin_writing): New function.
6108 * som.c (som_write_object_contents): Do not abort. Flesh out.
6109 (som_set_section_contents): Do not abort. Flesh out.
6111 * som.c (som_write_headers): New function.
6112 (som_prep_headers): New function.
6113 (som_build_and_write_symbol_table): New function.
6115 * som.c (som_sizeof_headers): Add missing prototype.
6116 (som_set_arch_mach): Do not abort.
6118 * som.c (som_count_spaces): New function.
6119 (som_count_subspaces): New function.
6120 (compare_syms): New function.
6121 (som_compute_checksum): New function.
6123 * som.c (hppa_som_gen_reloc_type): New function.
6124 (som_bfd_reloc_type_lookup): New function.
6126 * som.c (try_prev_fixup): New function.
6127 (som_reloc_skip): New function.
6128 (som_reloc_addend): New function.
6129 (som_reloc_call): New function.
6131 * som.c (som_initialize_reloc_queue): New function.
6132 (som_reloc_queue_insert): Likewise.
6133 (som_reloc_queue_fix): Likewise.
6134 (som_reloc_queue_find): Likewise.
6136 * som.c (som_hppa_howto_table): SOM howto relocation table.
6137 (hppa_som_reloc): New function.
6139 * som.c (struct reloc_queue): New structure to keep track of
6140 the last four multibyte relocations emitted.
6141 (enum pa_symbol_type): Type to fully describe the symbol types
6142 associated with .import/.export assembler directives.
6144 * som.c: Include libhppa.h
6146 * som.c (bfd_som_set_section_attributes): New function.
6147 (bfd_som_set_subsection_attributes): Likewise.
6148 (bfd_som_set_symboL_type): Likewise.
6149 (bfd_som_attach_unwind_info): Likewise.
6150 * som.h: Declare new exported functions.
6152 * som.h (struct som_symbol): Add new fields to hold additional
6153 information needed to build/write symbol tables and fixup streams.
6154 (struct som_section_data_struct): Add new fields to hold additional
6155 information needed to build/write space and subspace headers.
6156 (som_symbol_data): New accessor macro for SOM symbol information.
6157 (R_HPPA_*): Basic relocation types to be used by the assembler.
6161 * trad-core.c (trad_unix_core_file_p): If new hook
6162 TRAD_CORE_ALLOW_ANY_EXTRA_SIZE defined, then skip the check for the
6163 corefile being too big.
6164 * hosts/i386sco.h: Define it.
6168 * bfd.c (struct _bfd): Add hppabsd_core_data.
6169 * targets.c (target_vector): Add hppabsd_core_vec.
6170 * hpux-core.c (hpux_core_core_file_p): Fail if an unknown core
6171 section is encountered during core section scanning.
6172 * hppabsd-core.c: New file.
6173 * config/hppabsd.mh: Enable HPPA BSD core files.
6175 * elf32-hppa.c (hppa_elf_reloc): Remove DEFUN crud. Remove code
6176 which is either commented out or ifdef'd out. Add, update and
6177 clean comments. Fix various indention and spacing problems. Handle
6178 problems related to using "ble" to jump to a stub rather than "bl"
6179 (%r31 is trashed by "ble", but not by "bl").
6180 (NEW_INSTRUCTION): Put inside curly braces.
6181 (CURRENT_STUB_OFFSET): Fix indention problems.
6182 (hppa_elf_build_arg_reloc_stub): Fix indention and spacing problems.
6183 Add, update and clean comments. Handle "ble" %r31 lossage problems.
6184 (hppa_elf_build_long_branch_stub): Likewise.
6185 (hppa_look_for_stubs_in_section): Likewise.
6186 (hppa_elf_stub_check): Remove obsolete function.
6188 * hppa_stubs.h: Add new instructions to deal with %r31 lossage
6189 problems. Delete unused instructions.
6193 * m68klynx.c (TARGET_IS_BIG_ENDIAN_P): Define.
6197 * elfcode.h (elf_object_p): Rather than looking through an array
6198 of architectures, get the ELF EM_xxx code from the backend
6199 information. Let the generic ELF target match any EM_xxx code not
6200 matched by another ELF target. Call elf_backend_object_p to let
6201 the backend do more checks and set global information.
6202 * libelf.h (struct elf_backend_data): Added elf_machine_code and
6203 elf_backend_object_p fields.
6204 (struct bfd_elf_arch_map): Removed.
6205 (bfd_elf_arch_map, bfd_elf_arch_map_size): Don't declare.
6206 * elf32-target.h, elf64-target.h: Initialize elf_machine_code
6207 field with ELF_MACHINE_CODE. Initialize elf_backend_object_p
6208 field with elf_backend_object_p (if it is defined).
6209 * elf32-gen.c, elf32-hppa.c, elf32-i386.c, elf32-i860.c,
6210 elf32-m68k.c, elf32-m88k.c, elf32-mips.c, elf32-sparc.c,
6211 elf64-gen.c (ELF_MACHINE_CODE): Defined.
6212 * elf32-mips.c: Include ecoffswap.h to get ECOFF swapping
6214 (mips_elf_object_p): Set the right machine number.
6215 (mips_elf_ecoff_debug_swap): Defined.
6216 (elf_backend_object_p): Defined to be mips_elf_object_p.
6217 (elf_backend_ecoff_debug_swap): Defined to be
6218 mips_elf_ecoff_debug_swap.
6219 * elf.c (bfd_elf_arch_map, bfd_elf_arch_map_size): Removed.
6221 * libbfd-in.h (target_vector, default_vector): Declare.
6222 * libbfd.h: Rebuilt.
6223 * format.c (target_vector, default_vector): Don't declare.
6225 * elf32-mips.c (elf_mips_howto_table): Don't complain on overflow
6226 for R_MIPS_26. Correct overflow detection requires matching the
6227 upper four bits of the destination against the PC. From Ted Lemon
6230 * bout.c (b_out_reloc_type_lookup): Return type should point to
6232 * coff-i960.c (coff_i960_reloc_type_lookup): Likewise.
6233 * elf32-hppa.c (elf_hppa_reloc_type_lookup): Likewise.
6234 * mipsbsd.c (MY(reloc_howto_type_lookup)): Likewise.
6235 * coff-i386.c (coff_i386_reloc): Made howto const.
6236 * oasys.c (oasys_write_data): Made how const.
6238 * libelf.h: Added some comments.
6239 (struct elf_backend_data): Added elf_backend_ecoff_debug_swap
6240 field. Removed unused write_relocs field.
6241 * elf32-target.h: Adjusted elf_backend_data initialization
6243 * elf64-target.h: Corrected elf_backend_data initialization to
6244 fill in all fields and to set elf_64_p to 1.
6248 * elfcode.h (bfd_section_from_shdr): Remove duplicate assignment
6249 to filepos in SHT_STRTAB case.
6250 (assign_file_position_for_section): Set BFD section filepos as
6251 well as ELF section sh_offset.
6253 * reloc.c: Use const instead of CONST.
6254 (bfd_perform_relocation): Make variable howto a const pointer.
6255 * bfd-in2.h, libbfd.h: Rebuilt.
6259 * Makefile.in (realclean): Don't remove generated headers. Reverts
6260 change of 2 Jul 1993.
6264 * configure.bfd: make unixware equivalent to sysv4.
6266 * config/i386-nlm.mt: bring in elf config; make it the default.
6270 * libbfd.c (bfd_put_8): Add parens around reference to "val"
6275 * hosts/i386mach3.h (HOST_SEGMENT_SIZE),
6276 i386mach3.c (SEGMENT_SIZE, TEXT_START_ADDR): Correct values (?).
6280 * coffcode.h (coff_write_object_contents): Zero out internal_a.
6284 * aoutx.h, archive.c, archures.c, bfd.c, cache.c, coffcode.h,
6285 core.c, ctor.c, format.c, init.c, libbfd.c, opncls.c, reloc.c,
6286 section.c, syms.c, targets.c:
6287 Doc cleanup (spelling, punctuation, grammar, formatting).
6288 * bfd-in2.h, libbfd.h: Rebuild.
6292 * bfd-in.h (bfd_get_cacheable, bfd_set_cacheable): New accessors.
6293 * bfd.c, opncls.c: Improve comments on file descriptor cacheing.
6298 * elf32-hppa.c (hppa_elf_get_section_contents): Fix logic error
6299 in last change. Always rebuild symbol extension section the first
6300 time though if output sections exist (fixes ld -r problems).
6304 * Makefile.in: Add .PHONY for check and installcheck rules.
6308 * libbfd-in.h (artdata): Use long, not time_t for portability, at
6309 least to HPUX. File below is a derived file.
6313 * libbfd.h (artdata): Use long, not time_t for portability, at
6318 * config.bfd: Use bigmips for mips*-*-bsd*.
6322 * elfcode.h (elf_slurp_reloca_table, elf_slurp_reloc_table):
6323 Handle symbol number of zero.
6325 * reloc.c (enum bfd_reloc_code_real): Added
6326 BFD_RELOC_MIPS_LITERAL, BFD_RELOC_MIPS_GOT16,
6327 BFD_RELOC_MIPS_CALL16, BFD_RELOC_MIPS_GPREL32.
6328 * bfd-in2.h: Rebuilt.
6329 * coff-mips.c (mips_bfd_reloc_type_lookup): Handle
6330 BFD_RELOC_MIPS_LITERAL.
6331 * elf32-mips.c (mips_reloc_map): Handle new relocs.
6332 (mips_elf_hi16_reloc, mips_elf_lo16_reloc): Rearrange _gp_disp
6335 * aout-target.h (MY_bfd_debug_info_start, MY_bfd_debug_info_end,
6336 MY_bfd_debug_info_accumulat [sic]): Remove unused definitions.
6337 (MY_bfd_get_relocated_section_contents, MY_bfd_relax_section,
6338 MY_bfd_seclet_link): Define.
6339 (MY_bfd_reloc_type_lookup): Rename from
6340 MY_reloc_howto_type_lookup.
6341 (MY_bfd_make_debug_symbol): Rename from MY_make_debug_symbol.
6342 (MY(vec)): Use JUMP_TABLE rather than listing functions.
6343 * hp300hpux.c (MY_get_symtab, MY_get_symtab_upper_bound,
6344 MY_canonicalize_reloc, MY_write_object_contents): Don't define in
6345 terms of MY, because that causes a recusive invocation of CAT when
6346 expanded within JUMP_TABLE, and ANSI compilers don't expand
6348 * mipsbsd.c (MY_bfd_reloc_type_lookup): Rename from
6349 MY_reloc_howto_type_lookup, and don't define in terms of MY.
6350 (MY_canonicalize_reloc): Don't define in terms of MY.
6351 (aout_mips_little_vec, aout_mips_big_vec): Use JUMP_TABLE rather
6352 than listing functions.
6356 * config.bfd: Use m68k-elf for m68*-*-sysv4*.
6358 See file ChangeLog.1
6365 version-control: never