Commit Graph

112 Commits

Author SHA1 Message Date
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
Thiemo Seufer cb56d3d327 * elf32-mips.c (mips_elf_calculate_relocation): Fix overflow handling
of R_MIPS_PC16.

	* config/tc-mips.c (append_insn): Handle BFD_RELOC_16_PCREL.
	(macro_build): Use BFD_RELOC_16_PCREL_S2 only for embedded
	PIC, BFD_RELOC_16_PCREL for the rest.
	(mips_ip): Likewise.
        (md_pcrel_from): return the right offset for the differently shifted
        pcrel relocs.
	(md_apply_fix): Handle BFD_RELOC_16_PCREL.

	* gas/mips/beq.d: Check branches to external labels.
	* gas/mips/beq.s: Likewise.
	* gas/mips/bge.d: Likewise.
	* gas/mips/bge.s: Likewise.
	* gas/mips/bgeu.d: Likewise.
	* gas/mips/bgeu.s: Likewise.
	* gas/mips/blt.d: Likewise.
	* gas/mips/blt.s: Likewise.
	* gas/mips/bltu.d: Likewise.
	* gas/mips/bltu.s: Likewise.
	* gas/mips/elempic.d: Switch from R_MIPS_GNU_REL16_S2 to R_MIPS_PC16.
	* gas/mips/empic.d: Likewise.
	* gas/mips/empic.s: Likewise.
	* gas/mips/telempic.d: Likewise.
	* gas/mips/tempic.d: Likewise.
2001-09-07 05:00:37 +00:00
H.J. Lu 6140b3b903 2001-08-31 H.J. Lu <hjl@gnu.org>
* elf32-mips.c (_bfd_mips_elf_check_relocs): Report filename
	with bad relocation.
2001-08-31 21:41:10 +00:00
Eric Christopher a1cd6a8fe3 2001-08-31 Eric Christopher <echristo@redhat.com>
Jason Eckhardt  <jle@redhat.com>

	* bfd/archures.c: Add mipsisa32 and mipsisa64. Remove mips32,
	mips32_4k and mips64.
	* bfd/aoutx.h: Remove bfd_mach_mips32, bfd_mach_mips32_4k,
	bfd_mach_mips64.  Add bfd_mach_mipsisa32, bfd_mach_mipsisa64.
	* bfd/cpu-mips.c: Ditto.
	* bfd/elf32-mips.c (_bfd_mips_elf_final_write_processing): Ditto.
	* bfd/bfd-in2.h: Regenerate.
2001-08-31 21:24:28 +00:00
H.J. Lu 2bab97856d 2001-08-30 H.J. Lu <hjl@gnu.org>
* elf32-mips.c (mips_elf_calculate_relocation): Revert the last
	2 changes.
	(_bfd_mips_elf_adjust_dynamic_symbol): Allocate dynamic
	relocations for weak definitions.
2001-08-30 21:26:26 +00:00
H.J. Lu 8eb59a907a 2001-08-30 H.J. Lu <hjl@gnu.org>
* elf32-mips.c (mips_elf_calculate_relocation): Don't create
	dynamic relocation for undefined weak symbols when creating
	executables. Check h->root.root.type, instead of h->root.type.
2001-08-30 15:24:18 +00:00
H.J. Lu 14d5043ad0 2001-08-27 H.J. Lu <hjl@gnu.org>
* elf32-mips.c (mips_elf_create_dynamic_relocation): Add more
	sanity check.
	(mips_elf_calculate_relocation): Create dynamic relocation for
	symbols with weak definition or the ELF_LINK_HASH_DEF_REGULAR
	bit is not set.
2001-08-27 15:40:38 +00:00
H.J. Lu 9e80ff3a40 2001-08-27 H.J. Lu <hjl@gnu.org>
* elf32-mips.c (_bfd_mips_elf_hide_symbol): Add prototype.
	(_bfd_mips_elf_copy_indirect_symbol): Likewise.
	(_bfd_elf32_mips_grok_prstatus): Likewise.
	(_bfd_elf32_mips_grok_psinfo): Likewise.
	(_bfd_mips_elf_hide_symbol): Make it static and cast to
	`struct mips_elf_link_hash_entry *'.
	(_bfd_mips_elf_copy_indirect_symbol): Make it static.
2001-08-27 14:47:33 +00:00
Thiemo Seufer aee61b1396 * elf32-mips.c (elf_mips_abi_name): Return the right ABI string for
E_MIPS_ABI_O64 and E_MIPS_ABI_EABI64
2001-08-25 01:27:54 +00:00
H.J. Lu 5e7079af51 2001-07-04 H.J. Lu <hjl@gnu.org>
* bfd/elf32-mips.c (_bfd_mips_elf_final_write_processing):
	Handle bfd_mach_mips4400, bfd_mach_mips4600 and
	bfd_mach_mips5000.
2001-07-04 07:15:20 +00:00
Alan Modra 936e320bf4 * elfcore.h (elf_core_file_p): Call bfd_section_from_phdr directly
instead of _bfd_elfcore_section_from_phdr.
	* elf-bfd.h (_bfd_elfcore_section_from_phdr): Remove.
	* elf.c (_bfd_elfcore_section_from_phdr): Remove.
	(_bfd_elfcore_make_pseudosection): Expedite tail-call.
	(elfcore_grok_prstatus): Likewise.
	(elfcore_grok_lwpstatus): Likewise.
	(bfd_get_elf_phdr_upper_bound): Likewise.
	(elfcore_make_note_pseudosection): Formatting.
	(_bfd_elfcore_strndup): Formatting.
	* elf32-mips.c (mips_elf_sym_is_global): Formatting.
	(_bfd_elf32_mips_grok_prstatus): Expedite tail-call.
2001-06-30 04:05:13 +00:00
Alan Modra bb0082d686 * elf-bfd.h: Add prototypes for _bfd_elfcore_make_pseudosection
and _bfd_elfcore_strndup.
	(struct elf_backend_data): Add elf_backend_grok_prstatus
	and elf_backend_grok_psinfo.
	* elf.c (_bfd_elfcore_make_pseudosection): New function.
	(elfcore_grok_prstatus): Use it.
	(elfcore_make_note_pseudosection): Likewise.
	(elfcore_strndup):  Rename to...
	(_bfd_elfcore_strndup): Here, and make global.
	(elfcore_grok_psinfo): Use _bfd_elfcore_strndup.
	(elfcore_grok_note): Call elf_backend_grok_prstatus
	and elf_backend_grok_psinfo if available.
	* elf32-mips.c (_bfd_elf32_mips_grok_prstatus): New function.
	(_bfd_elf32_mips_grok_psinfo): New function.
	(elf_backend_grok_prstatus): Define.
	(elf_backend_grok_psinfo): Define.
	* elfxx-target.h (elf_backend_grok_prstatus): Default to NULL.
	(elf_backend_grok_psinfo): Likewise.
	(elfNN_bed): Include elf_backend_grok_prstatus and
	elf_backend_grok_psinfo.
2001-06-30 03:15:46 +00:00
H.J. Lu 4391705434 2001-06-17 H.J. Lu <hjl@gnu.org>
* elf32-mips.c (mips_elf_link_hash_entry): Add a new field,
	readonly_reloc, to record if a relocation in the .rel.dyn
	section is against a read-only section.
	(mips_elf_link_hash_newfunc): Initialize the readonly_reloc
	field to false.
	(_bfd_mips_elf_check_relocs): Record if there is a relocation
	in the .rel.dyn section against a read-only section by setting
	DF_TEXTREL or readonly_reloc.
	(_bfd_mips_elf_copy_indirect_symbol): Copy readonly_reloc if
	it is true.
	(_bfd_mips_elf_adjust_dynamic_symbol): Record DF_TEXTREL if
	there is a relocation in the .rel.dyn section against a
	read-only section.
	(_bfd_mips_elf_size_dynamic_sections): Set DT_TEXTREL if
	DF_TEXTREL is set.
2001-06-17 16:14:42 +00:00
Alan Modra 4e8a9624b8 * elflink.h: Whitespace changes.
(elf_link_read_relocs_from_section): Use "unsigned int" iterator
	rather than "unsigned char".
	(elf_link_output_relocs): Likewise.
	(elf_link_input_bfd): Likewise.
	(elf_reloc_link_order): LIkewise.
	* elf.c: s/CONST/const/.  Whitespace changes.
	* elf32-mips.c: Formatting fix.

	* Makefile.am (SOURCE_HFILES): Include xcoff-target.h, remove xcoff.h.
	* Makefile.in: Regenerate.
	* po/Make-in: Remove trailing tab.
2001-06-10 05:21:00 +00:00
H.J. Lu c36e006fbc 2001-06-07 H.J. Lu <hjl@gnu.org>
* elf32-mips.c (_bfd_mips_elf_object_p): Set the bad symtab
	for SGI only.

	* config.bfd: Remove ecoff from Linux/mips.
2001-06-07 17:31:22 +00:00
Nick Clifton d1cf510e5e Add MIPS r12k support 2001-05-23 17:26:40 +00:00
Nick Clifton d9bc7a4499 Replace sh_size/sh_entsize with NUM_SHDR_ENTRIES 2001-05-23 08:23:27 +00:00
Ian Lance Taylor efcbd82c36 Remove extraneous character in first line. 2001-05-08 17:14:35 +00:00
Alan Modra 062e23589d * ecoff.c (bfd_debug_section): Fix initialization.
* elf.c (_bfd_elf_slurp_version_tables): Change maxidx to unsigned, it
	is always a positive integer. Cast away sign mismatch.
	* elf32-mips.c: Fix misleading comment and typo.
	(_bfd_mips_elf_section_from_bfd_section): Remove unused attribute, use
	correct data type.
	* elflink.c: Fix typo.
	(_bfd_elf_create_dynamic_sections): Remove superfluous initialization.
	* ecoffswap.h (ecoff_swap_fdr_in): Cast away sign mismatch.
2001-05-07 09:15:26 +00:00
H.J. Lu 5fba655aed 2000-04-27 H.J. Lu <hjl@gnu.org>
* elf.c (_bfd_elf_link_hash_hide_symbol): Set dynindx to -1
	only for ELF_LINK_FORCED_LOCAL.
	* elf32-hppa.c (elf32_hppa_hide_symbol): Likewise.
	* elf32-mips.c (_bfd_mips_elf_hide_symbol): Likewise.
	* elfxx-ia64.c (elfNN_ia64_hash_hide_symbol): Likewise.

	* elflink.h (elf_fix_symbol_flags): Set ELF_LINK_FORCED_LOCAL
	if the symbol has hidden or internal visibility.
2001-04-30 16:13:26 +00:00
Nick Clifton b3baf5d0a8 Add OpenRISC support 2001-04-24 15:08:16 +00:00
H.J. Lu fdbafa100f 2001-04-05 Steven J. Hill <sjhill@cotw.com>
* config.bfd (mips*el*-*-linux-gnu*): Use traditional little
	endian MIPS ELF target.
	* config.bfd (mips*-*-linux-gnu*): Use traditional big endian
	MIPS ELF target.

	* configure.in (bfd_elf64_tradbigmips_vec): New. Traditional
	64bit big endian MIPS ELF target.
	(bfd_elf64_tradlittlemips_vec): New. Traditional 64bit little
	endian MIPS ELF target.
	* configure: Regenerated.

	* elf32-mips.c (IRIX_COMPAT): Handle traditional 64bit and
	little endian targets.
	(mips_elf_sym_is_global): Handle traditional targets.

	* elf64-mips.c (bfd_elf64_tradbigmips_vec): New. Traditional
	64bit big endian MIPS ELF target.
	(bfd_elf64_tradlittlemips_vec): New. Traditional 64bit little
	endian MIPS ELF target.

	* targets.c: (_bfd_target_vector): Add bfd_elf64_tradbigmips_vec
	and bfd_elf64_tradlittlemips_vec.
2001-04-08 05:11:49 +00:00
Diego Novillo 7a65545dc5 2001-03-21 Diego Novillo <dnovillo@redhat.com>
(_bfd_mips_elf_relocate_section): Give a better error message when
	a relocation is not recognized.
2001-03-22 00:29:15 +00:00
Nick Clifton 7898dedac0 Update copyright notices 2001-03-08 21:04:02 +00:00
Nick Clifton 9117d2197e Apply several patches from Maciej W. Rozycki 2001-02-11 23:11:41 +00:00
Nick Clifton 38b1a46ca2 Fix formatting. 2000-12-12 19:23:16 +00:00
Nick Clifton 857ec808bb Pass dwarf2_find_line_info as last parameter to invocation of
_bfd_dwarf2_find_nearest_line.
2000-12-09 20:12:57 +00:00
Nick Clifton 51db370890 Generalize DWARF2 and COFF support. 2000-12-08 22:50:07 +00:00
Ulf Carlsson a9922e52c7 2000-12-06 Ulf Carlsson <ulfc@engr.sgi.com>
From  Ralf Baechle  <ralf@gnu.org>

	* elf32-mips.c (elf32_mips_merge_private_bfd_data): Always permit
	BFDs containing no sections or empty .text, .data or .bss sections
	to be merged, regardless of their flags.
2000-12-07 01:05:04 +00:00
Nick Clifton c6c98b3833 Add MIPS SB1 machine 2000-12-02 01:10:33 +00:00
Nick Clifton 84ea6cf2c5 Add MIPS V and MIPS 64 machine numbers 2000-12-02 00:55:22 +00:00
Nick Clifton e7af610e14 Add MIPS32 as a seperate MIPS architecture 2000-12-01 21:35:38 +00:00
Kazu Hirata be3ccd9c2b 2000-11-28 Kazu Hirata <kazu@hxi.com>
* elf32-mips.c: Fix formatting.
2000-11-29 04:56:32 +00:00
Ulf Carlsson 5af5b85bc3 2000-10-13 Ulf Carlsson <ulfc@engr.sgi.com>
From  Ralf Baechle  <ralf@gnu.org>

	* elf32-mips.c (mips_elf_create_dynamic_relocation): New argument
	local_p.  Add symbol value only for non-R_MIPS_REL32 relocations
	against local symbols.
	(_bfd_mips_elf_finish_dynamic_sections): Undo patch from 2000-10-01.
2000-10-14 04:05:23 +00:00
Ulf Carlsson 4b6609a057 2000-10-01 Ulf Carlsson <ulfc@engr.sgi.com>
From  Ralf Baechle  <ralf@gnu.org>

	* elf32-mips.c (_bfd_mips_elf_finish_dynamic_sections): Mark gld
	produces binaries with got[1] = 0x80000001 to differenciate them
	for the dynamic linker from the broken binaries produced by old
	versions.
2000-10-02 06:04:16 +00:00
Nick Clifton 156c2f8bf7 Add support for the MIPS32 2000-09-14 01:47:38 +00:00
Ulf Carlsson 313ba8d62b 2000-07-23 Ulf Carlsson <ulfc@engr.sgi.com>
* elf32-mips.c (_bfd_mips_elf_check_relocs): Use abfd instead
	of dynobj for SGI_COMPAT checks.
2000-07-23 20:51:35 +00:00
Nick Clifton 7a3120d9a6 Detect and report corrupt relocs 2000-07-21 19:56:19 +00:00
H.J. Lu d6cf28795d 2000-07-19 H.J. Lu <hjl@gnu.org>
* elf32-arm.h (elf32_arm_size_dynamic_sections): Also set
	DF_TEXTREL if DT_TEXTREL is set.
	* elf32-i370.c (i370_elf_size_dynamic_sections): Likewise.
	* elf32-i386.c (elf_i386_size_dynamic_sections): Likewise.
	* elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise.
	* elf32-mips.c (_bfd_mips_elf_size_dynamic_sections): Likewise.
	* elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise.
	* elf32-sparc.c (elf32_sparc_size_dynamic_sections): Likewise.
	* elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise.
	* elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise.
	* elf64-ia64.c (elf64_ia64_size_dynamic_sections): Likewise.
	* elf64-sparc.c (sparc64_elf_size_dynamic_sections): Likewise.

	* bfd/elflink.h (NAME(bfd_elf,size_dynamic_sections)): Also
	set DF_SYMBOLIC for symbolic link. Also set DT_RUNPATH if
	DT_RPATH is set.
	Set the DT_FLAGS and DT_FLAGS_1 entries if necessary.
2000-07-20 03:21:59 +00:00
Ulf Carlsson 31a9bdd961 2000-07-18 Ulf Carlsson <ulfc@engr.sgi.com>
* elf32-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Add
	paranthesis in if statement.
2000-07-18 09:45:26 +00:00
Ulf Carlsson f7cb7d68c2 2000-07-17 Koundinya K <kk@ddeorg.soft.net>
Enable the support for Traditional MIPS.
	* elf32-mips.c (IRIX_COMPAT): Recognize bfd_elf32_tradbigmips_vecand
	return ict_none appropriately for traditional mips targets.
	(STUB_LW): Change 0x8f998000 to 0x8f998010 for traditional mips.
	(STUB_MOVE): Conditionalize for traditonal mips.
	(STUB_LI16): Likewise.
	(_bfd_mips_elf_modify_segment_map): Conditionalize to avoid making
	room for RTPROC header.
	(_bfd_mips_elf_modify_segment_map): For a normal mips executable set
	the permission for the PT_DYNAMIC as read, write and execute.
	(mips_elf_calculate_relocation): Check for the symbol _DYNAMIC_LINKING
	for traditonal mips.
	(_bfd_mips_elf_create_dynamic_sections): Add the symbol
	_DYNAMIC_LINKING for traditonal mips.
	(_bfd_mips_elf_create_dynamic_sections): Add the symbol __RLD_MAP
	in case of traditonal mips.
	(_bfd_mips_elf_adjust_dynamic_symbol): Create a stub only if a PLT
	entry is required. For a function if PLT is not required then set the
	corresponding hash table entry to 0.
	(_bfd_mips_elf_size_dynamic_sections): Add DT_DEBUG entry for
	traditonal mips.
	(_bfd_mips_elf_finish_dynamic_symbol): for a undefined symbol in a
	shared object set the value to 0.
	(_bfd_mips_elf_finish_dynamic_symbol): Check for the symbol
	_DYNAMIC_LINKING for traditonal mips.
	(_bfd_mips_elf_finish_dynamic_symbol): Check for the symbol __RLD_MAP
	for traditonal mips.
2000-07-17 19:39:40 +00:00
Andrew Cagney 23e2c83b83 The MIPS thinks that addresses are signed. Sign extend MIPS ECOFF
addresses.
2000-07-11 06:37:34 +00:00
Ulf Carlsson adb76a3e5c 2000-07-09 Koundinya K <kk@ddeorg.soft.net>
* elf32-mips.c (sort_dynamic_relocs): New Function.
        (_bfd_mips_elf_finish_dynamic_sections): Call sort_dynamic_relocs
	via qsort to sort the dynamic relocations in increasing r_symndx
	value.
2000-07-09 13:48:21 +00:00
Ulf Carlsson e364195dbd 2000-07-03 Ulf Carlsson <ulfc@engr.sgi.com>
* elf32-mips.c: Include elf32-target.h again for the traditional
	MIPS targets.
2000-07-03 23:49:36 +00:00
Ulf Carlsson 8a20f077fe 2000-06-20 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
* elf32-mips.c (_bfd_mips_elf_copy_indirect_symbol): New function.
	(elf_backend_copy_indirect_symbol): Map to the new function.
2000-06-20 16:37:36 +00:00
Ulf Carlsson b305ef96a1 2000-06-20 Ulf Carlsson <ulfc@engr.sgi.com>
* elf-bfd.h (struct elf_obj_tdata): Define per BFD Irix 5 virtual
	sections elf_{text,data}_{section,symbol}.
	* elf32-mips.c: mips_elf_{text,data}_{section,symbol}{,_ptr}: Remove.
	(_bfd_mips_elf_hide_symbol): New function.
	(elf_backend_hide_symbol): Map to the new function.
	(_bfd_mips_elf_add_symbol_hook): Change to use new per BFD
	definitions of mips_elf_{text,data}_{section,symbol}.
	(mips_elf_local_relocation_p): Try to find the direct symbol
	based on new check_forced argument.
	(mips_elf_calculate_relocation): Use new version of
	mips_elf_local_relocation_p.
	(mips_elf_relocate_section): Likewise.
	(_bfd_mips_elf_relocate_section): Likewise.
	(mips_elf_sort_hash_table): Only assert that have enough GOT
	space.
	(mips_elf_got16_entry): Match all 32 bits to the existing GOT
	entry if the relocation based on the new external argument.
	(mips_elf_create_dynamic_relocation): Assert that we have a
	section contents allocated where we can swap out the dynamic
	relocations.
	(mips_elf_calculate_relocation): Find the real hash-table entry
	correctly by using h->root.root.type.  Only create a dynamic
	relocation entry if the symbol is defined in a shared library.
	Create an external GOT entry for the GOT16 relocation if the
	symbol was forced local.
	(_bfd_mips_elf_finish_dynamic_symbol): Don't assert there is a
	dynamic index if the symbol was forced local.

2000-06-20  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>

	* elf32-mips.c: Fix typos in comments.
2000-06-20 11:06:19 +00:00
Ulf Carlsson 9a8f3bb734 2000-06-17 Ulf Carlsson <ulfc@engr.sgi.com>
* elf32-mips.c (mips_elf_calculate_relocation): Explicitly write
	GOT entries if we're doing a static link or -Bsymbolic link.
2000-06-17 09:47:15 +00:00
H.J. Lu ba09750c1e 2000-05-23 H.J. Lu <hjl@gnu.org>
* elf32-mips.c (mips_elf_calculate_relocation): Check
	h->root.other not h->other.

	* elf32-ppc.c (ppc_elf_relocate_section): Fix a typo.
2000-05-23 14:20:57 +00:00
H.J. Lu 3a27a730c7 2000-05-23 H.J. Lu <hjl@gnu.org>
* elf32-i386.c (elf_i386_relocate_section): Don't allow the
	undefined symbol with the non-default visibility attributes.
	* elf-hppa.h (elf_hppa_relocate_section): Likewise.
	* elf32-arm.h (elf32_arm_relocate_section): Likewise.
	* elf32-i370.c (i370_elf_relocate_section): Likewise.
	* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
	* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
	* elf32-mips.c (mips_elf_calculate_relocation): Likewise.
	* elf32-ppc.c (ppc_elf_relocate_section): Likewise.
	* elf32-sparc.c (elf32_sparc_relocate_section): Likewise.
	* elf64-alpha.c (elf64_alpha_relocate_section): Likewise.
	* elf64-ia64.c (elf64_ia64_relocate_section): Likewise.
	* elf64-sparc.c (sparc64_elf_relocate_section): Likewise.
2000-05-23 14:05:50 +00:00
Nick Clifton 1fe494a572 Use bfd_generic_verify_endian_match() and fix it to only check when endianness
is known.
2000-05-22 18:44:02 +00:00