Commit Graph

28 Commits

Author SHA1 Message Date
Alan Modra 73e87d7038 hash bfd sections for fast lookup and create.
bfd/ChangeLog
	* bfd.c (struct _bfd): Add section_htab, section_tail.
	* libbfd-in.h (_bfd_delete_bfd): Declare.
	(bfd_section_hash_newfunc): Declare.
	* opncls.c (_bfd_new_bfd): Free memory on failure.  Init
	section_htab and section_tail.
	(_bfd_delete_bfd): New function.
	(bfd_openr): Use it.
	(bfd_fdopenr): Likewise.
	(bfd_openstreamr): Likewise.
	(bfd_openw): Likewise.
	(bfd_close): Likewise.
	(bfd_close_all_done): Likewise.
	(bfd_release): Comment.
	* section.c (struct section_hash_entry): New.
	(bfd_section_hash_newfunc): New function.
	(section_hash_lookup): Define.
	(bfd_section_init): New function, split out from
	bfd_make_section_anyway.
	(bfd_get_section_by_name): Lookup via hash table.
	(bfd_get_unique_section_name): Likewise.
	(bfd_make_section_old_way): Rewrite to use hash table.
	(bfd_make_section_anyway): Likewise.
	(bfd_make_section): Likewise.  Return NULL for attempts to make
	BFD_{ABS,COM,UND,IND}_SECTION_NAME.
	(_bfd_strip_section_from_output): Adjust section_tail if needed.
	* configure.in: Bump bfd version.
	* configure: Regenerate.
	* libbfd.h: Regenerate.
	* bfd-in2.h: Regenerate.

ld/ChangeLog
	* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Adjust
	section_tail when fiddling with section list.
	(gld${EMULATION_NAME}_list_options): Ensure sentences aren't
	broken into separate strings to make translation easier.
	* emultempl/mmo.em (mmo_place_orphan): Adjust section_tail when
	fiddling with section list.
	* emultempl/pe.em (gld_${EMULATION_NAME}_place_orphan): Likewise.
2001-12-17 00:40:53 +00:00
Nick Clifton 3c3bdf30e4 Add MMIX support 2001-10-30 15:20:14 +00:00
Alan Modra aec2f56188 * bfd.c (bfd_assert): Report bfd version.
(_bfd_abort): Likewise.
2001-10-06 07:40:44 +00:00
Alan Modra af6166c063 * bfd.c (_bfd_default_error_handlerl): Define using VPARAMS,
VA_OPEN, VA_FIXEDARG, VA_CLOSE.
	(bfd_archive_filename): Cast bfd_malloc arg to the correct size.
2001-09-26 01:53:25 +00:00
Alan Modra 8f615d0704 * bfd.c (bfd_archive_filename): New function.
* bfd-in2.h: Regenerate.
	* aout-adobe.c: Replace bfd_get_filename with bfd_archive_filename
	in error messages where the bfd is an input bfd.
	* aout-cris.c: Likewise.
	* coff-arm.c: Likewise.
	* coff-mcore.c: Likewise.
	* coff-ppc.c: Likewise.
	* coff-rs6000.c: Likewise.
	* coff-sh.c: Likewise.
	* coff-tic54x.c: Likewise.
	* coff-tic80.c: Likewise.
	* coff64-rs6000.c: Likewise.
	* coffcode.h: Likewise.
	* coffgen.c: Likewise.
	* cofflink.c: Likewise.
	* ecofflink.c: Likewise.
	* elf-hppa.h: Likewise.
	* elf.c: Likewise.
	* elf32-arm.h: Likewise.
	* elf32-cris.c: Likewise.
	* elf32-gen.c: Likewise.
	* elf32-hppa.c: Likewise.
	* elf32-i370.c: Likewise.
	* elf32-i386.c: Likewise.
	* elf32-m32r.c: Likewise.
	* elf32-mcore.c: Likewise.
	* elf32-mips.c: Likewise.
	* elf32-ppc.c: Likewise.
	* elf32-s390.c: Likewise.
	* elf32-sh.c: Likewise.
	* elf32-sparc.c: Likewise.
	* elf32-v850.c: Likewise.
	* elf64-alpha.c: Likewise.
	* elf64-gen.c: Likewise.
	* elf64-ppc.c: Likewise.
	* elf64-s390.c: Likewise.
	* elf64-sparc.c: Likewise.
	* elf64-x86-64.c: Likewise.
	* elflink.h: Likewise.
	* elfxx-ia64.c: Likewise.
	* ieee.c: Likewise.
	* ihex.c: Likewise.
	* libbfd.c: Likewise.
	* pdp11.c: Likewise.
	* pe-mips.c: Likewise.
	* peicode.h: Likewise.
	* srec.c: Likewise.
	* xcofflink.c: Likewise.

	* elf32-arm.h: Make _bfd_error_handler calls K&R compatible.

	* elflink.c (_bfd_elf_create_linker_section): Better grammar for
	error message.

	* coff-mcore.c (coff_mcore_relocate_section): Internalionalise
	error message.

	* elf64-sparc.c (sparc64_elf_add_symbol_hook): Constify stt_types.
	Consolidate error messages, and split long messages to two lines.
2001-09-20 23:30:37 +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
Alexandre Oliva 8c98ec7dcc * bfd.c (bfd_alt_mach_code): New function.
* bfd-in2.h: Rebuilt.
2001-08-24 13:55:55 +00:00
Alan Modra c0846b2397 * bfd.c (bfd_get_gp_size): Return an unsigned int.
(bfd_set_gp_size): Make param unsigned.
	* bfd-in2.h: Regenerate.
	* elf32-ppc.c (ppc_elf_add_symbol_hook): Use elf_gp_size rather
	than calling bfd_get_gp_size.
	* elf64-alpha.c (elf64_alpha_add_symbol_hook): Likewise.
	* elfxx-ia64.c (elfNN_ia64_add_symbol_hook): Likewise.
2001-08-17 15:56:58 +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 4e771d61a3 replace direct invocation og elf vma print functions with indirect invocation 2001-08-11 16:48:15 +00:00
H.J. Lu ef071f2471 2001-08-10 H.J. Lu <hjl@gnu.org>
* bfd.c (bfd_sprintf_vma): Fix a typo in the last change.
	(bfd_fprintf_vma): Likewise.
2001-08-10 18:43:44 +00:00
H.J. Lu 5c36c02b3b 2001-08-10 H.J. Lu <hjl@gnu.org>
* bfd.c (bfd_sprintf_vma): Don't return void.
	(bfd_fprintf_vma): Likewise.
2001-08-10 16:32:03 +00:00
H.J. Lu ae4221d7c2 2001-08-09 H.J. Lu <hjl@gnu.org>
* bfd-in.h (bfd_sprintf_vma): New prototype.
	(bfd_fprintf_vma): Likewise.
	(bfd_elf_sprintf_vma): Likewise.
	(bfd_elf_fprintf_vma): Likewise.
	(bfd_printf_vma): New. Defined with bfd_fprintf_vma.
	* bfd-in2.h: Regenerated.

	* bfd.c (bfd_sprintf_vma): New. Defined.
	(bfd_fprintf_vma): Likewise.

	* elf.c (bfd_elf_sprintf_vma): New. Defined.
	(bfd_elf_fprintf_vma): Likewise.
2001-08-09 16:00:21 +00:00
Nick Clifton 55ab10f0ee Fix formatting 2001-08-09 09:09:03 +00:00
Nick Clifton f47e50716b Support DJGPP COFF targets in bfd_get_sign_extend_vma() 2001-07-03 16:27:45 +00:00
Jakub Jelinek 8550eb6e64 * merge.c (struct sec_merge_hash_entry): Add u.entsize and u.suffix
fields, change sec into secinfo.
	(struct sec_merge_info): Add chain, remove last fields.
	(struct sec_merge_sec_info): Add next, sec, psecinfo fields.
	(sec_merge_hash_lookup): If lookup could not use a string only
	because it has bad alignment, mark the old string for deletion.
	(sec_merge_add): Add secinfo argument. Don't compute entry's
	position, instead record the section.
	(sec_merge_emit): Update for the sec into secinfo change in
	struct sec_merge_hash_entry.
	(_bfd_merge_section): Only record the section for merging, defer
	putting strings into the hash table.
	(cmplengthentry, last4_eq, last_eq, record_section, merge_strings,
	_bfd_merge_sections): New functions.
	(_bfd_merged_section_offset): Update for the sec_merge_hash_entry
	changes.
	* libbfd-in.h (_bfd_merge_sections): Add prototype.
	(_bfd_nolink_bfd_merge_sections): Define.
	* libbfd.h: Likewise.
	(bfd_generic_merge_sections): Add prototype.
	* targets.c (BFD_JUMP_TABLE_LINK): Add _bfd_merge_sections.
	(struct bfd_target): Likewise.
	* bfd.c (bfd_merge_sections): Define.
	* bfd-in2.h: Rebuilt.
	* elf.c (_bfd_elf_merge_sections): New function.
	* elf-bfd.h (_bfd_elf_merge_sections): Add prototype.
	* elfxx-target.h (bfd_elfNN_bfd_merge_sections): Define.
	* reloc.c (bfd_generic_merge_sections): New function.
	* vms.c (vms_bfd_merge_sections): New function.
	* aout-adobe.c (aout_32_bfd_merge_sections): Define.
	* aout-target.h (MY_bfd_merge_sections): Define.
	* aout-tic30.c (MY_bfd_merge_sections): Define.
	* binary.c (binary_bfd_merge_sections): Define.
	* bout.c (b_out_bfd_merge_sections): Define.
	* coff-alpha.c (_bfd_ecoff_bfd_merge_sections): Define.
	* coffcode.c (coff_bfd_merge_sections): Define.
	* coff-mips.c (_bfd_ecoff_bfd_merge_sections): Define.
	* i386msdos.c (msdos_bfd_merge_sections): Define.
	* i386os9k.c (os9k_bfd_merge_sections): Define.
	* ieee.c (ieee_bfd_merge_sections): Define.
	* ihex.c (ihex_bfd_merge_sections): Define.
	* nlm-target.h (nlm_bfd_merge_sections): Define.
	* oasys.c (oasys_bfd_merge_sections): Define.
	* ppcboot.c (ppcboot_bfd_merge_sections): Define.
	* som.c (som_bfd_merge_sections): Define.
	* srec.c (srec_bfd_merge_sections): Define.
	* tekhex.c (tekhex_bfd_merge_sections): Define.
	* versados.c (versados_bfd_merge_sections): Define.
	* xcoff-target.h (_bfd_xcoff_bfd_merge_sections): Define.

	* ldlang.c (lang_process): Call bfd_merge_sections.
2001-05-11 12:23:48 +00:00
Nick Clifton 7898dedac0 Update copyright notices 2001-03-08 21:04:02 +00:00
Kazu Hirata 3fde5a36df 2001-01-23 Kazu Hirata <kazu@hxi.com>
* aoutx.h: Fix formatting.
	* bfd.c: Likewise.
	* bfd-in2.h: Likewise.
	* bfd-in.h: Likewise.
	* cpu-i386.c: Likewise.
	* cpu-m68hc11.c: Likewise.
	* dwarf2.c: Likewise.
	* elf64-x86-64.c: Likewise.
	* format.c: Likewise.
	* freebsd.h: Likewise.
	* hash.c: Likewise.
	* hp300hpux.c: Likewise.
	* hppabsd-core.c: Likewise.
	* hpux-core.c: Likewise.
2001-01-23 20:27:54 +00:00
Kazu Hirata eb6e10cb73 2000-11-20 Kazu Hirata <kazu@hxi.com>
* bfd-in.h: Fix formatting.
	* bfd-in2.h: Likewise.
	* bfd.c: Likewise.
	* bout.c: Likewise.
2000-11-21 02:24:32 +00:00
Kazu Hirata aebad5fe2c 2000-11-08 Kazu Hirata <kazu@hxi.com>
* bfd.c: Fix formatting.
	* binary.c: Likewise.
	* bout.c: Likewise.
2000-11-08 06:38:10 +00:00
Nick Clifton a022216bd4 Minor formatting fixes. 2000-07-31 18:49:56 +00:00
Nick Clifton 125c4a69c4 Rename bfd_elf_get_arch_size to bfd_get_arch_size
Rename bfd_elf_get_sign_extend_vma  to  bfd_get_sign_extend_vma
2000-07-18 19:20:13 +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 c0bed66d09 1999-09-11 Donn Terry <donn@interix.com>
* libbfd-in.h (_bfd_abort): Declare.
	(abort): Define.
	* bfd.c (_bfd_abort): New function.
	* libbfd.h: Rebuild.
1999-09-11 21:51:55 +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
Richard Henderson 252b5132c7 19990502 sourceware import 1999-05-03 07:29:11 +00:00