aboutsummaryrefslogtreecommitdiff
path: root/bfd/libbfd.c
AgeCommit message (Collapse)AuthorFilesLines
1994-02-05 * libbfd.c (bfd_zmalloc): Call bfd_xmalloc instead of malloc.David MacKenzie1-53/+2
(bfd_xmalloc, bfd_xmalloc_by_size_t): Functions deleted. * libbfd-in.h: Define them as macros calling xmalloc and declare xmalloc. * libbfd.h: Rebuilt. * ecofflink.c hash.c ieee.c opncls.c (obstack_chunk_alloc): Define to be xmalloc, not bfd_xmalloc_by_size_t.
1994-02-03 * libbfd.c, bfd-in.h, hosts/alphaosf.h, hosts/sparc-ll.h, aoutf1.h,Jim Kingdon1-1/+1
sparclynx.c, Makefile.in: Change HOST_64_BIT to BFD_HOST_64_BIT.
1994-01-25 * opncls.c (_bfd_new_bfd, _bfd_new_bfd_contained_in): AddDavid MacKenzie1-139/+129
"_bfd_" to function names. * archive.c (_bfd_create_empty_archive_element_shell), libbfd-in.h: Change callers. * libbfd.c (bfd_zmalloc): Renamed from zalloc. * libbfd.c (bfd_add_to_string_table), trad-core.c (trad_unix_core_file_p), targets.c (bfd_target_list), ptrace-core.c (ptrace_unix_core_file_p), opncls.c (new_bfd), libbfd-in.h, ieee.c (ieee_make_empty_symbol), elf32-hppa.c (hppa_elf_stub_branch_reloc), (hppa_elf_stub_reloc): Change callers. * libbfd.h: Regenerated. * archive.c (_bfd_look_for_bfd_in_cache): Add "_bfd_" to name. (_bfd_get_elt_at_filepos), coff-rs6000.c (rs6000coff_get_elt_at_filepos), libbfd-in.h: Change callers. * format.c (bfd_check_format_matches), libbfd-in.h, targets.c, elfcode.h (elf_object_p): Rename target_vector to bfd_target_vector and default_vector to bfd_default_vector. * libbfd.h: Regenerated.
1993-12-31 Minor cleanups suggested by CodeCenter.Ian Lance Taylor1-0/+11
* aoutx.h, coffgen.c, ecoff.c, ecofflink.c, elf.c, libbfd.c, linker.c, reloc.c, section.c, srec.c: Added /*ARGSUSED*/ as appropriate. * aoutx.h (struct external_exec): Removed unnecessary declaration. (NAME(aout,some_aout_object_p)): Set some tdata pointers to NULL. (adjust_z_magic): Removed useless variable data_vma. (stringtab_init): Initialize hash_zero. (add_to_stringtab): Removed unused fourth argument. (NAME(aout,swap_std_reloc_out)): Removed useless variable r_addend. (aout_link_input_section): Added some casts. * archive.c (get_extended_arelt_filename, do_slurp_coff_armap, bfd_ar_hdr_from_filesystem, bsd_write_armap, coff_write_armap): Minor code rewriting to make it more C like. (do_slurp_bsd_armap): Added some casts. * ecoff.c (ecoff_write_object_contents): Removed useless variable scn_base. (ecoff_write_armap): Added some casts. Use "" rather than "\0". * ecofflink.c (bfd_ecoff_write_debug): Added a cast. * libaout.h (struct internal_exec): Removed unnecessary declaration. * linker.c (_bfd_generic_indirect_link_order): Added a cast. * opncls.c (new_bfd): Removed a cast. * reloc.c (bfd_generic_get_relocated_section_contents): Added some casts. * srec.c (internal_srec_write_object_contents): Removed useless variable bytes_written.
1993-12-30 Extensive changes to move the bulk of the linker into BFD so thatIan Lance Taylor1-3/+3
more efficient backend code can be written for specific object files. Only existing efficient backend is a.out. * seclet.c, seclet.h: Removed. * hash.c, linker.c, genlink.h: New files. * bfd-in.h: Removed bfd_error_vector. Declared hash table structures and functions. (JUMP_TABLE): Removed bfd_seclet_link, added bfd_link_hash_table_create, bfd_link_add_symbols and bfd_final_link. * All backends: Changed accordingly. * bfd-in2.h: Rebuilt. * bfd.c (struct _bfd): Added link_next and archive_pass fields. Removed ld_symbols field. (bfd_nonrepresentable_section, bfd_undefined_symbol, bfd_reloc_value_truncated, bfd_reloc_is_dangerous, bfd_error_vector): Removed. (bfd_default_error_trap, bfd_error_trap, bfd_error_nonrepresentabltrap): Removed. (bfd_get_relocated_section_contents): Pass link_info. Pass link_order instead of seclet. Pass symbols. (bfd_relax_section): Pass link_info. (bfd_seclet_link): Removed. (bfd_link_hash_table_create, bfd_link_add_symbols, bfd_final_link): New macros. * libbfd-in.h: If __GNUC__ is defined and alloca is not, define alloca as __builtin_alloca. Declare internal linking functions. * libbfd.h: Rebuilt. * libbfd.c (bfd_seek): Comment out fseek assertion. It's worked for months. * reloc.c (reloc_howto_type): Added error_message argument to special_function field. Changed all callers and all definitions. (bfd_get_reloc_size): Make argument a const pointer. (bfd_perform_relocation): Add error_message argument to hold string set if return value if bfd_reloc_dangerous. Changed all callers. (_bfd_final_link_relocate, _bfd_relocate_contents): New functions. * section.c (asection): Renamed seclets_head and seclets_tail to link_order_head and link_order_tail. * targets.c (bfd_target): Replaced seclet argument with link_info and link_order and symbols arguments in bfd_get_relocated_section_contents. Added symbols argument to bfd_relax_section. Removed bfd_seclet_link. Added bfd_link_hash_table_create, bfd_link_add_symbols and bfd_final_link. * libaout.h (struct aoutdata): Added external_syms, external_sym_count, external_strings, sym_hashes fields. (obj_aout_external_syms, obj_aout_external_sym_count, obj_aout_external_strings, obj_aout_sym_hashes): New accessor macros. (WRITE_HEADERS): Only output symbols if outsymbols is not NULL. * aoutx.h: Wrote new back end linker routines. (translate_to_native_sym_flags): Return boolean value. Don't use bfd_error_vector. (NAME(aout,write_syms)): Return boolean value. Check return value of translate_to_native_sym_flags and bfd_write. * aout-target.h (final_link_callback): New function. (MY_bfd_final_link): New function. * aout-adobe.c (aout_adobe_write_object_contents): Check return value of aout_32_write_syms. * hp300hpux.c (MY(write_object_contents)): Likewise. * i386lynx.c (WRITE_HEADERS): Likewise. * libaout.h (WRITE_HEADERS): Likewise. * bout.c: Changed functions to use link_info->callbacks rather than bfd_error_vector, and link_orders rather than seclets. * coff-alpha.c: Likewise. * coff-h8300.c: Likewise. * coff-h8500.c: Likewise. * coff-sh.c: Likewise. * coff-z8k.c: Likewise. * elf32-hppa.c: Likewise. * reloc16.c: Likewise. * coff-alpha.c (alpha_ecoff_get_relocated_section_contents): Look up _gp in the hash table rather than in outsymbols. * coff-a29k.c (a29k_reloc): Pass errors back in new error_message argument rather than printing them. * coffcode.h (bfd_coff_reloc16_extra_cases): Take link_info and link_order arguments rather than seclet. Changed all uses and definitions. (bfd_coff_reloc16_estimate): Pass link_info arguments. Changed all uses and definitions. * libcoff.h: Rebuilt. * ecoff.c (ecoff_get_extr): If symbol is defined by linker, but not by ECOFF, make it scAbs. (ecoff_bfd_final_link): Renamed from ecoff_bfd_seclet_link and rewritten. * elf32-mips.c (mips_elf_final_link): Renamed from mips_elf_seclet_link and rewritten. * elf32-hppa.c (elf32_hppa_stub_description): Added link_info field. (new_stub, add_stub_by_name, hppa_elf_build_arg_reloc_stub, hppa_elf_build_long_branch_stub, hppa_look_for_stubs_in_section): Added link_info arguments. Changed all callers. * elfcode.h (elf_slurp_symbol_table): Don't quit if outsymbols is not NULL. * oasys.c (oasys_write_sections): Return boolean value rather than using bfd_error_vector. (oasys_write_object_contents): Check return value of oasys_write_sections. * hosts/std-host.h: Don't declare qsort or strtol. * Makefile.in: Rebuild dependencies. (BFD_LIBS): Removed seclet.o. Added hash.o and linker.o. (CFILES): Removed seclet.c. Added hash.c and linker.c. (HFILES): Removed seclet.h. Added genlink.h.
1993-11-06more doc cleanupsDavid MacKenzie1-13/+13
1993-11-05doc cleanupDavid MacKenzie1-12/+11
1993-10-25 * libbfd.c (bfd_write): If not everything is written out, setIan Lance Taylor1-33/+53
bfd_error to system_call_error. If the return value is non-negative, set errno to ENOSPC (if ENOSPC is defined). (bfd_seek): If the seek fails, set bfd_error to system_call_error. (bfd_generic_set_section_contents): For a bad offset + count, set bfd_error to bad_value. * seclet.c (rel): Don't abort. Instead, return false.
1993-09-14Improve timestamp support in BSD archive files to avoid linkerJohn Gilmore1-34/+68
warnings. * libbfd.h (struct artdata): Add armap_timestamp and armap_datepos. (bfd_flush, bfd_stat): Add prototypes. * libbfd.c (bfd_flush): Add, does fflush on a BFD. (bfd_stat): Add, does fstat on a BFD. * archive.c (_bfd_write_archive_contents): At end of file writing, verify and possibly update the timestamp in the armap, if a BSD archive. FIXME! Kludge recognizes BSD archive, rather than vectoring properly. Should add to xvec. (compute_and_write_armap): Move prototype to top, avoid PROTO. (bsd_write_armap): Save timestamp and file location thereof, when writing the armap in a BSD file. (bsd_update_armap_timestamp): New function to check and rewrite the timestamp.
1993-05-25(COERCE64): Avoid out-of-range numbersKen Raeburn1-19/+41
1993-04-19 * libbfd.c: bfd_put*: Remove casts to bfd_vma.Jim Kingdon1-3/+11
1993-04-17 * libbfd.c: Add signed versions of bfd_{h_,}{get,put}_signed_<size>.Jim Kingdon1-10/+121
libbfd.c, libbfd-in.h: Add _do*signed*. targets.c, all targets: Add bfd*signed*. bfd-in.h: Add bfd_signed_vma. Add comments.
1993-04-15Cleanup in preparation for better 64-bit host support.John Gilmore1-4/+35
* bfd-in.h (bfd_64_type): Remove. * libbfd.c (_do_getb64, _do_putb64): Use bfd_vma, not bfd_64_type. * bfd-in.h (bfd_size): Remove. * bfd-in.h (bfd_offset): Remove, after fixing ld/ldlang.[ch]. * bfd-in.h (bfd_word): Remove. * reloc.c (reloc_howto_type): Replace bfd_word with bfd_vma. * bfd-in.h (rawdata_offset): Remove. * reloc.c (arelent): Replace rawdata_offset with bfd_size_type. (bfd_perform_relocation): Lint. (enum bfd_reloc_status): Comment cleanup.
1993-03-24fix some (not all) bugs in previous changesKen Raeburn1-8/+17
1993-03-23Eek, a bug!Ken Raeburn1-1/+1
Position 0 means no-movement for SEEK_CUR ... not for SEEK_SET.
1993-03-23oops, left some debug code inKen Raeburn1-1/+1
1993-03-23libbfd.c: Maintain `where' field of BFD with current position while BFD isKen Raeburn1-33/+54
in use. If FILE_OFFSET_IS_CHAR_INDEX, assume arithmetic can be done on it, and ignore SEEK_SET requests that move to the current position. hosts/sparc.h: Define FILE_OFFSET_IS_CHAR_INDEX.
1992-10-15* aout-adobe.c, aoutf1.h, archive.c, bout.c, coff-rs6000.c,John Gilmore1-74/+109
coffcode.h, elf.c, ieee.c, libaout.h, libbfd.c, oasys.c, sco-core.c: Lint: Second argument of bfd_seek is always file_ptr. Third argument is SEEK_SET or SEEK_CUR. Result is always 0 or -1.
1991-11-22LintJohn Gilmore1-2/+31
1991-10-21 * targets.c (proto write_armap). Changed orl_count to unsigned.Steve Chamberlain1-33/+61
* opncls.c (bfd_close_all_done). Added so that generative programs like gas can close a bfd without causing bfd confusion. * libbfd.h (changed becuase of protos) * amdcoff.c: messed with the way that jmp displacements are calcualated. This may not yet be totally correct. * archive.c (coff_write_armap): rewrote the way that ranlibs are written out. * coffcode.h (fixup_symbol_value): now doesn't core dump if a non abs symbol has no section (like a register symbol). (coff_write_symbol) now zeros auxent before filling it up to help with sensitive applications. * libbfd.c (bfd_write_bigendian_4byte_int): added.
1991-07-04Now full of documentation. Yum Yum.Steve Chamberlain1-69/+147
1991-05-22Not only compiles, but spells _do_getl64 right tooSteve Chamberlain1-3/+3
1991-05-22* libbfd.c: Now compilesSteve Chamberlain1-2/+2
* coffcode.h: removed all put_x_<sizes>
1991-05-22Changed #ifdef __GNUC__ to #ifdef HOST_64_BITSteve Chamberlain1-82/+84
Added DEFUNS
1991-05-21*** empty log message ***Steve Chamberlain1-39/+133
1991-05-09Add bfd_generic_get_section_contents.John Gilmore1-6/+18
1991-05-08Various portability lints.Steve Chamberlain1-2/+2
Fixed reloc bug in ieee and oasys.
1991-05-03Make arg to zalloc a bfd_size_type not a size_tJim Kingdon1-1/+1
1991-05-02Merge Per Bothner's MIPS changes from 31 March 1991 (bfd-0.5.2-patch1a)John Gilmore1-6/+6
and make the result compile and run on the DEC 3100. It still has trouble running but it can handle opening exec and symbol files in ecoff format.
1991-05-02Merge devo/bfd with GDB's bfd.John Gilmore1-0/+2
Remove obstack.h to ../include and obstack.c to ../libiberty. Move COFF symbol swapping code to coffswap.c where GDB can call it but it won't be duplicated if we have N different COFF targets. Add support for traditional Unix core files (with a upage). This support is from an Ultrix port, but is probably slightly broken now. Improve bfd_release's of obstack'd items on error returns. gcc -Wall fixes. Handle section alignment slightly better in coff, and comment where it needs more work (on page-aligning virtual vs file addresses for DPAGED). Use set_tdata everywhere that tdata is set, to avoid "cast to the left of assignment" problems with some compilers. Move bfd_alloc, bfd_zalloc, bfd_realloc, and bfd_release into libbfd.h (from bfd.h) since they are internal routines. Remove the redundant suffix "_struct" from struct tags. Set symbol count early in file reading, before slurping in the syms, for GDB's use.
1991-04-17StuffSteve Chamberlain1-1/+1
1991-04-15Merged in some changes from Intel,Steve Chamberlain1-7/+7
Added some more prototypes.
1991-03-21Initial revisionDavid Henkel-Wallace1-0/+332