Commit Graph

41 Commits

Author SHA1 Message Date
Mark Kettenis b820f1e4a8 * archive.c: Include "libiberty.h". 2005-06-16 08:05:39 +00:00
Jakub Jelinek 933d961a3c * elf.c (bfd_section_from_shdr): Fail if name is NULL.
Prevent endless recursion on broken objects.

	* archive.c (do_slurp_coff_armap): Check for overflows.
2005-06-14 11:04:22 +00:00
Nick Clifton 3e11053365 Update the address and phone number of the FSF organization in the GPL notices 2005-05-04 15:53:43 +00:00
Nick Clifton 53e09e0aaf Update the FSF address in the copyright/GPL notice 2005-05-04 07:19:45 +00:00
Jakub Jelinek 390c0e4288 * libbfd-in.h (_bfd_ar_spacepad): New prototype.
* libbfd.h: Rebuilt.
	* archive.c (_bfd_ar_spacepad): New function.
	(_bfd_construct_extended_name_table, _bfd_write_archive_contents,
	bsd_write_armap, _bfd_archive_bsd_update_armap_timestamp,
	coff_write_armap): Use it.
	(bfd_ar_hdr_from_filesystem): Likewise.  Fix HP-UX large
	uid/gid support.
	* archive64.c (bfd_elf64_archive_write_armap): Use _bfd_ar_spacepad.
2005-03-11 16:37:17 +00:00
Mark Kettenis a2633f4e94 * archive.c (_bfd_look_for_bfd_in_cache): Move declaration of
has_table to the start of the function.
2005-03-10 21:26:53 +00:00
Ben Elliston 109f709619 * archive.c: Include hashtab.h.
(struct ar_cache): Rename `arelt' to `arbfd' and remove `next'.
	(_bfd_look_for_bfd_in_cache): Reimplement using htab_find.
	(hash_file_ptr): New function.
	(eq_file_ptr): Likewise.
	(_bfd_add_bfd_to_archive_cache): Reimplement using a hash table.
	* libbfd-in.h: Include hashtab.h.
	(struct artdata): Change `cache' member type to htab_t.
	* libbfd.h: Rebuild.
2005-03-10 00:29:35 +00:00
Alan Modra 9553c6388c update copyright dates 2005-03-03 11:41:03 +00:00
Ben Elliston 10adf131a5 * coffcode.h (coff_sym_filepos): Remove GNU960 conditional code.
* format.c (bfd_check_format_matches): Likewise.
	* archive.c (BFD_GNU960_ARMAG): Likewise.
	(bfd_generic_archive_p): Likewise.
	(_bfd_write_archive_contents): Likewise.
2005-02-24 20:16:56 +00:00
Ben Elliston 0e71e4955c * aout-arm.c, aout-target.h, aoutx.h, archive.c, armnetbsd.c,
bfd-in.h, bfdio.c, coff-alpha.c, coff-arm.c, coff-h8300.c,
	coff-i860.c, coff-mcore.c, coff-or32.c, coff-ppc.c, coff-sh.c,
	coff-sparc.c, coffcode.h, coffgen.c, cofflink.c, cpu-cris.c,
	cpu-h8500.c, cpu-ns32k.c, ecoff.c, ecofflink.c, elf.c,
	elf32-dlx.c, elf32-fr30.c, elf32-frv.c, elf32-hppa.c,
	elf32-i860.c, elf32-ip2k.c, elf32-m32r.c, elf32-sh.c,
	elf32-v850.c, elf64-mips.c, elf64-sparc.c, elflink.c,
	i386aout.c, i386msdos.c, i386os9k.c, ieee.c, mach-o.c,
	nlm32-sparc.c, oasys.c, opncls.c, pdp11.c, pe-mips.c, peXXigen.c,
	pef.c, peicode.h, reloc.c, riscix.c, section.c, simple.c, som.c,
	sparclynx.c, targets.c, vms-misc.c, vms-tir.c, xsym.c, doc/chew.c,
	hosts/delta68.h, hosts/vaxbsd.h: Remove #if 0'd code
	throughout. Similarly, collapse #if 1'd code.
2005-01-31 23:13:34 +00:00
Nick Clifton 1b09e940ec Add code to cope with nested archives. 2004-05-19 14:46:59 +00:00
Nick Clifton 06fc8a8ce6 PR/136 - Have bfd_cache_lookup_worker() abort rather than return an
(unchecked-for) NULL.
2004-05-05 15:39:11 +00:00
Alan Modra edeb6e24a9 * bfd-in.h (bfd_getb64, bfd_getl64): Replace bfd_byte* with void*.
(bfd_getb32, bfd_getl32, bfd_getb16, bfd_getl16): Likewise.
	(bfd_getb_signed_64, bfd_getl_signed_64): Likewise.
	(bfd_getb_signed_32, bfd_getl_signed_32): Likewise.
	(bfd_getb_signed_16, bfd_getl_signed_16): Likewise.
	(bfd_putb64, bfd_putl64, bfd_putb32, bfd_putl32): Likewise.
	(bfd_putb16, bfd_putl16, bfd_get_bits, bfd_put_bits): Likewise.
	* libbfd.c: Likewise in function definitions.
	(bfd_put_8): Mask with 0xff rather than casting to char.
	(bfd_putb16, bfd_putl16, bfd_putb32, bfd_putl32): Likewise.
	(bfd_putb64, bfd_putl64, bfd_put_bits): Likewise.
	(H_PUT_64, H_PUT_32, H_PUT_16, H_PUT_8): Remove casts, simplify.
	(H_PUT_S64, H_PUT_S32, H_PUT_S16, H_PUT_S8): Likewise.
	(H_GET_64, H_GET_32, H_GET_16, H_GET_8): Likewise.
	(H_GET_S64, H_GET_S32, H_GET_S16, H_GET_S8): Likewise.
	* libaout.h (H_PUT_64 H_PUT_32, H_PUT_16): Remove casts, simplify.
	(H_PUT_S64, H_PUT_S32, H_PUT_S16): Likewise.
	(H_GET_64, H_GET_32, H_GET_16): Likewise.
	(H_GET_S64, H_GET_S32, H_GET_S16): Likewise.
	* archive.c (do_slurp_coff_armap): Update swap prototype.
	* coff-tic54x.c (tic54x_getl32): Replace bfd_byte* with void*.
	(tic54x_getl_signed_32): Likewise.
	(tic54x_putl32): Likewise.  Mask with 0xff rather than casting to char.
	* mach-o.c (bfd_mach_o_read_header): Update get32 prototype.
	* pdp11.c (bfd_getp32): Make static, replace bfd_byte* with void*.
	(bfd_getp_signed_32, bfd_putp32): Likewise.
	* targets.c (struct bfd_target): Use void* in place of bfd_byte* for
	bfd_getx64, bfd_getx_signed_64, bfd_putx64, bfd_getx32,
	bfd_getx_signed_32, bfd_putx32, bfd_getx16, bfd_getx_signed_16,
	bfd_putx16, bfd_h_getx64, bfd_h_getx_signed_64, bfd_h_putx64,
	bfd_h_getx32, bfd_h_getx_signed_32, bfd_h_putx32, bfd_h_getx16,
	bfd_h_getx_signed_16, bfd_h_putx16.
	* aix386-core.c (NO_GET, NO_GETS, NO_PUT): Update prototypes.
	* hppabsd-core.c: Similarly.  Rename NO_SIGNED_GET to NO_GETS.
	* hpux-core.c: Likewise.
	* irix-core.c: Likewise.
	* netbsd-core.c: Likewise.
	* osf-core.c: Likewise.
	* ptrace-core.c: Likewise.
	* sco5-core.c: Likewise.
	* trad-core.c: Likewise.
	* bfd-in2.h: Regenerate.
2004-03-15 12:23:11 +00:00
Alan Modra c58b95236c Convert to C90 and a few tweaks. 2003-06-29 10:06:40 +00:00
Alan Modra b34976b65a s/boolean/bfd_boolean/ s/true/TRUE/ s/false/FALSE/. Simplify
comparisons of bfd_boolean vars with TRUE/FALSE.  Formatting.
2002-11-30 08:39:46 +00:00
Dave Anglin d45913a06f * aoutx.h (NAME(aout,swap_ext_reloc_in)): Cast bytes->r_index to
unsigned int.  Cast RELOC_BASE10, RELOC_BASE13 and RELOC_BASE22 to
	unsigned int.
	(NAME(aout,final_link)): Cast enum used in assignment.
	(aout_link_write_symbols): Cast enums in comparisons, int values to
	boolean, enums in assignments to int.
	(aout_link_input_section_std): Cast rel->r_index to unsigned int.
	(aout_link_input_section_ext): Likewise.  Cast enums used in comparisons
	with unsigned ints.
	(aout_link_reloc_link_order): Cast enum to int in assignment.
	* archive.c (_bfd_generic_read_ar_hdr_mag): Cast result of memchr
	calls to char *.
	* bfd-in.h (bfd_set_section_vma): Cast enum true to unsigned int in
	assignment.
	* bfd-in2.h (bfd_set_section_vma): Likewise.
	* bfd.c (bfd_record_phdr): Cast enums in assignments.
	* binary.c (bfd_alloc): Cast enum to long.
	* coffgen.c (_bfd_coff_is_local_label_name): Cast return to boolean.
	* dwarf2.c (read_abbrevs): Add casts to enum types.
	(read_attribute_value): Likewise.
	(arange_add): Cast result of bfd_zalloc call.
	(comp_unit_contains_address): Return true and false.
	(comp_unit_find_nearest_line): Cast return to boolean.
	* format.c (bfd_check_format_matches, bfd_set_format): Likewise.
	* gen-aout.c: define macro '_' if not defined.
	* libbfd.c (bfd_realloc): Cast malloc and realloc to PTR.
	(bfd_bwrite): Cast bfd_realloc to bfd_byte *.
	(bfd_write_bigendian_4byte_int): Cast return to boolean.
	(bfd_seek): Cast bfd_realloc to bfd_byte *.
	(bfd_generic_is_local_label_name): Cast return to boolean.
	* libcoff.h (_bfd_coff_adjust_symndx): Remove extraneous '\'.
	* linker.c (_bfd_link_hash_newfunc): Cast bfd_hash_allocate result to
	struct bfd_hash_entry *.
	(_bfd_generic_link_hash_newfunc): likewise.
	(_bfd_generic_final_link): Cast enum to unsigned int.
	* merge.c (sec_merge_emit): Cast return to boolean.
	(merge_strings): Add casts to const unsigned char *.
	* reloc.c (bfd_get_reloc_code_name): Cast enums in comparison to int.
	(bfd_generic_get_relocated_section_content): Cast enum to unsigned int.
	* section.c (bfd_section_hash_newfunc): Cast bfd_hash_allocate result to
	struct bfd_hash_entry *.
	(bfd_set_section_content): Add cast to PTR in comparison.
	* simple.c (simple_dummy_warning, simple_dummy_undefined_symbol,
	simple_dummy_reloc_overflow, simple_dummy_reloc_dangerous,
	simple_dummy_unattached_reloc,
	bfd_simple_get_relocated_section_contents): Add K&R declarations and
	function definitions.
	* srec.c (S3Forced): Initialize to false.
	(srec_get_symtab): Cast return value from bfd_alloc to asymbol *.
	* stabs.c (_bfd_link_section_stabs): Cast enum to int in comparisons.
	(_bfd_discard_section_stabs): Likewise.  Also cast return to boolean.
	* syms.c (bfd_is_undefined_symclass): Cast return to boolean.
	(_bfd_stab_section_find_nearest_line): Cast enum to bfd_byte in
	comparisons.
2002-10-25 02:45:54 +00:00
Alan Modra 5fe39caef5 * archive.c (_bfd_archive_bsd_update_armap_timestamp): Replace
perror with bfd_perror.
2002-10-21 01:58:48 +00:00
Alan Modra 487e54f29a * aoutx.h (some_aout_object_p): Clean up tdata properly on error.
* archive.c (bfd_generic_archive_p): Likewise.
	* coff-rs6000.c (_bfd_xcoff_archive_p): Likewise.
	(_bfd_xcoff_archive_p): Use bfd_scan_vma in place of strtol.
	* coff64-rs6000.c (xcoff64_slurp_armap): Likewise.
	(xcoff64_archive_p): Likewise.
	(xcoff64_openr_next_archived_file): Likewise.
	(xcoff64_archive_p): Clean up tdata properly on error.
	* coffgen.c (coff_real_object_p): Likewise.
	(coff_object_p): Release filehdr and opthdr.
	* ecoff.c (_bfd_ecoff_archive_p): Clean up tdata properly on error.
	* ieee.c (ieee_archive_p): Likewise.
	* ihex.c (ihex_object_p): Likewise.
	(ihex_mkobject): Always allocate tdata.
	* peicode.h (pe_ILF_object_p): Release bfd_alloc'd buffer on error.
	* srec.c (srec_mkobject): Always allocate tdata.
	(srec_object_p): Clean up tdata properly on error.
	(symbolsrec_object_p): Likewise.
	* versados.c (versados_object_p): Likewise.
	* vms-misc.c (_bfd_vms_get_record): Use bfd_malloc instead of malloc,
	and bfd_realloc instead of realloc.
	(add_new_contents): Use bfd_alloc instead of bfd_malloc for sections.
	* vms.c (vms_initialize): Always allocate tdata.  Use bfd_alloc in
	place of bfd_malloc, simplifying error freeing.  Free hash table too.
	(vms_object_p): Clean up tdata on error.
	(vms_mkobject): Don't complain on stderr if vms_initialize fails.
	(vms_close_and_cleanup): Adjust for bfd_alloc use.
2002-07-30 05:49:24 +00:00
Alan Modra 82e5191826 * aout-adobe.c: Don't compare against "true" or "false.
* aout-target.h: Likewise.
	* aoutx.h: Likewise.
	* archive.c: Likewise.
	* bout.c: Likewise.
	* cache.c: Likewise.
	* coff-a29k.c: Likewise.
	* coff-alpha.c: Likewise.
	* coff-i386.c: Likewise.
	* coff-mips.c: Likewise.
	* coff-or32.c: Likewise.
	* coff64-rs6000.c: Likewise.
	* coffcode.h: Likewise.
	* coffgen.c: Likewise.
	* cpu-ns32k.c: Likewise.
	* ecoff.c: Likewise.
	* ecofflink.c: Likewise.
	* elf.c: Likewise.
	* elf32-arm.h: Likewise.
	* elf32-cris.c: Likewise.
	* elf32-d30v.c: Likewise.
	* elf32-i386.c: Likewise.
	* elf32-mcore.c: Likewise.
	* elf32-ppc.c: Likewise.
	* elf32-sh.c: Likewise.
	* elf32-sh64.c: Likewise.
	* elf32-v850.c: Likewise.
	* elf64-alpha.c: Likewise.
	* elf64-sh64.c: Likewise.
	* elfcode.h: Likewise.
	* elfcore.h: Likewise.
	* elflink.h: Likewise.
	* elfxx-mips.c: Likewise.
	* i386os9k.c: Likewise.
	* ieee.c: Likewise.
	* libbfd.c: Likewise.
	* linker.c: Likewise.
	* mmo.c: Likewise.
	* nlm32-alpha.c: Likewise.
	* nlm32-i386.c: Likewise.
	* nlm32-ppc.c: Likewise.
	* nlm32-sparc.c: Likewise.
	* nlmcode.h: Likewise.
	* oasys.c: Likewise.
	* pdp11.c: Likewise.
	* peicode.h: Likewise.
	* reloc.c: Likewise.
	* som.c: Likewise.
	* srec.c: Likewise.
	* tekhex.c: Likewise.
	* vms.c: Likewise.
	* xcofflink.c: Likewise.
	* elf64-sparc.c: Edit comment to not use "== false".

	* aoutf1.h: Don't use "? true : false".
	* ecoff.c: Likewise.
	* format.c: Likewise.
	* ieee.c: Likewise.
	* linker.c: Likewise.
	* mmo.c: Likewise.
	* oasys.c: Likewise.
2002-06-25 06:21:54 +00:00
Alan Modra 54327882f0 * coff64-rs6000.c (_bfd_xcoff64_put_symbol_name): Prototype.
Whitespace changes.
	* archive.c: Update copyright date.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
	* Makefile.am: Run "make dep-am"
	* Makefile.in: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.
2002-03-21 09:15:18 +00:00
Alan Modra 4dae1ae748 * libbfd.c (bfd_write_bigendian_4byte_int): Return true iff success.
* libbfd.h: Regenerate.
	* archive.c (coff_write_armap): Pass on failures from
	bfd_write_bigendian_4byte_int.
2002-03-18 01:26:57 +00:00
Thiemo Seufer 36b4548250 * Makefile.am: split up BFD_LIBS like statements in BFD32_LIBS and
BFD64_LIBS, make the latter depending on the availability of BFD64.
	Add archive64.c source file.
	* archive64.c: New file implementing bfd_elf64_archive_slurp_armap
	and bfd_elf64_archive_write_armap, code from elf64-mips.c
	* archive.c (bfd_slurp_armap): Add ELF64 archive support.
	* config.bfd (mips*-*-irix6*): Allow with BFD64 only.
	(mips64*el-*-linux*): Likewise.
	(mips*el-*-linux*): Likewise. Reorder entries.
	* configure.in (bfd_libs): Define in dependency of BFD64 and
	AC_SUBST it.
	* elf64-mips.c (mips_elf64_slurp_armap): Remove, use
	bfd_elf64_archive_slurp_armap instead.
	(mips_elf64_write_armap): Remove, use bfd_elf64_archive_write_armap
	instead.
2001-12-05 22:46:21 +00:00
Kazu Hirata 08da05b004 * aout-encap.c: Fix comment typos.
* aoutx.h: Likewise.
	* archive.c: Likewise.
	* bout.c: Likewise.
	* coff64-rs6000.c: Likewise.
	* coffcode.h: Likewise.
	* coffgen.c: Likewise.
	* cofflink.c: Likewise.
	* coff-mips.c: Likewise.
	* ecoff.c: Likewise.
	* elf32-m32r.c: Likewise.
	* libcoff-in.h: Likewise.
	* libecoff.h: Likewise.
	* libxcoff.h: Likewise.
	* nlm32-i386.c: Likewise.
	* pdp11.c: Likewise.
	* section.c: Likewise.
	* som.c: Likewise.
	* som.h: Likewise.
	* bfd-in2.h: Regenerate.
	* libcoff.h: Likewise.
2001-10-10 12:08:29 +00:00
H.J. Lu 3882b01078 Locale changes from Bruno Haible <haible@clisp.cons.org>. 2001-09-19 05:33:36 +00:00
Alan Modra dc810e3900 Touches most files in bfd/, so likely will be blamed for everything..
o  bfd_read and bfd_write lose an unnecessary param and become
   bfd_bread and bfd_bwrite.

o  bfd_*alloc now all take a bfd_size_type arg, and will error if
   size_t is too small.  eg. 32 bit host, 64 bit bfd, verrry big files
   or bugs in linker scripts etc.

o  file_ptr becomes a bfd_signed_vma.  Besides matching sizes with
   various other types involved in handling sections, this should make
   it easier for bfd to support a 64 bit off_t on 32 bit hosts that
   provide it.

o  I've made the H_GET_* and H_PUT_* macros (which invoke bfd_h_{get,put}_*)
   generally available.  They now cast their args to bfd_vma and
   bfd_byte * as appropriate, which removes a swag of casts from the
   source.

o  Bug fixes to bfd_get8, aix386_core_vec, elf32_h8_relax_section, and
   aout-encap.c.

o  Zillions of formatting and -Wconversion fixes.
2001-09-18 09:57:26 +00:00
Alan Modra ba3ef70e78 * archive.c (offsetof): Remove define.
* elf.c: Likewise.
	* oasys.c: Likewise
	* sysdep.h (offsetof): Define.
2001-08-19 23:42:47 +00:00
Alan Modra 3619ad0439 * bfd.c (enum bfd_error): Add bfd_error_wrong_object_format.
(bfd_errmsgs): Add corresponding message.
	* archive.c (bfd_generic_archive_p): Don't release bfd_ardata when
	finding an archive that contains different format object files.
	Return bfd_error_wrong_object_format for this case.
	* format.c: Formatting fixes.  s/CONST/const/.
	(bfd_check_format_matches): Accept archives that give
	bfd_error_wrong_object_format if no full match is found.  Tidy
	code handling matching_vector.  Don't return a pointer to freed
	memory in `matching'.  Handle ambiguous matches as for partial
	archive matches.
	* bfd-in2.h: Regenerate.
2001-08-17 03:19:01 +00:00
Nick Clifton 7898dedac0 Update copyright notices 2001-03-08 21:04:02 +00:00
Alexandre Oliva 3c5798123f * archive.c (coff_write_armap): Don't write more than symbol_count
`archive_member_file_ptr's.
2000-12-25 21:41:20 +00:00
Kazu Hirata beb0d161cd 2000-11-20 Kazu Hirata <kazu@hxi.com>
* aix386-core.c: Fix formatting.
	* aout-adobe.c: Likewise.
	* aout-arm.c: Likewise.
	* aout-encap.c: Likewise.
	* aout-ns32k.c: Likewise.
	* aout-target.h: Likewise.
	* aout-tic30.c: Likewise.
	* aoutf1.h: Likewise.
	* aoutx.h: Likewise.
	* archive.c: Likewise.
2000-11-20 19:05:12 +00:00
Kazu Hirata 047066e166 2000-11-09 Kazu Hirata <kazu@hxi.com>
* archive.c: Fix formatting.
	* archures.c: Likewise.
2000-11-10 04:28:20 +00:00
Kazu Hirata d70910e85d 2000-09-08 Kazu Hirata <kazu@hxi.com>
* archive.c: Fix formatting.
	* coff-arm.c: Likewise.
	* doc/chew.c: Likewise.
2000-09-08 23:46:41 +00:00
DJ Delorie 8000a61811 * archive.c (_bfd_write_archive_contents): Add an informative
comment.
2000-07-07 17:40:23 +00:00
Alan Modra 2ab47eed68 Correct pointer comparisons relying on NULL less than any other pointer.
Alexander Aganichev's fix for ieee.c
2000-06-20 12:33:21 +00:00
Alan Modra 5af11cab92 Eli Zaretskii's DOSish file name patches. 2000-05-26 13:11:57 +00:00
Jeff Law 23afc6f672 * archive.c (hpux_uid_gid_encode): New function.
(bfd_ar_hdr_from_filesystem): Use it if HPUX_LARGE_AR_IDS is
        defined and the ID is greater than 99999.
        (bfd_generic_stat_arch_elt): If HPUX_LARGE_AR_IDS is defined decode
        special uid/gid fields into 32 bit values.
2000-04-24 07:52:50 +00:00
Nick Clifton 77fb9c28ac Revert previous patch. 1999-12-10 18:51:35 +00:00
Nick Clifton ad247e3c7d Change AR for ELF so that common symbols are not included in archive map.
Change LD for ELF so that archive elements whoes archive map contains a
 reference to a common symbol will get linkled in.
Add new field to bfd_target structure and initialise it for all bfd targets.
1999-12-10 01:41:22 +00:00
Ian Lance Taylor 7442e600c8 * Many files: Changes to avoid gcc warnings: Add ATTRIBUTE_UNUSED
as appropriate.  Fill in structure initializations.  Add variable
	initializations.  Add casts.
	* dwarf1.c (parse_line_table): Change eachLine to unsigned long.
	(dwarf1_unit_find_nearest_line): Change i to unsigned long.
1999-07-11 19:49:48 +00:00
Ian Lance Taylor 633fd09f3c * configure.in: Check whether getuid and getgid exist.
* archive.c: Define getuid and getgid as macros if HAVE_GETUID or
	HAVE_GETGID are not defined, respectively.
	(bfd_write_armap): Don't special case on _WIN32 for getuid and
	getgid.
	* configure.host: Set ac_cv_func_get{ug}id for *-*-windows*.
	* configure, config.in: Rebuild.
1999-05-27 22:48:53 +00:00
Richard Henderson 252b5132c7 19990502 sourceware import 1999-05-03 07:29:11 +00:00